Re: lib/sort.t failure (and [PATCH])
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-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 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Thu Apr  4 20:10:51 EET DST 2002 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84 paths="$paths /system/gnu_library/bin"
85
86 for p in $paths
87 do
88         case "$p_$PATH$p_" in
89         *$p_$p$p_*) ;;
90         *) test -d $p && PATH=$PATH$p_$p ;;
91         esac
92 done
93
94 PATH=.$p_$PATH
95 export PATH
96
97 : shall we be using ksh?
98 inksh=''
99 needksh=''
100 avoidksh=''
101 newsh=/bin/ksh
102 changesh=''
103 if (PATH=.; alias -x) >/dev/null 2>&1; then
104                 inksh=true
105 fi
106 if test -f /hp-ux -a -f /bin/ksh; then
107         needksh='to avoid sh bug in "here document" expansion'
108 fi
109 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110         if test X`/usr/bin/uname -v` = X4; then
111                 avoidksh="to avoid AIX 4's /bin/sh"
112                 newsh=/usr/bin/bsh
113         fi
114 fi
115 if test -f /osf_boot -a -f /usr/sbin/setld; then
116         if test X`/usr/bin/uname -s` = XOSF1; then
117                 avoidksh="to avoid Digital UNIX' ksh"
118                 newsh=/bin/sh
119                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120         fi
121 fi
122 case "$inksh/$needksh" in
123 /[a-z]*)
124                 ENV=''
125                 changesh=true
126                 reason="$needksh"
127         ;;
128 esac
129 case "$inksh/$avoidksh" in
130 true/[a-z]*)
131         changesh=true
132         reason="$avoidksh"
133         ;;
134 esac
135 case "$inksh/$needksh-$avoidksh-" in
136 true/--)
137                 cat <<EOM
138 (I see you are using the Korn shell.  Some ksh's blow up on $me,
139 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140 EOM
141         ;;
142 esac
143 case "$changesh" in
144 true)
145         export newsh
146         echo "(Feeding myself to $newsh $reason.)"
147         case "$0" in
148         Configure|*/Configure) exec $newsh $0 "$@";;
149         *) exec $newsh Configure "$@";;
150         esac
151         ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168
169 ccname=''
170 ccversion=''
171 ccsymbols=''
172 cppccsymbols=''
173 cppsymbols=''
174 from=''
175 run=''
176 targetarch=''
177 to=''
178 usecrosscompile=''
179 perllibs=''
180 dynamic_ext=''
181 extensions=''
182 known_extensions=''
183 nonxs_ext=''
184 static_ext=''
185 useopcode=''
186 useposix=''
187 extras=''
188 d_bsd=''
189 d_eunice=''
190 d_xenix=''
191 eunicefix=''
192 Mcc=''
193 ar=''
194 awk=''
195 bash=''
196 bison=''
197 byacc=''
198 cat=''
199 chgrp=''
200 chmod=''
201 chown=''
202 comm=''
203 compress=''
204 cp=''
205 cpio=''
206 cpp=''
207 csh=''
208 date=''
209 echo=''
210 egrep=''
211 emacs=''
212 expr=''
213 find=''
214 flex=''
215 gmake=''
216 grep=''
217 gzip=''
218 inews=''
219 ksh=''
220 less=''
221 line=''
222 lint=''
223 ln=''
224 lp=''
225 lpr=''
226 ls=''
227 mail=''
228 mailx=''
229 make=''
230 mkdir=''
231 more=''
232 mv=''
233 nm=''
234 nroff=''
235 perl=''
236 pg=''
237 pmake=''
238 pr=''
239 rm=''
240 rmail=''
241 sed=''
242 sendmail=''
243 shar=''
244 sleep=''
245 smail=''
246 sort=''
247 submit=''
248 tail=''
249 tar=''
250 tbl=''
251 tee=''
252 test=''
253 touch=''
254 tr=''
255 troff=''
256 uname=''
257 uniq=''
258 uuname=''
259 vi=''
260 zcat=''
261 zip=''
262 full_ar=''
263 full_sed=''
264 libswanted=''
265 hint=''
266 myuname=''
267 osname=''
268 osvers=''
269 Author=''
270 Date=''
271 Header=''
272 Id=''
273 Locker=''
274 Log=''
275 RCSfile=''
276 Revision=''
277 Source=''
278 State=''
279 _a=''
280 _exe=''
281 _o=''
282 archobjs=''
283 exe_ext=''
284 firstmakefile=''
285 lib_ext=''
286 obj_ext=''
287 path_sep=''
288 afs=''
289 afsroot=''
290 alignbytes=''
291 ansi2knr=''
292 archlib=''
293 archlibexp=''
294 d_archlib=''
295 installarchlib=''
296 archname=''
297 myarchname=''
298 d_atolf=''
299 d_atoll=''
300 baserev=''
301 bin=''
302 binexp=''
303 installbin=''
304 bincompat5005=''
305 d_bincompat5005=''
306 byteorder=''
307 cc=''
308 ccflags=''
309 cppflags=''
310 ldflags=''
311 lkflags=''
312 locincpth=''
313 optimize=''
314 cf_email=''
315 cf_by=''
316 cf_time=''
317 charsize=''
318 contains=''
319 cpp_stuff=''
320 cpplast=''
321 cppminus=''
322 cpprun=''
323 cppstdin=''
324 d__fwalk=''
325 d_access=''
326 d_accessx=''
327 d_alarm=''
328 asctime_r_proto=''
329 d_asctime_r=''
330 d_attribut=''
331 d_bcmp=''
332 d_bcopy=''
333 d_bzero=''
334 d_casti32=''
335 castflags=''
336 d_castneg=''
337 d_chown=''
338 d_chroot=''
339 d_chsize=''
340 d_class=''
341 d_closedir=''
342 d_void_closedir=''
343 d_cmsghdr_s=''
344 d_const=''
345 cryptlib=''
346 d_crypt=''
347 crypt_r_proto=''
348 d_crypt_r=''
349 d_csh=''
350 full_csh=''
351 ctermid_r_proto=''
352 d_ctermid_r=''
353 ctime_r_proto=''
354 d_ctime_r=''
355 d_cuserid=''
356 d_dbl_dig=''
357 d_dbminitproto=''
358 d_difftime=''
359 d_dirfd=''
360 d_dlerror=''
361 d_dlopen=''
362 d_dlsymun=''
363 d_dosuid=''
364 d_suidsafe=''
365 d_drand48_r=''
366 drand48_r_proto=''
367 d_drand48proto=''
368 d_dup2=''
369 d_eaccess=''
370 d_endgrent=''
371 d_endgrent_r=''
372 endgrent_r_proto=''
373 d_endhent=''
374 d_endhostent_r=''
375 endhostent_r_proto=''
376 d_endnent=''
377 d_endnetent_r=''
378 endnetent_r_proto=''
379 d_endpent=''
380 d_endprotoent_r=''
381 endprotoent_r_proto=''
382 d_endpwent=''
383 d_endpwent_r=''
384 endpwent_r_proto=''
385 d_endsent=''
386 d_endservent_r=''
387 endservent_r_proto=''
388 d_fchdir=''
389 d_fchmod=''
390 d_fchown=''
391 d_fcntl=''
392 d_fcntl_can_lock=''
393 d_fd_macros=''
394 d_fd_set=''
395 d_fds_bits=''
396 d_fgetpos=''
397 d_finite=''
398 d_finitel=''
399 d_flexfnam=''
400 d_flock=''
401 d_flockproto=''
402 d_fork=''
403 d_fp_class=''
404 d_fpclass=''
405 d_fpclassify=''
406 d_fpclassl=''
407 d_fpos64_t=''
408 d_frexpl=''
409 d_fs_data_s=''
410 d_fseeko=''
411 d_fsetpos=''
412 d_fstatfs=''
413 d_fsync=''
414 d_ftello=''
415 d_ftime=''
416 d_gettimeod=''
417 d_Gconvert=''
418 d_getcwd=''
419 d_getespwnam=''
420 d_getfsstat=''
421 d_getgrent=''
422 d_getgrent_r=''
423 getgrent_r_proto=''
424 d_getgrgid_r=''
425 getgrgid_r_proto=''
426 d_getgrnam_r=''
427 getgrnam_r_proto=''
428 d_getgrps=''
429 d_gethbyaddr=''
430 d_gethbyname=''
431 d_gethent=''
432 aphostname=''
433 d_gethname=''
434 d_phostname=''
435 d_uname=''
436 d_gethostbyaddr_r=''
437 gethostbyaddr_r_proto=''
438 d_gethostbyname_r=''
439 gethostbyname_r_proto=''
440 d_gethostent_r=''
441 gethostent_r_proto=''
442 d_gethostprotos=''
443 d_getitimer=''
444 d_getlogin=''
445 d_getlogin_r=''
446 getlogin_r_proto=''
447 d_getmnt=''
448 d_getmntent=''
449 d_getnbyaddr=''
450 d_getnbyname=''
451 d_getnent=''
452 d_getnetbyaddr_r=''
453 getnetbyaddr_r_proto=''
454 d_getnetbyname_r=''
455 getnetbyname_r_proto=''
456 d_getnetent_r=''
457 getnetent_r_proto=''
458 d_getnetprotos=''
459 d_getpagsz=''
460 d_getpent=''
461 d_getpgid=''
462 d_getpgrp2=''
463 d_bsdgetpgrp=''
464 d_getpgrp=''
465 d_getppid=''
466 d_getprior=''
467 d_getpbyname=''
468 d_getpbynumber=''
469 d_getprotobyname_r=''
470 getprotobyname_r_proto=''
471 d_getprotobynumber_r=''
472 getprotobynumber_r_proto=''
473 d_getprotoent_r=''
474 getprotoent_r_proto=''
475 d_getprotoprotos=''
476 d_getprpwnam=''
477 d_getpwent=''
478 d_getpwent_r=''
479 getpwent_r_proto=''
480 d_getpwnam_r=''
481 getpwnam_r_proto=''
482 d_getpwuid_r=''
483 getpwuid_r_proto=''
484 d_getsent=''
485 d_getservbyname_r=''
486 getservbyname_r_proto=''
487 d_getservbyport_r=''
488 getservbyport_r_proto=''
489 d_getservent_r=''
490 getservent_r_proto=''
491 d_getservprotos=''
492 d_getspnam=''
493 d_getspnam_r=''
494 getspnam_r_proto=''
495 d_getsbyname=''
496 d_getsbyport=''
497 d_gmtime_r=''
498 gmtime_r_proto=''
499 d_gnulibc=''
500 d_hasmntopt=''
501 d_htonl=''
502 d_inetaton=''
503 d_int64_t=''
504 d_isascii=''
505 d_isfinite=''
506 d_isinf=''
507 d_isnan=''
508 d_isnanl=''
509 d_killpg=''
510 d_lchown=''
511 d_ldbl_dig=''
512 d_link=''
513 d_localtime_r=''
514 localtime_r_proto=''
515 d_locconv=''
516 d_lockf=''
517 d_longdbl=''
518 longdblsize=''
519 d_longlong=''
520 longlongsize=''
521 d_lseekproto=''
522 d_lstat=''
523 d_madvise=''
524 d_mblen=''
525 d_mbstowcs=''
526 d_mbtowc=''
527 d_memchr=''
528 d_memcmp=''
529 d_memcpy=''
530 d_memmove=''
531 d_memset=''
532 d_mkdir=''
533 d_mkdtemp=''
534 d_mkfifo=''
535 d_mkstemp=''
536 d_mkstemps=''
537 d_mktime=''
538 d_mmap=''
539 mmaptype=''
540 d_modfl=''
541 d_modfl_pow32_bug=''
542 d_mprotect=''
543 d_msg=''
544 d_msgctl=''
545 d_msgget=''
546 d_msghdr_s=''
547 d_msgrcv=''
548 d_msgsnd=''
549 d_msync=''
550 d_munmap=''
551 d_nice=''
552 d_nl_langinfo=''
553 d_off64_t=''
554 d_open3=''
555 d_fpathconf=''
556 d_pathconf=''
557 d_pause=''
558 d_pipe=''
559 d_poll=''
560 d_portable=''
561 d_procselfexe=''
562 procselfexe=''
563 d_old_pthread_create_joinable=''
564 old_pthread_create_joinable=''
565 d_pthread_atfork=''
566 d_pthread_yield=''
567 d_sched_yield=''
568 sched_yield=''
569 d_qgcvt=''
570 d_random_r=''
571 random_r_proto=''
572 d_readdir64_r=''
573 readdir64_r_proto=''
574 d_readdir=''
575 d_rewinddir=''
576 d_seekdir=''
577 d_telldir=''
578 d_readdir_r=''
579 readdir_r_proto=''
580 d_readlink=''
581 d_readv=''
582 d_recvmsg=''
583 d_rename=''
584 d_rmdir=''
585 d_safebcpy=''
586 d_safemcpy=''
587 d_sanemcmp=''
588 d_sbrkproto=''
589 d_select=''
590 d_sem=''
591 d_semctl=''
592 d_semget=''
593 d_semop=''
594 d_sendmsg=''
595 d_setegid=''
596 d_seteuid=''
597 d_setgrent=''
598 d_setgrent_r=''
599 setgrent_r_proto=''
600 d_setgrps=''
601 d_sethent=''
602 d_sethostent_r=''
603 sethostent_r_proto=''
604 d_setitimer=''
605 d_setlinebuf=''
606 d_setlocale=''
607 d_setlocale_r=''
608 setlocale_r_proto=''
609 d_setnent=''
610 d_setnetent_r=''
611 setnetent_r_proto=''
612 d_setpent=''
613 d_setpgid=''
614 d_setpgrp2=''
615 d_bsdsetpgrp=''
616 d_setpgrp=''
617 d_setprior=''
618 d_setproctitle=''
619 d_setprotoent_r=''
620 setprotoent_r_proto=''
621 d_setpwent=''
622 d_setpwent_r=''
623 setpwent_r_proto=''
624 d_setregid=''
625 d_setresgid=''
626 d_setresuid=''
627 d_setreuid=''
628 d_setrgid=''
629 d_setruid=''
630 d_setsent=''
631 d_setservent_r=''
632 setservent_r_proto=''
633 d_setsid=''
634 d_setvbuf=''
635 d_sfio=''
636 usesfio=''
637 d_shm=''
638 d_shmat=''
639 d_shmatprototype=''
640 shmattype=''
641 d_shmctl=''
642 d_shmdt=''
643 d_shmget=''
644 d_sigaction=''
645 d_sigprocmask=''
646 d_sigsetjmp=''
647 d_sockatmark=''
648 d_sockatmarkproto=''
649 d_msg_ctrunc=''
650 d_msg_dontroute=''
651 d_msg_oob=''
652 d_msg_peek=''
653 d_msg_proxy=''
654 d_oldsock=''
655 d_scm_rights=''
656 d_socket=''
657 d_sockpair=''
658 sockethdr=''
659 socketlib=''
660 d_socklen_t=''
661 d_socks5_init=''
662 d_sqrtl=''
663 d_srand48_r=''
664 srand48_r_proto=''
665 d_srandom_r=''
666 srandom_r_proto=''
667 d_sresgproto=''
668 d_sresuproto=''
669 d_statblks=''
670 d_statfs_f_flags=''
671 d_statfs_s=''
672 d_fstatvfs=''
673 d_statvfs=''
674 d_stdio_cnt_lval=''
675 d_stdio_ptr_lval=''
676 d_stdio_ptr_lval_nochange_cnt=''
677 d_stdio_ptr_lval_sets_cnt=''
678 d_stdiobase=''
679 d_stdstdio=''
680 stdio_base=''
681 stdio_bufsiz=''
682 stdio_cnt=''
683 stdio_filbuf=''
684 stdio_ptr=''
685 d_index=''
686 d_strchr=''
687 d_strcoll=''
688 d_strctcpy=''
689 d_strerrm=''
690 d_strerror=''
691 d_sysernlst=''
692 d_syserrlst=''
693 d_strerror_r=''
694 strerror_r_proto=''
695 d_strftime=''
696 d_strtod=''
697 d_strtol=''
698 d_strtold=''
699 d_strtoll=''
700 d_strtoq=''
701 d_strtoul=''
702 d_strtoull=''
703 d_strtouq=''
704 d_strxfrm=''
705 d_symlink=''
706 d_syscall=''
707 d_syscallproto=''
708 d_sysconf=''
709 d_system=''
710 d_tcgetpgrp=''
711 d_tcsetpgrp=''
712 d_telldirproto=''
713 d_time=''
714 timetype=''
715 clocktype=''
716 d_times=''
717 d_tmpnam_r=''
718 tmpnam_r_proto=''
719 d_truncate=''
720 d_ttyname_r=''
721 ttyname_r_proto=''
722 d_tzname=''
723 d_u32align=''
724 d_ualarm=''
725 d_umask=''
726 d_semctl_semid_ds=''
727 d_semctl_semun=''
728 d_union_semun=''
729 d_unordered=''
730 d_usleep=''
731 d_usleepproto=''
732 d_ustat=''
733 d_vfork=''
734 usevfork=''
735 d_voidsig=''
736 signal_t=''
737 d_volatile=''
738 d_charvspr=''
739 d_vprintf=''
740 d_wait4=''
741 d_waitpid=''
742 d_wcstombs=''
743 d_wctomb=''
744 d_writev=''
745 dlext=''
746 cccdlflags=''
747 ccdlflags=''
748 dlsrc=''
749 ld=''
750 lddlflags=''
751 usedl=''
752 doublesize=''
753 ebcdic=''
754 fflushNULL=''
755 fflushall=''
756 fpossize=''
757 fpostype=''
758 gccosandvers=''
759 gccversion=''
760 gidformat=''
761 gidsign=''
762 gidsize=''
763 gidtype=''
764 groupstype=''
765 h_fcntl=''
766 h_sysfile=''
767 i_arpainet=''
768 i_crypt=''
769 db_hashtype=''
770 db_prefixtype=''
771 db_version_major=''
772 db_version_minor=''
773 db_version_patch=''
774 i_db=''
775 i_dbm=''
776 i_rpcsvcdbm=''
777 d_dirnamlen=''
778 direntrytype=''
779 i_dirent=''
780 i_dld=''
781 i_dlfcn=''
782 i_fcntl=''
783 i_float=''
784 i_fp=''
785 i_fp_class=''
786 i_gdbm=''
787 d_grpasswd=''
788 i_grp=''
789 i_ieeefp=''
790 i_inttypes=''
791 i_langinfo=''
792 i_libutil=''
793 i_limits=''
794 i_locale=''
795 i_machcthr=''
796 i_malloc=''
797 i_math=''
798 i_memory=''
799 i_mntent=''
800 i_ndbm=''
801 i_netdb=''
802 i_neterrno=''
803 i_netinettcp=''
804 i_niin=''
805 i_sysin=''
806 i_poll=''
807 i_prot=''
808 i_pthread=''
809 d_pwage=''
810 d_pwchange=''
811 d_pwclass=''
812 d_pwcomment=''
813 d_pwexpire=''
814 d_pwgecos=''
815 d_pwpasswd=''
816 d_pwquota=''
817 i_pwd=''
818 i_sfio=''
819 i_shadow=''
820 i_socks=''
821 i_stddef=''
822 i_stdlib=''
823 i_string=''
824 strings=''
825 i_sunmath=''
826 i_sysaccess=''
827 i_sysdir=''
828 i_sysfile=''
829 d_voidtty=''
830 i_bsdioctl=''
831 i_sysfilio=''
832 i_sysioctl=''
833 i_syssockio=''
834 i_syslog=''
835 i_sysmman=''
836 i_sysmode=''
837 i_sysmount=''
838 i_sysndir=''
839 i_sysparam=''
840 i_sysresrc=''
841 i_syssecrt=''
842 i_sysselct=''
843 i_sysstat=''
844 i_sysstatfs=''
845 i_sysstatvfs=''
846 i_systimes=''
847 i_systypes=''
848 i_sysuio=''
849 i_sysun=''
850 i_sysutsname=''
851 i_sysvfs=''
852 i_syswait=''
853 i_sgtty=''
854 i_termio=''
855 i_termios=''
856 d_tm_tm_gmtoff=''
857 d_tm_tm_zone=''
858 i_systime=''
859 i_systimek=''
860 i_time=''
861 timeincl=''
862 i_unistd=''
863 i_ustat=''
864 i_utime=''
865 i_values=''
866 i_stdarg=''
867 i_varargs=''
868 i_varhdr=''
869 i_vfork=''
870 inc_version_list=''
871 inc_version_list_init=''
872 installprefix=''
873 installprefixexp=''
874 installstyle=''
875 installusrbinperl=''
876 intsize=''
877 longsize=''
878 shortsize=''
879 issymlink=''
880 libc=''
881 ldlibpthname=''
882 libperl=''
883 shrpenv=''
884 useshrplib=''
885 glibpth=''
886 libpth=''
887 loclibpth=''
888 plibpth=''
889 xlibpth=''
890 ignore_versioned_solibs=''
891 libs=''
892 libsdirs=''
893 libsfiles=''
894 libsfound=''
895 libspath=''
896 lns=''
897 d_PRIEUldbl=''
898 d_PRIFUldbl=''
899 d_PRIGUldbl=''
900 d_PRIeldbl=''
901 d_PRIfldbl=''
902 d_PRIgldbl=''
903 d_SCNfldbl=''
904 sPRIEUldbl=''
905 sPRIFUldbl=''
906 sPRIGUldbl=''
907 sPRIeldbl=''
908 sPRIfldbl=''
909 sPRIgldbl=''
910 sSCNfldbl=''
911 lseeksize=''
912 lseektype=''
913 make_set_make=''
914 d_mymalloc=''
915 freetype=''
916 mallocobj=''
917 mallocsrc=''
918 malloctype=''
919 usemymalloc=''
920 installman1dir=''
921 man1dir=''
922 man1direxp=''
923 man1ext=''
924 installman3dir=''
925 man3dir=''
926 man3direxp=''
927 man3ext=''
928 modetype=''
929 multiarch=''
930 mydomain=''
931 myhostname=''
932 phostname=''
933 c=''
934 n=''
935 d_eofnblk=''
936 eagain=''
937 o_nonblock=''
938 rd_nodata=''
939 need_va_copy=''
940 netdb_hlen_type=''
941 netdb_host_type=''
942 netdb_name_type=''
943 netdb_net_type=''
944 groupcat=''
945 hostcat=''
946 passcat=''
947 orderlib=''
948 ranlib=''
949 d_perl_otherlibdirs=''
950 otherlibdirs=''
951 package=''
952 spackage=''
953 pager=''
954 api_revision=''
955 api_subversion=''
956 api_version=''
957 api_versionstring=''
958 patchlevel=''
959 perl_patchlevel=''
960 revision=''
961 subversion=''
962 version=''
963 version_patchlevel_string=''
964 perl5=''
965 perladmin=''
966 perlpath=''
967 d_nv_preserves_uv=''
968 i16size=''
969 i16type=''
970 i32size=''
971 i32type=''
972 i64size=''
973 i64type=''
974 i8size=''
975 i8type=''
976 ivsize=''
977 ivtype=''
978 nv_preserves_uv_bits=''
979 nvsize=''
980 nvtype=''
981 u16size=''
982 u16type=''
983 u32size=''
984 u32type=''
985 u64size=''
986 u64type=''
987 u8size=''
988 u8type=''
989 uvsize=''
990 uvtype=''
991 ivdformat=''
992 nvEUformat=''
993 nvFUformat=''
994 nvGUformat=''
995 nveformat=''
996 nvfformat=''
997 nvgformat=''
998 uvXUformat=''
999 uvoformat=''
1000 uvuformat=''
1001 uvxformat=''
1002 pidtype=''
1003 prefix=''
1004 prefixexp=''
1005 installprivlib=''
1006 privlib=''
1007 privlibexp=''
1008 prototype=''
1009 ptrsize=''
1010 d_PRIXU64=''
1011 d_PRId64=''
1012 d_PRIi64=''
1013 d_PRIo64=''
1014 d_PRIu64=''
1015 d_PRIx64=''
1016 sPRIXU64=''
1017 sPRId64=''
1018 sPRIi64=''
1019 sPRIo64=''
1020 sPRIu64=''
1021 sPRIx64=''
1022 d_quad=''
1023 quadkind=''
1024 quadtype=''
1025 uquadtype=''
1026 drand01=''
1027 randbits=''
1028 randfunc=''
1029 randseedtype=''
1030 seedfunc=''
1031 installscript=''
1032 scriptdir=''
1033 scriptdirexp=''
1034 selectminbits=''
1035 selecttype=''
1036 sh=''
1037 sig_count=''
1038 sig_name=''
1039 sig_name_init=''
1040 sig_num=''
1041 sig_num_init=''
1042 sig_size=''
1043 installsitearch=''
1044 sitearch=''
1045 sitearchexp=''
1046 installsitebin=''
1047 sitebin=''
1048 sitebinexp=''
1049 installsitelib=''
1050 sitelib=''
1051 sitelib_stem=''
1052 sitelibexp=''
1053 siteprefix=''
1054 siteprefixexp=''
1055 sizesize=''
1056 sizetype=''
1057 so=''
1058 socksizetype=''
1059 sharpbang=''
1060 shsharp=''
1061 spitshell=''
1062 src=''
1063 ssizetype=''
1064 startperl=''
1065 startsh=''
1066 stdchar=''
1067 d_stdio_stream_array=''
1068 stdio_stream_array=''
1069 sysman=''
1070 trnl=''
1071 uidformat=''
1072 uidsign=''
1073 uidsize=''
1074 uidtype=''
1075 archname64=''
1076 use64bitall=''
1077 use64bitint=''
1078 ccflags_uselargefiles=''
1079 ldflags_uselargefiles=''
1080 libswanted_uselargefiles=''
1081 uselargefiles=''
1082 uselongdouble=''
1083 usemorebits=''
1084 usemultiplicity=''
1085 nm_opt=''
1086 nm_so_opt=''
1087 runnm=''
1088 usenm=''
1089 useperlio=''
1090 usesocks=''
1091 d_oldpthreads=''
1092 use5005threads=''
1093 useithreads=''
1094 usereentrant=''
1095 usethreads=''
1096 incpath=''
1097 mips_type=''
1098 usrinc=''
1099 d_vendorarch=''
1100 installvendorarch=''
1101 vendorarch=''
1102 vendorarchexp=''
1103 d_vendorbin=''
1104 installvendorbin=''
1105 vendorbin=''
1106 vendorbinexp=''
1107 d_vendorlib=''
1108 installvendorlib=''
1109 vendorlib=''
1110 vendorlib_stem=''
1111 vendorlibexp=''
1112 usevendorprefix=''
1113 vendorprefix=''
1114 vendorprefixexp=''
1115 versiononly=''
1116 defvoidused=''
1117 voidflags=''
1118 pm_apiversion=''
1119 xs_apiversion=''
1120 yacc=''
1121 yaccflags=''
1122 CONFIG=''
1123
1124 define='define'
1125 undef='undef'
1126 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1127 rmlist=''
1128
1129 : We must find out about Eunice early
1130 eunicefix=':'
1131 if test -f /etc/unixtovms; then
1132         eunicefix=/etc/unixtovms
1133 fi
1134 if test -f /etc/unixtovms.exe; then
1135         eunicefix=/etc/unixtovms.exe
1136 fi
1137
1138 : Set executable suffix now -- needed before hints available
1139 if test -f "/libs/version.library"; then
1140 : Amiga OS
1141     _exe=""
1142 elif test -f "/system/gnu_library/bin/ar.pm"; then
1143 : Stratus VOS
1144     _exe=".pm"
1145 elif test -n "$DJGPP"; then
1146 : DOS DJGPP
1147     _exe=".exe"
1148 elif test -d c:/. ; then
1149 : OS/2 or cygwin
1150     _exe=".exe"
1151 fi
1152
1153 i_whoami=''
1154 ccname=''
1155 ccversion=''
1156 perllibs=''
1157 : set useposix=false in your hint file to disable the POSIX extension.
1158 useposix=true
1159 : set useopcode=false in your hint file to disable the Opcode extension.
1160 useopcode=true
1161 : Trailing extension.  Override this in a hint file, if needed.
1162 : Extra object files, if any, needed on this platform.
1163 archobjs=''
1164 archname=''
1165 : Possible local include directories to search.
1166 : Set locincpth to "" in a hint file to defeat local include searches.
1167 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1168 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1169 :
1170 : no include file wanted by default
1171 inclwanted=''
1172
1173 groupstype=''
1174 libnames=''
1175 : change the next line if compiling for Xenix/286 on Xenix/386
1176 xlibpth='/usr/lib/386 /lib/386'
1177 : Possible local library directories to search.
1178 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1179 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1180
1181 : general looking path for locating libraries
1182 glibpth="/lib /usr/lib $xlibpth"
1183 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1184 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1185 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1186
1187 : Private path used by Configure to find libraries.  Its value
1188 : is prepended to libpth. This variable takes care of special
1189 : machines, like the mips.  Usually, it should be empty.
1190 plibpth=''
1191
1192 : default library list
1193 libswanted=''
1194 : some systems want to use only the non-versioned libso:s
1195 ignore_versioned_solibs=''
1196 archname64=''
1197 ccflags_uselargefiles=''
1198 ldflags_uselargefiles=''
1199 libswanted_uselargefiles=''
1200 : set usemultiplicity on the Configure command line to enable multiplicity.
1201 : set usesocks on the Configure command line to enable socks.
1202 : set usethreads on the Configure command line to enable threads.
1203 usereentrant='undef'
1204 : full support for void wanted by default
1205 defvoidused=15
1206
1207 : List of libraries we want.
1208 : If anyone needs -lnet, put it in a hint file.
1209 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1210 libswanted="$libswanted dld ld sun m c cposix posix"
1211 libswanted="$libswanted ndir dir crypt sec"
1212 libswanted="$libswanted ucb bsd BSD PW x util"
1213 : We probably want to search /usr/shlib before most other libraries.
1214 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1215 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1216 glibpth="/usr/shlib $glibpth"
1217 : Do not use vfork unless overridden by a hint file.
1218 usevfork=false
1219
1220 : Find the basic shell for Bourne shell scripts
1221 case "$sh" in
1222 '')
1223         case "$SYSTYPE" in
1224         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1225         *) xxx='/bin/sh';;
1226         esac
1227         if test -f "$xxx"; then
1228                 sh="$xxx"
1229         else
1230                 : Build up a list and do a single loop so we can 'break' out.
1231                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1232                 for xxx in sh bash ksh pdksh ash; do
1233                         for p in $pth; do
1234                                 try="$try ${p}/${xxx}"
1235                         done
1236                 done
1237                 for xxx in $try; do
1238                         if test -f "$xxx"; then
1239                                 sh="$xxx";
1240                                 break
1241                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1242                                 sh="$xxx";
1243                                 break
1244                         elif test -f "$xxx.exe"; then
1245                                 sh="$xxx";
1246                                 break
1247                         fi
1248                 done
1249         fi
1250         ;;
1251 esac
1252
1253 case "$sh" in
1254 '')     cat >&2 <<EOM
1255 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1256
1257 Usually it's in /bin/sh.  How did you even get this far?
1258 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1259 we'll try to straighten this all out.
1260 EOM
1261         exit 1
1262         ;;
1263 esac
1264
1265 : see if sh knows # comments
1266 if `$sh -c '#' >/dev/null 2>&1`; then
1267         shsharp=true
1268         spitshell=cat
1269         xcat=/bin/cat
1270         test -f $xcat$_exe || xcat=/usr/bin/cat
1271         if test ! -f $xcat$_exe; then
1272                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1273                         if test -f $p/cat$_exe; then
1274                                 xcat=$p/cat
1275                                 break
1276                         fi
1277                 done
1278                 if test ! -f $xcat$_exe; then
1279                         echo "Can't find cat anywhere!"
1280                         exit 1
1281                 fi
1282         fi
1283         echo "#!$xcat" >sharp
1284         $eunicefix sharp
1285         chmod +x sharp
1286         ./sharp > today
1287         if test -s today; then
1288                 sharpbang='#!'
1289         else
1290                 echo "#! $xcat" > sharp
1291                 $eunicefix sharp
1292                 chmod +x sharp
1293                 ./sharp > today
1294                 if test -s today; then
1295                         sharpbang='#! '
1296                 else
1297                         sharpbang=': use '
1298                 fi
1299         fi
1300 else
1301         echo " "
1302         echo "Your $sh doesn't grok # comments--I will strip them later on."
1303         shsharp=false
1304         cd ..
1305         echo "exec grep -v '^[  ]*#'" >spitshell
1306         chmod +x spitshell
1307         $eunicefix spitshell
1308         spitshell=`pwd`/spitshell
1309         cd UU
1310         echo "I presume that if # doesn't work, #! won't work either!"
1311         sharpbang=': use '
1312 fi
1313 rm -f sharp today
1314
1315 : figure out how to guarantee sh startup
1316 case "$startsh" in
1317 '') startsh=${sharpbang}${sh} ;;
1318 *)
1319 esac
1320 cat >sharp <<EOSS
1321 $startsh
1322 set abc
1323 test "$?abc" != 1
1324 EOSS
1325
1326 chmod +x sharp
1327 $eunicefix sharp
1328 if ./sharp; then
1329         : echo "Yup, it does."
1330 else
1331         echo "Hmm... '$startsh' does not guarantee sh startup..."
1332         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1333 fi
1334 rm -f sharp
1335
1336
1337 : Save command line options in file UU/cmdline.opt for later use in
1338 : generating config.sh.
1339 cat > cmdline.opt <<EOSH
1340 # Configure command line arguments.
1341 config_arg0='$0'
1342 config_args='$*'
1343 config_argc=$#
1344 EOSH
1345 argn=1
1346 args_exp=''
1347 args_sep=''
1348 for arg in "$@"; do
1349         cat >>cmdline.opt <<EOSH
1350 config_arg$argn='$arg'
1351 EOSH
1352         # Extreme backslashitis: replace each ' by '"'"'
1353         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1354 $arg
1355 EOC
1356         arg_exp=`cat cmdl.opt`
1357         args_exp="$args_exp$args_sep'$arg_exp'"
1358         argn=`expr $argn + 1`
1359         args_sep=' '
1360 done
1361 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1362 # used by ./hints/os2.sh
1363 rm -f cmdl.opt
1364
1365 : produce awk script to parse command line options
1366 cat >options.awk <<'EOF'
1367 BEGIN {
1368         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1369
1370         len = length(optstr);
1371         for (i = 1; i <= len; i++) {
1372                 c = substr(optstr, i, 1);
1373                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1374                 if (a == ":") {
1375                         arg[c] = 1;
1376                         i++;
1377                 }
1378                 opt[c] = 1;
1379         }
1380 }
1381 {
1382         expect = 0;
1383         str = $0;
1384         if (substr(str, 1, 1) != "-") {
1385                 printf("'%s'\n", str);
1386                 next;
1387         }
1388         len = length($0);
1389         for (i = 2; i <= len; i++) {
1390                 c = substr(str, i, 1);
1391                 if (!opt[c]) {
1392                         printf("-%s\n", substr(str, i));
1393                         next;
1394                 }
1395                 printf("-%s\n", c);
1396                 if (arg[c]) {
1397                         if (i < len)
1398                                 printf("'%s'\n", substr(str, i + 1));
1399                         else
1400                                 expect = 1;
1401                         next;
1402                 }
1403         }
1404 }
1405 END {
1406         if (expect)
1407                 print "?";
1408 }
1409 EOF
1410
1411 : process the command line options
1412 set X `for arg in "$@"; do echo "X$arg"; done |
1413         sed -e s/X// | awk -f options.awk`
1414 eval "set $*"
1415 shift
1416 rm -f options.awk
1417
1418 : set up default values
1419 fastread=''
1420 reuseval=false
1421 config_sh=''
1422 alldone=''
1423 error=''
1424 silent=''
1425 extractsh=''
1426 override=''
1427 knowitall=''
1428 rm -f optdef.sh posthint.sh
1429 cat >optdef.sh <<EOS
1430 $startsh
1431 EOS
1432
1433
1434 : option parsing
1435 while test $# -gt 0; do
1436         case "$1" in
1437         -d) shift; fastread=yes;;
1438         -e) shift; alldone=cont;;
1439         -f)
1440                 shift
1441                 cd ..
1442                 if test -r "$1"; then
1443                         config_sh="$1"
1444                 else
1445                         echo "$me: cannot read config file $1." >&2
1446                         error=true
1447                 fi
1448                 cd UU
1449                 shift;;
1450         -h) shift; error=true;;
1451         -r) shift; reuseval=true;;
1452         -s) shift; silent=true; realsilent=true;;
1453         -E) shift; alldone=exit;;
1454         -K) shift; knowitall=true;;
1455         -O) shift; override=true;;
1456         -S) shift; silent=true; extractsh=true;;
1457         -D)
1458                 shift
1459                 case "$1" in
1460                 *=)
1461                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1462                         echo "$me: ignoring -D $1" >&2
1463                         ;;
1464                 *=*) echo "$1" | \
1465                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1466                 *) echo "$1='define'" >> optdef.sh;;
1467                 esac
1468                 shift
1469                 ;;
1470         -U)
1471                 shift
1472                 case "$1" in
1473                 *=) echo "$1" >> optdef.sh;;
1474                 *=*)
1475                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1476                         echo "$me: ignoring -U $1" >&2
1477                         ;;
1478                 *) echo "$1='undef'" >> optdef.sh;;
1479                 esac
1480                 shift
1481                 ;;
1482         -A)
1483             shift
1484             xxx=''
1485             yyy="$1"
1486             zzz=''
1487             uuu=undef
1488             case "$yyy" in
1489             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1490                  case "$zzz" in
1491                  *:*) zzz='' ;;
1492                  *)   xxx=append
1493                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1494                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1495                  esac
1496                  ;;
1497             esac
1498             case "$xxx" in
1499             '')  case "$yyy" in
1500                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1501                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1502                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1503                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1504                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1505                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1506                  esac
1507                  ;;       
1508             esac
1509             case "$xxx" in
1510             append)
1511                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1512             clear)
1513                 echo "$yyy=''"                  >> posthint.sh ;;
1514             define)
1515                 case "$zzz" in
1516                 '') zzz=define ;;
1517                 esac
1518                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1519             eval)
1520                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1521             prepend)
1522                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1523             undef)
1524                 case "$zzz" in
1525                 '') zzz="$uuu" ;;
1526                 esac
1527                 echo "$yyy=$zzz"                >> posthint.sh ;;
1528             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1529             esac
1530             shift
1531             ;;
1532         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1533             exit 0;;
1534         --) break;;
1535         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1536         *) break;;
1537         esac
1538 done
1539
1540 case "$error" in
1541 true)
1542         cat >&2 <<EOM
1543 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1544                  [-U symbol] [-U symbol=] [-A command:symbol...]
1545   -d : use defaults for all answers.
1546   -e : go on without questioning past the production of config.sh.
1547   -f : specify an alternate default configuration file.
1548   -h : print this help message and exit (with an error status).
1549   -r : reuse C symbols value if possible (skips costly nm extraction).
1550   -s : silent mode, only echoes questions and essential information.
1551   -D : define symbol to have some value:
1552          -D symbol         symbol gets the value 'define'
1553          -D symbol=value   symbol gets the value 'value'
1554   -E : stop at the end of questions, after having produced config.sh.
1555   -K : do not use unless you know what you are doing.
1556   -O : let -D and -U override definitions from loaded configuration file.
1557   -S : perform variable substitutions on all .SH files (can mix with -f)
1558   -U : undefine symbol:
1559          -U symbol    symbol gets the value 'undef'
1560          -U symbol=   symbol gets completely empty
1561   -A : manipulate symbol after the platform specific hints have been applied:
1562          -A symbol=value                append " "value to symbol
1563          -A append:symbol=value         append value to symbol
1564          -A define:symbol=value         define symbol to have value
1565          -A clear:symbol                define symbol to be ''
1566          -A define:symbol               define symbol to be 'define'
1567          -A eval:symbol=value           define symbol to be eval of value
1568          -A prepend:symbol=value        prepend value to symbol
1569          -A undef:symbol                define symbol to be 'undef'
1570          -A undef:symbol=               define symbol to be ''
1571   -V : print version number and exit (with a zero status).
1572 EOM
1573         exit 1
1574         ;;
1575 esac
1576
1577 : Sanity checks
1578 case "$fastread$alldone" in
1579 yescont|yesexit) ;;
1580 *)
1581         case "$extractsh" in
1582         true) ;;
1583         *)
1584                 if test ! -t 0; then
1585                         echo "Say 'sh Configure', not 'sh <Configure'"
1586                         exit 1
1587                 fi
1588                 ;;
1589         esac
1590         ;;
1591 esac
1592
1593 exec 4>&1
1594 case "$silent" in
1595 true) exec 1>/dev/null;;
1596 esac
1597
1598 : run the defines and the undefines, if any, but leave the file out there...
1599 touch optdef.sh
1600 . ./optdef.sh
1601 : create the posthint manipulation script and leave the file out there...
1602 touch posthint.sh
1603
1604 : set package name
1605 package=perl5
1606 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1607 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1608 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1609 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1610 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1611 esac
1612
1613 : Some greps do not return status, grrr.
1614 echo "grimblepritz" >grimble
1615 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1616         contains=contains
1617 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1618         contains=grep
1619 else
1620         contains=contains
1621 fi
1622 rm -f grimble
1623 : the following should work in any shell
1624 case "$contains" in
1625 contains*)
1626         echo " "
1627         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1628         cat >contains <<'EOSS'
1629 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1630 EOSS
1631 chmod +x contains
1632 esac
1633
1634 : Find the path to the source tree
1635 case "$src" in
1636 '') case "$0" in
1637     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1638          case "$src" in
1639          /*)    ;;
1640          .)     ;;
1641          *)     src=`cd ../$src && pwd` ;;
1642          esac
1643          ;;
1644     *)   src='.';;
1645     esac;;
1646 esac
1647 case "$src" in
1648 '')     src=/
1649         rsrc=/
1650         ;;
1651 /*) rsrc="$src";;
1652 *) rsrc="../$src";;
1653 esac
1654 if test -f $rsrc/Configure && \
1655         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1656 then
1657    : found it, so we are ok.
1658 else
1659         rsrc=''
1660         for src in . .. ../.. ../../.. ../../../..; do
1661                 if test -f ../$src/Configure && \
1662                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1663                 then
1664                         rsrc=../$src
1665                         break
1666                 fi
1667         done
1668 fi
1669 case "$rsrc" in
1670 '')
1671         cat <<EOM >&4
1672
1673 Sorry, I can't seem to locate the source dir for $package.  Please start
1674 Configure with an explicit path -- i.e. /some/path/Configure.
1675
1676 EOM
1677         exit 1
1678         ;;
1679 ../.)   rsrc='..';;
1680 *)
1681         echo " "
1682         echo "Sources for $package found in \"$src\"." >&4
1683         ;;
1684 esac
1685
1686 : script used to extract .SH files with variable substitutions
1687 cat >extract <<'EOS'
1688 PERL_CONFIG_SH=true
1689 echo "Doing variable substitutions on .SH files..."
1690 if test -f MANIFEST; then
1691         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1692 else
1693         echo "(Looking for .SH files under the source directory.)"
1694         set x `(cd "$src"; find . -name "*.SH" -print)`
1695 fi
1696 shift
1697 case $# in
1698 0) set x `(cd "$src"; echo *.SH)`; shift;;
1699 esac
1700 if test ! -f "$src/$1"; then
1701         shift
1702 fi
1703 mkdir_p='
1704 name=$1;
1705 create="";
1706 while test $name; do
1707         if test ! -d "$name"; then
1708                 create="$name $create";
1709                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1710                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1711         else
1712                 name="";
1713         fi;
1714 done;
1715 for file in $create; do
1716         mkdir $file;
1717 done
1718 '
1719 for file in $*; do
1720         case "$src" in
1721         ".")
1722                 case "$file" in
1723                 */*)
1724                         dir=`expr X$file : 'X\(.*\)/'`
1725                         file=`expr X$file : 'X.*/\(.*\)'`
1726                         (cd "$dir" && . ./$file)
1727                         ;;
1728                 *)
1729                         . ./$file
1730                         ;;
1731                 esac
1732                 ;;
1733         *)
1734                 case "$file" in
1735                 */*)
1736                         dir=`expr X$file : 'X\(.*\)/'`
1737                         file=`expr X$file : 'X.*/\(.*\)'`
1738                         (set x $dir; shift; eval $mkdir_p)
1739                         sh <"$src/$dir/$file"
1740                         ;;
1741                 *)
1742                         sh <"$src/$file"
1743                         ;;
1744                 esac
1745                 ;;
1746         esac
1747 done
1748 if test -f "$src/config_h.SH"; then
1749         if test ! -f config.h; then
1750         : oops, they left it out of MANIFEST, probably, so do it anyway.
1751         . "$src/config_h.SH"
1752         fi
1753 fi
1754 EOS
1755
1756 : extract files and exit if asked to do so
1757 case "$extractsh" in
1758 true)
1759         case "$realsilent" in
1760         true) ;;
1761         *) exec 1>&4;;
1762         esac
1763         case "$config_sh" in
1764         '') config_sh='config.sh';;
1765         esac
1766         echo " "
1767         echo "Fetching answers from $config_sh..."
1768         cd ..
1769         . $config_sh
1770         test "$override" && . ./optdef.sh
1771         echo " "
1772         . UU/extract
1773         rm -rf UU
1774         echo "Extraction done."
1775         exit 0
1776         ;;
1777 esac
1778
1779 : Eunice requires " " instead of "", can you believe it
1780 echo " "
1781 : Here we go...
1782 echo "Beginning of configuration questions for $package."
1783
1784 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1785
1786 : first determine how to suppress newline on echo command
1787 echo " "
1788 echo "Checking echo to see how to suppress newlines..."
1789 (echo "hi there\c" ; echo " ") >.echotmp
1790 if $contains c .echotmp >/dev/null 2>&1 ; then
1791         echo "...using -n."
1792         n='-n'
1793         c=''
1794 else
1795         cat <<'EOM'
1796 ...using \c
1797 EOM
1798         n=''
1799         c='\c'
1800 fi
1801 echo $n "The star should be here-->$c"
1802 echo '*'
1803 rm -f .echotmp
1804
1805 : Now test for existence of everything in MANIFEST
1806 echo " "
1807 if test -f "$rsrc/MANIFEST"; then
1808         echo "First let's make sure your kit is complete.  Checking..." >&4
1809         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1810         rm -f missing
1811         tmppwd=`pwd`
1812         for filelist in x??; do
1813                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1814         done
1815         if test -s missing; then
1816                 cat missing >&4
1817                 cat >&4 <<'EOM'
1818
1819 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1820
1821 You have the option of continuing the configuration process, despite the
1822 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1823 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1824 and contact the author (perlbug@perl.org).
1825
1826 EOM
1827                 echo $n "Continue? [n] $c" >&4
1828                 read ans
1829                 case "$ans" in
1830                 y*)
1831                         echo "Continuing..." >&4
1832                         rm -f missing
1833                         ;;
1834                 *)
1835                         echo "ABORTING..." >&4
1836                         kill $$
1837                         ;;
1838                 esac
1839         else
1840                 echo "Looks good..."
1841         fi
1842 else
1843         echo "There is no MANIFEST file.  I hope your kit is complete !"
1844 fi
1845 rm -f missing x??
1846
1847 echo " "
1848 : Find the appropriate value for a newline for tr
1849 if test -n "$DJGPP"; then
1850        trnl='\012'
1851 fi
1852 if test X"$trnl" = X; then
1853         case "`echo foo|tr '\n' x 2>/dev/null`" in
1854         foox) trnl='\n' ;;
1855         esac
1856 fi
1857 if test X"$trnl" = X; then
1858         case "`echo foo|tr '\012' x 2>/dev/null`" in
1859         foox) trnl='\012' ;;
1860         esac
1861 fi
1862 if test X"$trnl" = X; then
1863         cat <<EOM >&2
1864
1865 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1866
1867 EOM
1868         exit 1
1869 fi
1870
1871 : compute the number of columns on the terminal for proper question formatting
1872 case "$COLUMNS" in
1873 '') COLUMNS='80';;
1874 esac
1875
1876 : set up the echo used in my read
1877 myecho="case \"\$xxxm\" in
1878 '') echo $n \"\$rp $c\" >&4;;
1879 *) case \"\$rp\" in
1880         '') echo $n \"[\$xxxm] $c\";;
1881         *)
1882                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1883                         echo \"\$rp\" >&4
1884                         echo $n \"[\$xxxm] $c\" >&4
1885                 else
1886                         echo $n \"\$rp [\$xxxm] $c\" >&4
1887                 fi
1888                 ;;
1889         esac;;
1890 esac"
1891
1892 : now set up to do reads with possible shell escape and default assignment
1893 cat <<EOSC >myread
1894 $startsh
1895 xxxm=\$dflt
1896 $myecho
1897 ans='!'
1898 case "\$fastread" in
1899 yes) case "\$dflt" in
1900         '') ;;
1901         *) ans='';
1902                 case "\$silent-\$rp" in
1903                 true-) ;;
1904                 *) echo " " >&4;;
1905                 esac;;
1906         esac;;
1907 *) case "\$silent" in
1908         true) case "\$rp" in
1909                 '') ans='';;
1910                 esac;;
1911         esac;;
1912 esac
1913 while expr "X\$ans" : "X!" >/dev/null; do
1914         read answ
1915         set x \$xxxm
1916         shift
1917         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1918         case  "\$answ" in
1919         "!")
1920                 sh 1>&4
1921                 echo " "
1922                 $myecho
1923                 ;;
1924         !*)
1925                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1926                 shift
1927                 sh 1>&4 -c "\$*"
1928                 echo " "
1929                 $myecho
1930                 ;;
1931         "\$ans")
1932                 case "\$ans" in
1933                 \\&*)
1934                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1935                         shift
1936                         case "\$1" in
1937                         -d)
1938                                 fastread=yes
1939                                 echo "(OK, I'll run with -d after this question.)" >&4
1940                                 ;;
1941                         -*)
1942                                 echo "*** Sorry, \$1 not supported yet." >&4
1943                                 ;;
1944                         esac
1945                         $myecho
1946                         ans=!
1947                         ;;
1948                 esac;;
1949         *)
1950                 case "\$aok" in
1951                 y)
1952                         echo "*** Substitution done -- please confirm."
1953                         xxxm="\$ans"
1954                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1955                         xxxm="\$ans"
1956                         ans=!
1957                         ;;
1958                 *)
1959                         echo "*** Error -- try again."
1960                         ans=!
1961                         ;;
1962                 esac
1963                 $myecho
1964                 ;;
1965         esac
1966         case "\$ans\$xxxm\$nostick" in
1967         '')
1968                 ans=!
1969                 $myecho
1970                 ;;
1971         esac
1972 done
1973 case "\$ans" in
1974 '') ans="\$xxxm";;
1975 esac
1976 EOSC
1977
1978 : create .config dir to save info across Configure sessions
1979 test -d ../.config || mkdir ../.config
1980 cat >../.config/README <<EOF
1981 This directory created by Configure to save information that should
1982 persist across sessions for $package.
1983
1984 You may safely delete it if you wish.
1985 EOF
1986
1987 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1988 case "$usedevel" in
1989 $define|true|[yY]*) ;;
1990 *) case "$xversion" in
1991    *[13579])
1992         cat >&4 <<EOH
1993 *** WHOA THERE!!! ***
1994
1995     This is an UNSTABLE DEVELOPMENT release.
1996     The version of this $package distribution is $xversion, that is, odd,
1997     (as opposed to even) and that signifies a development release.
1998     If you want a maintenance release, you want an even-numbered version.
1999
2000     Do ***NOT*** install this into production use.
2001     Data corruption and crashes are possible.
2002
2003     It is most seriously suggested that you do not continue any further
2004     unless you want to help in developing and debugging Perl.
2005
2006     If you *still* want to build perl, you can answer 'y' now,
2007     or pass -Dusedevel to Configure.
2008
2009 EOH
2010         rp='Do you really want to continue?'
2011         dflt='n'
2012         . ./myread
2013         case "$ans" in
2014         [yY]) echo >&4 "Okay, continuing."
2015               usedevel="$define" ;;
2016         *) echo >&4 "Okay, bye."
2017            exit 1
2018            ;;
2019         esac
2020         ;;
2021     esac
2022     ;;
2023 esac
2024 case "$usedevel" in
2025 $define|true|[yY]*)
2026         case "$versiononly" in
2027         '') versiononly="$define" ;;
2028         esac
2029         case "$installusrbinperl" in
2030         '') installusrbinperl="$undef" ;;
2031         esac
2032         ;;
2033 esac
2034
2035 : general instructions
2036 needman=true
2037 firsttime=true
2038 user=`(logname) 2>/dev/null`
2039 case "$user" in
2040 '') user=`whoami 2>&1`;;
2041 esac
2042 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2043         firsttime=false
2044         echo " "
2045         rp='Would you like to see the instructions?'
2046         dflt=n
2047         . ./myread
2048         case "$ans" in
2049         [yY]*) ;;
2050         *) needman=false;;
2051         esac
2052 fi
2053 if $needman; then
2054         cat <<EOH
2055
2056 This installation shell script will examine your system and ask you questions
2057 to determine how the perl5 package should be installed. If you get
2058 stuck on a question, you may use a ! shell escape to start a subshell or
2059 execute a command.  Many of the questions will have default answers in square
2060 brackets; typing carriage return will give you the default.
2061
2062 On some of the questions which ask for file or directory names you are allowed
2063 to use the ~name construct to specify the login directory belonging to "name",
2064 even if you don't have a shell which knows about that.  Questions where this is
2065 allowed will be marked "(~name ok)".
2066
2067 EOH
2068         rp=''
2069         dflt='Type carriage return to continue'
2070         . ./myread
2071         cat <<'EOH'
2072
2073 The prompter used in this script allows you to use shell variables and
2074 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2075 in the default answer, as if the default line was a set of arguments given to a
2076 script shell.  This means you may also use $* to repeat the whole default line,
2077 so you do not have to re-type everything to add something to the default.
2078
2079 Everytime there is a substitution, you will have to confirm.  If there is an
2080 error (e.g. an unmatched backtick), the default answer will remain unchanged
2081 and you will be prompted again.
2082
2083 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2084 the questions and use the computed defaults (or the previous answers if there
2085 was already a config.sh file). Type 'Configure -h' for a list of options.
2086 You may also start interactively and then answer '& -d' at any prompt to turn
2087 on the non-interactive behaviour for the remainder of the execution.
2088
2089 EOH
2090         . ./myread
2091         cat <<EOH
2092
2093 Much effort has been expended to ensure that this shell script will run on any
2094 Unix system.  If despite that it blows up on yours, your best bet is to edit
2095 Configure and run it again.  If you can't run Configure for some reason,
2096 you'll have to generate a config.sh file by hand.  Whatever problems you
2097 have, let me (perlbug@perl.org) know how I blew it.
2098
2099 This installation script affects things in two ways:
2100
2101 1) it may do direct variable substitutions on some of the files included
2102    in this kit.
2103 2) it builds a config.h file for inclusion in C programs.  You may edit
2104    any of these files as the need arises after running this script.
2105
2106 If you make a mistake on a question, there is no easy way to back up to it
2107 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2108 files.  Configure will offer to let you do this before it runs the SH files.
2109
2110 EOH
2111         dflt='Type carriage return to continue'
2112         . ./myread
2113         case "$firsttime" in
2114         true) echo $user >>../.config/instruct;;
2115         esac
2116 fi
2117
2118 : find out where common programs are
2119 echo " "
2120 echo "Locating common programs..." >&4
2121 cat <<EOSC >loc
2122 $startsh
2123 case \$# in
2124 0) exit 1;;
2125 esac
2126 thing=\$1
2127 shift
2128 dflt=\$1
2129 shift
2130 for dir in \$*; do
2131         case "\$thing" in
2132         .)
2133         if test -d \$dir/\$thing; then
2134                 echo \$dir
2135                 exit 0
2136         fi
2137         ;;
2138         *)
2139         for thisthing in \$dir/\$thing; do
2140                 : just loop through to pick last item
2141         done
2142         if test -f \$thisthing; then
2143                 echo \$thisthing
2144                 exit 0
2145         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2146                 echo \$thisthing
2147                 exit 0
2148         elif test -f \$dir/\$thing.exe; then
2149                 if test -n "$DJGPP"; then
2150                         echo \$dir/\$thing.exe
2151                 else
2152                         : on Eunice apparently
2153                         echo \$dir/\$thing
2154                 fi
2155                 exit 0
2156         fi
2157         ;;
2158         esac
2159 done
2160 echo \$dflt
2161 exit 1
2162 EOSC
2163 chmod +x loc
2164 $eunicefix loc
2165 loclist="
2166 awk
2167 cat
2168 chmod
2169 comm
2170 cp
2171 echo
2172 expr
2173 grep
2174 ls
2175 mkdir
2176 rm
2177 sed
2178 sort
2179 touch
2180 tr
2181 uniq
2182 "
2183 trylist="
2184 Mcc
2185 ar
2186 bison
2187 byacc
2188 cpp
2189 csh
2190 date
2191 egrep
2192 gmake
2193 gzip
2194 less
2195 ln
2196 make
2197 more
2198 nm
2199 nroff
2200 pg
2201 test
2202 uname
2203 zip
2204 "
2205 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2206 pth="$pth /lib /usr/lib"
2207 for file in $loclist; do
2208         eval xxx=\$$file
2209         case "$xxx" in
2210         /*|?:[\\/]*)
2211                 if test -f "$xxx"; then
2212                         : ok
2213                 else
2214                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2215                         xxx=`./loc $file $file $pth`
2216                 fi
2217                 ;;
2218         '') xxx=`./loc $file $file $pth`;;
2219         *) xxx=`./loc $xxx $xxx $pth`;;
2220         esac
2221         eval $file=$xxx$_exe
2222         eval _$file=$xxx
2223         case "$xxx" in
2224         /*)
2225                 echo $file is in $xxx.
2226                 ;;
2227         ?:[\\/]*)
2228                 echo $file is in $xxx.
2229                 ;;
2230         *)
2231                 echo "I don't know where '$file' is, and my life depends on it." >&4
2232                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2233                 exit 1
2234                 ;;
2235         esac
2236 done
2237 echo " "
2238 echo "Don't worry if any of the following aren't found..."
2239 say=offhand
2240 for file in $trylist; do
2241         eval xxx=\$$file
2242         case "$xxx" in
2243         /*|?:[\\/]*)
2244                 if test -f "$xxx"; then
2245                         : ok
2246                 else
2247                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2248                         xxx=`./loc $file $file $pth`
2249                 fi
2250                 ;;
2251         '') xxx=`./loc $file $file $pth`;;
2252         *) xxx=`./loc $xxx $xxx $pth`;;
2253         esac
2254         eval $file=$xxx$_exe
2255         eval _$file=$xxx
2256         case "$xxx" in
2257         /*)
2258                 echo $file is in $xxx.
2259                 ;;
2260         ?:[\\/]*)
2261                 echo $file is in $xxx.
2262                 ;;
2263         *)
2264                 echo "I don't see $file out there, $say."
2265                 say=either
2266                 ;;
2267         esac
2268 done
2269 case "$egrep" in
2270 egrep)
2271         echo "Substituting grep for egrep."
2272         egrep=$grep
2273         _egrep=$grep
2274         ;;
2275 esac
2276 case "$ln" in
2277 ln)
2278         echo "Substituting cp for ln."
2279         ln=$cp
2280         _ln=$cp
2281         ;;
2282 esac
2283 case "$make" in
2284 make)   
2285         case "$gmake" in
2286         gmake)
2287         echo "I can't find make or gmake, and my life depends on it." >&4
2288         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2289         exit 1
2290         ;;
2291         esac
2292         ;;
2293 esac    
2294 case "$gmake" in
2295 gmake)  ;;
2296 *)      # We can't have osname yet.
2297         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2298                 # Assume that gmake, if found, is definitely GNU make
2299                 # and prefer it over the system make.
2300                 echo "Substituting gmake for make."
2301                 make=$gmake
2302                 _make=$gmake
2303         fi
2304         ;;
2305 esac
2306 case "$test" in
2307 test)
2308         echo "Hopefully test is built into your sh."
2309         ;;
2310 *)
2311         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2312                 echo "Using the test built into your sh."
2313                 test=test
2314                 _test=test
2315         fi
2316         ;;
2317 esac
2318 case "$echo" in
2319 echo)
2320         echo "Hopefully echo is built into your sh."
2321         ;;
2322 '') ;;
2323 *)
2324         echo " "
2325 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2326         $echo $n "hi there$c" >foo1
2327         echo $n "hi there$c" >foo2
2328         if cmp foo1 foo2 >/dev/null 2>&1; then
2329                 echo "They are compatible.  In fact, they may be identical."
2330         else
2331                 case "$n" in
2332                 '-n') n='' c='\c';;
2333                 *) n='-n' c='';;
2334                 esac
2335                 cat <<FOO
2336 They are not compatible!  You are probably running ksh on a non-USG system.
2337 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2338 have echo built in and we may have to run some Bourne shell scripts.  That
2339 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2340
2341 FOO
2342                 $echo $n "The star should be here-->$c"
2343                 $echo "*"
2344         fi
2345         $rm -f foo1 foo2
2346         ;;
2347 esac
2348
2349 cat <<EOS >trygcc
2350 $startsh
2351 EOS
2352 cat <<'EOSC' >>trygcc
2353 case "$cc" in
2354 '') ;;
2355 *)  $rm -f try try.*
2356     $cat >try.c <<EOM
2357 int main(int argc, char *argv[]) {
2358   return 0;
2359 }
2360 EOM
2361     if $cc -o try $ccflags $ldflags try.c; then
2362        :
2363     else
2364         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2365         despair=yes
2366         trygcc=yes
2367         case "$cc" in
2368         *gcc*) trygcc=no ;;
2369         esac
2370         case "`$cc -v -c try.c 2>&1`" in
2371         *gcc*) trygcc=no ;;
2372         esac
2373         if $test X"$trygcc" = Xyes; then
2374             if gcc -o try -c try.c; then
2375                 echo " "
2376                 echo "You seem to have a working gcc, though." >&4
2377                 rp="Would you like to use it?"
2378                 dflt=y
2379                 if $test -f myread; then
2380                     . ./myread
2381                 else
2382                     if $test -f UU/myread; then
2383                         . ./UU/myread
2384                     else
2385                         echo "Cannot find myread, sorry.  Aborting." >&2
2386                         exit 1
2387                     fi
2388                 fi  
2389                 case "$ans" in
2390                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2391                        if $test -f usethreads.cbu; then
2392                            $cat >&4 <<EOM 
2393
2394 *** However, any setting of the C compiler flags (e.g. for thread support)
2395 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2396 *** (together with e.g. -Dusethreads).
2397
2398 EOM
2399                        fi;;
2400                 esac
2401             fi
2402         fi
2403     fi
2404     $rm -f try try.*
2405     ;;
2406 esac
2407 EOSC
2408
2409 cat <<EOS >checkcc
2410 $startsh
2411 EOS
2412 cat <<'EOSC' >>checkcc
2413 case "$cc" in        
2414 '') ;;
2415 *)  $rm -f try try.*              
2416     $cat >try.c <<EOM
2417 int main(int argc, char *argv[]) {
2418   return 0;
2419 }
2420 EOM
2421     if $cc -o try $ccflags $ldflags try.c; then
2422        :
2423     else
2424         if $test X"$despair" = Xyes; then
2425            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2426         fi
2427         $cat >&4 <<EOM         
2428 You need to find a working C compiler.
2429 Either (purchase and) install the C compiler supplied by your OS vendor,
2430 or for a free C compiler try http://gcc.gnu.org/
2431 I cannot continue any further, aborting.
2432 EOM
2433         exit 1
2434     fi
2435     $rm -f try try.*
2436     ;;
2437 esac
2438 EOSC
2439
2440 : determine whether symbolic links are supported
2441 echo " "
2442 $touch blurfl
2443 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2444         echo "Symbolic links are supported." >&4
2445         lns="$ln -s"
2446 else
2447         echo "Symbolic links are NOT supported." >&4
2448         lns="$ln"
2449 fi
2450 $rm -f blurfl sym
2451
2452 : determine whether symbolic links are supported
2453 echo " "
2454 case "$lns" in
2455 *"ln"*" -s")
2456         echo "Checking how to test for symbolic links..." >&4
2457         $lns blurfl sym
2458         if $test "X$issymlink" = X; then
2459                 case "$newsh" in
2460                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2461                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2462                 esac
2463                 if test $? = 0; then
2464                         issymlink="test -h"
2465                 else
2466                         echo "Your builtin 'test -h' may be broken." >&4
2467                         case "$test" in
2468                         /*)     ;;
2469                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2470                                 for p in $pth
2471                                 do
2472                                         if test -f "$p/$test"; then
2473                                                 test="$p/$test"
2474                                                 break
2475                                         fi
2476                                 done
2477                                 ;;
2478                         esac
2479                         case "$test" in
2480                         /*)
2481                                 echo "Trying external '$test -h'." >&4
2482                                 issymlink="$test -h"
2483                                 if $test ! -h sym >/dev/null 2>&1; then
2484                                         echo "External '$test -h' is broken, too." >&4
2485                                         issymlink=''
2486                                 fi
2487                                 ;;
2488                         *)      issymlink='' ;;
2489                         esac
2490                 fi              
2491         fi
2492         if $test "X$issymlink" = X; then
2493                 if $test -L sym 2>/dev/null; then
2494                         issymlink="$test -L"
2495                         echo "The builtin '$test -L' worked." >&4
2496                 fi
2497         fi
2498         if $test "X$issymlink" != X; then
2499                 echo "You can test for symbolic links with '$issymlink'." >&4
2500         else
2501                 echo "I do not know how you can test for symbolic links." >&4
2502         fi
2503         $rm -f blurfl sym
2504         ;;
2505 *)      echo "No symbolic links, so not testing for their testing..." >&4
2506         ;;
2507 esac
2508 echo " "
2509
2510
2511 case "$mksymlinks" in
2512 $define|true|[yY]*)
2513         case "$src" in
2514         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2515                 exit 1
2516                 ;;
2517         *)      case "$lns:$issymlink" in
2518                 *"ln"*" -s:"*"test -"?)
2519                         echo "Creating the symbolic links..." >&4
2520                         echo "(First creating the subdirectories...)" >&4
2521                         cd ..
2522                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2523                                 read directory
2524                                 test -z "$directory" && break
2525                                 mkdir -p $directory
2526                         done
2527                         # Sanity check 1.
2528                         if test ! -d t/base; then
2529                                 echo "Failed to create the subdirectories.  Aborting." >&4
2530                                 exit 1
2531                         fi
2532                         echo "(Then creating the symlinks...)" >&4
2533                         awk '{print $1}' $src/MANIFEST | while true; do
2534                                 read filename
2535                                 test -z "$filename" && break
2536                                 if test -f $filename; then
2537                                         if $issymlink $filename; then
2538                                                 rm -f $filename
2539                                         fi
2540                                 fi
2541                                 if test -f $filename; then
2542                                         echo "$filename already exists, not symlinking."
2543                                 else
2544                                         ln -s $src/$filename $filename
2545                                 fi
2546                         done
2547                         # Sanity check 2.
2548                         if test ! -f t/base/lex.t; then
2549                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2550                                 exit 1
2551                         fi
2552                         cd UU
2553                         ;;
2554                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2555                         ;;
2556                 esac
2557                 ;;
2558         esac
2559         ;;
2560 esac
2561
2562
2563 case "$usecrosscompile" in
2564 $define|true|[yY]*)
2565         $echo "Cross-compiling..."
2566         croak=''
2567         case "$cc" in
2568         *-*-gcc) # A cross-compiling gcc, probably.
2569             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2570             ar=$targetarch-ar
2571             # leave out ld, choosing it is more complex
2572             nm=$targetarch-nm
2573             ranlib=$targetarch-ranlib
2574             $echo 'extern int foo;' > try.c
2575             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2576             shift
2577             if $test $# -gt 0; then
2578                 incpth="$incpth $*"
2579                 incpth="`$echo $incpth|$sed 's/^ //'`"
2580                 echo "Guessing incpth '$incpth'." >&4
2581                 for i in $*; do
2582                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2583                     if $test -d $j; then
2584                         libpth="$libpth $j"
2585                     fi
2586                 done   
2587                 libpth="`$echo $libpth|$sed 's/^ //'`"
2588                 echo "Guessing libpth '$libpth'." >&4
2589             fi
2590             $rm -f try.c
2591             ;;
2592         esac
2593         case "$targetarch" in
2594         '') echo "Targetarch not defined." >&4; croak=y ;;
2595         *)  echo "Using targetarch $targetarch." >&4 ;;
2596         esac
2597         case "$incpth" in
2598         '') echo "Incpth not defined." >&4; croak=y ;;
2599         *)  echo "Using incpth '$incpth'." >&4 ;;
2600         esac
2601         case "$libpth" in
2602         '') echo "Libpth not defined." >&4; croak=y ;;
2603         *)  echo "Using libpth '$libpth'." >&4 ;;
2604         esac
2605         case "$usrinc" in
2606         '') for i in $incpth; do
2607                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2608                     usrinc=$i
2609                     echo "Guessing usrinc $usrinc." >&4
2610                     break
2611                 fi
2612             done
2613             case "$usrinc" in
2614             '') echo "Usrinc not defined." >&4; croak=y ;;
2615             esac
2616             ;;
2617         *)  echo "Using usrinc $usrinc." >&4 ;;
2618         esac
2619         case "$targethost" in
2620         '') echo "Targethost not defined." >&4; croak=y ;;
2621         *)  echo "Using targethost $targethost." >&4
2622         esac
2623         locincpth=' '
2624         loclibpth=' '
2625         case "$croak" in
2626         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2627         esac
2628         case "$src" in
2629         /*) run=$src/Cross/run
2630             targetmkdir=$src/Cross/mkdir
2631             to=$src/Cross/to
2632             from=$src/Cross/from
2633             ;;
2634         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2635             run=$pwd/Cross/run
2636             targetmkdir=$pwd/Cross/mkdir
2637             to=$pwd/Cross/to
2638             from=$pwd/Cross/from
2639             ;;
2640         esac
2641         case "$targetrun" in
2642         '') targetrun=ssh ;;
2643         esac
2644         case "$targetto" in
2645         '') targetto=scp ;;
2646         esac
2647         case "$targetfrom" in
2648         '') targetfrom=scp ;;
2649         esac
2650         run=$run-$targetrun
2651         to=$to-$targetto
2652         from=$from-$targetfrom
2653         case "$targetdir" in
2654         '')  targetdir=/tmp
2655              echo "Guessing targetdir $targetdir." >&4
2656              ;;
2657         esac
2658         case "$targetuser" in
2659         '')  targetuser=root
2660              echo "Guessing targetuser $targetuser." >&4
2661              ;;
2662         esac
2663         case "$targetfrom" in
2664         scp)    q=-q ;;
2665         *)      q='' ;;
2666         esac
2667         case "$targetrun" in
2668         ssh|rsh)
2669             cat >$run <<EOF
2670 #!/bin/sh
2671 case "\$1" in
2672 -cwd)
2673   shift
2674   cwd=\$1
2675   shift
2676   ;;
2677 esac
2678 case "\$cwd" in
2679 '') cwd=$targetdir ;;
2680 esac
2681 exe=\$1
2682 shift
2683 if $test ! -f \$exe.xok; then
2684   $to \$exe
2685   $touch \$exe.xok
2686 fi
2687 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2688 EOF
2689             ;;
2690         *)  echo "Unknown targetrun '$targetrun'" >&4
2691             exit 1
2692             ;;
2693         esac
2694         case "$targetmkdir" in
2695         */Cross/mkdir)
2696             cat >$targetmkdir <<EOF
2697 #!/bin/sh
2698 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2699 EOF
2700             $chmod a+rx $targetmkdir
2701             ;;
2702         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2703             exit 1
2704             ;;
2705         esac
2706         case "$targetto" in
2707         scp|rcp)
2708             cat >$to <<EOF
2709 #!/bin/sh
2710 for f in \$@
2711 do
2712   case "\$f" in
2713   /*)
2714     $targetmkdir \`dirname \$f\`
2715     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2716     ;;
2717   *)
2718     $targetmkdir $targetdir/\`dirname \$f\`
2719     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2720     ;;
2721   esac
2722 done
2723 exit 0
2724 EOF
2725             ;;
2726         cp) cat >$to <<EOF
2727 #!/bin/sh
2728 for f in \$@
2729 do
2730   case "\$f" in
2731   /*)
2732     $mkdir -p $targetdir/\`dirname \$f\`
2733     $cp \$f $targetdir/\$f || exit 1
2734     ;;
2735   *)
2736     $targetmkdir $targetdir/\`dirname \$f\`
2737     $cp \$f $targetdir/\$f || exit 1
2738     ;;
2739   esac
2740 done
2741 exit 0
2742 EOF
2743             ;;
2744         *)  echo "Unknown targetto '$targetto'" >&4
2745             exit 1
2746             ;;
2747         esac
2748         case "$targetfrom" in
2749         scp|rcp)
2750           cat >$from <<EOF
2751 #!/bin/sh
2752 for f in \$@
2753 do
2754   $rm -f \$f
2755   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2756 done
2757 exit 0
2758 EOF
2759             ;;
2760         cp) cat >$from <<EOF
2761 #!/bin/sh
2762 for f in \$@
2763 do
2764   $rm -f \$f
2765   cp $targetdir/\$f . || exit 1
2766 done
2767 exit 0
2768 EOF
2769             ;;
2770         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2771             exit 1
2772             ;;
2773         esac
2774         if $test ! -f $run; then
2775             echo "Target 'run' script '$run' not found." >&4
2776         else
2777             $chmod a+rx $run
2778         fi
2779         if $test ! -f $to; then
2780             echo "Target 'to' script '$to' not found." >&4
2781         else
2782             $chmod a+rx $to
2783         fi
2784         if $test ! -f $from; then
2785             echo "Target 'from' script '$from' not found." >&4
2786         else
2787             $chmod a+rx $from
2788         fi
2789         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2790             exit 1
2791         fi
2792         cat >&4 <<EOF
2793 Using '$run' for remote execution,
2794 and '$from' and '$to'
2795 for remote file transfer.
2796 EOF
2797         ;;
2798 *)      run=''
2799         to=:
2800         from=:
2801         usecrosscompile='undef'
2802         targetarch=''
2803         ;;
2804 esac
2805
2806 : see whether [:lower:] and [:upper:] are supported character classes
2807 echo " "
2808 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2809 ABYZ)
2810         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2811         up='[:upper:]'
2812         low='[:lower:]'
2813         ;;
2814 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2815         # (0xc9 and 0xd1), therefore that is a nice testing point.
2816         if test "X$up" = X -o "X$low" = X; then
2817             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2818             ij) up='[A-Z]'
2819                 low='[a-z]'
2820                 ;;
2821             esac
2822         fi
2823         if test "X$up" = X -o "X$low" = X; then
2824             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2825             ij) up='A-Z'
2826                 low='a-z'
2827                 ;;
2828             esac
2829         fi
2830         if test "X$up" = X -o "X$low" = X; then
2831             case "`echo IJ | od -x 2>/dev/null`" in
2832             *C9D1*|*c9d1*)
2833                 echo "Hey, this might be EBCDIC." >&4
2834                 if test "X$up" = X -o "X$low" = X; then
2835                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2836                     ij) up='[A-IJ-RS-Z]'
2837                         low='[a-ij-rs-z]'
2838                         ;;
2839                     esac
2840                 fi
2841                 if test "X$up" = X -o "X$low" = X; then
2842                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2843                     ij) up='A-IJ-RS-Z'
2844                         low='a-ij-rs-z'
2845                         ;;
2846                     esac
2847                 fi
2848                 ;;
2849             esac
2850         fi
2851 esac
2852 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2853 ij)
2854     echo "Using $up and $low to convert case." >&4
2855     ;;
2856 *)
2857     echo "I don't know how to translate letters from upper to lower case." >&4
2858     echo "Your tr is not acting any way I know of." >&4
2859     exit 1
2860     ;;
2861 esac
2862 : set up the translation script tr, must be called with ./tr of course
2863 cat >tr <<EOSC
2864 $startsh
2865 case "\$1\$2" in
2866 '[A-Z][a-z]') exec $tr '$up' '$low';;
2867 '[a-z][A-Z]') exec $tr '$low' '$up';;
2868 esac
2869 exec $tr "\$@"
2870 EOSC
2871 chmod +x tr
2872 $eunicefix tr
2873
2874 : Try to determine whether config.sh was made on this system
2875 case "$config_sh" in
2876 '')
2877 myuname=`$uname -a 2>/dev/null`
2878 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2879 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2880 # because the A-Z/a-z are not consecutive.
2881 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2882         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2883 newmyuname="$myuname"
2884 dflt=n
2885 case "$knowitall" in
2886 '')
2887         if test -f ../config.sh; then
2888                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2889                         eval "`grep myuname= ../config.sh`"
2890                 fi
2891                 if test "X$myuname" = "X$newmyuname"; then
2892                         dflt=y
2893                 fi
2894         fi
2895         ;;
2896 *) dflt=y;;
2897 esac
2898
2899 : Get old answers from old config file if Configure was run on the
2900 : same system, otherwise use the hints.
2901 hint=default
2902 cd ..
2903 if test -f config.sh; then
2904         echo " "
2905         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2906         . UU/myread
2907         case "$ans" in
2908         n*|N*) echo "OK, I'll ignore it."
2909                 mv config.sh config.sh.old
2910                 myuname="$newmyuname"
2911                 ;;
2912         *)  echo "Fetching default answers from your old config.sh file..." >&4
2913                 tmp_n="$n"
2914                 tmp_c="$c"
2915                 tmp_sh="$sh"
2916                 . ./config.sh
2917                 cp config.sh UU
2918                 n="$tmp_n"
2919                 c="$tmp_c"
2920                 : Older versions did not always set $sh.  Catch re-use of such
2921                 : an old config.sh.
2922                 case "$sh" in
2923                 '') sh="$tmp_sh" ;;
2924                 esac
2925                 hint=previous
2926                 ;;
2927         esac
2928 fi
2929 . ./UU/checkcc
2930 if test ! -f config.sh; then
2931         $cat <<EOM
2932
2933 First time through, eh?  I have some defaults handy for some systems
2934 that need some extra help getting the Configure answers right:
2935
2936 EOM
2937         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2938         dflt=''
2939         : Half the following guesses are probably wrong... If you have better
2940         : tests or hints, please send them to perlbug@perl.org
2941         : The metaconfig authors would also appreciate a copy...
2942         $test -f /irix && osname=irix
2943         $test -f /xenix && osname=sco_xenix
2944         $test -f /dynix && osname=dynix
2945         $test -f /dnix && osname=dnix
2946         $test -f /lynx.os && osname=lynxos
2947         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2948         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2949         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2950         $test -f /bin/mips && /bin/mips && osname=mips
2951         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2952                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2953         $test -d /usr/apollo/bin && osname=apollo
2954         $test -f /etc/saf/_sactab && osname=svr4
2955         $test -d /usr/include/minix && osname=minix
2956         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2957         if $test -d /MachTen -o -d /MachTen_Folder; then
2958                 osname=machten
2959                 if $test -x /sbin/version; then
2960                         osvers=`/sbin/version | $awk '{print $2}' |
2961                         $sed -e 's/[A-Za-z]$//'`
2962                 elif $test -x /usr/etc/version; then
2963                         osvers=`/usr/etc/version | $awk '{print $2}' |
2964                         $sed -e 's/[A-Za-z]$//'`
2965                 else
2966                         osvers="$2.$3"
2967                 fi
2968         fi
2969
2970         $test -f /sys/posix.dll &&
2971                 $test -f /usr/bin/what &&
2972                 set X `/usr/bin/what /sys/posix.dll` &&
2973                 $test "$3" = UWIN &&
2974                 osname=uwin &&
2975                 osvers="$5"
2976
2977         if $test -f $uname; then
2978                 set X $myuname
2979                 shift
2980
2981                 case "$5" in
2982                 fps*) osname=fps ;;
2983                 mips*)
2984                         case "$4" in
2985                         umips) osname=umips ;;
2986                         *) osname=mips ;;
2987                         esac;;
2988                 [23]100) osname=mips ;;
2989                 next*) osname=next ;;
2990                 i386*)
2991                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2992                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2993                                 osname='sco'
2994                                 osvers=$tmp
2995                         elif $test -f /etc/kconfig; then
2996                                 osname=isc
2997                                 if test "$lns" = "$ln -s"; then
2998                                         osvers=4
2999                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3000                                         osvers=3
3001                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3002                                         osvers=2
3003                                 fi
3004                         fi
3005                         tmp=''
3006                         ;;
3007                 pc*)
3008                         if test -n "$DJGPP"; then
3009                                 osname=dos
3010                                 osvers=djgpp
3011                         fi
3012                         ;;
3013                 esac
3014
3015                 case "$1" in
3016                 aix) osname=aix
3017                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3018                         case "$tmp" in
3019                         'not found') osvers="$4"."$3" ;;
3020                         '<3240'|'<>3240') osvers=3.2.0 ;;
3021                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3022                         '=3250'|'>3250') osvers=3.2.5 ;;
3023                         *) osvers=$tmp;;
3024                         esac
3025                         ;;
3026                 bsd386) osname=bsd386
3027                         osvers=`$uname -r`
3028                         ;;
3029                 cygwin*) osname=cygwin
3030                         osvers="$3"
3031                         ;;
3032                 *dc.osx) osname=dcosx
3033                         osvers="$3"
3034                         ;;
3035                 dnix) osname=dnix
3036                         osvers="$3"
3037                         ;;
3038                 domainos) osname=apollo
3039                         osvers="$3"
3040                         ;;
3041                 dgux) osname=dgux 
3042                         osvers="$3"
3043                         ;;
3044                 dynixptx*) osname=dynixptx
3045                         osvers=`echo "$4"|sed 's/^v//'`
3046                         ;;
3047                 freebsd) osname=freebsd 
3048                         osvers="$3" ;;
3049                 genix) osname=genix ;;
3050                 hp*) osname=hpux 
3051                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3052                         ;;
3053                 irix*) osname=irix
3054                         case "$3" in
3055                         4*) osvers=4 ;;
3056                         5*) osvers=5 ;;
3057                         *)      osvers="$3" ;;
3058                         esac
3059                         ;;
3060                 linux) osname=linux
3061                         case "$3" in
3062                         *)      osvers="$3" ;;
3063                         esac
3064                         ;;
3065                 MiNT) osname=mint
3066                         ;;
3067                 netbsd*) osname=netbsd
3068                         osvers="$3"
3069                         ;;
3070                 news-os) osvers="$3"
3071                         case "$3" in
3072                         4*) osname=newsos4 ;;
3073                         *) osname=newsos ;;
3074                         esac
3075                         ;;
3076                 next*) osname=next ;;
3077                 nonstop-ux) osname=nonstopux ;;
3078                 POSIX-BC | posix-bc ) osname=posix-bc
3079                         osvers="$3"
3080                         ;;
3081                 powerux | power_ux | powermax_os | powermaxos | \
3082                 powerunix | power_unix) osname=powerux
3083                         osvers="$3"
3084                         ;;
3085                 qnx) osname=qnx
3086                         osvers="$4"
3087                         ;;
3088                 solaris) osname=solaris
3089                         case "$3" in
3090                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3091                         *)      osvers="$3" ;;
3092                         esac
3093                         ;;
3094                 sunos) osname=sunos
3095                         case "$3" in
3096                         5*) osname=solaris
3097                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3098                         *)      osvers="$3" ;;
3099                         esac
3100                         ;;
3101                 titanos) osname=titanos
3102                         case "$3" in
3103                         1*) osvers=1 ;;
3104                         2*) osvers=2 ;;
3105                         3*) osvers=3 ;;
3106                         4*) osvers=4 ;;
3107                         *)      osvers="$3" ;;
3108                         esac
3109                         ;;
3110                 ultrix) osname=ultrix
3111                         osvers="$3"
3112                         ;;
3113                 osf1|mls+)      case "$5" in
3114                                 alpha)
3115                                         osname=dec_osf
3116                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3117                                         case "$osvers" in
3118                                         [1-9].[0-9]*) ;;
3119                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3120                                         esac
3121                                         ;;
3122                         hp*)    osname=hp_osf1  ;;
3123                         mips)   osname=mips_osf1 ;;
3124                         esac
3125                         ;;
3126                 unixware) osname=svr5
3127                         osvers="$4"
3128                         ;;
3129                 uts)    osname=uts
3130                         osvers="$3"
3131                         ;;
3132                 vos) osvers="$3"
3133                         ;;
3134                 $2) case "$osname" in
3135                         *isc*) ;;
3136                         *freebsd*) ;;
3137                         svr*)
3138                                 : svr4.x or possibly later
3139                                 case "svr$3" in 
3140                                 ${osname}*)
3141                                         osname=svr$3
3142                                         osvers=$4
3143                                         ;;
3144                                 esac
3145                                 case "$osname" in
3146                                 svr4.0)
3147                                         : Check for ESIX
3148                                         if test -f /stand/boot ; then
3149                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3150                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3151                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3152                                                         if test -n "$isesix"; then
3153                                                                 osname=esix4
3154                                                         fi
3155                                                 fi
3156                                         fi
3157                                         ;;
3158                                 esac
3159                                 ;;
3160                         *)      if test -f /etc/systemid; then
3161                                         osname=sco
3162                                         set `echo $3 | $sed 's/\./ /g'` $4
3163                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3164                                                 osvers=$1.$2.$3
3165                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3166                                                 osvers=$1.$2
3167                                         elif $test -f $src/hints/sco_$1.sh; then
3168                                                 osvers=$1
3169                                         fi
3170                                 else
3171                                         case "$osname" in
3172                                         '') : Still unknown.  Probably a generic Sys V.
3173                                                 osname="sysv"
3174                                                 osvers="$3"
3175                                                 ;;
3176                                         esac
3177                                 fi
3178                                 ;;
3179                         esac
3180                         ;;
3181                 *)      case "$osname" in
3182                         '') : Still unknown.  Probably a generic BSD.
3183                                 osname="$1"
3184                                 osvers="$3"
3185                                 ;;
3186                         esac
3187                         ;;
3188                 esac
3189         else
3190                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3191                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3192                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3193                                 osname=news_os
3194                         fi
3195                         $rm -f UU/kernel.what
3196                 elif test -d c:/.; then
3197                         set X $myuname
3198                         osname=os2
3199                         osvers="$5"
3200                 fi
3201         fi
3202         
3203         case "$targetarch" in
3204         '') ;;
3205         *)  hostarch=$osname
3206             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3207             osvers=''
3208             ;;
3209         esac
3210
3211         : Now look for a hint file osname_osvers, unless one has been
3212         : specified already.
3213         case "$hintfile" in
3214         ''|' ')
3215                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3216                 : Also try without trailing minor version numbers.
3217                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3218                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3219                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3220                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3221                 case "$file" in
3222                 '') dflt=none ;;
3223                 *)  case "$osvers" in
3224                         '') dflt=$file
3225                                 ;;
3226                         *)  if $test -f $src/hints/$file.sh ; then
3227                                         dflt=$file
3228                                 elif $test -f $src/hints/$xfile.sh ; then
3229                                         dflt=$xfile
3230                                 elif $test -f $src/hints/$xxfile.sh ; then
3231                                         dflt=$xxfile
3232                                 elif $test -f $src/hints/$xxxfile.sh ; then
3233                                         dflt=$xxxfile
3234                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3235                                         dflt=$xxxxfile
3236                                 elif $test -f "$src/hints/${osname}.sh" ; then
3237                                         dflt="${osname}"
3238                                 else
3239                                         dflt=none
3240                                 fi
3241                                 ;;
3242                         esac
3243                         ;;
3244                 esac
3245                 if $test -f Policy.sh ; then
3246                         case "$dflt" in
3247                         *Policy*) ;;
3248                         none) dflt="Policy" ;;
3249                         *) dflt="Policy $dflt" ;;
3250                         esac
3251                 fi
3252                 ;;
3253         *)
3254                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3255                 ;;
3256         esac
3257
3258         if $test -f Policy.sh ; then
3259                 $cat <<EOM
3260
3261 There's also a Policy hint file available, which should make the
3262 site-specific (policy) questions easier to answer.
3263 EOM
3264
3265         fi
3266
3267         $cat <<EOM
3268
3269 You may give one or more space-separated answers, or "none" if appropriate.
3270 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3271 is a good thing.  DO NOT give a wrong version or a wrong OS.
3272
3273 EOM
3274
3275         rp="Which of these apply, if any?"
3276         . UU/myread
3277         tans=$ans
3278         for file in $tans; do
3279                 if $test X$file = XPolicy -a -f Policy.sh; then
3280                         . Policy.sh
3281                         $cat Policy.sh >> UU/config.sh
3282                 elif $test -f $src/hints/$file.sh; then
3283                         . $src/hints/$file.sh
3284                         $cat $src/hints/$file.sh >> UU/config.sh
3285                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3286                         : nothing
3287                 else
3288                         : Give one chance to correct a possible typo.
3289                         echo "$file.sh does not exist"
3290                         dflt=$file
3291                         rp="hint to use instead?"
3292                         . UU/myread
3293                         for file in $ans; do
3294                                 if $test -f "$src/hints/$file.sh"; then
3295                                         . $src/hints/$file.sh
3296                                         $cat $src/hints/$file.sh >> UU/config.sh
3297                                 elif $test X$ans = X -o X$ans = Xnone ; then
3298                                         : nothing
3299                                 else
3300                                         echo "$file.sh does not exist -- ignored."
3301                                 fi
3302                         done
3303                 fi
3304         done
3305
3306         hint=recommended
3307         : Remember our hint file for later.
3308         if $test -f "$src/hints/$file.sh" ; then
3309                 hintfile="$file"
3310         else
3311                 hintfile=''
3312         fi
3313 fi
3314 cd UU
3315 ;;
3316 *)
3317         echo " "
3318         echo "Fetching default answers from $config_sh..." >&4
3319         tmp_n="$n"
3320         tmp_c="$c"
3321         cd ..
3322         cp $config_sh config.sh 2>/dev/null
3323         chmod +w config.sh
3324         . ./config.sh
3325         cd UU
3326         cp ../config.sh .
3327         n="$tmp_n"
3328         c="$tmp_c"
3329         hint=previous
3330         ;;
3331 esac
3332 test "$override" && . ./optdef.sh
3333
3334 : Restore computed paths
3335 for file in $loclist $trylist; do
3336         eval $file="\$_$file"
3337 done
3338
3339 cat << EOM
3340
3341 Configure uses the operating system name and version to set some defaults.
3342 The default value is probably right if the name rings a bell. Otherwise,
3343 since spelling matters for me, either accept the default or answer "none"
3344 to leave it blank.
3345
3346 EOM
3347 case "$osname" in
3348         ''|' ')
3349                 case "$hintfile" in
3350                 ''|' '|none) dflt=none ;;
3351                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3352                 esac
3353                 ;;
3354         *) dflt="$osname" ;;
3355 esac
3356 rp="Operating system name?"
3357 . ./myread
3358 case "$ans" in
3359 none)  osname='' ;;
3360 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3361 esac
3362 echo " "
3363 case "$osvers" in
3364         ''|' ')
3365                 case "$hintfile" in
3366                 ''|' '|none) dflt=none ;;
3367                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3368                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3369                         case "$dflt" in
3370                         ''|' ') dflt=none ;;
3371                         esac
3372                         ;;
3373                 esac
3374                 ;;
3375         *) dflt="$osvers" ;;
3376 esac
3377 rp="Operating system version?"
3378 . ./myread
3379 case "$ans" in
3380 none)  osvers='' ;;
3381 *) osvers="$ans" ;;
3382 esac
3383
3384
3385 . ./posthint.sh
3386
3387 : who configured the system
3388 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3389 cf_by=`(logname) 2>/dev/null`
3390 case "$cf_by" in
3391 "")
3392         cf_by=`(whoami) 2>/dev/null`
3393         case "$cf_by" in
3394         "") cf_by=unknown ;;
3395         esac ;;
3396 esac
3397
3398 : set up the script used to warn in case of inconsistency
3399 cat <<EOS >whoa
3400 $startsh
3401 EOS
3402 cat <<'EOSC' >>whoa
3403 dflt=y
3404 echo " "
3405 echo "*** WHOA THERE!!! ***" >&4
3406 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3407 rp="    Keep the $hint value?"
3408 . ./myread
3409 case "$ans" in
3410 y) td=$was; tu=$was;;
3411 esac
3412 EOSC
3413
3414 : function used to set $1 to $val
3415 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3416 case "$val$was" in
3417 $define$undef) . ./whoa; eval "$var=\$td";;
3418 $undef$define) . ./whoa; eval "$var=\$tu";;
3419 *) eval "$var=$val";;
3420 esac'
3421
3422 case "$usethreads" in
3423 $define|true|[yY]*)     dflt='y';;
3424 *)     # Catch case where user specified ithreads or 5005threads but
3425        # forgot -Dusethreads (A.D. 4/2002)
3426        case "$useithreads$use5005threads" in
3427        *$define*)      dflt='y' ;;
3428        *)      dflt='n';;
3429        esac
3430        ;;
3431 esac
3432 cat <<EOM
3433
3434 Perl can be built to take advantage of threads on some systems.
3435 To do so, Configure can be run with -Dusethreads.
3436
3437 Note that threading is a highly experimental feature, and
3438 some known race conditions still remain.  If you choose to try
3439 it, be very sure to not actually deploy it for production
3440 purposes.  README.threads has more details, and is required
3441 reading if you enable threads.
3442
3443 If this doesn't make any sense to you, just accept the default '$dflt'.
3444 EOM
3445 rp='Build a threading Perl?'
3446 . ./myread
3447 case "$ans" in
3448 y|Y)    val="$define" ;;
3449 *)      val="$undef" ;;
3450 esac
3451 set usethreads
3452 eval $setvar
3453
3454 case "$usethreads" in
3455 $define)
3456         $cat <<EOM
3457
3458 As of release 5.6, Perl has two different threading implementations,
3459 an interpreter-based version (ithreads) with one interpreter per
3460 thread, and the 5.005 version (5005threads).  Both implementations
3461 are considered experimental, but since 5.8 ithreads somewhat less so.
3462 The 5005threads is effectively unmaintained.
3463
3464 EOM
3465         : Default to ithreads unless overridden on command line or with
3466         : old config.sh
3467         dflt='y'
3468         case "$use5005threads" in
3469                 $define|true|[yY]*) dflt='n';;
3470         esac
3471         case "$useithreads" in
3472                 $undef|false|[nN]*) dflt='n';;
3473         esac
3474         rp='Use interpreter-based ithreads?'
3475         . ./myread
3476         case "$ans" in
3477         y|Y)    val="$define" ;;
3478         *)      val="$undef" ;;
3479         esac
3480         set useithreads
3481         eval $setvar
3482         : Now set use5005threads to the opposite value.
3483         case "$useithreads" in
3484         $define) val="$undef" ;;
3485         *) val="$define" ;;
3486         esac
3487         set use5005threads
3488         eval $setvar
3489         ;;
3490 *)
3491         useithreads="$undef"
3492         use5005threads="$undef"
3493         ;;
3494 esac
3495
3496 case "$useithreads$use5005threads" in
3497 "$define$define")
3498         $cat >&4 <<EOM
3499
3500 You cannot have both the ithreads and the 5.005 threads enabled
3501 at the same time.  Disabling the 5.005 threads since they are
3502 much less stable than the ithreads.
3503
3504 EOM
3505         use5005threads="$undef"
3506         ;;
3507 esac
3508
3509 case "$d_oldpthreads" in
3510 '')     : Configure tests would be welcome here.  For now, assume undef.
3511         val="$undef" ;;
3512 *)      val="$d_oldpthreads" ;;
3513 esac
3514 set d_oldpthreads
3515 eval $setvar
3516
3517
3518 case "$usethreads" in
3519 "$define"|true|[yY]*)
3520 : Look for a hint-file generated 'call-back-unit'.  If the
3521 : user has specified that a threading perl is to be built,
3522 : we may need to set or change some other defaults.
3523         if $test -f usethreads.cbu; then
3524                 echo "Your platform has some specific hints for threaded builds, using them..."
3525                 . ./usethreads.cbu
3526         else
3527                 $cat <<EOM
3528 (Your platform doesn't have any specific hints for threaded builds.
3529  Assuming POSIX threads, then.)
3530 EOM
3531         fi
3532         ;;
3533 esac
3534
3535 cat <<EOM
3536
3537 Perl can be built so that multiple Perl interpreters can coexist
3538 within the same Perl executable.
3539 EOM
3540
3541 case "$useithreads" in
3542 $define)
3543         cat <<EOM
3544 This multiple interpreter support is required for interpreter-based threads.
3545 EOM
3546         val="$define"
3547         ;;
3548 *)      case "$usemultiplicity" in
3549         $define|true|[yY]*)     dflt='y';;
3550         *) dflt='n';;
3551         esac
3552         echo " "
3553         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3554         rp='Build Perl for multiplicity?'
3555         . ./myread
3556         case "$ans" in
3557         y|Y)    val="$define" ;;
3558         *)      val="$undef" ;;
3559         esac
3560         ;;
3561 esac
3562 set usemultiplicity
3563 eval $setvar
3564
3565
3566 case "$usemorebits" in
3567 "$define"|true|[yY]*)
3568         use64bitint="$define"
3569         uselongdouble="$define"
3570         usemorebits="$define"
3571         ;;
3572 *)      usemorebits="$undef"
3573         ;;
3574 esac
3575
3576 : make some quick guesses about what we are up against
3577 echo " "
3578 $echo $n "Hmm...  $c"
3579 echo exit 1 >bsd
3580 echo exit 1 >usg
3581 echo exit 1 >v7
3582 echo exit 1 >osf1
3583 echo exit 1 >eunice
3584 echo exit 1 >xenix
3585 echo exit 1 >venix
3586 echo exit 1 >os2
3587 d_bsd="$undef"
3588 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3589 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3590 then
3591         echo "Looks kind of like an OSF/1 system, but we'll see..."
3592         echo exit 0 >osf1
3593 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3594         xxx=`./loc addbib blurfl $pth`
3595         if $test -f $xxx; then
3596         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3597                 echo exit 0 >bsd
3598                 echo exit 0 >usg
3599         else
3600                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3601                         echo "Looks kind of like an extended USG system, but we'll see..."
3602                 else
3603                         echo "Looks kind of like a USG system, but we'll see..."
3604                 fi
3605                 echo exit 0 >usg
3606         fi
3607 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3608         echo "Looks kind of like a BSD system, but we'll see..."
3609         d_bsd="$define"
3610         echo exit 0 >bsd
3611 else
3612         echo "Looks kind of like a Version 7 system, but we'll see..."
3613         echo exit 0 >v7
3614 fi
3615 case "$eunicefix" in
3616 *unixtovms*)
3617         $cat <<'EOI'
3618 There is, however, a strange, musty smell in the air that reminds me of
3619 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3620 EOI
3621         echo exit 0 >eunice
3622         d_eunice="$define"
3623 : it so happens the Eunice I know will not run shell scripts in Unix format
3624         ;;
3625 *)
3626         echo " "
3627         echo "Congratulations.  You aren't running Eunice."
3628         d_eunice="$undef"
3629         ;;
3630 esac
3631 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3632 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3633 : semicolon as a patch separator
3634 case "$p_" in
3635 :) ;;
3636 *)
3637         $cat <<'EOI'
3638 I have the feeling something is not exactly right, however...don't tell me...
3639 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3640 (Or you may be running DOS with DJGPP.)
3641 EOI
3642         echo exit 0 >os2
3643         ;;
3644 esac
3645 if test -f /xenix; then
3646         echo "Actually, this looks more like a XENIX system..."
3647         echo exit 0 >xenix
3648         d_xenix="$define"
3649 else
3650         echo " "
3651         echo "It's not Xenix..."
3652         d_xenix="$undef"
3653 fi
3654 chmod +x xenix
3655 $eunicefix xenix
3656 if test -f /venix; then
3657         echo "Actually, this looks more like a VENIX system..."
3658         echo exit 0 >venix
3659 else
3660         echo " "
3661         if ./xenix; then
3662                 : null
3663         else
3664                 echo "Nor is it Venix..."
3665         fi
3666 fi
3667 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3668 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3669 $rm -f foo
3670
3671 case "$cc" in
3672 '') dflt=cc;;
3673 *) dflt="$cc";;
3674 esac
3675 rp="Use which C compiler?"
3676 . ./myread
3677 cc="$ans"
3678
3679 : See if they have not cc but they do have gcc
3680 . ./trygcc
3681 : Look for a hint-file generated 'call-back-unit'.  Now that the
3682 : user has specified the compiler, we may need to set or change some
3683 : other defaults.
3684 if $test -f cc.cbu; then
3685     . ./cc.cbu
3686 fi
3687 . ./checkcc
3688
3689 echo " "
3690 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3691 $cat >try.c <<EOM
3692 #include <stdio.h>
3693 int main() {
3694 #ifdef __GNUC__
3695 #ifdef __VERSION__
3696         printf("%s\n", __VERSION__);
3697 #else
3698         printf("%s\n", "1");
3699 #endif
3700 #endif
3701         exit(0);
3702 }
3703 EOM
3704 if $cc -o try $ccflags $ldflags try.c; then
3705         gccversion=`$run ./try`
3706         case "$gccversion" in
3707         '') echo "You are not using GNU cc." ;;
3708         *)  echo "You are using GNU cc $gccversion."
3709             ccname=gcc  
3710             ;;
3711         esac
3712 else
3713         echo " "
3714         echo "*** WHOA THERE!!! ***" >&4
3715         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3716         case "$knowitall" in
3717         '')
3718         echo "    You'd better start hunting for one and let me know about it." >&4
3719                 exit 1
3720                 ;;
3721         esac
3722 fi
3723 $rm -f try try.*
3724 case "$gccversion" in
3725 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3726 esac
3727 case "$gccversion" in
3728 '') gccosandvers='' ;;
3729 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3730    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3731    gccshortvers=''
3732    case "$gccosandvers" in
3733    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3734    $osname$osvers) ;; # looking good
3735    $osname*) cat <<EOM >&4
3736
3737 *** WHOA THERE!!! ***
3738
3739     Your gcc has not been compiled for the exact release of
3740     your operating system ($gccosandvers versus $osname$osvers).
3741
3742     In general it is a good idea to keep gcc synchronized with
3743     the operating system because otherwise serious problems
3744     may ensue when trying to compile software, like Perl.
3745
3746     I'm trying to be optimistic here, though, and will continue.
3747     If later during the configuration and build icky compilation
3748     problems appear (headerfile conflicts being the most common
3749     manifestation), I suggest reinstalling the gcc to match
3750     your operating system release.
3751
3752 EOM
3753       ;;
3754    *) gccosandvers='' ;; # failed to parse, better be silent
3755    esac
3756    ;;
3757 esac
3758 case "$ccname" in
3759 '') ccname="$cc" ;;
3760 esac
3761
3762
3763 : decide how portable to be.  Allow command line overrides.
3764 case "$d_portable" in
3765 "$undef") ;;
3766 *)      d_portable="$define" ;;
3767 esac
3768
3769 : set up shell script to do ~ expansion
3770 cat >filexp <<EOSS
3771 $startsh
3772 : expand filename
3773 case "\$1" in
3774  ~/*|~)
3775         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3776         ;;
3777  ~*)
3778         if $test -f /bin/csh; then
3779                 /bin/csh -f -c "glob \$1"
3780                 failed=\$?
3781                 echo ""
3782                 exit \$failed
3783         else
3784                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3785                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3786                 if $test ! -d "\$dir"; then
3787                         me=\`basename \$0\`
3788                         echo "\$me: can't locate home directory for: \$name" >&2
3789                         exit 1
3790                 fi
3791                 case "\$1" in
3792                 */*)
3793                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3794                         ;;
3795                 *)
3796                         echo \$dir
3797                         ;;
3798                 esac
3799         fi
3800         ;;
3801 *)
3802         echo \$1
3803         ;;
3804 esac
3805 EOSS
3806 chmod +x filexp
3807 $eunicefix filexp
3808
3809 : now set up to get a file name
3810 cat <<EOS >getfile
3811 $startsh
3812 EOS
3813 cat <<'EOSC' >>getfile
3814 tilde=''
3815 fullpath=''
3816 already=''
3817 skip=''
3818 none_ok=''
3819 exp_file=''
3820 nopath_ok=''
3821 orig_rp="$rp"
3822 orig_dflt="$dflt"
3823 case "$gfpth" in
3824 '') gfpth='.' ;;
3825 esac
3826
3827 case "$fn" in
3828 *\(*)
3829         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3830         fn=`echo $fn | sed 's/(.*)//'`
3831         ;;
3832 esac
3833
3834 case "$fn" in
3835 *:*)
3836         loc_file=`expr $fn : '.*:\(.*\)'`
3837         fn=`expr $fn : '\(.*\):.*'`
3838         ;;
3839 esac
3840
3841 case "$fn" in
3842 *~*) tilde=true;;
3843 esac
3844 case "$fn" in
3845 */*) fullpath=true;;
3846 esac
3847 case "$fn" in
3848 *+*) skip=true;;
3849 esac
3850 case "$fn" in
3851 *n*) none_ok=true;;
3852 esac
3853 case "$fn" in
3854 *e*) exp_file=true;;
3855 esac
3856 case "$fn" in
3857 *p*) nopath_ok=true;;
3858 esac
3859
3860 case "$fn" in
3861 *f*) type='File';;
3862 *d*) type='Directory';;
3863 *l*) type='Locate';;
3864 esac
3865
3866 what="$type"
3867 case "$what" in
3868 Locate) what='File';;
3869 esac
3870
3871 case "$exp_file" in
3872 '')
3873         case "$d_portable" in
3874         "$define") ;;
3875         *) exp_file=true;;
3876         esac
3877         ;;
3878 esac
3879
3880 cd ..
3881 while test "$type"; do
3882         redo=''
3883         rp="$orig_rp"
3884         dflt="$orig_dflt"
3885         case "$tilde" in
3886         true) rp="$rp (~name ok)";;
3887         esac
3888         . UU/myread
3889         if test -f UU/getfile.ok && \
3890                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3891         then
3892                 value="$ans"
3893                 ansexp="$ans"
3894                 break
3895         fi
3896         case "$ans" in
3897         none)
3898                 value=''
3899                 ansexp=''
3900                 case "$none_ok" in
3901                 true) type='';;
3902                 esac
3903                 ;;
3904         *)
3905                 case "$tilde" in
3906                 '') value="$ans"
3907                         ansexp="$ans";;
3908                 *)
3909                         value=`UU/filexp $ans`
3910                         case $? in
3911                         0)
3912                                 if test "$ans" != "$value"; then
3913                                         echo "(That expands to $value on this system.)"
3914                                 fi
3915                                 ;;
3916                         *) value="$ans";;
3917                         esac
3918                         ansexp="$value"
3919                         case "$exp_file" in
3920                         '') value="$ans";;
3921                         esac
3922                         ;;
3923                 esac
3924                 case "$fullpath" in
3925                 true)
3926                         case "$ansexp" in
3927                         /*) value="$ansexp" ;;
3928                         [a-zA-Z]:/*) value="$ansexp" ;;
3929                         *)
3930                                 redo=true
3931                                 case "$already" in
3932                                 true)
3933                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3934                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3935                                         ;;
3936                                 *)
3937                                 echo "Please give a full path name, starting with slash." >&4
3938                                         case "$tilde" in
3939                                         true)
3940                                 echo "Note that using ~name is ok provided it expands well." >&4
3941                                                 already=true
3942                                                 ;;
3943                                         esac
3944                                 esac
3945                                 ;;
3946                         esac
3947                         ;;
3948                 esac
3949                 case "$redo" in
3950                 '')
3951                         case "$type" in
3952                         File)
3953                                 for fp in $gfpth; do
3954                                         if test "X$fp" = X.; then
3955                                             pf="$ansexp"
3956                                         else    
3957                                             pf="$fp/$ansexp"
3958                                         fi
3959                                         if test -f "$pf"; then
3960                                                 type=''
3961                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3962                                         then
3963                                                 echo "($value is not a plain file, but that's ok.)"
3964                                                 type=''
3965                                         fi
3966                                         if test X"$type" = X; then
3967                                             value="$pf"
3968                                             break
3969                                         fi
3970                                 done
3971                                 ;;
3972                         Directory)
3973                                 for fp in $gfpth; do
3974                                         if test "X$fp" = X.; then
3975                                             dir="$ans"
3976                                             direxp="$ansexp"
3977                                         else    
3978                                             dir="$fp/$ansexp"
3979                                             direxp="$fp/$ansexp"
3980                                         fi
3981                                         if test -d "$direxp"; then
3982                                                 type=''
3983                                                 value="$dir"
3984                                                 break
3985                                         fi
3986                                 done
3987                                 ;;
3988                         Locate)
3989                                 if test -d "$ansexp"; then
3990                                         echo "(Looking for $loc_file in directory $value.)"
3991                                         value="$value/$loc_file"
3992                                         ansexp="$ansexp/$loc_file"
3993                                 fi
3994                                 if test -f "$ansexp"; then
3995                                         type=''
3996                                 fi
3997                                 case "$nopath_ok" in
3998                                 true)   case "$value" in
3999                                         */*) ;;
4000                                         *)      echo "Assuming $value will be in people's path."
4001                                                 type=''
4002                                                 ;;
4003                                         esac
4004                                         ;;
4005                                 esac
4006                                 ;;
4007                         esac
4008
4009                         case "$skip" in
4010                         true) type='';
4011                         esac
4012
4013                         case "$type" in
4014                         '') ;;
4015                         *)
4016                                 if test "$fastread" = yes; then
4017                                         dflt=y
4018                                 else
4019                                         dflt=n
4020                                 fi
4021                                 rp="$what $value doesn't exist.  Use that name anyway?"
4022                                 . UU/myread
4023                                 dflt=''
4024                                 case "$ans" in
4025                                 y*) type='';;
4026                                 *) echo " ";;
4027                                 esac
4028                                 ;;
4029                         esac
4030                         ;;
4031                 esac
4032                 ;;
4033         esac
4034 done
4035 cd UU
4036 ans="$value"
4037 rp="$orig_rp"
4038 dflt="$orig_dflt"
4039 rm -f getfile.ok
4040 test "X$gfpthkeep" != Xy && gfpth=""
4041 EOSC
4042
4043 : What should the include directory be ?
4044 echo " "
4045 $echo $n "Hmm...  $c"
4046 dflt='/usr/include'
4047 incpath=''
4048 mips_type=''
4049 if $test -f /bin/mips && /bin/mips; then
4050         echo "Looks like a MIPS system..."
4051         $cat >usr.c <<'EOCP'
4052 #ifdef SYSTYPE_BSD43
4053 /bsd43
4054 #endif
4055 EOCP
4056         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4057                 dflt='/bsd43/usr/include'
4058                 incpath='/bsd43'
4059                 mips_type='BSD 4.3'
4060         else
4061                 mips_type='System V'
4062         fi
4063         $rm -f usr.c usr.out
4064         echo "and you're compiling with the $mips_type compiler and libraries."
4065         xxx_prompt=y
4066         echo "exit 0" >mips
4067 else
4068         echo "Doesn't look like a MIPS system."
4069         xxx_prompt=n
4070         echo "exit 1" >mips
4071 fi
4072 chmod +x mips
4073 $eunicefix mips
4074 case "$usrinc" in
4075 '') ;;
4076 *) dflt="$usrinc";;
4077 esac
4078 case "$xxx_prompt" in
4079 y)      fn=d/
4080         echo " "
4081         rp='Where are the include files you want to use?'
4082         . ./getfile
4083         usrinc="$ans"
4084         ;;
4085 *)      usrinc="$dflt"
4086         ;;
4087 esac
4088
4089 : see how we invoke the C preprocessor
4090 echo " "
4091 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4092 cat <<'EOT' >testcpp.c
4093 #define ABC abc
4094 #define XYZ xyz
4095 ABC.XYZ
4096 EOT
4097 cd ..
4098 if test ! -f cppstdin; then
4099         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4100                 # AIX cc -E doesn't show the absolute headerfile
4101                 # locations but we'll cheat by using the -M flag.
4102                 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
4103         else
4104                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4105         fi
4106 else
4107         echo "Keeping your $hint cppstdin wrapper."
4108 fi
4109 chmod 755 cppstdin
4110 wrapper=`pwd`/cppstdin
4111 ok='false'
4112 cd UU
4113
4114 if $test "X$cppstdin" != "X" && \
4115         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4116         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4117 then
4118         echo "You used to use $cppstdin $cppminus so we'll use that again."
4119         case "$cpprun" in
4120         '') echo "But let's see if we can live without a wrapper..." ;;
4121         *)
4122                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4123                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4124                 then
4125                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4126                         ok='true'
4127                 else
4128                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4129                 fi
4130                 ;;
4131         esac
4132 else
4133         case "$cppstdin" in
4134         '') ;;
4135         *)
4136                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4137                 ;;
4138         esac
4139 fi
4140
4141 if $ok; then
4142         : nothing
4143 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4144         $cc -E <testcpp.c >testcpp.out 2>&1; \
4145         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4146         echo "Yup, it does."
4147         x_cpp="$cc -E"
4148         x_minus='';
4149 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4150         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4151         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4152         echo "Yup, it does."
4153         x_cpp="$cc -E"
4154         x_minus='-';
4155 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4156         $cc -P <testcpp.c >testcpp.out 2>&1; \
4157         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4158         echo "Yipee, that works!"
4159         x_cpp="$cc -P"
4160         x_minus='';
4161 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4162         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4163         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4164         echo "At long last!"
4165         x_cpp="$cc -P"
4166         x_minus='-';
4167 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4168         $cpp <testcpp.c >testcpp.out 2>&1; \
4169         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4170         echo "It works!"
4171         x_cpp="$cpp"
4172         x_minus='';
4173 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4174         $cpp - <testcpp.c >testcpp.out 2>&1; \
4175         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4176         echo "Hooray, it works!  I was beginning to wonder."
4177         x_cpp="$cpp"
4178         x_minus='-';
4179 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4180         $wrapper <testcpp.c >testcpp.out 2>&1; \
4181         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4182         x_cpp="$wrapper"
4183         x_minus=''
4184         echo "Eureka!"
4185 else
4186         dflt=''
4187         rp="No dice.  I can't find a C preprocessor.  Name one:"
4188         . ./myread
4189         x_cpp="$ans"
4190         x_minus=''
4191         $x_cpp <testcpp.c >testcpp.out 2>&1
4192         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4193                 echo "OK, that will do." >&4
4194         else
4195 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4196                 exit 1
4197         fi
4198 fi
4199
4200 case "$ok" in
4201 false)
4202         cppstdin="$x_cpp"
4203         cppminus="$x_minus"
4204         cpprun="$x_cpp"
4205         cpplast="$x_minus"
4206         set X $x_cpp
4207         shift
4208         case "$1" in
4209         "$cpp")
4210                 echo "Perhaps can we force $cc -E using a wrapper..."
4211                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4212                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4213                 then
4214                         echo "Yup, we can."
4215                         cppstdin="$wrapper"
4216                         cppminus='';
4217                 else
4218                         echo "Nope, we'll have to live without it..."
4219                 fi
4220                 ;;
4221         esac
4222         case "$cpprun" in
4223         "$wrapper")
4224                 cpprun=''
4225                 cpplast=''
4226                 ;;
4227         esac
4228         ;;
4229 esac
4230
4231 case "$cppstdin" in
4232 "$wrapper"|'cppstdin') ;;
4233 *) $rm -f $wrapper;;
4234 esac
4235 $rm -f testcpp.c testcpp.out
4236
4237 : Set private lib path
4238 case "$plibpth" in
4239 '') if ./mips; then
4240                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4241         fi;;
4242 esac
4243 case "$libpth" in
4244 ' ') dlist='';;
4245 '') dlist="$loclibpth $plibpth $glibpth";;
4246 *) dlist="$libpth";;
4247 esac
4248
4249 : Now check and see which directories actually exist, avoiding duplicates
4250 libpth=''
4251 for xxx in $dlist
4252 do
4253     if $test -d $xxx; then
4254                 case " $libpth " in
4255                 *" $xxx "*) ;;
4256                 *) libpth="$libpth $xxx";;
4257                 esac
4258     fi
4259 done
4260 $cat <<'EOM'
4261
4262 Some systems have incompatible or broken versions of libraries.  Among
4263 the directories listed in the question below, please remove any you
4264 know not to be holding relevant libraries, and add any that are needed.
4265 Say "none" for none.
4266
4267 EOM
4268 case "$libpth" in
4269 '') dflt='none';;
4270 *)
4271         set X $libpth
4272         shift
4273         dflt=${1+"$@"}
4274         ;;
4275 esac
4276 rp="Directories to use for library searches?"
4277 . ./myread
4278 case "$ans" in
4279 none) libpth=' ';;
4280 *) libpth="$ans";;
4281 esac
4282
4283 : compute shared library extension
4284 case "$so" in
4285 '')
4286         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4287                 dflt='sl'
4288         else
4289                 dflt='so'
4290         fi
4291         ;;
4292 *) dflt="$so";;
4293 esac
4294 $cat <<EOM
4295
4296 On some systems, shared libraries may be available.  Answer 'none' if
4297 you want to suppress searching of shared libraries for the remainder
4298 of this configuration.
4299
4300 EOM
4301 rp='What is the file extension used for shared libraries?'
4302 . ./myread
4303 so="$ans"
4304
4305 : Define several unixisms.
4306 : Hints files or command line option can be used to override them.
4307 : The convoluted testing is in case hints files set either the old
4308 : or the new name.
4309 case "$_exe" in
4310 '')     case "$exe_ext" in
4311         '')     ;;
4312         *)      _exe="$exe_ext" ;;
4313         esac
4314         ;;
4315 esac
4316 case "$_a" in
4317 '')     case "$lib_ext" in
4318     '') _a='.a';;
4319         *)      _a="$lib_ext" ;;
4320         esac
4321         ;;
4322 esac
4323 case "$_o" in
4324 '') case "$obj_ext" in
4325         '')     _o='.o';;
4326         *)      _o="$obj_ext";;
4327         esac
4328         ;;
4329 esac
4330 case "$p_" in
4331 '') case "$path_sep" in
4332         '')     p_=':';;
4333         *)      p_="$path_sep";;
4334         esac
4335         ;;
4336 esac
4337 exe_ext=$_exe
4338 lib_ext=$_a
4339 obj_ext=$_o
4340 path_sep=$p_
4341
4342 : Which makefile gets called first.  This is used by make depend.
4343 case "$firstmakefile" in
4344 '') firstmakefile='makefile';;
4345 esac
4346
4347 case "$usesocks" in
4348 $define|true|[yY]*)     dflt='y';;
4349 *) dflt='n';;
4350 esac
4351 cat <<EOM
4352
4353 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4354 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4355 to use the PerlIO abstraction layer, this will be implicitly selected.
4356
4357 If this doesn't make any sense to you, just accept the default '$dflt'.
4358 EOM
4359 rp='Build Perl for SOCKS?'
4360 . ./myread
4361 case "$ans" in
4362 y|Y)    val="$define" ;;     
4363 *)      val="$undef" ;;
4364 esac
4365 set usesocks
4366 eval $setvar
4367
4368 case "$usesocks" in
4369 $define|true|[yY]*) useperlio="$define";;
4370 esac
4371
4372 : Looking for optional libraries
4373 echo " "
4374 echo "Checking for optional libraries..." >&4
4375 case "$libs" in
4376 ' '|'') dflt='';;
4377 *) dflt="$libs";;
4378 esac
4379 case "$libswanted" in
4380 '') libswanted='c_s';;
4381 esac
4382 case "$usesocks" in
4383 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4384 esac
4385 libsfound=''
4386 libsfiles=''
4387 libsdirs=''
4388 libspath=''
4389 for thisdir in $libpth $xlibpth; do
4390   test -d $thisdir && libspath="$libspath $thisdir"
4391 done
4392 for thislib in $libswanted; do
4393         for thisdir in $libspath; do
4394             xxx=''
4395             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4396                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4397                 $test -f "$xxx" && eval $libscheck
4398                 $test -f "$xxx" && libstyle=shared
4399             fi
4400             if test ! -f "$xxx"; then
4401                 xxx=$thisdir/lib$thislib.$so
4402                 $test -f "$xxx" && eval $libscheck
4403                 $test -f "$xxx" && libstyle=shared
4404             fi  
4405             if test ! -f "$xxx"; then
4406                 xxx=$thisdir/lib$thislib$_a
4407                 $test -f "$xxx" && eval $libscheck
4408                 $test -f "$xxx" && libstyle=static
4409             fi
4410             if test ! -f "$xxx"; then
4411                 xxx=$thisdir/$thislib$_a
4412                 $test -f "$xxx" && eval $libscheck
4413                 $test -f "$xxx" && libstyle=static
4414             fi
4415             if test ! -f "$xxx"; then
4416                 xxx=$thisdir/lib${thislib}_s$_a
4417                 $test -f "$xxx" && eval $libscheck
4418                 $test -f "$xxx" && libstyle=static
4419                 $test -f "$xxx" && thislib=${thislib}_s
4420             fi
4421             if test ! -f "$xxx"; then
4422                 xxx=$thisdir/Slib$thislib$_a
4423                 $test -f "$xxx" && eval $libscheck
4424                 $test -f "$xxx" && libstyle=static
4425             fi
4426             if $test -f "$xxx"; then
4427                 case "$libstyle" in
4428                 shared) echo "Found -l$thislib (shared)." ;;
4429                 static) echo "Found -l$thislib." ;;
4430                 *)      echo "Found -l$thislib ($libstyle)." ;;
4431                 esac
4432                 case " $dflt " in
4433                 *"-l$thislib "*);;
4434                 *) dflt="$dflt -l$thislib"
4435                    libsfound="$libsfound $xxx"
4436                    yyy=`basename $xxx`
4437                    libsfiles="$libsfiles $yyy"
4438                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4439                    case " $libsdirs " in
4440                    *" $yyy "*) ;;
4441                    *) libsdirs="$libsdirs $yyy" ;;
4442                    esac
4443                    ;;
4444                 esac
4445                 break
4446             fi  
4447         done
4448         if $test ! -f "$xxx"; then
4449             echo "No -l$thislib."
4450         fi
4451 done
4452 set X $dflt
4453 shift
4454 dflt="$*"
4455 case "$libs" in
4456 '') dflt="$dflt";;
4457 *) dflt="$libs";;
4458 esac
4459 case "$dflt" in
4460 ' '|'') dflt='none';;
4461 esac
4462
4463 $cat <<EOM
4464
4465 In order to compile $package on your machine, a number of libraries
4466 are usually needed.  Include any other special libraries here as well.
4467 Say "none" for none.  The default list is almost always right.
4468 EOM
4469
4470 echo " "
4471 rp="What libraries to use?"
4472 . ./myread
4473 case "$ans" in
4474 none) libs=' ';;
4475 *) libs="$ans";;
4476 esac
4477
4478 : determine optimization, if desired, or use for debug flag also
4479 case "$optimize" in
4480 ' '|$undef) dflt='none';;
4481 '') dflt='-O';;
4482 *) dflt="$optimize";;
4483 esac
4484 $cat <<EOH
4485
4486 By default, $package compiles with the -O flag to use the optimizer.
4487 Alternately, you might want to use the symbolic debugger, which uses
4488 the -g flag (on traditional Unix systems).  Either flag can be
4489 specified here.  To use neither flag, specify the word "none".
4490
4491 EOH
4492 rp="What optimizer/debugger flag should be used?"
4493 . ./myread
4494 optimize="$ans"
4495 case "$optimize" in
4496 'none') optimize=" ";;
4497 esac
4498
4499 dflt=''
4500 : We will not override a previous value, but we might want to
4501 : augment a hint file
4502 case "$hint" in
4503 default|recommended)
4504         case "$gccversion" in
4505         1*) dflt='-fpcc-struct-return' ;;
4506         esac
4507         case "$optimize" in
4508         *-g*) dflt="$dflt -DDEBUGGING";;
4509         esac
4510         case "$gccversion" in
4511         2*) if test -d /etc/conf/kconfig.d &&
4512                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4513                 then
4514                         dflt="$dflt -posix"
4515                 fi
4516                 ;;
4517         esac
4518         case "$gccversion" in
4519         1*) ;;
4520         2.[0-8]*) ;;
4521         ?*)     echo " "
4522                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4523                 echo 'int main(void) { return 0; }' > gcctest.c
4524                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4525                         echo "Yes, it does." 2>&1
4526                         case "$ccflags" in
4527                         *strict-aliasing*) 
4528                                 echo "Leaving current flags $ccflags alone." 2>&1
4529                                 ;;
4530                         *) dflt="$dflt -fno-strict-aliasing" ;;
4531                         esac
4532                 else
4533                         echo "Nope, it doesn't, but that's ok." 2>&1
4534                 fi
4535                 ;;
4536         esac
4537         ;;
4538 esac
4539
4540 case "$mips_type" in
4541 *BSD*|'') inclwanted="$locincpth $usrinc";;
4542 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4543 esac
4544 for thisincl in $inclwanted; do
4545         if $test -d $thisincl; then
4546                 if $test x$thisincl != x$usrinc; then
4547                         case "$dflt" in
4548                         *" -I$thisincl "*);;
4549                         *) dflt="$dflt -I$thisincl ";;
4550                         esac
4551                 fi
4552         fi
4553 done
4554
4555 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4556         xxx=true;
4557 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4558         xxx=true;
4559 else
4560         xxx=false;
4561 fi;
4562 if $xxx; then
4563         case "$dflt" in
4564         *$2*);;
4565         *) dflt="$dflt -D$2";;
4566         esac;
4567 fi'
4568
4569 set signal.h LANGUAGE_C; eval $inctest
4570
4571 case "$usesocks" in
4572 $define)
4573         ccflags="$ccflags -DSOCKS"
4574         ;;
4575 esac
4576
4577 case "$hint" in
4578 default|recommended) dflt="$ccflags $dflt" ;;
4579 *) dflt="$ccflags";;
4580 esac
4581
4582 case "$dflt" in
4583 ''|' ') dflt=none;;
4584 esac
4585
4586 $cat <<EOH
4587
4588 Your C compiler may want other flags.  For this question you should include
4589 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4590 but you should NOT include libraries or ld flags like -lwhatever.  If you
4591 want $package to honor its debug switch, you should include -DDEBUGGING here.
4592 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4593
4594 To use no flags, specify the word "none".
4595
4596 EOH
4597 set X $dflt
4598 shift
4599 dflt=${1+"$@"}
4600 rp="Any additional cc flags?"
4601 . ./myread
4602 case "$ans" in
4603 none) ccflags='';;
4604 *) ccflags="$ans";;
4605 esac
4606
4607 : the following weeds options from ccflags that are of no interest to cpp
4608 case "$cppflags" in
4609 '') cppflags="$ccflags" ;;
4610 *)  cppflags="$cppflags $ccflags" ;;
4611 esac
4612 case "$gccversion" in
4613 1*) cppflags="$cppflags -D__GNUC__"
4614 esac
4615 case "$mips_type" in
4616 '');;
4617 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4618 esac
4619 case "$cppflags" in
4620 '');;
4621 *)
4622         echo " "
4623         echo "Let me guess what the preprocessor flags are..." >&4
4624         set X $cppflags
4625         shift
4626         cppflags=''
4627         $cat >cpp.c <<'EOM'
4628 #define BLURFL foo
4629
4630 BLURFL xx LFRULB
4631 EOM
4632         previous=''
4633         for flag in $*
4634         do
4635                 case "$flag" in
4636                 -*) ftry="$flag";;
4637                 *) ftry="$previous $flag";;
4638                 esac
4639                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4640                         >cpp1.out 2>/dev/null && \
4641                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4642                         >cpp2.out 2>/dev/null && \
4643                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4644                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4645                 then
4646                         cppflags="$cppflags $ftry"
4647                         previous=''
4648                 else
4649                         previous="$flag"
4650                 fi
4651         done
4652         set X $cppflags
4653         shift
4654         cppflags=${1+"$@"}
4655         case "$cppflags" in
4656         *-*)  echo "They appear to be: $cppflags";;
4657         esac
4658         $rm -f cpp.c cpp?.out
4659         ;;
4660 esac
4661
4662 : flags used in final linking phase
4663 case "$ldflags" in
4664 '') if ./venix; then
4665                 dflt='-i -z'
4666         else
4667                 dflt=''
4668         fi
4669         case "$ccflags" in
4670         *-posix*) dflt="$dflt -posix" ;;
4671         esac
4672         ;;
4673 *) dflt="$ldflags";;
4674 esac
4675
4676 : Try to guess additional flags to pick up local libraries.
4677 for thislibdir in $libpth; do
4678         case " $loclibpth " in
4679         *" $thislibdir "*)
4680                 case "$dflt " in 
4681                 *"-L$thislibdir "*) ;;
4682                 *)  dflt="$dflt -L$thislibdir" ;;
4683                 esac
4684                 ;;
4685         esac
4686 done
4687
4688 case "$dflt" in
4689 '') dflt='none' ;;
4690 esac
4691
4692 $cat <<EOH
4693
4694 Your C linker may need flags.  For this question you should
4695 include -L/whatever and any other flags used by the C linker, but you
4696 should NOT include libraries like -lwhatever.
4697
4698 Make sure you include the appropriate -L/path flags if your C linker
4699 does not normally search all of the directories you specified above,
4700 namely
4701         $libpth
4702 To use no flags, specify the word "none".
4703
4704 EOH
4705
4706 rp="Any additional ld flags (NOT including libraries)?"
4707 . ./myread
4708 case "$ans" in
4709 none) ldflags='';;
4710 *) ldflags="$ans";;
4711 esac
4712 rmlist="$rmlist pdp11"
4713
4714 : coherency check
4715 echo " "
4716 echo "Checking your choice of C compiler and flags for coherency..." >&4
4717 $cat > try.c <<'EOF'
4718 #include <stdio.h>
4719 int main() { printf("Ok\n"); exit(0); }
4720 EOF
4721 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4722 shift
4723 $cat >try.msg <<'EOM'
4724 I've tried to compile and run the following simple program:
4725
4726 EOM
4727 $cat try.c >> try.msg
4728
4729 $cat >> try.msg <<EOM
4730
4731 I used the command:
4732
4733         $*
4734         $run ./try
4735
4736 and I got the following output:
4737
4738 EOM
4739 dflt=y
4740 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4741         if $sh -c "$run ./try" >>try.msg 2>&1; then
4742                 xxx=`$run ./try`
4743                 case "$xxx" in
4744                 "Ok") dflt=n ;;
4745                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4746                         case " $libs " in
4747                         *" -lsfio "*)
4748                                 cat >> try.msg <<'EOQS'
4749 If $libs contains -lsfio, and sfio is mis-configured, then it
4750 sometimes (apparently) runs and exits with a 0 status, but with no
4751 output!  It may have to do with sfio's use of _exit vs. exit.
4752
4753 EOQS
4754                                 rp="You have a big problem.  Shall I abort Configure"
4755                                 dflt=y
4756                                 ;;
4757                         esac
4758                         ;;
4759                 esac
4760         else
4761                 echo "The program compiled OK, but exited with status $?." >>try.msg
4762                 rp="You have a problem.  Shall I abort Configure"
4763                 dflt=y
4764         fi
4765 else
4766         echo "I can't compile the test program." >>try.msg
4767         rp="You have a BIG problem.  Shall I abort Configure"
4768         dflt=y
4769 fi
4770 case "$dflt" in
4771 y)
4772         $cat try.msg >&4
4773         case "$knowitall" in
4774         '')
4775                 echo "(The supplied flags or libraries might be incorrect.)"
4776                 ;;
4777         *) dflt=n;;
4778         esac
4779         echo " "
4780         . ./myread
4781         case "$ans" in
4782         n*|N*) ;;
4783         *)      echo "Ok.  Stopping Configure." >&4
4784                 exit 1
4785                 ;;
4786         esac
4787         ;;
4788 n) echo "OK, that should do.";;
4789 esac
4790 $rm -f try try.* core
4791
4792 : define a shorthand compile call
4793 compile='
4794 mc_file=$1;
4795 shift;
4796 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4797 : define a shorthand compile call for compilations that should be ok.
4798 compile_ok='
4799 mc_file=$1;
4800 shift;
4801 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4802
4803 : check for lengths of integral types
4804 echo " "
4805 case "$intsize" in
4806 '')
4807         echo "Checking to see how big your integers are..." >&4
4808         $cat >try.c <<'EOCP'
4809 #include <stdio.h>
4810 int main()
4811 {
4812         printf("intsize=%d;\n", (int)sizeof(int));
4813         printf("longsize=%d;\n", (int)sizeof(long));
4814         printf("shortsize=%d;\n", (int)sizeof(short));
4815         exit(0);
4816 }
4817 EOCP
4818         set try
4819         if eval $compile_ok && $run ./try > /dev/null; then
4820                 eval `$run ./try`
4821                 echo "Your integers are $intsize bytes long."
4822                 echo "Your long integers are $longsize bytes long."
4823                 echo "Your short integers are $shortsize bytes long."
4824         else
4825                 $cat >&4 <<EOM
4826 !
4827 Help! I can't compile and run the intsize test program: please enlighten me!
4828 (This is probably a misconfiguration in your system or libraries, and
4829 you really ought to fix it.  Still, I'll try anyway.)
4830 !
4831 EOM
4832                 dflt=4
4833                 rp="What is the size of an integer (in bytes)?"
4834                 . ./myread
4835                 intsize="$ans"
4836                 dflt=$intsize
4837                 rp="What is the size of a long integer (in bytes)?"
4838                 . ./myread
4839                 longsize="$ans"
4840                 dflt=2
4841                 rp="What is the size of a short integer (in bytes)?"
4842                 . ./myread
4843                 shortsize="$ans"
4844         fi
4845         ;;
4846 esac
4847 $rm -f try try.*
4848
4849 : check for void type
4850 echo " "
4851 echo "Checking to see how well your C compiler groks the void type..." >&4
4852 case "$voidflags" in
4853 '')
4854         $cat >try.c <<'EOCP'
4855 #if TRY & 1
4856 void sub() {
4857 #else
4858 sub() {
4859 #endif
4860         extern void moo();      /* function returning void */
4861         void (*goo)();          /* ptr to func returning void */
4862 #if TRY & 8
4863         void *hue;              /* generic ptr */
4864 #endif
4865 #if TRY & 2
4866         void (*foo[10])();
4867 #endif
4868
4869 #if TRY & 4
4870         if(goo == moo) {
4871                 exit(0);
4872         }
4873 #endif
4874         exit(0);
4875 }
4876 int main() { sub(); }
4877 EOCP
4878         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4879                 voidflags=$defvoidused
4880         echo "Good.  It appears to support void to the level $package wants.">&4
4881                 if $contains warning .out >/dev/null 2>&1; then
4882                         echo "However, you might get some warnings that look like this:"
4883                         $cat .out
4884                 fi
4885         else
4886 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4887                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4888                         echo "It supports 1..."
4889                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4890                                 echo "It also supports 2..."
4891                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4892                                         voidflags=7
4893                                         echo "And it supports 4 but not 8 definitely."
4894                                 else
4895                                         echo "It doesn't support 4..."
4896                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4897                                                 voidflags=11
4898                                                 echo "But it supports 8."
4899                                         else
4900                                                 voidflags=3
4901                                                 echo "Neither does it support 8."
4902                                         fi
4903                                 fi
4904                         else
4905                                 echo "It does not support 2..."
4906                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4907                                         voidflags=13
4908                                         echo "But it supports 4 and 8."
4909                                 else
4910                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4911                                                 voidflags=5
4912                                                 echo "And it supports 4 but has not heard about 8."
4913                                         else
4914                                                 echo "However it supports 8 but not 4."
4915                                         fi
4916                                 fi
4917                         fi
4918                 else
4919                         echo "There is no support at all for void."
4920                         voidflags=0
4921                 fi
4922         fi
4923 esac
4924 case "$voidflags" in
4925 "$defvoidused") ;;
4926 *)      $cat >&4 <<'EOM'
4927   Support flag bits are:
4928     1: basic void declarations.
4929     2: arrays of pointers to functions returning void.
4930     4: operations between pointers to and addresses of void functions.
4931     8: generic void pointers.
4932 EOM
4933         dflt="$voidflags";
4934         rp="Your void support flags add up to what?"
4935         . ./myread
4936         voidflags="$ans"
4937         ;;
4938 esac
4939 $rm -f try.* .out
4940
4941 : check for length of pointer
4942 echo " "
4943 case "$ptrsize" in
4944 '')
4945         echo "Checking to see how big your pointers are..." >&4
4946         if test "$voidflags" -gt 7; then
4947                 echo '#define VOID_PTR char *' > try.c
4948         else
4949                 echo '#define VOID_PTR void *' > try.c
4950         fi
4951         $cat >>try.c <<'EOCP'
4952 #include <stdio.h>
4953 int main()
4954 {
4955     printf("%d\n", (int)sizeof(VOID_PTR));
4956     exit(0);
4957 }
4958 EOCP
4959         set try
4960         if eval $compile_ok; then
4961                 ptrsize=`$run ./try`
4962                 echo "Your pointers are $ptrsize bytes long."
4963         else
4964                 dflt='4'
4965                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4966                 rp="What is the size of a pointer (in bytes)?"
4967                 . ./myread
4968                 ptrsize="$ans"
4969         fi
4970         ;;
4971 esac
4972 $rm -f try.c try
4973
4974 : check for long long
4975 echo " "
4976 echo "Checking to see if you have long long..." >&4
4977 echo 'int main() { long long x = 7; return 0; }' > try.c
4978 set try
4979 if eval $compile; then
4980         val="$define"
4981         echo "You have long long."
4982 else
4983         val="$undef"
4984         echo "You do not have long long."
4985 fi
4986 $rm try.*
4987 set d_longlong
4988 eval $setvar
4989
4990 : check for length of long long
4991 case "${d_longlong}${longlongsize}" in
4992 $define)
4993         echo " "
4994         echo "Checking to see how big your long longs are..." >&4
4995         $cat >try.c <<'EOCP'
4996 #include <stdio.h>
4997 int main()
4998 {
4999     printf("%d\n", (int)sizeof(long long));
5000     return(0);
5001 }
5002 EOCP
5003         set try
5004         if eval $compile_ok; then
5005                 longlongsize=`$run ./try`
5006                 echo "Your long longs are $longlongsize bytes long."
5007         else
5008                 dflt='8'
5009                 echo " "
5010                 echo "(I can't seem to compile the test program.  Guessing...)"
5011                 rp="What is the size of a long long (in bytes)?"
5012                 . ./myread
5013                 longlongsize="$ans"
5014         fi
5015         if $test "X$longsize" = "X$longlongsize"; then
5016                 echo "(That isn't any different from an ordinary long.)"
5017         fi      
5018         ;;
5019 esac
5020 $rm -f try.* try
5021
5022 : determine filename position in cpp output
5023 echo " "
5024 echo "Computing filename position in cpp output for #include directives..." >&4
5025 case "$osname" in
5026 vos) testaccess=-e ;;
5027 *)   testaccess=-r ;;
5028 esac
5029 echo '#include <stdio.h>' > foo.c
5030 $cat >fieldn <<EOF
5031 $startsh
5032 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5033 $grep '^[       ]*#.*stdio\.h' | \
5034 while read cline; do
5035         pos=1
5036         set \$cline
5037         while $test \$# -gt 0; do
5038                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5039                         echo "\$pos"
5040                         exit 0
5041                 fi
5042                 shift
5043                 pos=\`expr \$pos + 1\`
5044         done
5045 done
5046 EOF
5047 chmod +x fieldn
5048 fieldn=`./fieldn`
5049 $rm -f foo.c fieldn
5050 case $fieldn in
5051 '') pos='???';;
5052 1) pos=first;;
5053 2) pos=second;;
5054 3) pos=third;;
5055 *) pos="${fieldn}th";;
5056 esac
5057 echo "Your cpp writes the filename in the $pos field of the line."
5058
5059 case "$osname" in
5060 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5061 *)   cppfilter='' ;;
5062 esac
5063 : locate header file
5064 $cat >findhdr <<EOF
5065 $startsh
5066 wanted=\$1
5067 name=''
5068 for usrincdir in $usrinc
5069 do
5070         if test -f \$usrincdir/\$wanted; then
5071                 echo "\$usrincdir/\$wanted"
5072                 exit 0
5073         fi
5074 done
5075 awkprg='{ print \$$fieldn }'
5076 echo "#include <\$wanted>" > foo\$\$.c
5077 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5078 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5079 while read cline; do
5080         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5081         case "\$name" in
5082         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5083         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5084         *) exit 2;;
5085         esac;
5086 done;
5087 #
5088 # status = 0: grep returned 0 lines, case statement not executed
5089 # status = 1: headerfile found
5090 # status = 2: while loop executed, no headerfile found
5091 #
5092 status=\$?
5093 $rm -f foo\$\$.c;
5094 if test \$status -eq 1; then
5095         exit 0;
5096 fi
5097 exit 1
5098 EOF
5099 chmod +x findhdr
5100
5101 : define an alternate in-header-list? function
5102 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5103 cont=true; xxf="echo \"<\$1> found.\" >&4";
5104 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5105 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5106 esac;
5107 case $# in 4) instead=instead;; *) instead="at last";; esac;
5108 while $test "$cont"; do
5109         xxx=`./findhdr $1`
5110         var=$2; eval "was=\$$2";
5111         if $test "$xxx" && $test -r "$xxx";
5112         then eval $xxf;
5113         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5114                 cont="";
5115         else eval $xxnf;
5116         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5117         set $yyy; shift; shift; yyy=$@;
5118         case $# in 0) cont="";;
5119         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5120                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5121         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5122                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5123         esac;
5124 done;
5125 while $test "$yyy";
5126 do set $yyy; var=$2; eval "was=\$$2";
5127         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5128         set $yyy; shift; shift; yyy=$@;
5129 done'
5130
5131 : see if inttypes.h is available
5132 : we want a real compile instead of Inhdr because some systems
5133 : have an inttypes.h which includes non-existent headers
5134 echo " "
5135 $cat >try.c <<EOCP
5136 #include <inttypes.h>
5137 int main() {
5138         static int32_t foo32 = 0x12345678;
5139 }
5140 EOCP
5141 set try
5142 if eval $compile; then
5143         echo "<inttypes.h> found." >&4
5144         val="$define"
5145 else
5146         echo "<inttypes.h> NOT found." >&4
5147         val="$undef"
5148 fi
5149 $rm -f try.c try
5150 set i_inttypes
5151 eval $setvar
5152
5153 : check for int64_t
5154 echo " "
5155 echo "Checking to see if you have int64_t..." >&4
5156 $cat >try.c <<EOCP
5157 #include <sys/types.h>
5158 #$i_inttypes I_INTTYPES
5159 #ifdef I_INTTYPES
5160 #include <inttypes.h>
5161 #endif
5162 int main() { int64_t x = 7; }
5163 EOCP
5164 set try
5165 if eval $compile; then
5166         val="$define"
5167         echo "You have int64_t."
5168 else
5169         val="$undef"
5170         echo "You do not have int64_t."
5171 fi
5172 $rm -f try try.*
5173 set d_int64_t
5174 eval $setvar
5175
5176
5177 echo " "
5178 echo "Checking which 64-bit integer type we could use..." >&4
5179
5180 case "$intsize" in
5181 8) val=int
5182    set quadtype
5183    eval $setvar
5184    val='"unsigned int"'
5185    set uquadtype
5186    eval $setvar
5187    quadkind=1
5188    ;;
5189 *) case "$longsize" in
5190    8) val=long
5191       set quadtype
5192       eval $setvar
5193       val='"unsigned long"'
5194       set uquadtype
5195       eval $setvar
5196       quadkind=2
5197       ;;
5198    *) case "$d_longlong:$longlongsize" in
5199       define:8)
5200         val='"long long"'
5201         set quadtype
5202         eval $setvar
5203         val='"unsigned long long"'
5204         set uquadtype
5205         eval $setvar
5206         quadkind=3
5207         ;;
5208       *) case "$d_int64_t" in
5209          define)
5210            val=int64_t
5211            set quadtype
5212            eval $setvar
5213            val=uint64_t
5214            set uquadtype
5215            eval $setvar
5216            quadkind=4
5217            ;;
5218          esac
5219          ;;
5220       esac
5221       ;;
5222    esac
5223    ;;
5224 esac
5225
5226 case "$quadtype" in
5227 '')     echo "Alas, no 64-bit integer types in sight." >&4
5228         d_quad="$undef"
5229         ;;
5230 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5231         d_quad="$define"
5232         ;;
5233 esac
5234
5235
5236 case "$uselonglong" in
5237 "$define"|true|[yY]*)
5238         cat <<EOM >&4
5239
5240 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5241 EOM
5242         use64bitint="$define"
5243         ;;
5244 esac                          
5245 case "$use64bits" in
5246 "$define"|true|[yY]*)
5247         cat <<EOM >&4
5248
5249 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5250 EOM
5251         use64bitint="$define"
5252         ;;
5253 esac                          
5254 case "$use64bitints" in
5255 "$define"|true|[yY]*)
5256         cat <<EOM >&4
5257
5258 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5259 EOM
5260         use64bitint="$define"
5261         ;;
5262 esac                          
5263 case "$use64bitsint" in
5264 "$define"|true|[yY]*)
5265         cat <<EOM >&4
5266
5267 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5268 EOM
5269         use64bitint="$define"
5270         ;;
5271 esac                          
5272 case "$uselonglongs" in
5273 "$define"|true|[yY]*)
5274         cat <<EOM >&4
5275
5276 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5277 EOM
5278         use64bitint="$define"
5279         ;;
5280 esac                          
5281 case "$use64bitsall" in
5282 "$define"|true|[yY]*)
5283         cat <<EOM >&4
5284
5285 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5286 EOM
5287         use64bitall="$define"
5288         ;;
5289 esac                          
5290
5291 case "$ccflags" in
5292 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5293 esac
5294 case "$use64bitall" in
5295 "$define"|true|[yY]*) use64bitint="$define" ;;
5296 esac
5297
5298 case "$longsize" in
5299 8) cat <<EOM
5300
5301 You have natively 64-bit long integers.
5302 EOM
5303    val="$define"
5304    ;;
5305 *) case "$use64bitint" in
5306    "$define"|true|[yY]*) dflt='y';;
5307    *) dflt='n';;
5308    esac
5309    case "$d_quad" in
5310    "$define") ;;
5311    *) dflt='n' ;;
5312    esac
5313    cat <<EOM
5314
5315 Perl can be built to take advantage of 64-bit integer types
5316 on some systems.  To do so, Configure can be run with -Duse64bitint.
5317 Choosing this option will most probably introduce binary incompatibilities.
5318
5319 If this doesn't make any sense to you, just accept the default '$dflt'.
5320 (The default has been chosen based on your configuration.)
5321 EOM
5322    rp='Try to use 64-bit integers, if available?'
5323    . ./myread
5324    case "$ans" in
5325    [yY]*) val="$define" ;;
5326    *)     val="$undef"  ;;
5327    esac
5328    ;;
5329 esac
5330 set use64bitint
5331 eval $setvar
5332
5333 case "$use64bitall" in
5334 "$define"|true|[yY]*) dflt='y' ;;
5335 *) case "$longsize" in
5336    8) dflt='y' ;;
5337    *) dflt='n' ;;
5338    esac
5339    ;;
5340 esac    
5341 cat <<EOM
5342
5343 You may also choose to try maximal 64-bitness.  It means using as much
5344 64-bitness as possible on the platform.  This in turn means even more
5345 binary incompatibilities.  On the other hand, your platform may not
5346 have any more 64-bitness available than what you already have chosen.
5347
5348 If this doesn't make any sense to you, just accept the default '$dflt'.
5349 (The default has been chosen based on your configuration.)
5350 EOM
5351 rp='Try to use maximal 64-bit support, if available?'
5352 . ./myread
5353 case "$ans" in
5354 [yY]*) val="$define" ;;
5355 *)     val="$undef"  ;;
5356 esac
5357 set use64bitall
5358 eval $setvar
5359 case "$use64bitall" in
5360 "$define")
5361         case "$use64bitint" in
5362         "$undef")
5363                 cat <<EOM
5364
5365 Since you have chosen a maximally 64-bit build, I'm also turning on
5366 the use of 64-bit integers.
5367 EOM
5368                 use64bitint="$define" ;;
5369         esac
5370         ;;
5371 esac
5372
5373 case "$use64bitall" in
5374 "$define"|true|[yY]*)
5375         case "$ptrsize" in
5376         4)      cat <<EOM >&4
5377
5378 *** You have chosen a maximally 64-bit build, but your pointers
5379 *** are only 4 bytes wide, disabling maximal 64-bitness.
5380
5381 EOM
5382                 use64bitall="$undef"
5383                 case "$use64bitint" in
5384                 "$define"|true|[yY]*) ;;
5385                 *)      cat <<EOM >&4
5386
5387 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5388
5389 EOM
5390                         use64bitint="$define"
5391                         ;;
5392                 esac
5393                 ;;
5394         esac
5395         ;;
5396 esac
5397
5398 case "$use64bitint" in
5399 "$define"|true|[yY]*)
5400 : Look for a hint-file generated 'call-back-unit'.  If the
5401 : user has specified that a 64-bit perl is to be built,
5402 : we may need to set or change some other defaults.
5403         if $test -f use64bitint.cbu; then
5404                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5405                 . ./use64bitint.cbu
5406         fi
5407         case "$longsize" in
5408         4) case "$archname64" in
5409            '') archname64=64int ;;
5410            esac
5411            ;;
5412         esac
5413         ;;
5414 esac
5415
5416 case "$use64bitall" in
5417 "$define"|true|[yY]*)
5418 : Look for a hint-file generated 'call-back-unit'.  If the
5419 : user has specified that a maximally 64-bit perl is to be built,
5420 : we may need to set or change some other defaults.
5421         if $test -f use64bitall.cbu; then
5422                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5423                 . ./use64bitall.cbu
5424         fi
5425         case "$longsize" in
5426         4) case "$archname64" in
5427            ''|64int) archname64=64all ;;
5428            esac
5429            ;;
5430         esac
5431         ;;
5432 esac
5433
5434 echo " "
5435 echo "Checking for GNU C Library..." >&4
5436 cat >try.c <<EOM
5437 #include <stdio.h>
5438 int main()
5439 {
5440 #ifdef __GLIBC__
5441     exit(0);
5442 #else
5443     exit(1);
5444 #endif
5445 }
5446 EOM
5447 set try
5448 if eval $compile_ok && $run ./try; then
5449         val="$define"
5450         echo "You are using the GNU C Library"
5451 else
5452         val="$undef"
5453         echo "You are not using the GNU C Library"
5454 fi
5455 $rm -f try try.*
5456 set d_gnulibc
5457 eval $setvar
5458
5459 : see if nm is to be used to determine whether a symbol is defined or not
5460 case "$usenm" in
5461 '')
5462         dflt=''
5463         case "$d_gnulibc" in
5464         "$define")
5465                 echo " "
5466                 echo "nm probably won't work on the GNU C Library." >&4
5467                 dflt=n
5468                 ;;
5469         esac
5470         case "$dflt" in
5471         '') 
5472                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5473                         echo " "
5474                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5475                         echo "'nm' won't be sufficient on this sytem." >&4
5476                         dflt=n
5477                 fi
5478                 ;;
5479         esac
5480         case "$dflt" in
5481         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5482                 if $test $dflt -gt 20; then
5483                         dflt=y
5484                 else
5485                         dflt=n
5486                 fi
5487                 ;;
5488         esac
5489         ;;
5490 *)
5491         case "$usenm" in
5492         true|$define) dflt=y;;
5493         *) dflt=n;;
5494         esac
5495         ;;
5496 esac
5497 $cat <<EOM
5498
5499 I can use $nm to extract the symbols from your C libraries. This
5500 is a time consuming task which may generate huge output on the disk (up
5501 to 3 megabytes) but that should make the symbols extraction faster. The
5502 alternative is to skip the 'nm' extraction part and to compile a small
5503 test program instead to determine whether each symbol is present. If
5504 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5505 this may be the best solution.
5506
5507 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5508
5509 EOM
5510 rp="Shall I use $nm to extract C symbols from the libraries?"
5511 . ./myread
5512 case "$ans" in
5513 [Nn]*) usenm=false;;
5514 *) usenm=true;;
5515 esac
5516
5517 runnm=$usenm
5518 case "$reuseval" in
5519 true) runnm=false;;
5520 esac
5521
5522 : nm options which may be necessary
5523 case "$nm_opt" in
5524 '') if $test -f /mach_boot; then
5525                 nm_opt=''       # Mach
5526         elif $test -d /usr/ccs/lib; then
5527                 nm_opt='-p'     # Solaris (and SunOS?)
5528         elif $test -f /dgux; then
5529                 nm_opt='-p'     # DG-UX
5530         elif $test -f /lib64/rld; then
5531                 nm_opt='-p'     # 64-bit Irix
5532         else
5533                 nm_opt=''
5534         fi;;
5535 esac
5536
5537 : nm options which may be necessary for shared libraries but illegal
5538 : for archive libraries.  Thank you, Linux.
5539 case "$nm_so_opt" in
5540 '')     case "$myuname" in
5541         *linux*)
5542                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5543                         nm_so_opt='--dynamic'
5544                 fi
5545                 ;;
5546         esac
5547         ;;
5548 esac
5549
5550 case "$runnm" in
5551 true)
5552 : get list of predefined functions in a handy place
5553 echo " "
5554 case "$libc" in
5555 '') libc=unknown
5556         case "$libs" in
5557         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5558         esac
5559         ;;
5560 esac
5561 case "$libs" in
5562 '') ;;
5563 *)  for thislib in $libs; do
5564         case "$thislib" in
5565         -lc|-lc_s)
5566                 : Handle C library specially below.
5567                 ;;
5568         -l*)
5569                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5570                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5571                         :
5572                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5573                         :
5574                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5575                         :
5576                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5577                         :
5578                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5579                         :
5580                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5581                         :
5582                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5583                         :
5584                 else
5585                         try=''
5586                 fi
5587                 libnames="$libnames $try"
5588                 ;;
5589         *) libnames="$libnames $thislib" ;;
5590         esac
5591         done
5592         ;;
5593 esac
5594 xxx=normal
5595 case "$libc" in
5596 unknown)
5597         set /lib/libc.$so
5598         for xxx in $libpth; do
5599                 $test -r $1 || set $xxx/libc.$so
5600                 : The messy sed command sorts on library version numbers.
5601                 $test -r $1 || \
5602                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5603                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5604                                 h
5605                                 s/[0-9][0-9]*/0000&/g
5606                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5607                                 G
5608                                 s/\n/ /' | \
5609                          $sort | $sed -e 's/^.* //'`
5610                 eval set \$$#
5611         done
5612         $test -r $1 || set /usr/ccs/lib/libc.$so
5613         $test -r $1 || set /lib/libsys_s$_a
5614         ;;
5615 *)
5616         set blurfl
5617         ;;
5618 esac
5619 if $test -r "$1"; then
5620         echo "Your (shared) C library seems to be in $1."
5621         libc="$1"
5622 elif $test -r /lib/libc && $test -r /lib/clib; then
5623         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5624         xxx=apollo
5625         libc='/lib/clib /lib/libc'
5626         if $test -r /lib/syslib; then
5627                 echo "(Your math library is in /lib/syslib.)"
5628                 libc="$libc /lib/syslib"
5629         fi
5630 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5631         echo "Your C library seems to be in $libc, as you said before."
5632 elif $test -r $incpath/usr/lib/libc$_a; then
5633         libc=$incpath/usr/lib/libc$_a;
5634         echo "Your C library seems to be in $libc.  That's fine."
5635 elif $test -r /lib/libc$_a; then
5636         libc=/lib/libc$_a;
5637         echo "Your C library seems to be in $libc.  You're normal."
5638 else
5639         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5640                 :
5641         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5642                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5643         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5644                 :
5645         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5646                 :
5647         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5648                 :
5649         else
5650                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5651         fi
5652         if $test -r "$tans"; then
5653                 echo "Your C library seems to be in $tans, of all places."
5654                 libc=$tans
5655         else
5656                 libc='blurfl'
5657         fi
5658 fi
5659 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5660         dflt="$libc"
5661         cat <<EOM
5662
5663 If the guess above is wrong (which it might be if you're using a strange
5664 compiler, or your machine supports multiple models), you can override it here.
5665
5666 EOM
5667 else
5668         dflt=''
5669         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5670         cat >&4 <<EOM
5671 I can't seem to find your C library.  I've looked in the following places:
5672
5673 EOM
5674         $sed 's/^/      /' libpath
5675         cat <<EOM
5676
5677 None of these seems to contain your C library. I need to get its name...
5678
5679 EOM
5680 fi
5681 fn=f
5682 rp='Where is your C library?'
5683 . ./getfile
5684 libc="$ans"
5685
5686 echo " "
5687 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5688 set X `cat libnames`
5689 shift
5690 xxx=files
5691 case $# in 1) xxx=file; esac
5692 echo "Extracting names from the following $xxx for later perusal:" >&4
5693 echo " "
5694 $sed 's/^/      /' libnames >&4
5695 echo " "
5696 $echo $n "This may take a while...$c" >&4
5697
5698 for file in $*; do
5699         case $file in
5700         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5701         *) $nm $nm_opt $file 2>/dev/null;;
5702         esac
5703 done >libc.tmp
5704
5705 $echo $n ".$c"
5706 $grep fprintf libc.tmp > libc.ptf
5707 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5708 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5709 xxx='[ADTSIW]'
5710 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5711         eval $xscan;\
5712         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5713                 eval $xrun
5714 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5715         eval $xscan;\
5716         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5717                 eval $xrun
5718 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5719         eval $xscan;\
5720         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5721                 eval $xrun
5722 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5723         eval $xscan;\
5724         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5725                 eval $xrun
5726 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5727         eval $xscan;\
5728         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5729                 eval $xrun
5730 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5731         eval $xscan;\
5732         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5733                 eval $xrun
5734 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5735                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5736         eval $xscan;\
5737         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5738                 eval $xrun
5739 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5740         eval $xscan;\
5741         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5742                 eval $xrun
5743 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5744         eval $xscan;\
5745         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5746                 eval $xrun
5747 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5748         eval $xscan;\
5749         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5750                 eval $xrun
5751 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5752         eval $xscan;\
5753         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5754                 eval $xrun
5755 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5756         eval $xscan;\
5757         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5758                 eval $xrun
5759 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5760         eval $xscan;\
5761         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5762                 eval $xrun
5763 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5764         eval $xscan;\
5765         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5766                 eval $xrun
5767 else
5768         $nm -p $* 2>/dev/null >libc.tmp
5769         $grep fprintf libc.tmp > libc.ptf
5770         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5771                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5772         then
5773                 nm_opt='-p'
5774                 eval $xrun
5775         else
5776                 echo " "
5777                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5778                 com=''
5779                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5780                         for thisname in $libnames $libc; do
5781                                 $ar t $thisname >>libc.tmp
5782                         done
5783                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5784                         echo "Ok." >&4
5785                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5786                         # Repeat libc to extract forwarders to DLL entries too
5787                         for thisname in $libnames $libc; do
5788                                 $ar tv $thisname >>libc.tmp
5789                                 # Revision 50 of EMX has bug in $ar.
5790                                 # it will not extract forwarders to DLL entries
5791                                 # Use emximp which will extract exactly them.
5792                                 emximp -o tmp.imp $thisname \
5793                                     2>/dev/null && \
5794                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5795                                     < tmp.imp >>libc.tmp
5796                                 $rm tmp.imp
5797                         done
5798                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5799                         echo "Ok." >&4
5800                 else
5801                         echo "$ar didn't seem to work right." >&4
5802                         echo "Maybe this is a Cray...trying bld instead..." >&4
5803                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5804                         then
5805                                 for thisname in $libnames; do
5806                                         bld t $libnames | \
5807                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5808                                         $ar t $thisname >>libc.tmp
5809                                 done
5810                                 echo "Ok." >&4
5811                         else
5812                                 echo "That didn't work either.  Giving up." >&4
5813                                 exit 1
5814                         fi
5815                 fi
5816         fi
5817 fi
5818 nm_extract="$com"
5819 if $test -f /lib/syscalls.exp; then
5820         echo " "
5821         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5822         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5823 fi
5824 ;;
5825 esac
5826 $rm -f libnames libpath
5827
5828 : is a C symbol defined?
5829 csym='tlook=$1;
5830 case "$3" in
5831 -v) tf=libc.tmp; tc=""; tdc="";;
5832 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5833 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5834 esac;
5835 tx=yes;
5836 case "$reuseval-$4" in
5837 true-) ;;
5838 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5839 esac;
5840 case "$tx" in
5841 yes)
5842         case "$runnm" in
5843         true)
5844                 if $contains $tlook $tf >/dev/null 2>&1;
5845                 then tval=true;
5846                 else tval=false;
5847                 fi;;
5848         *)
5849                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5850                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5851                 then tval=true;
5852                 else tval=false;
5853                 fi;
5854                 $rm -f t t.c;;
5855         esac;;
5856 *)
5857         case "$tval" in
5858         $define) tval=true;;
5859         *) tval=false;;
5860         esac;;
5861 esac;
5862 eval "$2=$tval"'
5863
5864 : define an is-in-libc? function
5865 inlibc='echo " "; td=$define; tu=$undef;
5866 sym=$1; var=$2; eval "was=\$$2";
5867 tx=yes;
5868 case "$reuseval$was" in
5869 true) ;;
5870 true*) tx=no;;
5871 esac;
5872 case "$tx" in
5873 yes)
5874         set $sym tres -f;
5875         eval $csym;
5876         case "$tres" in
5877         true)
5878                 echo "$sym() found." >&4;
5879                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5880         *)
5881                 echo "$sym() NOT found." >&4;
5882                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5883         esac;;
5884 *)
5885         case "$was" in
5886         $define) echo "$sym() found." >&4;;
5887         *) echo "$sym() NOT found." >&4;;
5888         esac;;
5889 esac'
5890
5891 : see if sqrtl exists
5892 set sqrtl d_sqrtl
5893 eval $inlibc
5894
5895 : check for length of double
5896 echo " "
5897 case "$doublesize" in
5898 '')
5899         echo "Checking to see how big your double precision numbers are..." >&4
5900         $cat >try.c <<'EOCP'
5901 #include <stdio.h>
5902 int main()
5903 {
5904     printf("%d\n", (int)sizeof(double));
5905     exit(0);
5906 }
5907 EOCP
5908         set try
5909         if eval $compile_ok; then
5910                 doublesize=`$run ./try`
5911                 echo "Your double is $doublesize bytes long."
5912         else
5913                 dflt='8'
5914                 echo "(I can't seem to compile the test program.  Guessing...)"
5915                 rp="What is the size of a double precision number (in bytes)?"
5916                 . ./myread
5917                 doublesize="$ans"
5918         fi
5919         ;;
5920 esac
5921 $rm -f try.c try
5922
5923 : check for long doubles
5924 echo " "
5925 echo "Checking to see if you have long double..." >&4
5926 echo 'int main() { long double x = 7.0; }' > try.c
5927 set try
5928 if eval $compile; then
5929         val="$define"
5930         echo "You have long double."
5931 else
5932         val="$undef"
5933         echo "You do not have long double."
5934 fi
5935 $rm try.*
5936 set d_longdbl
5937 eval $setvar
5938
5939 : check for length of long double
5940 case "${d_longdbl}${longdblsize}" in
5941 $define)
5942         echo " "
5943         echo "Checking to see how big your long doubles are..." >&4
5944         $cat >try.c <<'EOCP'
5945 #include <stdio.h>
5946 int main()
5947 {
5948         printf("%d\n", sizeof(long double));
5949 }
5950 EOCP
5951         set try
5952         set try
5953         if eval $compile; then
5954                 longdblsize=`$run ./try`
5955                 echo "Your long doubles are $longdblsize bytes long."
5956         else
5957                 dflt='8'
5958                 echo " "
5959                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5960                 rp="What is the size of a long double (in bytes)?"
5961                 . ./myread
5962                 longdblsize="$ans"
5963         fi
5964         if $test "X$doublesize" = "X$longdblsize"; then
5965                 echo "(That isn't any different from an ordinary double.)"
5966         fi      
5967         ;;
5968 esac
5969 $rm -f try.* try
5970
5971 echo " "
5972
5973 if $test X"$d_longdbl" = X"$define"; then
5974
5975 echo "Checking how to print long doubles..." >&4
5976
5977 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5978         $cat >try.c <<'EOCP'
5979 #include <sys/types.h>
5980 #include <stdio.h>
5981 int main() {
5982   double d = 123.456;
5983   printf("%.3f\n", d);
5984 }
5985 EOCP
5986         set try
5987         if eval $compile; then
5988                 yyy=`$run ./try`
5989                 case "$yyy" in
5990                 123.456)
5991                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5992                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5993                         echo "We will use %f."
5994                         ;;
5995                 esac
5996         fi
5997 fi
5998
5999 if $test X"$sPRIfldbl" = X; then
6000         $cat >try.c <<'EOCP'
6001 #include <sys/types.h>
6002 #include <stdio.h>
6003 int main() {
6004   long double d = 123.456;
6005   printf("%.3Lf\n", d);
6006 }
6007 EOCP
6008         set try
6009         if eval $compile; then
6010                 yyy=`$run ./try`
6011                 case "$yyy" in
6012                 123.456)
6013                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6014                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6015                         echo "We will use %Lf."
6016                         ;;
6017                 esac
6018         fi
6019 fi
6020
6021 if $test X"$sPRIfldbl" = X; then
6022         $cat >try.c <<'EOCP'
6023 #include <sys/types.h>
6024 #include <stdio.h>
6025 int main() {
6026   long double d = 123.456;
6027   printf("%.3llf\n", d);
6028 }
6029 EOCP
6030         set try
6031         if eval $compile; then
6032                 yyy=`$run ./try`
6033                 case "$yyy" in
6034                 123.456)
6035                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6036                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6037                         echo "We will use %llf."
6038                         ;;
6039                 esac
6040         fi
6041 fi
6042
6043 if $test X"$sPRIfldbl" = X; then
6044         $cat >try.c <<'EOCP'
6045 #include <sys/types.h>
6046 #include <stdio.h>
6047 int main() {
6048   long double d = 123.456;
6049   printf("%.3lf\n", d);
6050 }
6051 EOCP
6052         set try
6053         if eval $compile; then
6054                 yyy=`$run ./try`
6055                 case "$yyy" in
6056                 123.456)
6057                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6058                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6059                         echo "We will use %lf."
6060                         ;;
6061                 esac
6062         fi
6063 fi
6064
6065 if $test X"$sPRIfldbl" = X; then
6066         echo "Cannot figure out how to print long doubles." >&4
6067 else
6068         sSCNfldbl=$sPRIfldbl    # expect consistency
6069 fi
6070
6071 $rm -f try try.*
6072
6073 fi # d_longdbl
6074
6075 case "$sPRIfldbl" in
6076 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6077         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6078         d_SCNfldbl="$undef";
6079         ;;
6080 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6081         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6082         d_SCNfldbl="$define";
6083         ;;
6084 esac
6085
6086 : see if modfl exists
6087 set modfl d_modfl
6088 eval $inlibc
6089
6090 d_modfl_pow32_bug="$undef"
6091
6092 case "$d_longdbl$d_modfl" in
6093 $define$define)
6094         $cat <<EOM
6095 Checking to see whether your modfl() is okay for large values...
6096 EOM
6097 $cat >try.c <<EOCP
6098 #include <math.h> 
6099 #include <stdio.h>
6100 int main() {
6101     long double nv = 4294967303.15;
6102     long double v, w;
6103     v = modfl(nv, &w);         
6104 #ifdef __GLIBC__
6105     printf("glibc");
6106 #endif
6107     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6108     return 0;
6109 }
6110 EOCP
6111         case "$osname:$gccversion" in
6112         aix:)   saveccflags="$ccflags"
6113                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6114         esac
6115         set try
6116         if eval $compile; then
6117                 foo=`$run ./try`
6118                 case "$foo" in
6119                 *" 4294967303.150000 1.150000 4294967302.000000")
6120                         echo >&4 "Your modfl() is broken for large values."
6121                         d_modfl_pow32_bug="$define"
6122                         case "$foo" in
6123                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6124                         ;;
6125                         esac
6126                         ;;
6127                 *" 4294967303.150000 0.150000 4294967303.000000")
6128                         echo >&4 "Your modfl() seems okay for large values."
6129                         ;;
6130                 *)      echo >&4 "I don't understand your modfl() at all."
6131                         d_modfl="$undef"
6132                         ;;
6133                 esac
6134                 $rm -f try.* try core core.try.*
6135         else
6136                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6137                 d_modfl="$undef"
6138         fi
6139         case "$osname:$gccversion" in
6140         aix:)   ccflags="$saveccflags" ;; # restore
6141         esac
6142         ;;
6143 esac
6144
6145 case "$ccflags" in
6146 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6147 esac
6148
6149 case "$uselongdouble" in
6150 $define|true|[yY]*)     dflt='y';;
6151 *) dflt='n';;
6152 esac
6153 cat <<EOM
6154
6155 Perl can be built to take advantage of long doubles which
6156 (if available) may give more accuracy and range for floating point numbers.
6157
6158 If this doesn't make any sense to you, just accept the default '$dflt'.
6159 EOM
6160 rp='Try to use long doubles if available?'
6161 . ./myread
6162 case "$ans" in
6163 y|Y)    val="$define"   ;;
6164 *)      val="$undef"    ;;
6165 esac
6166 set uselongdouble
6167 eval $setvar
6168
6169 case "$uselongdouble" in
6170 true|[yY]*) uselongdouble="$define" ;;
6171 esac
6172
6173 case "$uselongdouble" in
6174 $define)
6175 : Look for a hint-file generated 'call-back-unit'.  If the
6176 : user has specified that long doubles should be used,
6177 : we may need to set or change some other defaults.
6178         if $test -f uselongdouble.cbu; then
6179                 echo "Your platform has some specific hints for long doubles, using them..."
6180                 . ./uselongdouble.cbu
6181         else
6182                 $cat <<EOM
6183 (Your platform doesn't have any specific hints for long doubles.)
6184 EOM
6185         fi
6186         ;;
6187 esac
6188
6189 message=X
6190 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6191 $define:$define:$define)
6192         : You have both
6193         ;;
6194 $define:$define:$undef)
6195         message="I could not find modfl"
6196         ;;
6197 $define:$undef:$define)
6198         message="I could not find sqrtl"
6199         ;;
6200 $define:$undef:$undef)
6201         message="I found neither sqrtl nor modfl"
6202         ;;
6203 esac
6204
6205 if $test "$message" != X; then
6206         $cat <<EOM >&4
6207
6208 *** You requested the use of long doubles but you do not seem to have
6209 *** the mathematic functions for long doubles.
6210 *** ($message)
6211 *** I'm disabling the use of long doubles.
6212
6213 EOM
6214
6215         uselongdouble=$undef
6216 fi
6217
6218 case "$useperlio" in
6219 $define|true|[yY]*|'')  dflt='y';;
6220 *) dflt='n';;
6221 esac
6222 cat <<EOM
6223
6224 Previous version of $package used the standard IO mechanisms as
6225 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6226 alternate IO mechanisms via the PerlIO abstraction layer, but the
6227 stdio mechanism is still available if needed.  The abstraction layer
6228 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6229 Using PerlIO with sfio may cause problems with some extension modules.
6230
6231 If this doesn't make any sense to you, just accept the default '$dflt'.
6232 EOM
6233 rp='Use the PerlIO abstraction layer?'
6234 . ./myread
6235 case "$ans" in
6236 y|Y) 
6237         val="$define"
6238         ;;
6239 *)      
6240         echo "Ok, doing things the stdio way."
6241         val="$undef"
6242         ;;
6243 esac
6244 set useperlio
6245 eval $setvar 
6246
6247 case "$usesocks" in
6248 $define|true|[yY]*)
6249         case "$useperlio" in
6250         $define|true|[yY]*) ;;
6251         *)      cat >&4 <<EOM
6252
6253 You are using the SOCKS proxy protocol library which means that you
6254 should also use the PerlIO layer.  You may be headed for trouble.
6255
6256 EOM
6257                 ;;
6258         esac
6259         ;;
6260 esac
6261
6262         
6263 : determine the architecture name
6264 echo " "
6265 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6266         tarch=`arch`"-$osname"
6267 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6268         if uname -m > tmparch 2>&1 ; then
6269                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6270                         -e 's/$/'"-$osname/" tmparch`
6271         else
6272                 tarch="$osname"
6273         fi
6274         $rm -f tmparch
6275 else
6276         tarch="$osname"
6277 fi
6278 case "$myarchname" in
6279 ''|"$tarch") ;;
6280 *)
6281         echo "(Your architecture name used to be $myarchname.)"
6282         archname=''
6283         ;;
6284 esac
6285 case "$targetarch" in
6286 '') ;;
6287 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6288 esac
6289 myarchname="$tarch"
6290 case "$archname" in
6291 '') dflt="$tarch";;
6292 *) dflt="$archname";;
6293 esac
6294 rp='What is your architecture name'
6295 . ./myread
6296 archname="$ans"
6297 case "$usethreads" in
6298 $define)
6299         echo "Threads selected." >&4
6300         case "$archname" in
6301         *-thread*) echo "...and architecture name already has -thread." >&4
6302                 ;;
6303         *)      archname="$archname-thread"
6304                 echo "...setting architecture name to $archname." >&4
6305                 ;;
6306         esac
6307         ;;
6308 esac
6309 case "$usemultiplicity" in
6310 $define)
6311         echo "Multiplicity selected." >&4
6312         case "$archname" in
6313         *-multi*) echo "...and architecture name already has -multi." >&4
6314                 ;;
6315         *)      archname="$archname-multi"
6316                 echo "...setting architecture name to $archname." >&4
6317                 ;;
6318         esac
6319         ;;
6320 esac
6321 case "$use64bitint$use64bitall" in
6322 *"$define"*)
6323         case "$archname64" in
6324         '')
6325                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6326                 ;;
6327         *)
6328                 case "$use64bitint" in
6329                 "$define") echo "64 bit integers selected." >&4 ;;
6330                 esac
6331                 case "$use64bitall" in
6332                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6333                 esac
6334                 case "$archname" in
6335                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6336                         ;;
6337                 *)      archname="$archname-$archname64"
6338                         echo "...setting architecture name to $archname." >&4
6339                         ;;
6340                 esac
6341                 ;;
6342         esac
6343 esac
6344 case "$uselongdouble" in
6345 $define)
6346         echo "Long doubles selected." >&4
6347         case "$longdblsize" in
6348         $doublesize)
6349                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6350                 ;;
6351         *)
6352                 case "$archname" in
6353                 *-ld*) echo "...and architecture name already has -ld." >&4
6354                         ;;
6355                 *)      archname="$archname-ld"
6356                         echo "...setting architecture name to $archname." >&4
6357                         ;;
6358                 esac
6359                 ;;
6360         esac
6361         ;;
6362 esac
6363 case "$useperlio" in
6364 $define)
6365         echo "Perlio selected." >&4
6366         ;;
6367 *)
6368         echo "Perlio not selected, using stdio." >&4
6369         case "$archname" in
6370         *-stdio*) echo "...and architecture name already has -stdio." >&4
6371                 ;;
6372         *)      archname="$archname-stdio"
6373                 echo "...setting architecture name to $archname." >&4
6374                 ;;
6375         esac
6376         ;;
6377 esac
6378
6379 : determine root of directory hierarchy where package will be installed.
6380 case "$prefix" in
6381 '')
6382         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6383         ;;
6384 *)
6385         dflt="$prefix"
6386         ;;
6387 esac
6388 $cat <<EOM
6389
6390 By default, $package will be installed in $dflt/bin, manual pages
6391 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6392 installation directories. Typically this is something like /usr/local.
6393 If you wish to have binaries under /usr/bin but other parts of the
6394 installation under /usr/local, that's ok: you will be prompted
6395 separately for each of the installation directories, the prefix being
6396 only used to set the defaults.
6397
6398 EOM
6399 fn=d~
6400 rp='Installation prefix to use?'
6401 . ./getfile
6402 oldprefix=''
6403 case "$prefix" in
6404 '') ;;
6405 *)
6406         case "$ans" in
6407         "$prefix") ;;
6408         *) oldprefix="$prefix";;
6409         esac
6410         ;;
6411 esac
6412 prefix="$ans"
6413 prefixexp="$ansexp"
6414
6415 case "$afsroot" in
6416 '')     afsroot=/afs ;;
6417 *)      afsroot=$afsroot ;;
6418 esac
6419
6420 : is AFS running?
6421 echo " "
6422 case "$afs" in
6423 $define|true)   afs=true ;;
6424 $undef|false)   afs=false ;;
6425 *)      if test -d $afsroot; then
6426                 afs=true
6427         else
6428                 afs=false
6429         fi
6430         ;;
6431 esac
6432 if $afs; then
6433         echo "AFS may be running... I'll be extra cautious then..." >&4
6434 else
6435         echo "AFS does not seem to be running..." >&4
6436 fi
6437
6438 : determine installation prefix for where package is to be installed.
6439 if $afs; then 
6440 $cat <<EOM
6441
6442 Since you are running AFS, I need to distinguish the directory in which
6443 files will reside from the directory in which they are installed (and from
6444 which they are presumably copied to the former directory by occult means).
6445
6446 EOM
6447         case "$installprefix" in
6448         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6449         *) dflt="$installprefix";;
6450         esac
6451 else
6452 $cat <<EOM
6453
6454 In some special cases, particularly when building $package for distribution,
6455 it is convenient to distinguish between the directory in which files should 
6456 be installed from the directory ($prefix) in which they 
6457 will eventually reside.  For most users, these two directories are the same.
6458
6459 EOM
6460         case "$installprefix" in
6461         '') dflt=$prefix ;;
6462         *) dflt=$installprefix;;
6463         esac
6464 fi
6465 fn=d~
6466 rp='What installation prefix should I use for installing files?'
6467 . ./getfile
6468 installprefix="$ans"
6469 installprefixexp="$ansexp"
6470
6471 : set the prefixit variable, to compute a suitable default value
6472 prefixit='case "$3" in
6473 ""|none)
6474         case "$oldprefix" in
6475         "") eval "$1=\"\$$2\"";;
6476         *)
6477                 case "$3" in
6478                 "") eval "$1=";;
6479                 none)
6480                         eval "tp=\"\$$2\"";
6481                         case "$tp" in
6482                         ""|" ") eval "$1=\"\$$2\"";;
6483                         *) eval "$1=";;
6484                         esac;;
6485                 esac;;
6486         esac;;
6487 *)
6488         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6489         case "$tp" in
6490         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6491         /*-$oldprefix/*|\~*-$oldprefix/*)
6492                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6493         *) eval "$1=\"\$$2\"";;
6494         esac;;
6495 esac'
6496
6497 : get the patchlevel
6498 echo " "
6499 echo "Getting the current patchlevel..." >&4
6500 if $test -r $rsrc/patchlevel.h;then
6501         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6502         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6503         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6504         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6505         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6506         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6507        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6508 else
6509         revision=0
6510         patchlevel=0
6511         subversion=0
6512         api_revision=0
6513         api_version=0
6514         api_subversion=0
6515         perl_patchlevel=0
6516         $echo "(You do not have patchlevel.h.  Eek.)"
6517 fi
6518 if $test -r $rsrc/.patch ; then  
6519         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6520                 perl_patchlevel=`cat $rsrc/.patch`
6521         fi
6522 fi
6523 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6524 version_patchlevel_string="version $patchlevel subversion $subversion"
6525 case "$perl_patchlevel" in
6526 0|'') ;;
6527 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6528 esac
6529
6530 $echo "(You have $package $version_patchlevel_string.)"
6531
6532 case "$osname" in
6533 dos|vms)
6534         : XXX Should be a Configure test for double-dots in filenames.
6535         version=`echo $revision $patchlevel $subversion | \
6536                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6537         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6538                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6539         ;;
6540 *)
6541         version=`echo $revision $patchlevel $subversion | \
6542                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6543         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6544                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6545         ;;
6546 esac
6547 : Special case the 5.005_xx maintenance series, which used 5.005
6548 : without any subversion label as a subdirectory in $sitelib
6549 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6550         api_versionstring='5.005'
6551 fi
6552
6553 : determine installation style
6554 : For now, try to deduce it from prefix unless it is already set.
6555 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6556 case "$installstyle" in
6557 '')     case "$prefix" in
6558                 *perl*) dflt='lib';;
6559                 *) dflt='lib/perl5' ;;
6560         esac
6561         ;;
6562 *)      dflt="$installstyle" ;;
6563 esac
6564 : Probably not worth prompting for this since we prompt for all
6565 : the directories individually, and the prompt would be too long and
6566 : confusing anyway.
6567 installstyle=$dflt
6568
6569 : determine where private library files go
6570 : Usual default is /usr/local/lib/perl5/$version.
6571 : Also allow things like /opt/perl/lib/$version, since 
6572 : /opt/perl/lib/perl5... would be redundant.
6573 : The default "style" setting is made in installstyle.U
6574 case "$installstyle" in
6575 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6576 *)       set dflt privlib lib/$version ;;
6577 esac
6578 eval $prefixit
6579 $cat <<EOM
6580
6581 There are some auxiliary files for $package that need to be put into a
6582 private library directory that is accessible by everyone.
6583
6584 EOM
6585 fn=d~+
6586 rp='Pathname where the private library files will reside?'
6587 . ./getfile
6588 privlib="$ans"
6589 privlibexp="$ansexp"
6590 : Change installation prefix, if necessary.
6591 if $test X"$prefix" != X"$installprefix"; then
6592         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6593 else
6594         installprivlib="$privlibexp"
6595 fi
6596
6597 : set the prefixup variable, to restore leading tilda escape
6598 prefixup='case "$prefixexp" in
6599 "$prefix") ;;
6600 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6601 esac'
6602
6603 : determine where public architecture dependent libraries go
6604 set archlib archlib
6605 eval $prefixit
6606 : privlib default is /usr/local/lib/$package/$version
6607 : archlib default is /usr/local/lib/$package/$version/$archname
6608 : privlib may have an optional trailing /share.
6609 tdflt=`echo $privlib | $sed 's,/share$,,'`
6610 tdflt=$tdflt/$archname
6611 case "$archlib" in
6612 '')     dflt=$tdflt
6613         ;;
6614 *)      dflt="$archlib"
6615     ;;
6616 esac
6617 $cat <<EOM
6618
6619 $spackage contains architecture-dependent library files.  If you are
6620 sharing libraries in a heterogeneous environment, you might store
6621 these files in a separate location.  Otherwise, you can just include
6622 them with the rest of the public library files.
6623
6624 EOM
6625 fn=d+~
6626 rp='Where do you want to put the public architecture-dependent libraries?'
6627 . ./getfile
6628 archlib="$ans"
6629 archlibexp="$ansexp"
6630 if $test X"$archlib" = X"$privlib"; then
6631         d_archlib="$undef"
6632 else
6633         d_archlib="$define"
6634 fi
6635 : Change installation prefix, if necessary.
6636 if $test X"$prefix" != X"$installprefix"; then
6637         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6638 else
6639         installarchlib="$archlibexp"
6640 fi
6641
6642
6643 : Binary compatibility with 5.005 is not possible for builds
6644 : with advanced features
6645 case "$usethreads$usemultiplicity" in
6646 *define*)
6647         bincompat5005="$undef"
6648         d_bincompat5005="$undef"
6649         ;;
6650 *)      $cat <<EOM
6651
6652 This version of Perl can be compiled for binary compatibility with 5.005.
6653 If you decide to do so, you will be able to continue using most of the
6654 extensions that were compiled for Perl 5.005.
6655
6656 EOM
6657         case "$bincompat5005$d_bincompat5005" in
6658         *"$undef"*) dflt=n ;;
6659         *) dflt=y ;;
6660         esac
6661         rp='Binary compatibility with Perl 5.005?'
6662         . ./myread
6663         case "$ans" in
6664         y*) val="$define" ;;
6665         *)  val="$undef" ;;
6666         esac
6667         set d_bincompat5005
6668         eval $setvar
6669         case "$d_bincompat5005" in
6670         "$define")
6671                 bincompat5005="$define"
6672                 ;;
6673         *)      bincompat5005="$undef"
6674                 d_bincompat5005="$undef"
6675                 ;;
6676         esac
6677         ;;
6678 esac
6679
6680
6681 : see if setuid scripts can be secure
6682 $cat <<EOM
6683
6684 Some kernels have a bug that prevents setuid #! scripts from being
6685 secure.  Some sites have disabled setuid #! scripts because of this.
6686
6687 First let's decide if your kernel supports secure setuid #! scripts.
6688 (If setuid #! scripts would be secure but have been disabled anyway,
6689 don't say that they are secure if asked.)
6690
6691 EOM
6692
6693 val="$undef"
6694 if $test -d /dev/fd; then
6695         echo "#!$ls" >reflect
6696         chmod +x,u+s reflect
6697         ./reflect >flect 2>&1
6698         if $contains "/dev/fd" flect >/dev/null; then
6699                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6700                 val="$define"
6701         else
6702                 $cat <<EOM
6703 If you are not sure if they are secure, I can check but I'll need a
6704 username and password different from the one you are using right now.
6705 If you don't have such a username or don't want me to test, simply
6706 enter 'none'.
6707
6708 EOM
6709                 rp='Other username to test security of setuid scripts with?'
6710                 dflt='none'
6711                 . ./myread
6712                 case "$ans" in
6713                 n|none)
6714                         case "$d_suidsafe" in
6715                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6716                                 dflt=n;;
6717                         "$undef")
6718                                 echo "Well, the $hint value is *not* secure." >&4
6719                                 dflt=n;;
6720                         *)      echo "Well, the $hint value *is* secure." >&4
6721                                 dflt=y;;
6722                         esac
6723                         ;;
6724                 *)
6725                         $rm -f reflect flect
6726                         echo "#!$ls" >reflect
6727                         chmod +x,u+s reflect
6728                         echo >flect
6729                         chmod a+w flect
6730                         echo '"su" will (probably) prompt you for '"$ans's password."
6731                         su $ans -c './reflect >flect'
6732                         if $contains "/dev/fd" flect >/dev/null; then
6733                                 echo "Okay, it looks like setuid scripts are secure." >&4
6734                                 dflt=y
6735                         else
6736                                 echo "I don't think setuid scripts are secure." >&4
6737                                 dflt=n
6738                         fi
6739                         ;;
6740                 esac
6741                 rp='Does your kernel have *secure* setuid scripts?'
6742                 . ./myread
6743                 case "$ans" in
6744                 [yY]*)  val="$define";;
6745                 *)      val="$undef";;
6746                 esac
6747         fi
6748 else
6749         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6750         echo "(That's for file descriptors, not floppy disks.)"
6751         val="$undef"
6752 fi
6753 set d_suidsafe
6754 eval $setvar
6755
6756 $rm -f reflect flect
6757
6758 : now see if they want to do setuid emulation
6759 echo " "
6760 val="$undef"
6761 case "$d_suidsafe" in
6762 "$define")
6763         val="$undef"
6764         echo "No need to emulate SUID scripts since they are secure here." >&4
6765         ;;
6766 *)
6767         $cat <<EOM
6768 Some systems have disabled setuid scripts, especially systems where
6769 setuid scripts cannot be secure.  On systems where setuid scripts have
6770 been disabled, the setuid/setgid bits on scripts are currently
6771 useless.  It is possible for $package to detect those bits and emulate
6772 setuid/setgid in a secure fashion.  This emulation will only work if
6773 setuid scripts have been disabled in your kernel.
6774
6775 EOM
6776         case "$d_dosuid" in
6777         "$define") dflt=y ;;
6778         *) dflt=n ;;
6779         esac
6780         rp="Do you want to do setuid/setgid emulation?"
6781         . ./myread
6782         case "$ans" in
6783         [yY]*)  val="$define";;
6784         *)      val="$undef";;
6785         esac
6786         ;;
6787 esac
6788 set d_dosuid
6789 eval $setvar
6790
6791 : see if this is a malloc.h system
6792 set malloc.h i_malloc
6793 eval $inhdr
6794
6795 : see if stdlib is available
6796 set stdlib.h i_stdlib
6797 eval $inhdr
6798
6799 : determine which malloc to compile in
6800 echo " "
6801 case "$usemymalloc" in
6802 [yY]*|true|$define)     dflt='y' ;;
6803 [nN]*|false|$undef)     dflt='n' ;;
6804 *)      case "$ptrsize" in
6805         4) dflt='y' ;;
6806         *) dflt='n' ;;
6807         esac
6808         ;;
6809 esac
6810 rp="Do you wish to attempt to use the malloc that comes with $package?"
6811 . ./myread
6812 usemymalloc="$ans"
6813 case "$ans" in
6814 y*|true)
6815         usemymalloc='y'
6816         mallocsrc='malloc.c'
6817         mallocobj="malloc$_o"
6818         d_mymalloc="$define"
6819         case "$libs" in
6820         *-lmalloc*)
6821                 : Remove malloc from list of libraries to use
6822                 echo "Removing unneeded -lmalloc from library list" >&4
6823                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6824                 shift
6825                 libs="$*"
6826                 echo "libs = $libs" >&4
6827                 ;;
6828         esac
6829         ;;
6830 *)
6831         usemymalloc='n'
6832         mallocsrc=''
6833         mallocobj=''
6834         d_mymalloc="$undef"
6835         ;;
6836 esac
6837
6838 : compute the return types of malloc and free
6839 echo " "
6840 $cat >malloc.c <<END
6841 #$i_malloc I_MALLOC
6842 #$i_stdlib I_STDLIB
6843 #include <stdio.h>
6844 #include <sys/types.h>
6845 #ifdef I_MALLOC
6846 #include <malloc.h>
6847 #endif
6848 #ifdef I_STDLIB
6849 #include <stdlib.h>
6850 #endif
6851 #ifdef TRY_MALLOC
6852 void *malloc();
6853 #endif
6854 #ifdef TRY_FREE
6855 void free();
6856 #endif
6857 END
6858 case "$malloctype" in
6859 '')
6860         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6861                 malloctype='void *'
6862         else
6863                 malloctype='char *'
6864         fi
6865         ;;
6866 esac
6867 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6868
6869 case "$freetype" in
6870 '')
6871         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6872                 freetype='void'
6873         else
6874                 freetype='int'
6875         fi
6876         ;;
6877 esac
6878 echo "Your system uses $freetype free(), it would seem." >&4
6879 $rm -f malloc.[co]
6880 $cat <<EOM
6881
6882 After $package is installed, you may wish to install various
6883 add-on modules and utilities.  Typically, these add-ons will
6884 be installed under $prefix with the rest
6885 of this package.  However, you may wish to install such add-ons
6886 elsewhere under a different prefix.
6887
6888 If you do not wish to put everything under a single prefix, that's
6889 ok.  You will be prompted for the individual locations; this siteprefix
6890 is only used to suggest the defaults.
6891
6892 The default should be fine for most people.
6893
6894 EOM
6895 fn=d~+
6896 rp='Installation prefix to use for add-on modules and utilities?'
6897 : XXX Here might be another good place for an installstyle setting.
6898 case "$siteprefix" in
6899 '') dflt=$prefix ;;
6900 *)  dflt=$siteprefix ;;
6901 esac
6902 . ./getfile
6903 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6904 oldsiteprefix=''
6905 case "$siteprefix" in
6906 '') ;;
6907 *)      case "$ans" in
6908         "$prefix") ;;
6909         *) oldsiteprefix="$prefix";;
6910         esac
6911         ;;
6912 esac
6913 siteprefix="$ans"
6914 siteprefixexp="$ansexp"
6915
6916 : determine where site specific libraries go.
6917 : Usual default is /usr/local/lib/perl5/site_perl/$version
6918 : The default "style" setting is made in installstyle.U
6919 : XXX No longer works with Prefixit stuff.
6920 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6921 case "$sitelib" in
6922 '') case "$installstyle" in
6923         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6924         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6925         esac
6926         ;;
6927 *)      dflt="$sitelib"
6928         ;;
6929 esac
6930 $cat <<EOM
6931
6932 The installation process will create a directory for
6933 site-specific extensions and modules.  Most users find it convenient
6934 to place all site-specific files in this directory rather than in the
6935 main distribution directory.
6936
6937 EOM
6938 fn=d~+
6939 rp='Pathname for the site-specific library files?'
6940 . ./getfile
6941 sitelib="$ans"
6942 sitelibexp="$ansexp"
6943 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6944 : Change installation prefix, if necessary.
6945 if $test X"$prefix" != X"$installprefix"; then
6946         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6947 else
6948         installsitelib="$sitelibexp"
6949 fi
6950
6951 : determine where site specific architecture-dependent libraries go.
6952 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6953 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6954 : sitelib may have an optional trailing /share.
6955 case "$sitearch" in
6956 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6957         dflt="$dflt/$archname"
6958         ;;
6959 *)      dflt="$sitearch"
6960         ;;
6961 esac
6962 set sitearch sitearch none
6963 eval $prefixit
6964 $cat <<EOM
6965
6966 The installation process will also create a directory for
6967 architecture-dependent site-specific extensions and modules.
6968
6969 EOM
6970 fn=d~+
6971 rp='Pathname for the site-specific architecture-dependent library files?'
6972 . ./getfile
6973 sitearch="$ans"
6974 sitearchexp="$ansexp"
6975 : Change installation prefix, if necessary.
6976 if $test X"$prefix" != X"$installprefix"; then
6977         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6978 else
6979         installsitearch="$sitearchexp"
6980 fi
6981
6982 $cat <<EOM
6983
6984 The installation process will also create a directory for
6985 vendor-supplied add-ons.  Vendors who supply perl with their system
6986 may find it convenient to place all vendor-supplied files in this
6987 directory rather than in the main distribution directory.  This will
6988 ease upgrades between binary-compatible maintenance versions of perl.
6989
6990 Of course you may also use these directories in whatever way you see
6991 fit.  For example, you might use them to access modules shared over a
6992 company-wide network.
6993
6994 The default answer should be fine for most people.
6995 This causes further questions about vendor add-ons to be skipped
6996 and no vendor-specific directories will be configured for perl.
6997
6998 EOM
6999 rp='Do you want to configure vendor-specific add-on directories?'
7000 case "$usevendorprefix" in
7001 define|true|[yY]*) dflt=y ;;
7002 *)      : User may have set vendorprefix directly on Configure command line.
7003         case "$vendorprefix" in
7004         ''|' ') dflt=n ;;
7005         *)      dflt=y ;;
7006         esac
7007         ;;
7008 esac
7009 . ./myread
7010 case "$ans" in
7011 [yY]*)  fn=d~+
7012         rp='Installation prefix to use for vendor-supplied add-ons?'
7013         case "$vendorprefix" in
7014         '') dflt='' ;;
7015         *)  dflt=$vendorprefix ;;
7016         esac
7017         . ./getfile
7018         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7019         oldvendorprefix=''
7020         case "$vendorprefix" in
7021         '') ;;
7022         *)      case "$ans" in
7023                 "$prefix") ;;
7024                 *) oldvendorprefix="$prefix";;
7025                 esac
7026                 ;;
7027         esac
7028         usevendorprefix="$define"
7029         vendorprefix="$ans"
7030         vendorprefixexp="$ansexp"
7031         ;;
7032 *)      usevendorprefix="$undef"
7033         vendorprefix=''
7034         vendorprefixexp=''
7035         ;;
7036 esac
7037
7038 case "$vendorprefix" in
7039 '')     d_vendorlib="$undef"
7040         vendorlib=''
7041         vendorlibexp=''
7042         ;;
7043 *)      d_vendorlib="$define"
7044         : determine where vendor-supplied modules go.
7045         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7046         case "$vendorlib" in
7047         '')
7048                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7049                 case "$installstyle" in
7050                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7051                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7052                 esac
7053                 ;;
7054         *)      dflt="$vendorlib"
7055                 ;;
7056         esac
7057         fn=d~+
7058         rp='Pathname for the vendor-supplied library files?'
7059         . ./getfile
7060         vendorlib="$ans"
7061         vendorlibexp="$ansexp"
7062         ;;
7063 esac
7064 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7065 : Change installation prefix, if necessary.
7066 if $test X"$prefix" != X"$installprefix"; then
7067         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7068 else
7069         installvendorlib="$vendorlibexp"
7070 fi
7071
7072 case "$vendorprefix" in
7073 '')     d_vendorarch="$undef"
7074         vendorarch=''
7075         vendorarchexp=''
7076         ;;
7077 *)      d_vendorarch="$define"
7078         : determine where vendor-supplied architecture-dependent libraries go.
7079         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7080         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7081         : vendorlib may have an optional trailing /share.
7082         case "$vendorarch" in
7083         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7084                 dflt="$dflt/$archname"
7085                 ;;
7086         *)      dflt="$vendorarch" ;;
7087         esac
7088         fn=d~+
7089         rp='Pathname for vendor-supplied architecture-dependent files?'
7090         . ./getfile
7091         vendorarch="$ans"
7092         vendorarchexp="$ansexp"
7093         ;;
7094 esac
7095 : Change installation prefix, if necessary.
7096 if $test X"$prefix" != X"$installprefix"; then
7097         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7098 else
7099         installvendorarch="$vendorarchexp"
7100 fi
7101
7102 : Final catch-all directories to search
7103 $cat <<EOM
7104
7105 Lastly, you can have perl look in other directories for extensions and
7106 modules in addition to those already specified.
7107 These directories will be searched after 
7108         $sitearch 
7109         $sitelib 
7110 EOM
7111 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7112 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7113 echo ' '
7114 case "$otherlibdirs" in
7115 ''|' ') dflt='none' ;;
7116 *)      dflt="$otherlibdirs" ;;
7117 esac
7118 $cat <<EOM
7119 Enter a colon-separated set of extra paths to include in perl's @INC
7120 search path, or enter 'none' for no extra paths.
7121
7122 EOM
7123
7124 rp='Colon-separated list of additional directories for perl to search?'
7125 . ./myread
7126 case "$ans" in
7127 ' '|''|none)    otherlibdirs=' ' ;;     
7128 *)      otherlibdirs="$ans" ;;
7129 esac
7130 case "$otherlibdirs" in
7131 ' ') val=$undef ;;
7132 *)      val=$define ;;
7133 esac
7134 set d_perl_otherlibdirs
7135 eval $setvar
7136
7137 : Cruising for prototypes
7138 echo " "
7139 echo "Checking out function prototypes..." >&4
7140 $cat >prototype.c <<'EOCP'
7141 int main(int argc, char *argv[]) {
7142         exit(0);}
7143 EOCP
7144 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7145         echo "Your C compiler appears to support function prototypes."
7146         val="$define"
7147 else
7148         echo "Your C compiler doesn't seem to understand function prototypes."
7149         val="$undef"
7150 fi
7151 set prototype
7152 eval $setvar
7153 $rm -f prototype*
7154
7155 case "$prototype" in
7156 "$define") ;;
7157 *)      ansi2knr='ansi2knr'
7158         echo " "
7159         cat <<EOM >&4
7160
7161 $me:  FATAL ERROR:
7162 This version of $package can only be compiled by a compiler that 
7163 understands function prototypes.  Unfortunately, your C compiler 
7164         $cc $ccflags
7165 doesn't seem to understand them.  Sorry about that.
7166
7167 If GNU cc is available for your system, perhaps you could try that instead.  
7168
7169 Eventually, we hope to support building Perl with pre-ANSI compilers.
7170 If you would like to help in that effort, please contact <perlbug@perl.org>.
7171
7172 Aborting Configure now.
7173 EOM
7174         exit 2
7175         ;;
7176 esac
7177
7178 : determine where public executables go
7179 echo " "
7180 set dflt bin bin
7181 eval $prefixit
7182 fn=d~
7183 rp='Pathname where the public executables will reside?'
7184 . ./getfile
7185 if $test "X$ansexp" != "X$binexp"; then
7186         installbin=''
7187 fi
7188 bin="$ans"
7189 binexp="$ansexp"
7190 : Change installation prefix, if necessary.
7191 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7192 if $test X"$prefix" != X"$installprefix"; then
7193         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7194 else
7195         installbin="$binexp"
7196 fi
7197
7198 echo " "
7199 case "$extras" in
7200 '') dflt='n';;
7201 *) dflt='y';;
7202 esac
7203 cat <<EOM
7204 Perl can be built with extra modules or bundles of modules which
7205 will be fetched from the CPAN and installed alongside Perl.
7206
7207 Notice that you will need access to the CPAN; either via the Internet,
7208 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7209 be asked later to configure the CPAN.pm module which will in turn do
7210 the installation of the rest of the extra modules or bundles.)
7211
7212 Notice also that if the modules require any external software such as
7213 libraries and headers (the libz library and the zlib.h header for the
7214 Compress::Zlib module, for example) you MUST have any such software
7215 already installed, this configuration process will NOT install such
7216 things for you.
7217
7218 If this doesn't make any sense to you, just accept the default '$dflt'.
7219 EOM
7220 rp='Install any extra modules (y or n)?'
7221 . ./myread
7222 case "$ans" in
7223 y|Y)
7224         cat <<EOM
7225
7226 Please list any extra modules or bundles to be installed from CPAN,
7227 with spaces between the names.  The names can be in any format the
7228 'install' command of CPAN.pm will understand.  (Answer 'none',
7229 without the quotes, to install no extra modules or bundles.)
7230 EOM
7231         rp='Extras?'
7232         dflt="$extras"
7233         . ./myread
7234         extras="$ans"
7235 esac
7236 case "$extras" in
7237 ''|'none')
7238         val=''
7239         $rm -f ../extras.lst
7240         ;;
7241 *)      echo "(Saving the list of extras for later...)"
7242         echo "$extras" > ../extras.lst
7243         val="'$extras'"
7244         ;;
7245 esac
7246 set extras
7247 eval $setvar
7248 echo " "
7249
7250 : Find perl5.005 or later.
7251 echo "Looking for a previously installed perl5.005 or later... "
7252 case "$perl5" in
7253 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7254                 : Check if this perl is recent and can load a simple module
7255                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7256                         perl5=$tdir/perl
7257                         break;
7258                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7259                         perl5=$tdir/perl5
7260                         break;
7261                 fi
7262         done
7263         ;;
7264 *)      perl5="$perl5"
7265         ;;
7266 esac
7267 case "$perl5" in
7268 '')     echo "None found.  That's ok.";;
7269 *)      echo "Using $perl5." ;;
7270 esac
7271
7272 : Determine list of previous versions to include in @INC
7273 $cat > getverlist <<EOPL
7274 #!$perl5 -w
7275 use File::Basename;
7276 \$api_versionstring = "$api_versionstring";
7277 \$version = "$version";
7278 \$stem = "$sitelib_stem";
7279 \$archname = "$archname";
7280 EOPL
7281         $cat >> getverlist <<'EOPL'
7282 # Can't have leading @ because metaconfig interprets it as a command!
7283 ;@inc_version_list=();
7284 # XXX Redo to do opendir/readdir? 
7285 if (-d $stem) {
7286     chdir($stem);
7287     ;@candidates = glob("5.*");
7288 }
7289 else {
7290     ;@candidates = ();
7291 }
7292
7293 # XXX ToDo:  These comparisons must be reworked when two-digit
7294 # subversions come along, so that 5.7.10 compares as greater than
7295 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7296 # widespread that we can use the built-in version vectors rather
7297 # than reinventing them here.  For 5.6.0, however, we must
7298 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7299 foreach $d (@candidates) {
7300     if ($d lt $version) {
7301         if ($d ge $api_versionstring) {
7302             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7303         }
7304         elsif ($d ge "5.005") {
7305             unshift(@inc_version_list, grep { -d } $d);
7306         }
7307     }
7308     else {
7309         # Skip newer version.  I.e. don't look in
7310         # 5.7.0 if we're installing 5.6.1.
7311     }
7312 }
7313
7314 if (@inc_version_list) {
7315     print join(' ', @inc_version_list);
7316 }
7317 else {
7318     # Blank space to preserve value for next Configure run.
7319     print " ";
7320 }
7321 EOPL
7322 chmod +x getverlist
7323 case "$inc_version_list" in
7324 '')     if test -x "$perl5$exe_ext"; then
7325                 dflt=`$perl5 getverlist`
7326         else
7327                 dflt='none'
7328         fi
7329         ;;
7330 $undef) dflt='none' ;;
7331 *)  eval dflt=\"$inc_version_list\" ;;
7332 esac
7333 case "$dflt" in
7334 ''|' ') dflt=none ;;
7335 esac
7336 case "$dflt" in
7337 5.005) case "$bincompat5005" in
7338        $define|true|[yY]*) ;;
7339        *) dflt=none ;;
7340        esac
7341        ;;
7342 esac
7343 $cat <<'EOM'
7344
7345 In order to ease the process of upgrading, this version of perl 
7346 can be configured to use modules built and installed with earlier 
7347 versions of perl that were installed under $prefix.  Specify here
7348 the list of earlier versions that this version of perl should check.
7349 If Configure detected no earlier versions of perl installed under
7350 $prefix, then the list will be empty.  Answer 'none' to tell perl
7351 to not search earlier versions.
7352
7353 The default should almost always be sensible, so if you're not sure,
7354 just accept the default.
7355 EOM
7356
7357 rp='List of earlier versions to include in @INC?'
7358 . ./myread
7359 case "$ans" in
7360 [Nn]one|''|' ') inc_version_list=' ' ;;
7361 *) inc_version_list="$ans" ;;
7362 esac
7363 case "$inc_version_list" in
7364 ''|' ') 
7365         inc_version_list_init='0';;
7366 *)      inc_version_list_init=`echo $inc_version_list |
7367                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7368         ;;
7369 esac
7370 $rm -f getverlist
7371
7372 : determine whether to install perl also as /usr/bin/perl
7373
7374 echo " "
7375 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7376         $cat <<EOM
7377 Many scripts expect perl to be installed as /usr/bin/perl.
7378 I can install the perl you are about to compile also as /usr/bin/perl
7379 (in addition to $installbin/perl).
7380 EOM
7381         case "$installusrbinperl" in
7382         "$undef"|[nN]*) dflt='n';;
7383         *)              dflt='y';;
7384         esac
7385         rp="Do you want to install perl as /usr/bin/perl?"
7386         . ./myread
7387         case "$ans" in
7388         [yY]*)  val="$define";;
7389         *)      val="$undef" ;;
7390         esac
7391 else
7392         val="$undef"
7393 fi
7394 set installusrbinperl
7395 eval $setvar
7396
7397 : see if dld is available
7398 set dld.h i_dld
7399 eval $inhdr
7400
7401 : see if dlopen exists
7402 xxx_runnm="$runnm"
7403 runnm=false
7404 set dlopen d_dlopen
7405 eval $inlibc
7406 runnm="$xxx_runnm"
7407
7408 : determine which dynamic loading, if any, to compile in
7409 echo " "
7410 dldir="ext/DynaLoader"
7411 case "$usedl" in
7412 $define|y|true)
7413         dflt='y'
7414         usedl="$define"
7415         ;;
7416 $undef|n|false)
7417         dflt='n'
7418         usedl="$undef"
7419         ;;
7420 *) 
7421         dflt='n'
7422         case "$d_dlopen" in
7423             $define) dflt='y' ;;
7424         esac
7425         case "$i_dld" in
7426             $define) dflt='y' ;;
7427         esac
7428         : Does a dl_xxx.xs file exist for this operating system
7429         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7430         ;;
7431 esac
7432 rp="Do you wish to use dynamic loading?"
7433 . ./myread
7434 usedl="$ans"
7435 case "$ans" in
7436 y*) usedl="$define"
7437         case "$dlsrc" in
7438         '')
7439                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7440                         dflt="$dldir/dl_${osname}.xs"
7441                 elif $test "$d_dlopen" = "$define" ; then
7442                         dflt="$dldir/dl_dlopen.xs"
7443                 elif $test "$i_dld" = "$define" ; then
7444                         dflt="$dldir/dl_dld.xs"
7445                 else
7446                         dflt=''
7447                 fi
7448                 ;;
7449         *)      dflt="$dldir/$dlsrc"
7450                 ;;
7451         esac
7452     echo "The following dynamic loading files are available:"
7453         : Can not go over to $dldir because getfile has path hard-coded in.
7454         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7455         rp="Source file to use for dynamic loading"
7456         fn="fne"
7457         gfpth="$src"
7458         . ./getfile
7459         usedl="$define"
7460         : emulate basename
7461         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7462
7463         $cat << EOM
7464
7465 Some systems may require passing special flags to $cc -c to
7466 compile modules that will be used to create a shared library.
7467 To use no flags, say "none".
7468
7469 EOM
7470     case "$cccdlflags" in
7471     '') case "$gccversion" in
7472                 '') case "$osname" in
7473                         hpux)   dflt='+z' ;;
7474                         next)   dflt='none' ;;
7475                         irix*)  dflt='-KPIC' ;;
7476                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7477                         sunos)  dflt='-pic' ;;
7478                         *)      dflt='none' ;;
7479                     esac
7480                         ;;
7481                 *)  case "$osname" in
7482                         darwin) dflt='none' ;;
7483                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7484                         *)      dflt='-fpic' ;;
7485                     esac ;;
7486             esac ;;
7487         ' ') dflt='none' ;;
7488     *)  dflt="$cccdlflags" ;;
7489     esac
7490     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7491     . ./myread
7492     case "$ans" in
7493     none) cccdlflags=' ' ;;
7494     *) cccdlflags="$ans" ;;
7495     esac
7496
7497     cat << EOM
7498
7499 Some systems use ld to create libraries that can be dynamically loaded,
7500 while other systems (such as those using ELF) use $cc.
7501
7502 EOM
7503         case "$ld" in
7504         '')     $cat >try.c <<'EOM'
7505 /* Test for whether ELF binaries are produced */
7506 #include <fcntl.h>
7507 #include <stdlib.h>
7508 int main() {
7509         char b[4];
7510         int i = open("a.out",O_RDONLY);
7511         if(i == -1) 
7512                 exit(1); /* fail */
7513         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7514                 exit(0); /* succeed (yes, it's ELF) */
7515         else
7516                 exit(1); /* fail */
7517 }
7518 EOM
7519                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7520                         cat <<EOM
7521 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7522 EOM
7523                         dflt="$cc"
7524                 else
7525                         echo "I'll use ld to build dynamic libraries."
7526                         dflt='ld'
7527                 fi
7528                 rm -f try.c a.out
7529                 ;;
7530         *)      dflt="$ld"
7531                 ;;
7532         esac
7533
7534     rp="What command should be used to create dynamic libraries?"
7535     . ./myread
7536         ld="$ans"
7537
7538     cat << EOM
7539
7540 Some systems may require passing special flags to $ld to create a
7541 library that can be dynamically loaded.  If your ld flags include
7542 -L/other/path options to locate libraries outside your loader's normal
7543 search path, you may need to specify those -L options here as well.  To
7544 use no flags, say "none".
7545
7546 EOM
7547     case "$lddlflags" in
7548     '') case "$osname" in
7549                         beos) dflt='-nostart' ;;
7550                         hpux) dflt='-b';
7551                               case "$gccversion" in
7552                               '') dflt="$dflt +vnocompatwarnings" ;;
7553                               esac
7554                               ;;        
7555                         linux|irix*)    dflt='-shared' ;;
7556                         next)  dflt='none' ;;
7557                         solaris) dflt='-G' ;;
7558                         sunos) dflt='-assert nodefinitions' ;;
7559                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7560                 *)     dflt='none' ;;
7561                         esac
7562                         ;;
7563     *) dflt="$lddlflags" ;;
7564     esac
7565
7566         : Try to guess additional flags to pick up local libraries.
7567         : Be careful not to append to a plain 'none'
7568         case "$dflt" in
7569         none) dflt='' ;;
7570         esac
7571         for thisflag in $ldflags; do
7572                 case "$thisflag" in
7573                 -L*|-R*|-Wl,-R*)
7574                         case " $dflt " in
7575                         *" $thisflag "*) ;;
7576                         *) dflt="$dflt $thisflag" ;;
7577                         esac
7578                         ;;
7579                 esac
7580         done
7581
7582         case "$dflt" in
7583         ''|' ') dflt='none' ;;
7584         esac
7585
7586     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7587     . ./myread
7588     case "$ans" in
7589     none) lddlflags=' ' ;;
7590     *) lddlflags="$ans" ;;
7591     esac
7592
7593         cat <<EOM
7594
7595 Some systems may require passing special flags to $cc to indicate that
7596 the resulting executable will use dynamic linking.  To use no flags,
7597 say "none".
7598
7599 EOM
7600     case "$ccdlflags" in
7601     '') case "$osname" in
7602                 hpux)   dflt='-Wl,-E' ;;
7603                 linux)  dflt='-rdynamic' ;;
7604                 next)   dflt='none' ;;
7605                 sunos)  dflt='none' ;;
7606                 *)      dflt='none' ;;
7607             esac ;;
7608     ' ')  dflt='none' ;;
7609     *)  dflt="$ccdlflags" ;;
7610     esac
7611     rp="Any special flags to pass to $cc to use dynamic linking?"
7612     . ./myread
7613     case "$ans" in
7614     none) ccdlflags=' ' ;;
7615     *) ccdlflags="$ans" ;;
7616     esac
7617     ;;
7618 *)  usedl="$undef"
7619         ld='ld'
7620     dlsrc='dl_none.xs'
7621     lddlflags=''
7622     ccdlflags=''
7623     ;;
7624 esac
7625
7626 also=''
7627 case "$usedl" in
7628 $undef)
7629         # No dynamic loading being used, so don't bother even to prompt.
7630         useshrplib='false'
7631         ;;
7632 *)      case "$useshrplib" in
7633         '')     case "$osname" in
7634                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7635                         dflt=y
7636                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7637                         ;;
7638                 next*)
7639                         case "$osvers" in
7640                         4*)     dflt=y
7641                                 also='Building a shared libperl is needed for MAB support.'
7642                                 ;;
7643                         *)      dflt=n
7644                                 ;;
7645                         esac
7646                         ;;
7647                 *)      dflt=n
7648                         ;;
7649                 esac
7650                 ;;
7651         $define|true|[Yy]*)
7652                 dflt=y
7653                 ;;
7654         *)      dflt=n
7655                 ;;
7656         esac
7657         $cat << EOM
7658
7659 The perl executable is normally obtained by linking perlmain.c with
7660 libperl${_a}, any static extensions (usually just DynaLoader), and
7661 any other libraries needed on this system (such as -lm, etc.).  Since
7662 your system supports dynamic loading, it is probably possible to build
7663 a shared libperl.$so.  If you will have more than one executable linked
7664 to libperl.$so, this will significantly reduce the size of each
7665 executable, but it may have a noticeable affect on performance.  The
7666 default is probably sensible for your system.
7667 $also
7668
7669 EOM
7670         rp="Build a shared libperl.$so (y/n)"
7671         . ./myread
7672         case "$ans" in
7673         true|$define|[Yy]*)
7674                 useshrplib='true'  ;;
7675         *)      useshrplib='false' ;;
7676         esac
7677         ;;
7678 esac
7679
7680 case "$useshrplib" in
7681 true)
7682         case "$libperl" in
7683         '')
7684                 # Figure out a good name for libperl.so.  Since it gets stored in
7685                 # a version-specific architecture-dependent library, the version
7686                 # number isn't really that important, except for making cc/ld happy.
7687                 #
7688                 # A name such as libperl.so.3.1
7689                 majmin="libperl.$so.$patchlevel.$subversion"
7690                 # A name such as libperl.so.301
7691                 majonly=`echo $patchlevel $subversion |
7692                         $awk '{printf "%d%02d", $1, $2}'`
7693                 majonly=libperl.$so.$majonly
7694                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7695                 # rely on figuring it out from the naming of libc.
7696                 case "${osname}${osvers}" in
7697                 next4*)
7698                         dflt=libperl.5.$so
7699                         # XXX How handle the --version stuff for MAB?
7700                         ;;
7701                 linux*)  # ld won't link with a bare -lperl otherwise.
7702                         dflt=libperl.$so
7703                         ;;
7704                 cygwin*) # ld links against an importlib
7705                         dflt=libperl$lib_ext
7706                         ;;
7707                 *)      # Try to guess based on whether libc has major.minor.
7708                         case "$libc" in
7709                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7710                         *libc.$so.[0-9]*) dflt=$majonly ;;
7711                         *)      dflt=libperl.$so ;;
7712                         esac
7713                         ;;
7714                 esac
7715                 ;;
7716         *)      dflt=$libperl
7717                 ;;
7718         esac
7719         cat << EOM
7720
7721 I need to select a good name for the shared libperl.  If your system uses
7722 library names with major and minor numbers, then you might want something
7723 like $majmin.  Alternatively, if your system uses a single version
7724 number for shared libraries, then you might want to use $majonly.
7725 Or, your system might be quite happy with a simple libperl.$so.
7726
7727 Since the shared libperl will get installed into a version-specific
7728 architecture-dependent directory, the version number of the shared perl
7729 library probably isn't important, so the default should be o.k.
7730
7731 EOM
7732         rp='What name do you want to give to the shared libperl?'
7733         . ./myread
7734         libperl=$ans
7735         echo "Ok, I'll use $libperl"
7736         ;;
7737 *)
7738         libperl="libperl${_a}"
7739         ;;
7740 esac
7741
7742 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7743 case "$shrpdir" in
7744 '') ;;
7745 *)      $cat >&4 <<EOM
7746 WARNING:  Use of the shrpdir variable for the installation location of
7747 the shared $libperl is not supported.  It was never documented and
7748 will not work in this version.  Let me (perlbug@perl.org)
7749 know of any problems this may cause.
7750
7751 EOM
7752         case "$shrpdir" in
7753         "$archlibexp/CORE")
7754                 $cat >&4 <<EOM
7755 But your current setting of $shrpdir is
7756 the default anyway, so it's harmless.
7757 EOM
7758                 ;;
7759         *)
7760                 $cat >&4 <<EOM
7761 Further, your current attempted setting of $shrpdir
7762 conflicts with the value of $archlibexp/CORE
7763 that installperl will use.
7764 EOM
7765                 ;;
7766         esac
7767         ;;
7768 esac
7769
7770 # How will the perl executable find the installed shared $libperl?
7771 # Add $xxx to ccdlflags.
7772 # If we can't figure out a command-line option, use $shrpenv to
7773 # set env LD_RUN_PATH.  The main perl makefile uses this.
7774 shrpdir=$archlibexp/CORE
7775 xxx=''
7776 tmp_shrpenv=''
7777 if "$useshrplib"; then
7778     case "$osname" in 
7779         aix)
7780                 # We'll set it in Makefile.SH...
7781                 ;;
7782         solaris)
7783                 xxx="-R $shrpdir"
7784                 ;;
7785         freebsd|netbsd)
7786                 xxx="-Wl,-R$shrpdir"
7787                 ;;
7788         bsdos|linux|irix*|dec_osf)
7789                 xxx="-Wl,-rpath,$shrpdir"
7790                 ;;
7791         next)
7792                 # next doesn't like the default...
7793                 ;;
7794         beos)
7795                 # beos doesn't like the default, either.
7796                 ;;
7797         hpux*)
7798                 # hpux doesn't like the default, either.
7799                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7800                 ;;
7801         *)
7802                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7803                 ;;
7804         esac
7805         case "$xxx" in
7806         '') ;;
7807         *)      
7808                 # Only add $xxx if it isn't already in ccdlflags.
7809                 case " $ccdlflags " in
7810                 *" $xxx "*)     ;;
7811                 *)      ccdlflags="$ccdlflags $xxx"
7812                         cat <<EOM >&4
7813
7814 Adding $xxx to the flags
7815 passed to $ld so that the perl executable will find the 
7816 installed shared $libperl.
7817
7818 EOM
7819                         ;;
7820                 esac
7821                 ;;
7822         esac
7823 fi
7824 # Fix ccdlflags in AIX for building external extensions.
7825 # (For building Perl itself bare -bE:perl.exp is needed,
7826 #  Makefile.SH takes care of this.)
7827 case "$osname" in
7828 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7829 esac
7830 # Respect a hint or command-line value.
7831 case "$shrpenv" in
7832 '') shrpenv="$tmp_shrpenv" ;;
7833 esac
7834 case "$ldlibpthname" in
7835 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7836 none)   ldlibpthname='' ;;
7837 esac
7838
7839 : determine where manual pages are on this system
7840 echo " "
7841 case "$sysman" in
7842 '') 
7843         syspath='/usr/share/man/man1 /usr/man/man1'
7844         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7845         syspath="$syspath /usr/man/u_man/man1"
7846         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7847         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7848         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7849         sysman=`./loc . /usr/man/man1 $syspath`
7850         ;;
7851 esac
7852 if $test -d "$sysman"; then
7853         echo "System manual is in $sysman." >&4
7854 else
7855         echo "Could not find manual pages in source form." >&4
7856 fi
7857
7858 : determine where manual pages go
7859 set man1dir man1dir none
7860 eval $prefixit
7861 $cat <<EOM
7862
7863 $spackage has manual pages available in source form.
7864 EOM
7865 case "$nroff" in
7866 nroff)
7867         echo "However, you don't have nroff, so they're probably useless to you."
7868         case "$man1dir" in
7869         '') man1dir="none";;
7870         esac;;
7871 esac
7872 echo "If you don't want the manual sources installed, answer 'none'."
7873 case "$man1dir" in
7874 ' ') dflt=none
7875         ;;
7876 '')
7877         lookpath="$prefixexp/share/man/man1"
7878         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7879         lookpath="$lookpath $prefixexp/man/p_man/man1"
7880         lookpath="$lookpath $prefixexp/man/u_man/man1"
7881         lookpath="$lookpath $prefixexp/man/man.1"
7882         case "$sysman" in
7883         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7884         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7885         esac
7886         set dflt
7887         eval $prefixup
7888         ;;
7889 *)  dflt="$man1dir"
7890         ;;
7891 esac
7892 echo " "
7893 fn=dn+~
7894 rp="Where do the main $spackage manual pages (source) go?"
7895 . ./getfile
7896 if $test "X$man1direxp" != "X$ansexp"; then
7897         installman1dir=''
7898 fi
7899 man1dir="$ans"
7900 man1direxp="$ansexp"
7901 case "$man1dir" in
7902 '')     man1dir=' '
7903         installman1dir='';;
7904 esac
7905
7906 : Change installation prefix, if necessary.
7907 if $test X"$prefix" != X"$installprefix"; then
7908         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7909 else
7910         installman1dir="$man1direxp"
7911 fi
7912
7913 : What suffix to use on installed man pages
7914
7915 case "$man1dir" in
7916 ' ')
7917         man1ext='0'
7918         ;;
7919 *)
7920         rp="What suffix should be used for the main $spackage man pages?"
7921         case "$man1ext" in
7922         '')     case "$man1dir" in
7923                 *1)  dflt=1 ;;
7924                 *1p) dflt=1p ;;
7925                 *1pm) dflt=1pm ;;
7926                 *l) dflt=l;;
7927                 *n) dflt=n;;
7928                 *o) dflt=o;;
7929                 *p) dflt=p;;
7930                 *C) dflt=C;;
7931                 *L) dflt=L;;
7932                 *L1) dflt=L1;;
7933                 *) dflt=1;;
7934                 esac
7935                 ;;
7936         *)      dflt="$man1ext";;
7937         esac
7938         . ./myread
7939         man1ext="$ans"
7940         ;;
7941 esac
7942
7943 : see if we can have long filenames
7944 echo " "
7945 first=123456789abcdef
7946 $rm -f $first
7947 if (echo hi >$first) 2>/dev/null; then
7948         if $test -f 123456789abcde; then
7949                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7950                 val="$undef"
7951         else
7952                 echo 'You can have filenames longer than 14 characters.'>&4
7953                 val="$define"
7954         fi
7955 else
7956         $cat <<'EOM'
7957 You can't have filenames longer than 14 chars.
7958 You can't even think about them!
7959 EOM
7960         val="$undef"
7961 fi 
7962 set d_flexfnam
7963 eval $setvar
7964 $rm -rf 123456789abcde*
7965
7966 : determine where library module manual pages go
7967 set man3dir man3dir none
7968 eval $prefixit
7969 $cat <<EOM
7970
7971 $spackage has manual pages for many of the library modules.
7972 EOM
7973
7974 case "$nroff" in
7975 nroff)
7976         $cat <<'EOM'
7977 However, you don't have nroff, so they're probably useless to you.
7978 EOM
7979         case "$man3dir" in
7980         '') man3dir="none";;
7981         esac;;
7982 esac
7983
7984 case "$d_flexfnam" in
7985 undef)
7986         $cat <<'EOM'
7987 However, your system can't handle the long file names like File::Basename.3. 
7988 EOM
7989         case "$man3dir" in
7990         '') man3dir="none";;
7991         esac;;
7992 esac
7993
7994 echo "If you don't want the manual sources installed, answer 'none'."
7995 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7996 case "$man3dir" in
7997 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7998         if $test -d "$privlib/man/man3"; then
7999                 cat <<EOM >&4
8000
8001 WARNING:  Previous versions of perl installed man3 pages into
8002 $privlib/man/man3.  This version will suggest a 
8003 new default of $dflt.  
8004 EOM
8005                 tdflt=$dflt
8006                 dflt='n'
8007                 rp='Do you wish to preserve the old behavior?(y/n)'
8008                 . ./myread
8009                 case "$ans" in
8010                 y*) dflt="$privlib/man/man3" ;;
8011                 *)  dflt=$tdflt ;;
8012                 esac
8013     fi
8014         ;;
8015 *)      dflt="$man3dir" ;;
8016 esac
8017 case "$dflt" in
8018 ' ') dflt=none ;;
8019 esac
8020 echo " "
8021 fn=dn+~
8022 rp="Where do the $package library man pages (source) go?"
8023 . ./getfile
8024 man3dir="$ans"
8025 man3direxp="$ansexp"
8026 case "$man3dir" in
8027 '')     man3dir=' '
8028         installman3dir='';;
8029 esac
8030
8031 : Change installation prefix, if necessary.
8032 if $test X"$prefix" != X"$installprefix"; then
8033         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8034 else
8035         installman3dir="$man3direxp"
8036 fi
8037
8038 : What suffix to use on installed man pages
8039 case "$man3dir" in
8040 ' ')
8041         man3ext='0'
8042         ;;
8043 *)
8044         rp="What suffix should be used for the $package library man pages?"
8045         case "$man3ext" in
8046         '')     case "$man3dir" in
8047                 *3)  dflt=3 ;;
8048                 *3p) dflt=3p ;;
8049                 *3pm) dflt=3pm ;;
8050                 *l) dflt=l;;
8051                 *n) dflt=n;;
8052                 *o) dflt=o;;
8053                 *p) dflt=p;;
8054                 *C) dflt=C;;
8055                 *L) dflt=L;;
8056                 *L3) dflt=L3;;
8057                 *) dflt=3;;
8058                 esac
8059                 ;;
8060         *)      dflt="$man3ext";;
8061         esac
8062         . ./myread
8063         man3ext="$ans"
8064         ;;
8065 esac
8066
8067 : see if we have to deal with yellow pages, now NIS.
8068 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8069         if $test -f /usr/etc/nibindd; then
8070                 echo " "
8071                 echo "I'm fairly confident you're on a NeXT."
8072                 echo " "
8073                 rp='Do you get the hosts file via NetInfo?'
8074                 dflt=y
8075                 case "$hostcat" in
8076                 nidump*) ;;
8077                 '') ;;
8078                 *) dflt=n;;
8079                 esac
8080                 . ./myread
8081                 case "$ans" in
8082                 y*) hostcat='nidump hosts .';;
8083                 *)      case "$hostcat" in
8084                         nidump*) hostcat='';;
8085                         esac
8086                         ;;
8087                 esac
8088         fi
8089         case "$hostcat" in
8090         nidump*) ;;
8091         *)
8092                 case "$hostcat" in
8093                 *ypcat*) dflt=y;;
8094                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8095                                 dflt=y
8096                         else
8097                                 dflt=n
8098                         fi;;
8099                 *) dflt=n;;
8100                 esac
8101                 echo " "
8102                 rp='Are you getting the hosts file via yellow pages?'
8103                 . ./myread
8104                 case "$ans" in
8105                 y*) hostcat='ypcat hosts';;
8106                 *) hostcat='cat /etc/hosts';;
8107                 esac
8108                 ;;
8109         esac
8110 fi
8111 case "$hostcat" in
8112 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8113 esac
8114 case "$groupcat" in
8115 '') test -f /etc/group && groupcat='cat /etc/group';;
8116 esac
8117 case "$passcat" in
8118 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8119 esac
8120
8121 : now get the host name
8122 echo " "
8123 echo "Figuring out host name..." >&4
8124 case "$myhostname" in
8125 '') cont=true
8126         echo 'Maybe "hostname" will work...'
8127         if tans=`sh -c hostname 2>&1` ; then
8128                 myhostname=$tans
8129                 phostname=hostname
8130                 cont=''
8131         fi
8132         ;;
8133 *) cont='';;
8134 esac
8135 if $test "$cont"; then
8136         if ./xenix; then
8137                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8138                 if tans=`cat /etc/systemid 2>&1` ; then
8139                         myhostname=$tans
8140                         phostname='cat /etc/systemid'
8141                         echo "Whadyaknow.  Xenix always was a bit strange..."
8142                         cont=''
8143                 fi
8144         elif $test -r /etc/systemid; then
8145                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8146         fi
8147 fi
8148 if $test "$cont"; then
8149         echo 'No, maybe "uuname -l" will work...'
8150         if tans=`sh -c 'uuname -l' 2>&1` ; then
8151                 myhostname=$tans
8152                 phostname='uuname -l'
8153         else
8154                 echo 'Strange.  Maybe "uname -n" will work...'
8155                 if tans=`sh -c 'uname -n' 2>&1` ; then
8156                         myhostname=$tans
8157                         phostname='uname -n'
8158                 else
8159                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8160                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8161                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8162                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8163                         else
8164                                 case "$myhostname" in
8165                                 '') echo "Does this machine have an identity crisis or something?"
8166                                         phostname='';;
8167                                 *)
8168                                         echo "Well, you said $myhostname before..."
8169                                         phostname='echo $myhostname';;
8170                                 esac
8171                         fi
8172                 fi
8173         fi
8174 fi
8175 case "$myhostname" in
8176 '') myhostname=noname ;;
8177 esac
8178 : you do not want to know about this
8179 set $myhostname
8180 myhostname=$1
8181
8182 : verify guess
8183 if $test "$myhostname" ; then
8184         dflt=y
8185         rp='Your host name appears to be "'$myhostname'".'" Right?"
8186         . ./myread
8187         case "$ans" in
8188         y*) ;;
8189         *) myhostname='';;
8190         esac
8191 fi
8192
8193 : bad guess or no guess
8194 while $test "X$myhostname" = X ; do
8195         dflt=''
8196         rp="Please type the (one word) name of your host:"
8197         . ./myread
8198         myhostname="$ans"
8199 done
8200
8201 : translate upper to lower if necessary
8202 case "$myhostname" in
8203 *[A-Z]*)
8204         echo "(Normalizing case in your host name)"
8205         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8206         ;;
8207 esac
8208
8209 case "$myhostname" in
8210 *.*)
8211         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8212         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8213         echo "(Trimming domain name from host name--host name is now $myhostname)"
8214         ;;
8215 *) case "$mydomain" in
8216         '')
8217                 {
8218                         test "X$hostcat" = "Xypcat hosts" &&
8219                         ypmatch "$myhostname" hosts 2>/dev/null |\
8220                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8221                         $test -s hosts
8222                 } || {
8223                         test "X$hostcat" != "X" &&
8224                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8225                                         /[       ]$myhostname[  . ]/p" > hosts
8226                 }
8227                 tmp_re="[       . ]"
8228                 if $test -f hosts; then
8229                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8230                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8231                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8232                                 hosts | $sort | $uniq | \
8233                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8234                         case `$echo X$dflt` in
8235                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8236                                 dflt=.
8237                                 ;;
8238                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8239                                 ;;
8240                         esac
8241                 else
8242                         echo "(I cannot locate a hosts database anywhere)"
8243                         dflt=.
8244                 fi
8245                 case "$dflt" in
8246                 .)
8247                         tans=`./loc resolv.conf X /etc /usr/etc`
8248                         if $test -f "$tans"; then
8249                                 echo "(Attempting domain name extraction from $tans)"
8250                                 dflt=.`$sed -n -e 's/   / /g' \
8251                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8252                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8253                                 case "$dflt" in
8254                                 .) dflt=.`$sed -n -e 's/        / /g' \
8255                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8256                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8257                                         ;;
8258                                 esac
8259                         fi
8260                         ;;
8261                 esac
8262                 case "$dflt" in
8263                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8264                         dflt=.`sh -c domainname 2>/dev/null`
8265                         case "$dflt" in
8266                         '') dflt='.';;
8267                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8268                         esac
8269                         ;;
8270                 esac
8271                 case "$dflt$osname" in
8272                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8273                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8274                         ;;
8275                 esac
8276                 case "$dflt" in
8277                 .) echo "(Lost all hope -- silly guess then)"
8278                         dflt='.nonet'
8279                         ;;
8280                 esac
8281                 $rm -f hosts
8282                 ;;
8283         *) dflt="$mydomain";;
8284         esac;;
8285 esac
8286 echo " "
8287 rp="What is your domain name?"
8288 . ./myread
8289 tans="$ans"
8290 case "$ans" in
8291 '') ;;
8292 .*) ;;
8293 *) tans=".$tans";;
8294 esac
8295 mydomain="$tans"
8296
8297 : translate upper to lower if necessary
8298 case "$mydomain" in
8299 *[A-Z]*)
8300         echo "(Normalizing case in your domain name)"
8301         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8302         ;;
8303 esac
8304
8305 : a little sanity check here
8306 case "$phostname" in
8307 '') ;;
8308 *)
8309         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8310         $myhostname$mydomain|$myhostname) ;;
8311         *)
8312                 case "$phostname" in
8313                 sed*)
8314                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8315                         ;;
8316                 *)
8317                         echo "(That doesn't agree with your $phostname command, by the way.)"
8318                         ;;
8319                 esac
8320         ;;
8321         esac
8322         ;;
8323 esac
8324
8325 $cat <<EOM
8326
8327 I need to get your e-mail address in Internet format if possible, i.e.
8328 something like user@host.domain. Please answer accurately since I have
8329 no easy means to double check it. The default value provided below
8330 is most probably close to reality but may not be valid from outside
8331 your organization...
8332
8333 EOM
8334 cont=x
8335 while test "$cont"; do
8336         case "$cf_email" in
8337         '') dflt="$cf_by@$myhostname$mydomain";;
8338         *) dflt="$cf_email";;
8339         esac
8340         rp='What is your e-mail address?'
8341         . ./myread
8342         cf_email="$ans"
8343         case "$cf_email" in
8344         *@*.*) cont='' ;;
8345         *)
8346                 rp='Address does not look like an Internet one.  Use it anyway?'
8347                 case "$fastread" in
8348                 yes) dflt=y ;;
8349                 *) dflt=n ;;
8350                 esac
8351                 . ./myread
8352                 case "$ans" in
8353                 y*) cont='' ;;
8354                 *) echo " " ;;
8355                 esac
8356                 ;;
8357         esac
8358 done
8359
8360 $cat <<EOM
8361
8362 If you or somebody else will be maintaining perl at your site, please
8363 fill in the correct e-mail address here so that they may be contacted
8364 if necessary. Currently, the "perlbug" program included with perl
8365 will send mail to this address in addition to perlbug@perl.org. You may
8366 enter "none" for no administrator.
8367
8368 EOM
8369 case "$perladmin" in
8370 '') dflt="$cf_email";;
8371 *) dflt="$perladmin";;
8372 esac
8373 rp='Perl administrator e-mail address'
8374 . ./myread
8375 perladmin="$ans"
8376
8377 : determine whether to only install version-specific parts.
8378 echo " "
8379 $cat <<EOM
8380 Do you want to install only the version-specific parts of the perl
8381 distribution?  Usually you do *not* want to do this.
8382 EOM
8383 case "$versiononly" in
8384 "$define"|[Yy]*|true) dflt='y' ;;
8385 *) dflt='n';
8386 esac
8387 rp="Do you want to install only the version-specific parts of perl?"
8388 . ./myread
8389 case "$ans" in
8390 [yY]*)  val="$define";;
8391 *)      val="$undef" ;;
8392 esac
8393 set versiononly
8394 eval $setvar
8395
8396 case "$versiononly" in
8397 "$define") inc_version_list=''
8398            inc_version_list_init=0
8399            ;;
8400 esac
8401
8402 : figure out how to guarantee perl startup
8403 case "$startperl" in
8404 '')
8405         case "$sharpbang" in
8406         *!)
8407                 $cat <<EOH
8408
8409 I can use the #! construct to start perl on your system. This will
8410 make startup of perl scripts faster, but may cause problems if you
8411 want to share those scripts and perl is not in a standard place
8412 ($binexp/perl) on all your platforms. The alternative is to force
8413 a shell by starting the script with a single ':' character.
8414
8415 EOH
8416                 case "$versiononly" in
8417                 "$define")      dflt="$binexp/perl$version";;  
8418                 *)              dflt="$binexp/perl";;
8419                 esac
8420                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8421                 . ./myread
8422                 case "$ans" in
8423                 none)   startperl=": # use perl";;
8424                 *)      startperl="#!$ans"
8425                         if $test 30 -lt `echo "$ans" | wc -c`; then
8426                                 $cat >&4 <<EOM
8427
8428 WARNING:  Some systems limit the #! command to 32 characters.
8429 If you experience difficulty running Perl scripts with #!, try
8430 installing Perl in a directory with a shorter pathname.
8431
8432 EOM
8433                         fi ;;
8434                 esac
8435                 ;;
8436         *) startperl=": # use perl"
8437                 ;;
8438         esac
8439         ;;
8440 esac
8441 echo "I'll use $startperl to start perl scripts."
8442
8443 : figure best path for perl in scripts
8444 case "$perlpath" in
8445 '')
8446         case "$versiononly" in
8447         "$define")      perlpath="$binexp/perl$version";;
8448         *)              perlpath="$binexp/perl";;
8449         esac
8450         case "$startperl" in
8451         *!*) ;;
8452         *)
8453                 $cat <<EOH
8454
8455 I will use the "eval 'exec'" idiom to start Perl on your system.
8456 I can use the full path of your Perl binary for this purpose, but
8457 doing so may cause problems if you want to share those scripts and
8458 Perl is not always in a standard place ($binexp/perl).
8459
8460 EOH
8461                 dflt="$binexp/perl"
8462                 rp="What path shall I use in \"eval 'exec'\"?"
8463                 . ./myread
8464                 perlpath="$ans"
8465                 ;;
8466         esac
8467         ;;
8468 esac
8469 case "$startperl" in
8470 *!*)    ;;
8471 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8472 esac
8473
8474 : determine where public executable scripts go
8475 set scriptdir scriptdir
8476 eval $prefixit
8477 case "$scriptdir" in
8478 '')
8479         dflt="$bin"
8480         : guess some guesses
8481         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8482         $test -d /usr/share/bin     && dflt=/usr/share/bin
8483         $test -d /usr/local/script  && dflt=/usr/local/script
8484         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8485         $test -d $prefixexp/script  && dflt=$prefixexp/script
8486         set dflt
8487         eval $prefixup
8488         ;;
8489 *)  dflt="$scriptdir"
8490         ;;
8491 esac
8492 $cat <<EOM
8493  
8494 Some installations have a separate directory just for executable scripts so
8495 that they can mount it across multiple architectures but keep the scripts in
8496 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8497 Or you might just lump your scripts in with all your other executables.
8498  
8499 EOM
8500 fn=d~
8501 rp='Where do you keep publicly executable scripts?'
8502 . ./getfile
8503 if $test "X$ansexp" != "X$scriptdirexp"; then
8504         installscript=''
8505 fi
8506 scriptdir="$ans"
8507 scriptdirexp="$ansexp"
8508 : Change installation prefix, if necessary.
8509 if $test X"$prefix" != X"$installprefix"; then
8510         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8511 else
8512         installscript="$scriptdirexp"
8513 fi
8514
8515 : determine where add-on public executables go
8516 case "$sitebin" in
8517 '')     dflt=$siteprefix/bin ;;
8518 *)      dflt=$sitebin ;;
8519 esac
8520 fn=d~
8521 rp='Pathname where the add-on public executables should be installed?'
8522 . ./getfile
8523 sitebin="$ans"
8524 sitebinexp="$ansexp"
8525 : Change installation prefix, if necessary.
8526 if $test X"$prefix" != X"$installprefix"; then
8527         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8528 else
8529         installsitebin="$sitebinexp"
8530 fi
8531
8532 : define an is-a-typedef? function
8533 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8534 case "$inclist" in
8535 "") inclist="sys/types.h";;
8536 esac;
8537 eval "varval=\$$var";
8538 case "$varval" in
8539 "")
8540         $rm -f temp.c;
8541         for inc in $inclist; do
8542                 echo "#include <$inc>" >>temp.c;
8543         done;
8544         echo "#ifdef $type" >> temp.c;
8545         echo "printf(\"We have $type\");" >> temp.c;
8546         echo "#endif" >> temp.c;
8547         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8548         if $contains $type temp.E >/dev/null 2>&1; then
8549                 eval "$var=\$type";
8550         else
8551                 eval "$var=\$def";
8552         fi;
8553         $rm -f temp.?;;
8554 *) eval "$var=\$varval";;
8555 esac'
8556
8557 : define an is-a-typedef? function that prompts if the type is not available.
8558 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8559 case "$inclist" in
8560 "") inclist="sys/types.h";;
8561 esac;
8562 eval "varval=\$$var";
8563 case "$varval" in
8564 "")
8565         $rm -f temp.c;
8566         for inc in $inclist; do
8567                 echo "#include <$inc>" >>temp.c;
8568         done;
8569         echo "#ifdef $type" >> temp.c;
8570         echo "printf(\"We have $type\");" >> temp.c;
8571         echo "#endif" >> temp.c;
8572         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8573         echo " " ;
8574         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8575         if $contains $type temp.E >/dev/null 2>&1; then
8576                 echo "$type found." >&4;
8577                 eval "$var=\$type";
8578         else
8579                 echo "$type NOT found." >&4;
8580                 dflt="$def";
8581                 . ./myread ;
8582                 eval "$var=\$ans";
8583         fi;
8584         $rm -f temp.?;;
8585 *) eval "$var=\$varval";;
8586 esac'
8587
8588 : see what type lseek is declared as in the kernel
8589 rp="What is the type used for lseek's offset on this system?"
8590 set off_t lseektype long stdio.h sys/types.h
8591 eval $typedef_ask
8592
8593 echo " "
8594 echo "Checking to see how big your file offsets are..." >&4
8595 $cat >try.c <<EOCP
8596 #include <sys/types.h>
8597 #include <stdio.h>
8598 int main()
8599 {
8600     printf("%d\n", (int)sizeof($lseektype));
8601     return(0); 
8602 }
8603 EOCP
8604 set try
8605 if eval $compile_ok; then
8606         lseeksize=`$run ./try`
8607         echo "Your file offsets are $lseeksize bytes long."
8608 else
8609         dflt=$longsize
8610         echo " "
8611         echo "(I can't seem to compile the test program.  Guessing...)"
8612         rp="What is the size of your file offsets (in bytes)?"
8613         . ./myread
8614         lseeksize="$ans"
8615 fi
8616 $rm -f try.c try
8617
8618 : see what type file positions are declared as in the library
8619 rp="What is the type for file position used by fsetpos()?"
8620 set fpos_t fpostype long stdio.h sys/types.h
8621 eval $typedef_ask
8622
8623 echo " "
8624 case "$fpostype" in
8625 *_t) zzz="$fpostype"    ;;
8626 *)   zzz="fpos_t"       ;;
8627 esac
8628 echo "Checking the size of $zzz..." >&4 
8629 cat > try.c <<EOCP
8630 #include <sys/types.h>
8631 #include <stdio.h>
8632 int main() {
8633     printf("%d\n", (int)sizeof($fpostype));
8634     exit(0);
8635 }
8636 EOCP
8637 set try
8638 if eval $compile_ok; then
8639         yyy=`$run ./try`
8640         case "$yyy" in
8641         '')     fpossize=4
8642                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8643                 ;;
8644         *)      fpossize=$yyy
8645                 echo "Your $zzz is $fpossize bytes long."
8646                 ;;
8647         esac
8648 else
8649         dflt="$longsize"
8650         echo " " >&4
8651         echo "(I can't compile the test program.  Guessing...)" >&4
8652         rp="What is the size of your file positions (in bytes)?"
8653         . ./myread
8654         fpossize="$ans"
8655 fi
8656
8657
8658
8659 # Backward compatibility (uselfs is deprecated).
8660 case "$uselfs" in
8661 "$define"|true|[yY]*)
8662         cat <<EOM >&4
8663
8664 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8665 EOM
8666         uselargefiles="$define"
8667         ;;
8668 esac                          
8669
8670 case "$lseeksize:$fpossize" in
8671 8:8) cat <<EOM
8672
8673 You can have files larger than 2 gigabytes.
8674 EOM
8675    val="$define" ;;
8676 *)    case "$uselargefiles" in
8677    "$undef"|false|[nN]*) dflt='n' ;;
8678    *)   dflt='y' ;;
8679    esac
8680    cat <<EOM
8681
8682 Perl can be built to understand large files (files larger than 2 gigabytes)
8683 on some systems.  To do so, Configure can be run with -Duselargefiles.
8684
8685 If this doesn't make any sense to you, just accept the default '$dflt'.
8686 EOM
8687    rp='Try to understand large files, if available?'
8688    . ./myread
8689    case "$ans" in
8690    y|Y)         val="$define" ;;
8691    *)           val="$undef"  ;;
8692    esac
8693    ;;
8694 esac
8695 set uselargefiles
8696 eval $setvar
8697 case "$uselargefiles" in
8698 "$define")
8699 : Look for a hint-file generated 'call-back-unit'.  If the
8700 : user has specified that a large files perl is to be built,
8701 : we may need to set or change some other defaults.
8702         if $test -f uselargefiles.cbu; then
8703                 echo "Your platform has some specific hints for large file builds, using them..."
8704                 . ./uselargefiles.cbu
8705                 echo " "
8706                 echo "Rechecking to see how big your file offsets are..." >&4
8707                 $cat >try.c <<EOCP
8708 #include <sys/types.h>
8709 #include <stdio.h>
8710 int main()
8711 {
8712     printf("%d\n", (int)sizeof($lseektype));
8713     return(0); 
8714 }
8715 EOCP
8716                 set try
8717                 if eval $compile_ok; then
8718                         lseeksize=`$run ./try`
8719                         $echo "Your file offsets are now $lseeksize bytes long."
8720                 else
8721                         dflt="$lseeksize"
8722                         echo " "
8723                         echo "(I can't seem to compile the test program.  Guessing...)"
8724                         rp="What is the size of your file offsets (in bytes)?"
8725                         . ./myread
8726                         lseeksize="$ans"
8727                 fi
8728                 case "$fpostype" in
8729                 *_t) zzz="$fpostype"    ;;
8730                 *)   zzz="fpos_t"       ;;
8731                 esac
8732                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8733                 $cat > try.c <<EOCP
8734 #include <sys/types.h>
8735 #include <stdio.h>
8736 int main() {
8737     printf("%d\n", (int)sizeof($fpostype));
8738     exit(0);
8739 }
8740 EOCP
8741                 set try
8742                 if eval $compile_ok; then
8743                         yyy=`$run ./try`
8744                         dflt="$lseeksize"
8745                         case "$yyy" in
8746                         '')     echo " "
8747                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8748                                 ;;
8749                         *)      fpossize=$yyy
8750                                 echo " $fpossize bytes." >&4
8751                                 ;;
8752                         esac
8753                 else
8754                         dflt="$fpossize"
8755                         echo " "
8756                         echo "(I can't compile the test program.  Guessing...)" >&4
8757                         rp="What is the size of your file positions (in bytes)?"
8758                         . ./myread
8759                         fpossize="$ans"
8760                 fi
8761                 $rm -f try.c try
8762         fi
8763         ;;
8764 esac
8765
8766 case "$vendorprefix" in
8767 '')     d_vendorbin="$undef"
8768         vendorbin=''
8769         vendorbinexp=''
8770         ;;
8771 *)      d_vendorbin="$define"
8772         : determine where vendor-supplied executables go.
8773         case "$vendorbin" in
8774         '') dflt=$vendorprefix/bin ;;
8775         *)      dflt="$vendorbin" ;;
8776         esac
8777         fn=d~+
8778         rp='Pathname for the vendor-supplied executables directory?'
8779         . ./getfile
8780         vendorbin="$ans"
8781         vendorbinexp="$ansexp"
8782         ;;
8783 esac
8784 : Change installation prefix, if necessary.
8785 if $test X"$prefix" != X"$installprefix"; then
8786         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8787 else
8788         installvendorbin="$vendorbinexp"
8789 fi
8790
8791 : see if qgcvt exists
8792 set qgcvt d_qgcvt
8793 eval $inlibc
8794
8795 : Check how to convert floats to strings.
8796
8797 if test "X$d_Gconvert" = X; then
8798
8799 echo " "
8800 echo "Checking for an efficient way to convert floats to strings."
8801 echo " " > try.c
8802 case "$uselongdouble" in
8803 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8804 esac
8805 case "$d_longdbl" in
8806 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8807 esac
8808 case "$d_PRIgldbl" in
8809 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8810 esac
8811 $cat >>try.c <<EOP
8812 #ifdef TRY_gconvert
8813 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8814 char *myname = "gconvert";
8815 #endif
8816 #ifdef TRY_gcvt
8817 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8818 char *myname = "gcvt";
8819 #endif
8820 #ifdef TRY_qgcvt
8821 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8822 char *myname = "qgcvt";
8823 #define DOUBLETYPE long double
8824 #endif
8825 #ifdef TRY_sprintf
8826 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8827 #ifdef HAS_PRIgldbl
8828 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8829 #else
8830 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8831 #endif
8832 #else
8833 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8834 #endif
8835 char *myname = "sprintf";
8836 #endif
8837
8838 #ifndef DOUBLETYPE
8839 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8840 #define DOUBLETYPE long double
8841 #else
8842 #define DOUBLETYPE double
8843 #endif
8844 #endif
8845
8846 #include <stdio.h>
8847
8848 #define I_STDLIB $i_stdlib
8849 #ifdef I_STDLIB
8850 #include <stdlib.h>
8851 #endif
8852
8853 int
8854 checkit(expect, got)
8855 char *expect;
8856 char *got;
8857 {
8858     if (strcmp(expect, got)) {
8859                 printf("%s oddity:  Expected %s, got %s\n",
8860                         myname, expect, got);
8861                 exit(1);
8862         }
8863 }
8864
8865 int main()
8866
8867         char buf[64]; 
8868         buf[63] = '\0';
8869
8870         /* This must be 1st test on (which?) platform */
8871         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8872         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8873         checkit("0.1", buf);
8874
8875         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8876         checkit("0.01", buf);
8877
8878         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8879         checkit("0.001", buf);
8880
8881         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8882         checkit("0.0001", buf);
8883
8884         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8885         if (strlen(buf) > 5)
8886             checkit("9e-005", buf); /* for Microsoft ?? */
8887         else
8888             checkit("9e-05", buf);
8889
8890         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8891         checkit("1", buf);
8892
8893         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8894         checkit("1.1", buf);
8895
8896         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8897         checkit("1.01", buf);
8898
8899         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8900         checkit("1.001", buf);
8901
8902         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8903         checkit("1.0001", buf);
8904
8905         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8906         checkit("1.00001", buf);
8907
8908         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8909         checkit("1.000001", buf);
8910
8911         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8912         checkit("0", buf);
8913
8914         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8915         checkit("-1", buf);
8916
8917         /* Some Linux gcvt's give 1.e+5 here. */
8918         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8919         checkit("100000", buf);
8920         
8921         /* Some Linux gcvt's give -1.e+5 here. */
8922         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8923         checkit("-100000", buf);
8924
8925         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8926         checkit("123.456", buf);
8927
8928         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8929         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8930         /* 34 should be enough to scare even long double
8931          * places into using the e notation. */
8932         if (strlen(buf) > 5)
8933             checkit("1e+034", buf); /* for Microsoft */
8934         else
8935             checkit("1e+34", buf);
8936
8937         /* For Perl, if you add additional tests here, also add them to
8938          * t/base/num.t for benefit of platforms not using Configure or
8939          * overriding d_Gconvert */
8940
8941         exit(0);
8942 }
8943 EOP
8944 : first add preferred functions to our list
8945 xxx_list=""
8946 for xxx_convert in $gconvert_preference; do
8947     case $xxx_convert in
8948     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8949     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8950     esac 
8951 done
8952 : then add any others
8953 for xxx_convert in gconvert gcvt sprintf; do
8954     case "$xxx_list" in
8955     *$xxx_convert*) ;;
8956     *) xxx_list="$xxx_list $xxx_convert" ;;
8957     esac 
8958 done
8959
8960 case "$d_longdbl$uselongdouble" in
8961 "$define$define")
8962     : again, add prefered functions to our list first
8963     xxx_ld_list=""
8964     for xxx_convert in $gconvert_ld_preference; do
8965         case $xxx_convert in
8966         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8967         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8968         esac
8969     done
8970     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8971     for xxx_convert in qgcvt sprintf $xxx_list; do
8972         case "$xxx_ld_list" in
8973         $xxx_convert*|*" $xxx_convert"*) ;;
8974         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8975         esac
8976     done
8977     : if sprintf cannot do long doubles, move it to the end
8978     if test "$d_PRIgldbl" != "$define"; then
8979         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8980     fi
8981     : if no qgcvt, remove it
8982     if test "$d_qgcvt" != "$define"; then
8983         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8984     fi
8985     : use the ld_list
8986     xxx_list="$xxx_ld_list"
8987     ;;
8988 esac
8989
8990 for xxx_convert in $xxx_list; do
8991         echo "Trying $xxx_convert..."
8992         $rm -f try try$_o
8993         set try -DTRY_$xxx_convert
8994         if eval $compile; then
8995                 echo "$xxx_convert() found." >&4
8996                 if $run ./try; then
8997                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8998                         break;
8999                 else
9000                         echo "...But $xxx_convert didn't work as I expected."
9001                         xxx_convert=''
9002                 fi
9003         else
9004                 echo "$xxx_convert NOT found." >&4
9005         fi
9006 done
9007
9008 if test X$xxx_convert = X; then
9009     echo "*** WHOA THERE!!! ***" >&4
9010     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9011     xxx_convert=sprintf
9012 fi
9013
9014 case "$xxx_convert" in
9015 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9016 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9017 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9018 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9019    "$define$define$define")
9020       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9021    "$define$define$undef")
9022       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9023    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9024    esac
9025    ;;  
9026 esac
9027
9028 fi
9029
9030 : see if _fwalk exists
9031 set fwalk d__fwalk
9032 eval $inlibc
9033
9034 : Initialize h_fcntl
9035 h_fcntl=false
9036
9037 : Initialize h_sysfile
9038 h_sysfile=false
9039
9040 : access call always available on UNIX
9041 set access d_access
9042 eval $inlibc
9043
9044 : locate the flags for 'access()'
9045 case "$d_access" in
9046 "$define")
9047         echo " "
9048         $cat >access.c <<'EOCP'
9049 #include <sys/types.h>
9050 #ifdef I_FCNTL
9051 #include <fcntl.h>
9052 #endif
9053 #ifdef I_SYS_FILE
9054 #include <sys/file.h>
9055 #endif
9056 #ifdef I_UNISTD
9057 #include <unistd.h>
9058 #endif
9059 int main() {
9060         exit(R_OK);
9061 }
9062 EOCP
9063         : check sys/file.h first, no particular reason here
9064         if $test `./findhdr sys/file.h` && \
9065                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9066                 h_sysfile=true;
9067                 echo "<sys/file.h> defines the *_OK access constants." >&4
9068         elif $test `./findhdr fcntl.h` && \
9069                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9070                 h_fcntl=true;
9071                 echo "<fcntl.h> defines the *_OK access constants." >&4
9072         elif $test `./findhdr unistd.h` && \
9073                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9074                 echo "<unistd.h> defines the *_OK access constants." >&4
9075         else
9076                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9077         fi
9078         ;;
9079 esac
9080 $rm -f access*
9081
9082 : see if accessx exists
9083 set accessx d_accessx
9084 eval $inlibc
9085
9086 : see if alarm exists
9087 set alarm d_alarm
9088 eval $inlibc
9089
9090 : define a fucntion to check prototypes
9091 $cat > protochk <<EOSH
9092 $startsh
9093 cc="$cc"
9094 optimize="$optimize"
9095 ccflags="$ccflags"
9096 prototype="$prototype"
9097 define="$define"
9098 rm=$rm
9099 EOSH
9100
9101 $cat >> protochk <<'EOSH'
9102
9103 $rm -f try.c
9104 foo="$1"
9105 shift
9106 while test $# -ge 2; do
9107         case "$1" in
9108                 $define) echo "#include <$2>" >> try.c ;;
9109                 literal) echo "$2" >> try.c ;;
9110         esac
9111     shift 2
9112 done
9113 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9114 cat >> try.c <<'EOCP'
9115 #ifdef CAN_PROTOTYPE
9116 #define _(args) args
9117 #else
9118 #define _(args) ()
9119 #endif
9120 EOCP
9121 echo "$foo" >> try.c
9122 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9123 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9124 status=$?
9125 $rm -f try.[co]
9126 exit $status
9127 EOSH
9128 chmod +x protochk
9129 $eunicefix protochk
9130
9131 hasproto='varname=$1; func=$2; shift; shift;
9132 while $test $# -ge 2; do
9133         case "$1" in
9134         $define) echo "#include <$2>";;
9135         esac ;
9136     shift 2;
9137 done > try.c;
9138 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9139 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9140         echo "$func() prototype found.";
9141         val="$define";
9142 else
9143         echo "$func() prototype NOT found.";
9144         val="$undef";
9145 fi;
9146 set $varname;
9147 eval $setvar;
9148 $rm -f try.c tryout.c'
9149
9150 : see if sys/types.h has to be included
9151 set sys/types.h i_systypes
9152 eval $inhdr
9153
9154 : see if sys/select.h has to be included
9155 set sys/select.h i_sysselct
9156 eval $inhdr
9157
9158 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9159 while $test $# -ge 2; do
9160         case "$1" in
9161         $define) echo "#include <$2>";;
9162         esac ;
9163     shift 2;
9164 done > try.c;
9165 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9166 set try;
9167 if eval $compile; then
9168         val="$define";
9169 else
9170         val="$undef";
9171 fi;
9172 set $varname;
9173 eval $setvar;
9174 $rm -f try.c try.o'
9175
9176 : see if we should include time.h, sys/time.h, or both
9177 echo " "
9178 if test "X$timeincl" = X; then
9179         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9180         $echo $n "I'm now running the test program...$c"
9181         $cat >try.c <<'EOCP'
9182 #include <sys/types.h>
9183 #ifdef I_TIME
9184 #include <time.h>
9185 #endif
9186 #ifdef I_SYSTIME
9187 #ifdef SYSTIMEKERNEL
9188 #define KERNEL
9189 #endif
9190 #include <sys/time.h>
9191 #endif
9192 #ifdef I_SYSSELECT
9193 #include <sys/select.h>
9194 #endif
9195 int main()
9196 {
9197         struct tm foo;
9198 #ifdef S_TIMEVAL
9199         struct timeval bar;
9200 #endif
9201 #ifdef S_TIMEZONE
9202         struct timezone tzp;
9203 #endif
9204         if (foo.tm_sec == foo.tm_sec)
9205                 exit(0);
9206 #ifdef S_TIMEVAL
9207         if (bar.tv_sec == bar.tv_sec)
9208                 exit(0);
9209 #endif
9210         exit(1);
9211 }
9212 EOCP
9213         flags=''
9214         for s_timezone in '-DS_TIMEZONE' ''; do
9215         sysselect=''
9216         for s_timeval in '-DS_TIMEVAL' ''; do
9217         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9218         for i_time in '' '-DI_TIME'; do
9219         for i_systime in '-DI_SYSTIME' ''; do
9220                 case "$flags" in
9221                 '') $echo $n ".$c"
9222                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9223                         if eval $compile; then
9224                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9225                                 shift
9226                                 flags="$*"
9227                                 echo " "
9228                                 $echo $n "Succeeded with $flags$c"
9229                         fi
9230                         ;;
9231                 esac
9232         done
9233         done
9234         done
9235         done
9236         done
9237         timeincl=''
9238         echo " "
9239         case "$flags" in
9240         *SYSTIMEKERNEL*) i_systimek="$define"
9241                 timeincl=`./findhdr sys/time.h`
9242                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9243         *) i_systimek="$undef";;
9244         esac
9245         case "$flags" in
9246         *I_TIME*) i_time="$define"
9247                 timeincl=`./findhdr time.h`" $timeincl"
9248                 echo "We'll include <time.h>." >&4;;
9249         *) i_time="$undef";;
9250         esac
9251         case "$flags" in
9252         *I_SYSTIME*) i_systime="$define"
9253                 timeincl=`./findhdr sys/time.h`" $timeincl"
9254                 echo "We'll include <sys/time.h>." >&4;;
9255         *) i_systime="$undef";;
9256         esac
9257         $rm -f try.c try
9258 fi
9259 : see if struct tm knows about tm_zone
9260 case "$i_systime$i_time" in
9261 *$define*) 
9262         echo " "
9263         echo "Checking to see if your struct tm has tm_zone field..." >&4
9264         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9265         eval $hasfield
9266         ;;
9267 *)      val="$undef"
9268         set d_tm_tm_zone
9269         eval $setvar
9270         ;;
9271 esac
9272 case "$d_tm_tm_zone" in
9273 "$define")      echo "Yes, it does."   ;;
9274 *)              echo "No, it doesn't." ;;
9275 esac
9276 : see if struct tm knows about tm_gmtoff
9277 case "$i_systime$i_time" in
9278 *$define*) 
9279         echo " "
9280         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9281         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9282         eval $hasfield
9283         ;;
9284 *)      val="$undef"
9285         set d_tm_tm_gmtoff
9286         eval $setvar
9287         ;;
9288 esac
9289 case "$d_tm_tm_gmtoff" in
9290 "$define")      echo "Yes, it does."   ;;
9291 *)              echo "No, it doesn't." ;;
9292 esac
9293
9294 : see if asctime_r exists
9295 set asctime_r d_asctime_r
9296 eval $inlibc
9297 case "$d_asctime_r" in
9298 "$define")
9299         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
9300         case "time" in
9301         time)
9302                 hdrs="$hdrs $i_systime sys/time.h"
9303                 ;;
9304         esac
9305         case "$d_asctime_r_proto:$usethreads" in
9306         ":define")      d_asctime_r_proto=define
9307                 set d_asctime_r_proto asctime_r $hdrs
9308                 eval $hasproto ;;
9309         *)      ;;
9310         esac
9311         case "$d_asctime_r_proto" in
9312         define)
9313         case "$asctime_r_proto" in
9314         ''|0) try='char* asctime_r(const struct tm*, char*);'
9315         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9316         esac
9317         case "$asctime_r_proto" in
9318         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9319         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9320         esac
9321         case "$asctime_r_proto" in
9322         ''|0) try='int asctime_r(const struct tm*, char*);'
9323         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9324         esac
9325         case "$asctime_r_proto" in
9326         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9327         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9328         esac
9329         case "$asctime_r_proto" in
9330         ''|0)   d_asctime_r=undef
9331                 asctime_r_proto=0
9332                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9333         * )     case "$asctime_r_proto" in
9334                 REENTRANT_PROTO*) ;;
9335                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9336                 esac
9337                 echo "Prototype: $try" ;;
9338         esac
9339         ;;
9340         *)      case "$usethreads" in
9341                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9342                 esac
9343                 d_asctime_r=undef
9344                 asctime_r_proto=0
9345                 ;;
9346         esac
9347         ;;
9348 *)      asctime_r_proto=0
9349         ;;
9350 esac
9351
9352 : see if atolf exists
9353 set atolf d_atolf
9354 eval $inlibc
9355
9356 : see if atoll exists
9357 set atoll d_atoll
9358 eval $inlibc
9359
9360 : Look for GNU-cc style attribute checking
9361 echo " "
9362 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9363 $cat >attrib.c <<'EOCP'
9364 #include <stdio.h>
9365 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9366 EOCP
9367 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9368         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9369                 echo "Your C compiler doesn't fully support __attribute__."
9370                 val="$undef"
9371         else
9372                 echo "Your C compiler supports __attribute__."
9373                 val="$define"
9374         fi
9375 else
9376         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9377         val="$undef"
9378 fi
9379 set d_attribut
9380 eval $setvar
9381 $rm -f attrib*
9382
9383 : see if bcmp exists
9384 set bcmp d_bcmp
9385 eval $inlibc
9386
9387 : see if bcopy exists
9388 set bcopy d_bcopy
9389 eval $inlibc
9390
9391 : see if this is a unistd.h system
9392 set unistd.h i_unistd
9393 eval $inhdr
9394
9395 : see if getpgrp exists
9396 set getpgrp d_getpgrp
9397 eval $inlibc
9398
9399 case "$d_getpgrp" in
9400 "$define")
9401         echo " "
9402         echo "Checking to see which flavor of getpgrp is in use..."
9403         $cat >try.c <<EOP
9404 #$i_unistd I_UNISTD
9405 #include <sys/types.h>
9406 #ifdef I_UNISTD
9407 #  include <unistd.h>
9408 #endif
9409 int main()
9410 {
9411         if (getuid() == 0) {
9412                 printf("(I see you are running Configure as super-user...)\n");
9413                 setuid(1);
9414         }
9415 #ifdef TRY_BSD_PGRP
9416         if (getpgrp(1) == 0)
9417                 exit(0);
9418 #else
9419         if (getpgrp() > 0)
9420                 exit(0);
9421 #endif
9422         exit(1);
9423 }
9424 EOP
9425         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9426                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9427                 val="$define"
9428         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9429                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9430                 val="$undef"
9431         else
9432                 echo "I can't seem to compile and run the test program."
9433                 if ./usg; then
9434                         xxx="a USG one, i.e. you use getpgrp()."
9435                 else
9436                         # SVR4 systems can appear rather BSD-ish.
9437                         case "$i_unistd" in
9438                         $undef)
9439                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9440                                 val="$define"
9441                                 ;;
9442                         $define)
9443                                 xxx="probably a USG one, i.e. you use getpgrp()."
9444                                 val="$undef"
9445                                 ;;
9446                         esac
9447                 fi
9448                 echo "Assuming your getpgrp is $xxx" >&4
9449         fi
9450         ;;
9451 *) val="$undef";;
9452 esac
9453 set d_bsdgetpgrp
9454 eval $setvar
9455 $rm -f try try.*
9456
9457 : see if setpgrp exists
9458 set setpgrp d_setpgrp
9459 eval $inlibc
9460
9461 case "$d_setpgrp" in
9462 "$define")
9463         echo " "
9464         echo "Checking to see which flavor of setpgrp is in use..."
9465         $cat >try.c <<EOP
9466 #$i_unistd I_UNISTD
9467 #include <sys/types.h>
9468 #ifdef I_UNISTD
9469 #  include <unistd.h>
9470 #endif
9471 int main()
9472 {
9473         if (getuid() == 0) {
9474                 printf("(I see you are running Configure as super-user...)\n");
9475                 setuid(1);
9476         }
9477 #ifdef TRY_BSD_PGRP
9478         if (-1 == setpgrp(1, 1))
9479                 exit(0);
9480 #else
9481         if (setpgrp() != -1)
9482                 exit(0);
9483 #endif
9484         exit(1);
9485 }
9486 EOP
9487         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9488                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9489                 val="$define"
9490         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9491                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9492                 val="$undef"
9493         else
9494                 echo "(I can't seem to compile and run the test program.)"
9495                 if ./usg; then
9496                         xxx="a USG one, i.e. you use setpgrp()."
9497                 else
9498                         # SVR4 systems can appear rather BSD-ish.
9499                         case "$i_unistd" in
9500                         $undef)
9501                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9502                                 val="$define"
9503                                 ;;
9504                         $define)
9505                                 xxx="probably a USG one, i.e. you use setpgrp()."
9506                                 val="$undef"
9507                                 ;;
9508                         esac
9509                 fi
9510                 echo "Assuming your setpgrp is $xxx" >&4
9511         fi
9512         ;;
9513 *) val="$undef";;
9514 esac
9515 set d_bsdsetpgrp
9516 eval $setvar
9517 $rm -f try try.*
9518 : see if bzero exists
9519 set bzero d_bzero
9520 eval $inlibc
9521
9522 : see if signal is declared as pointer to function returning int or void
9523 echo " "
9524 xxx=`./findhdr signal.h`
9525 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9526 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9527         echo "You have int (*signal())() instead of void." >&4
9528         val="$undef"
9529 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9530         echo "You have void (*signal())()." >&4
9531         val="$define"
9532 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9533         echo "You have int (*signal())() instead of void." >&4
9534         val="$undef"
9535 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9536         echo "You have void (*signal())()." >&4
9537         val="$define"
9538 else
9539         case "$d_voidsig" in
9540         '')
9541         echo "I can't determine whether signal handler returns void or int..." >&4
9542                 dflt=void
9543                 rp="What type does your signal handler return?"
9544                 . ./myread
9545                 case "$ans" in
9546                 v*) val="$define";;
9547                 *) val="$undef";;
9548                 esac;;
9549         "$define")
9550                 echo "As you already told me, signal handler returns void." >&4
9551                 val="$define"
9552                 ;;
9553         *)      echo "As you already told me, signal handler returns int." >&4
9554                 val="$undef"
9555                 ;;
9556         esac
9557 fi
9558 set d_voidsig
9559 eval $setvar
9560 case "$d_voidsig" in
9561 "$define") signal_t="void";;
9562 *) signal_t="int";;
9563 esac
9564 $rm -f $$.tmp
9565
9566 : check for ability to cast large floats to 32-bit ints.
9567 echo " "
9568 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9569 if $test "$intsize" -ge 4; then
9570         xxx=int
9571 else
9572         xxx=long
9573 fi
9574 $cat >try.c <<EOCP
9575 #include <stdio.h>
9576 #include <sys/types.h>
9577 #include <signal.h>
9578 $signal_t blech(s) int s; { exit(3); }
9579 int main()
9580 {
9581         $xxx i32;
9582         double f, g;
9583         int result = 0;
9584         char str[16];
9585         signal(SIGFPE, blech);
9586
9587         /* Don't let compiler optimize the test away.  Store the number 
9588            in a writable string for gcc to pass to sscanf under HP/UX.
9589         */
9590         sprintf(str, "2147483647");
9591         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9592         g = 10 * f;
9593         i32  = ($xxx) g;
9594
9595         /* x86 processors will probably give 0x8000 0000, which is a
9596        sign change.  We don't want that.  We want to mimic SPARC
9597            behavior here, which is to preserve the sign and give
9598            back 0x7fff ffff.
9599         */
9600         if (i32 != ($xxx) f)
9601                 result |= 1;
9602         exit(result);
9603 }
9604 EOCP
9605 set try
9606 if eval $compile_ok; then
9607         $run ./try
9608         yyy=$?
9609 else
9610         echo "(I can't seem to compile the test program--assuming it can't)"
9611         yyy=1
9612 fi
9613 case "$yyy" in
9614 0)      val="$define"
9615         echo "Yup, it can."
9616         ;;
9617 *)      val="$undef"
9618         echo "Nope, it can't."
9619         ;;
9620 esac
9621 set d_casti32
9622 eval $setvar
9623 $rm -f try try.*
9624
9625 : check for ability to cast negative floats to unsigned
9626 echo " "
9627 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9628 $cat >try.c <<EOCP
9629 #include <stdio.h>
9630 #include <sys/types.h>
9631 #include <signal.h>
9632 $signal_t blech(s) int s; { exit(7); }
9633 $signal_t blech_in_list(s) int s; { exit(4); }
9634 unsigned long dummy_long(p) unsigned long p; { return p; }
9635 unsigned int dummy_int(p) unsigned int p; { return p; }
9636 unsigned short dummy_short(p) unsigned short p; { return p; }
9637 int main()
9638 {
9639         double f;
9640         unsigned long along;
9641         unsigned int aint;
9642         unsigned short ashort;
9643         int result = 0;
9644         char str[16];
9645         
9646         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9647            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9648            optimized the whole file away
9649         */
9650         /* Store the number in a writable string for gcc to pass to 
9651            sscanf under HP/UX.
9652         */
9653         sprintf(str, "-123");
9654         sscanf(str, "%lf", &f);  /* f = -123.; */
9655
9656         signal(SIGFPE, blech);
9657         along = (unsigned long)f;
9658         aint = (unsigned int)f;
9659         ashort = (unsigned short)f;
9660         if (along != (unsigned long)-123)
9661                 result |= 1;
9662         if (aint != (unsigned int)-123)
9663                 result |= 1;
9664         if (ashort != (unsigned short)-123)
9665                 result |= 1;
9666         sprintf(str, "1073741824.");
9667         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9668         f = f + f;
9669         along = 0;
9670         along = (unsigned long)f;
9671         if (along != 0x80000000)
9672                 result |= 2;
9673         f -= 1.;
9674         along = 0;
9675         along = (unsigned long)f;
9676         if (along != 0x7fffffff)
9677                 result |= 1;
9678         f += 2.;
9679         along = 0;
9680         along = (unsigned long)f;
9681         if (along != 0x80000001)
9682                 result |= 2;
9683         if (result)
9684                 exit(result);
9685         signal(SIGFPE, blech_in_list);
9686         sprintf(str, "123.");
9687         sscanf(str, "%lf", &f);  /* f = 123.; */
9688         along = dummy_long((unsigned long)f);
9689         aint = dummy_int((unsigned int)f);
9690         ashort = dummy_short((unsigned short)f);
9691         if (along != (unsigned long)123)
9692                 result |= 4;
9693         if (aint != (unsigned int)123)
9694                 result |= 4;
9695         if (ashort != (unsigned short)123)
9696                 result |= 4;
9697         exit(result);
9698
9699 }
9700 EOCP
9701 set try
9702 if eval $compile_ok; then
9703         $run ./try
9704         castflags=$?
9705 else
9706         echo "(I can't seem to compile the test program--assuming it can't)"
9707         castflags=7
9708 fi
9709 case "$castflags" in
9710 0)      val="$define"
9711         echo "Yup, it can."
9712         ;;
9713 *)      val="$undef"
9714         echo "Nope, it can't."
9715         ;;
9716 esac
9717 set d_castneg
9718 eval $setvar
9719 $rm -f try.*
9720
9721 : see if vprintf exists
9722 echo " "
9723 if set vprintf val -f d_vprintf; eval $csym; $val; then
9724         echo 'vprintf() found.' >&4
9725         val="$define"
9726         $cat >try.c <<'EOF'
9727 #include <varargs.h>
9728
9729 int main() { xxx("foo"); }
9730
9731 xxx(va_alist)
9732 va_dcl
9733 {
9734         va_list args;
9735         char buf[10];
9736
9737         va_start(args);
9738         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9739 }
9740 EOF
9741         set try
9742         if eval $compile && $run ./try; then
9743                 echo "Your vsprintf() returns (int)." >&4
9744                 val2="$undef"
9745         else
9746                 echo "Your vsprintf() returns (char*)." >&4
9747                 val2="$define"
9748         fi
9749 else
9750         echo 'vprintf() NOT found.' >&4
9751                 val="$undef"
9752                 val2="$undef"
9753 fi
9754 $rm -f try try.*
9755 set d_vprintf
9756 eval $setvar
9757 val=$val2
9758 set d_charvspr
9759 eval $setvar
9760
9761 : see if chown exists
9762 set chown d_chown
9763 eval $inlibc
9764
9765 : see if chroot exists
9766 set chroot d_chroot
9767 eval $inlibc
9768
9769 : see if chsize exists
9770 set chsize d_chsize
9771 eval $inlibc
9772
9773 : see if class exists
9774 set class d_class
9775 eval $inlibc
9776
9777 hasstruct='varname=$1; struct=$2; shift; shift;
9778 while $test $# -ge 2; do
9779         case "$1" in
9780         $define) echo "#include <$2>";;
9781         esac ;
9782     shift 2;
9783 done > try.c;
9784 echo "int main () { struct $struct foo; }" >> try.c;
9785 set try;
9786 if eval $compile; then
9787         val="$define";
9788 else
9789         val="$undef";
9790 fi;
9791 set $varname;
9792 eval $setvar;
9793 $rm -f try.c try.o'
9794
9795 socketlib=''
9796 sockethdr=''
9797 : see whether socket exists
9798 echo " "
9799 $echo $n "Hmm... $c" >&4
9800 if set socket val -f d_socket; eval $csym; $val; then
9801         echo "Looks like you have Berkeley networking support." >&4
9802         d_socket="$define"
9803         if set setsockopt val -f; eval $csym; $val; then
9804                 d_oldsock="$undef"
9805         else
9806                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9807                 d_oldsock="$define"
9808         fi
9809 else
9810         if $contains socklib libc.list >/dev/null 2>&1; then
9811                 echo "Looks like you have Berkeley networking support." >&4
9812                 d_socket="$define"
9813                 : we will have to assume that it supports the 4.2 BSD interface
9814                 d_oldsock="$undef"
9815         else
9816                 echo "You don't have Berkeley networking in libc$_a..." >&4
9817                 if test "X$d_socket" = "X$define"; then
9818                    echo "...but you seem to believe that you have sockets." >&4
9819                 else
9820                         for net in net socket
9821                         do
9822                                 if test -f /usr/lib/lib$net$_a; then
9823                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9824                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9825                                         if $contains socket libc.list >/dev/null 2>&1; then
9826                                                 d_socket="$define"
9827                                                 socketlib="-l$net"
9828                                                 case "$net" in
9829                                                 net)
9830                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9831                                                         sockethdr="-I/usr/netinclude"
9832                                                         ;;
9833                                                 esac
9834                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9835                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9836                                                         d_oldsock="$undef"
9837                                                 else
9838                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9839                                                         d_oldsock="$define"
9840                                                 fi
9841                                                 break
9842                                         fi
9843                                 fi
9844                         done
9845                         if test "X$d_socket" != "X$define"; then
9846                            echo "or anywhere else I see." >&4
9847                            d_socket="$undef"
9848                            d_oldsock="$undef"
9849                         fi
9850                 fi
9851         fi
9852 fi
9853
9854 : see if socketpair exists
9855 set socketpair d_sockpair
9856 eval $inlibc
9857
9858
9859 echo " "
9860 echo "Checking the availability of certain socket constants..." >&4
9861 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9862         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9863         $cat >try.c <<EOF
9864 #include <sys/types.h>
9865 #include <sys/socket.h>
9866 int main() {
9867     int i = $ENUM;
9868 }
9869 EOF
9870         val="$undef"
9871         set try; if eval $compile; then
9872                 val="$define"
9873         fi
9874         set d_${enum}; eval $setvar
9875         $rm -f try.c try
9876 done
9877
9878 : see if this is a sys/uio.h system
9879 set sys/uio.h i_sysuio
9880 eval $inhdr
9881
9882
9883 echo " "
9884 echo "Checking to see if your system supports struct cmsghdr..." >&4
9885 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9886 eval $hasstruct
9887 case "$d_cmsghdr_s" in
9888 "$define")      echo "Yes, it does."   ;;
9889 *)              echo "No, it doesn't." ;;
9890 esac
9891
9892
9893 : check for const keyword
9894 echo " "
9895 echo 'Checking to see if your C compiler knows about "const"...' >&4
9896 $cat >const.c <<'EOCP'
9897 typedef struct spug { int drokk; } spug;
9898 int main()
9899 {
9900         const char *foo;
9901         const spug y;
9902 }
9903 EOCP
9904 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9905         val="$define"
9906         echo "Yup, it does."
9907 else
9908         val="$undef"
9909         echo "Nope, it doesn't."
9910 fi
9911 set d_const
9912 eval $setvar
9913
9914 : see if crypt exists
9915 echo " "
9916 set crypt d_crypt
9917 eval $inlibc
9918 case "$d_crypt" in
9919 $define) cryptlib='' ;;
9920 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9921                 echo 'crypt() found.' >&4
9922                 val="$define"
9923                 cryptlib=''
9924         else
9925                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9926                 if $test -z "$cryptlib"; then
9927                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9928                 else
9929                         cryptlib=-lcrypt
9930                 fi
9931                 if $test -z "$cryptlib"; then
9932                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9933                 else
9934                         cryptlib=-lcrypt
9935                 fi
9936                 if $test -z "$cryptlib"; then
9937                         cryptlib=`./loc libcrypt$_a "" $libpth`
9938                 else
9939                         cryptlib=-lcrypt
9940                 fi
9941                 if $test -z "$cryptlib"; then
9942                         echo 'crypt() NOT found.' >&4
9943                         val="$undef"
9944                 else
9945                         val="$define"
9946                 fi
9947         fi
9948         set d_crypt
9949         eval $setvar
9950         ;;
9951 esac
9952
9953 : see if this is a crypt.h system
9954 set crypt.h i_crypt
9955 eval $inhdr
9956
9957 : see if crypt_r exists
9958 set crypt_r d_crypt_r
9959 eval $inlibc
9960 case "$d_crypt_r" in
9961 "$define")
9962         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9963         case "crypt" in
9964         time)
9965                 hdrs="$hdrs $i_systime sys/time.h"
9966                 ;;
9967         esac
9968         case "$d_crypt_r_proto:$usethreads" in
9969         ":define")      d_crypt_r_proto=define
9970                 set d_crypt_r_proto crypt_r $hdrs
9971                 eval $hasproto ;;
9972         *)      ;;
9973         esac
9974         case "$d_crypt_r_proto" in
9975         define)
9976         case "$crypt_r_proto" in
9977         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9978         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9979         esac
9980         case "$crypt_r_proto" in
9981         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9982         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9983         esac
9984         case "$crypt_r_proto" in
9985         ''|0)   d_crypt_r=undef
9986                 crypt_r_proto=0
9987                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
9988         * )     case "$crypt_r_proto" in
9989                 REENTRANT_PROTO*) ;;
9990                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9991                 esac
9992                 echo "Prototype: $try" ;;
9993         esac
9994         ;;
9995         *)      case "$usethreads" in
9996                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9997                 esac
9998                 d_crypt_r=undef
9999                 crypt_r_proto=0
10000                 ;;
10001         esac
10002         ;;
10003 *)      crypt_r_proto=0
10004         ;;
10005 esac
10006
10007 : get csh whereabouts
10008 case "$csh" in
10009 'csh') val="$undef" ;;
10010 *) val="$define" ;;
10011 esac
10012 set d_csh
10013 eval $setvar
10014 : Respect a hint or command line value for full_csh.
10015 case "$full_csh" in
10016 '') full_csh=$csh ;;
10017 esac
10018
10019 : see if ctermid_r exists
10020 set ctermid_r d_ctermid_r
10021 eval $inlibc
10022 case "$d_ctermid_r" in
10023 "$define")
10024         hdrs="$i_systypes sys/types.h define stdio.h "
10025         case "stdio" in
10026         time)
10027                 hdrs="$hdrs $i_systime sys/time.h"
10028                 ;;
10029         esac
10030         case "$d_ctermid_r_proto:$usethreads" in
10031         ":define")      d_ctermid_r_proto=define
10032                 set d_ctermid_r_proto ctermid_r $hdrs
10033                 eval $hasproto ;;
10034         *)      ;;
10035         esac
10036         case "$d_ctermid_r_proto" in
10037         define)
10038         case "$ctermid_r_proto" in
10039         ''|0) try='char* ctermid_r(char*);'
10040         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10041         esac
10042         case "$ctermid_r_proto" in
10043         ''|0)   d_ctermid_r=undef
10044                 ctermid_r_proto=0
10045                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10046         * )     case "$ctermid_r_proto" in
10047                 REENTRANT_PROTO*) ;;
10048                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10049                 esac
10050                 echo "Prototype: $try" ;;
10051         esac
10052         ;;
10053         *)      case "$usethreads" in
10054                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10055                 esac
10056                 d_ctermid_r=undef
10057                 ctermid_r_proto=0
10058                 ;;
10059         esac
10060         ;;
10061 *)      ctermid_r_proto=0
10062         ;;
10063 esac
10064
10065 : see if ctime_r exists
10066 set ctime_r d_ctime_r
10067 eval $inlibc
10068 case "$d_ctime_r" in
10069 "$define")
10070         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
10071         case "time" in
10072         time)
10073                 hdrs="$hdrs $i_systime sys/time.h"
10074                 ;;
10075         esac
10076         case "$d_ctime_r_proto:$usethreads" in
10077         ":define")      d_ctime_r_proto=define
10078                 set d_ctime_r_proto ctime_r $hdrs
10079                 eval $hasproto ;;
10080         *)      ;;
10081         esac
10082         case "$d_ctime_r_proto" in
10083         define)
10084         case "$ctime_r_proto" in
10085         ''|0) try='char* ctime_r(const time_t*, char*);'
10086         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10087         esac
10088         case "$ctime_r_proto" in
10089         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10090         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10091         esac
10092         case "$ctime_r_proto" in
10093         ''|0) try='int ctime_r(const time_t*, char*);'
10094         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10095         esac
10096         case "$ctime_r_proto" in
10097         ''|0) try='int ctime_r(const time_t*, char*, int);'
10098         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10099         esac
10100         case "$ctime_r_proto" in
10101         ''|0)   d_ctime_r=undef
10102                 ctime_r_proto=0
10103                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10104         * )     case "$ctime_r_proto" in
10105                 REENTRANT_PROTO*) ;;
10106                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10107                 esac
10108                 echo "Prototype: $try" ;;
10109         esac
10110         ;;
10111         *)      case "$usethreads" in
10112                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10113                 esac
10114                 d_ctime_r=undef
10115                 ctime_r_proto=0
10116                 ;;
10117         esac
10118         ;;
10119 *)      ctime_r_proto=0
10120         ;;
10121 esac
10122
10123 : see if cuserid exists
10124 set cuserid d_cuserid
10125 eval $inlibc
10126
10127 : see if this is a limits.h system
10128 set limits.h i_limits
10129 eval $inhdr
10130
10131 : see if this is a float.h system
10132 set float.h i_float
10133 eval $inhdr
10134
10135 : See if number of significant digits in a double precision number is known
10136 echo " "
10137 $cat >dbl_dig.c <<EOM
10138 #$i_limits I_LIMITS
10139 #$i_float I_FLOAT
10140 #ifdef I_LIMITS
10141 #include <limits.h>
10142 #endif
10143 #ifdef I_FLOAT
10144 #include <float.h>
10145 #endif
10146 #ifdef DBL_DIG
10147 printf("Contains DBL_DIG");
10148 #endif
10149 EOM
10150 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10151 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10152         echo "DBL_DIG found." >&4
10153         val="$define"
10154 else
10155         echo "DBL_DIG NOT found." >&4
10156         val="$undef"
10157 fi
10158 $rm -f dbl_dig.?
10159 set d_dbl_dig
10160 eval $setvar
10161
10162 : see if dbm.h is available
10163 : see if dbmclose exists
10164 set dbmclose d_dbmclose
10165 eval $inlibc
10166
10167 case "$d_dbmclose" in
10168 $define)
10169         set dbm.h i_dbm
10170         eval $inhdr
10171         case "$i_dbm" in
10172         $define)
10173                 val="$undef"
10174                 set i_rpcsvcdbm
10175                 eval $setvar
10176                 ;;
10177         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10178                 eval $inhdr
10179                 ;;
10180         esac
10181         ;;
10182 *)      echo "We won't be including <dbm.h>"
10183         val="$undef"
10184         set i_dbm
10185         eval $setvar
10186         val="$undef"
10187         set i_rpcsvcdbm
10188         eval $setvar
10189         ;;
10190 esac
10191
10192 : see if prototype for dbminit is available
10193 echo " "
10194 set d_dbminitproto dbminit $i_dbm dbm.h
10195 eval $hasproto
10196
10197 : see if difftime exists
10198 set difftime d_difftime
10199 eval $inlibc
10200
10201 : see if this is a dirent system
10202 echo " "
10203 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10204         val="$define"
10205         echo "<dirent.h> found." >&4
10206 else
10207         val="$undef"
10208         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10209                 echo "<sys/dir.h> found." >&4
10210                 echo " "
10211         else
10212                 xinc=`./findhdr sys/ndir.h`
10213         fi
10214         echo "<dirent.h> NOT found." >&4
10215 fi
10216 set i_dirent
10217 eval $setvar
10218
10219 : Look for type of directory structure.
10220 echo " "
10221 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10222
10223 case "$direntrytype" in
10224 ''|' ')
10225         case "$i_dirent" in
10226         $define) guess1='struct dirent' ;;
10227         *) guess1='struct direct'  ;;
10228         esac
10229         ;;
10230 *)      guess1="$direntrytype"
10231         ;;
10232 esac
10233
10234 case "$guess1" in
10235 'struct dirent') guess2='struct direct' ;;
10236 *) guess2='struct dirent' ;;
10237 esac
10238                 
10239 if $contains "$guess1" try.c >/dev/null 2>&1; then
10240         direntrytype="$guess1"
10241         echo "Your directory entries are $direntrytype." >&4
10242 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10243         direntrytype="$guess2"
10244         echo "Your directory entries seem to be $direntrytype." >&4
10245 else
10246         echo "I don't recognize your system's directory entries." >&4
10247         rp="What type is used for directory entries on this system?"
10248         dflt="$guess1"
10249         . ./myread
10250         direntrytype="$ans"
10251 fi
10252 $rm -f try.c
10253
10254
10255 : see if the directory entry stores field length
10256 echo " "
10257 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10258 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10259         echo "Good, your directory entry keeps length information in d_namlen." >&4
10260         val="$define"
10261 else
10262         echo "Your directory entry does not know about the d_namlen field." >&4
10263         val="$undef"
10264 fi
10265 set d_dirnamlen
10266 eval $setvar
10267 $rm -f try.c
10268
10269 : see if this is an sysdir system
10270 set sys/dir.h i_sysdir
10271 eval $inhdr
10272
10273 : see if this is an sysndir system
10274 set sys/ndir.h i_sysndir
10275 eval $inhdr
10276
10277 : Look for dirfd
10278 echo " "
10279 $cat >dirfd.c <<EOM
10280 #include <stdio.h>
10281 #$i_dirent I_DIRENT             /**/
10282 #$i_sysdir I_SYS_DIR            /**/
10283 #$i_sysndir I_SYS_NDIR          /**/
10284 #$i_systypes I_SYS_TYPES        /**/
10285 #if defined(I_SYS_TYPES)
10286 #include <sys/types.h>
10287 #endif
10288 #if defined(I_DIRENT)
10289 #include <dirent.h>
10290 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10291 #include <sys/dir.h>
10292 #endif
10293 #else
10294 #ifdef I_SYS_NDIR
10295 #include <sys/ndir.h>
10296 #else
10297 #ifdef I_SYS_DIR
10298 #ifdef hp9000s500
10299 #include <ndir.h>       /* may be wrong in the future */
10300 #else
10301 #include <sys/dir.h>
10302 #endif
10303 #endif
10304 #endif
10305 #endif 
10306 int main() {
10307         DIR *dirp = opendir(".");
10308         if (dirfd(dirp) >= 0)
10309                 exit(0);
10310         else
10311                 exit(1);
10312 }
10313 EOM
10314 set dirfd
10315 if eval $compile; then
10316         val="$define"
10317 fi
10318 case "$val" in
10319 $define)        echo "dirfd() found." >&4       ;;
10320 *)              echo "dirfd() NOT found." >&4   ;;
10321 esac
10322 set d_dirfd
10323 eval $setvar
10324 $rm -f dirfd*
10325
10326 : see if dlerror exists
10327 xxx_runnm="$runnm"
10328 runnm=false
10329 set dlerror d_dlerror
10330 eval $inlibc
10331 runnm="$xxx_runnm"
10332
10333 : see if dlfcn is available
10334 set dlfcn.h i_dlfcn
10335 eval $inhdr
10336
10337 case "$usedl" in
10338 $define|y|true)
10339         $cat << EOM
10340
10341 On a few systems, the dynamically loaded modules that perl generates and uses
10342 will need a different extension than shared libs. The default will probably
10343 be appropriate.
10344
10345 EOM
10346         case "$dlext" in
10347         '')     dflt="$so" ;;
10348         *)      dflt="$dlext" ;;
10349         esac
10350         rp='What is the extension of dynamically loaded modules'
10351         . ./myread
10352         dlext="$ans"
10353         ;;
10354 *)
10355         dlext="none"
10356         ;;
10357 esac
10358
10359 : Check if dlsym need a leading underscore
10360 echo " "
10361 val="$undef"
10362
10363 case "$dlsrc" in
10364 dl_dlopen.xs)
10365         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10366         $cat >dyna.c <<'EOM'
10367 fred () { }
10368 EOM
10369
10370 $cat >fred.c<<EOM
10371
10372 #include <stdio.h>
10373 #$i_dlfcn I_DLFCN
10374 #ifdef I_DLFCN
10375 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10376 #else
10377 #include <sys/types.h>
10378 #include <nlist.h>
10379 #include <link.h>
10380 #endif
10381
10382 extern int fred() ;
10383
10384 int main()
10385 {
10386     void * handle ;
10387     void * symbol ;
10388 #ifndef RTLD_LAZY
10389     int mode = 1 ;
10390 #else
10391     int mode = RTLD_LAZY ;
10392 #endif
10393     handle = dlopen("./dyna.$dlext", mode) ;
10394     if (handle == NULL) {
10395         printf ("1\n") ;
10396         fflush (stdout) ;
10397         exit(0);
10398     }
10399     symbol = dlsym(handle, "fred") ;
10400     if (symbol == NULL) {
10401         /* try putting a leading underscore */
10402         symbol = dlsym(handle, "_fred") ;
10403         if (symbol == NULL) {
10404             printf ("2\n") ;
10405             fflush (stdout) ;
10406             exit(0);
10407         }
10408         printf ("3\n") ;
10409     }
10410     else
10411         printf ("4\n") ;
10412     fflush (stdout) ;
10413     exit(0);
10414 }
10415 EOM
10416         : Call the object file tmp-dyna.o in case dlext=o.
10417         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10418                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10419                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10420                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10421                 xxx=`$run ./fred`
10422                 case $xxx in
10423                 1)      echo "Test program failed using dlopen." >&4
10424                         echo "Perhaps you should not use dynamic loading." >&4;;
10425                 2)      echo "Test program failed using dlsym." >&4
10426                         echo "Perhaps you should not use dynamic loading." >&4;;
10427                 3)      echo "dlsym needs a leading underscore" >&4
10428                         val="$define" ;;
10429                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10430                 esac
10431         else
10432                 echo "I can't compile and run the test program." >&4
10433                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10434         fi
10435         ;;
10436 esac
10437                 
10438 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10439
10440 set d_dlsymun
10441 eval $setvar
10442
10443 : see if drand48_r exists
10444 set drand48_r d_drand48_r
10445 eval $inlibc
10446 case "$d_drand48_r" in
10447 "$define")
10448         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10449         case "stdlib" in
10450         time)
10451                 hdrs="$hdrs $i_systime sys/time.h"
10452                 ;;
10453         esac
10454         case "$d_drand48_r_proto:$usethreads" in
10455         ":define")      d_drand48_r_proto=define
10456                 set d_drand48_r_proto drand48_r $hdrs
10457                 eval $hasproto ;;
10458         *)      ;;
10459         esac
10460         case "$d_drand48_r_proto" in
10461         define)
10462         case "$drand48_r_proto" in
10463         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10464         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10465         esac
10466         case "$drand48_r_proto" in
10467         ''|0)   d_drand48_r=undef
10468                 drand48_r_proto=0
10469                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10470         * )     case "$drand48_r_proto" in
10471                 REENTRANT_PROTO*) ;;
10472                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10473                 esac
10474                 echo "Prototype: $try" ;;
10475         esac
10476         ;;
10477         *)      case "$usethreads" in
10478                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10479                 esac
10480                 d_drand48_r=undef
10481                 drand48_r_proto=0
10482                 ;;
10483         esac
10484         ;;
10485 *)      drand48_r_proto=0
10486         ;;
10487 esac
10488
10489 : see if prototype for drand48 is available
10490 echo " "
10491 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10492 eval $hasproto
10493
10494 : see if dup2 exists
10495 set dup2 d_dup2
10496 eval $inlibc
10497
10498 : see if eaccess exists
10499 set eaccess d_eaccess
10500 eval $inlibc
10501
10502 : see if endgrent exists
10503 set endgrent d_endgrent
10504 eval $inlibc
10505
10506 : see if this is an grp system
10507 set grp.h i_grp
10508 eval $inhdr
10509
10510 case "$i_grp" in
10511 $define)
10512         xxx=`./findhdr grp.h`
10513         $cppstdin $cppflags $cppminus < $xxx >$$.h
10514
10515         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10516                 val="$define"
10517         else
10518                 val="$undef"
10519         fi
10520         set d_grpasswd
10521         eval $setvar
10522
10523         $rm -f $$.h
10524         ;;
10525 *)
10526         val="$undef";
10527         set d_grpasswd; eval $setvar
10528         ;;
10529 esac
10530
10531 : see if endgrent_r exists
10532 set endgrent_r d_endgrent_r
10533 eval $inlibc
10534 case "$d_endgrent_r" in
10535 "$define")
10536         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10537         case "grp" in
10538         time)
10539                 hdrs="$hdrs $i_systime sys/time.h"
10540                 ;;
10541         esac
10542         case "$d_endgrent_r_proto:$usethreads" in
10543         ":define")      d_endgrent_r_proto=define
10544                 set d_endgrent_r_proto endgrent_r $hdrs
10545                 eval $hasproto ;;
10546         *)      ;;
10547         esac
10548         case "$d_endgrent_r_proto" in
10549         define)
10550         case "$endgrent_r_proto" in
10551         ''|0) try='int endgrent_r(FILE**);'
10552         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10553         esac
10554         case "$endgrent_r_proto" in
10555         ''|0) try='void endgrent_r(FILE**);'
10556         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10557         esac
10558         case "$endgrent_r_proto" in
10559         ''|0)   d_endgrent_r=undef
10560                 endgrent_r_proto=0
10561                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10562         * )     case "$endgrent_r_proto" in
10563                 REENTRANT_PROTO*) ;;
10564                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10565                 esac
10566                 echo "Prototype: $try" ;;
10567         esac
10568         ;;
10569         *)      case "$usethreads" in
10570                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10571                 esac
10572                 d_endgrent_r=undef
10573                 endgrent_r_proto=0
10574                 ;;
10575         esac
10576         ;;
10577 *)      endgrent_r_proto=0
10578         ;;
10579 esac
10580
10581 : see if endhostent exists
10582 set endhostent d_endhent
10583 eval $inlibc
10584
10585 : see if this is a netdb.h system
10586 set netdb.h i_netdb
10587 eval $inhdr
10588
10589 : see if endhostent_r exists
10590 set endhostent_r d_endhostent_r
10591 eval $inlibc
10592 case "$d_endhostent_r" in
10593 "$define")
10594         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10595         case "netdb" in
10596         time)
10597                 hdrs="$hdrs $i_systime sys/time.h"
10598                 ;;
10599         esac
10600         case "$d_endhostent_r_proto:$usethreads" in
10601         ":define")      d_endhostent_r_proto=define
10602                 set d_endhostent_r_proto endhostent_r $hdrs
10603                 eval $hasproto ;;
10604         *)      ;;
10605         esac
10606         case "$d_endhostent_r_proto" in
10607         define)
10608         case "$endhostent_r_proto" in
10609         ''|0) try='int endhostent_r(struct hostent_data*);'
10610         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10611         esac
10612         case "$endhostent_r_proto" in
10613         ''|0) try='void endhostent_r(struct hostent_data*);'
10614         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10615         esac
10616         case "$endhostent_r_proto" in
10617         ''|0)   d_endhostent_r=undef
10618                 endhostent_r_proto=0
10619                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10620         * )     case "$endhostent_r_proto" in
10621                 REENTRANT_PROTO*) ;;
10622                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10623                 esac
10624                 echo "Prototype: $try" ;;
10625         esac
10626         ;;
10627         *)      case "$usethreads" in
10628                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10629                 esac
10630                 d_endhostent_r=undef
10631                 endhostent_r_proto=0
10632                 ;;
10633         esac
10634         ;;
10635 *)      endhostent_r_proto=0
10636         ;;
10637 esac
10638
10639 : see if endnetent exists
10640 set endnetent d_endnent
10641 eval $inlibc
10642
10643 : see if endnetent_r exists
10644 set endnetent_r d_endnetent_r
10645 eval $inlibc
10646 case "$d_endnetent_r" in
10647 "$define")
10648         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10649         case "netdb" in
10650         time)
10651                 hdrs="$hdrs $i_systime sys/time.h"
10652                 ;;
10653         esac
10654         case "$d_endnetent_r_proto:$usethreads" in
10655         ":define")      d_endnetent_r_proto=define
10656                 set d_endnetent_r_proto endnetent_r $hdrs
10657                 eval $hasproto ;;
10658         *)      ;;
10659         esac
10660         case "$d_endnetent_r_proto" in
10661         define)
10662         case "$endnetent_r_proto" in
10663         ''|0) try='int endnetent_r(struct netent_data*);'
10664         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10665         esac
10666         case "$endnetent_r_proto" in
10667         ''|0) try='void endnetent_r(struct netent_data*);'
10668         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10669         esac
10670         case "$endnetent_r_proto" in
10671         ''|0)   d_endnetent_r=undef
10672                 endnetent_r_proto=0
10673                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10674         * )     case "$endnetent_r_proto" in
10675                 REENTRANT_PROTO*) ;;
10676                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10677                 esac
10678                 echo "Prototype: $try" ;;
10679         esac
10680         ;;
10681         *)      case "$usethreads" in
10682                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10683                 esac
10684                 d_endnetent_r=undef
10685                 endnetent_r_proto=0
10686                 ;;
10687         esac
10688         ;;
10689 *)      endnetent_r_proto=0
10690         ;;
10691 esac
10692
10693 : see if endprotoent exists
10694 set endprotoent d_endpent
10695 eval $inlibc
10696
10697 : see if endprotoent_r exists
10698 set endprotoent_r d_endprotoent_r
10699 eval $inlibc
10700 case "$d_endprotoent_r" in
10701 "$define")
10702         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10703         case "netdb" in
10704         time)
10705                 hdrs="$hdrs $i_systime sys/time.h"
10706                 ;;
10707         esac
10708         case "$d_endprotoent_r_proto:$usethreads" in
10709         ":define")      d_endprotoent_r_proto=define
10710                 set d_endprotoent_r_proto endprotoent_r $hdrs
10711                 eval $hasproto ;;
10712         *)      ;;
10713         esac
10714         case "$d_endprotoent_r_proto" in
10715         define)
10716         case "$endprotoent_r_proto" in
10717         ''|0) try='int endprotoent_r(struct protoent_data*);'
10718         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10719         esac
10720         case "$endprotoent_r_proto" in
10721         ''|0) try='void endprotoent_r(struct protoent_data*);'
10722         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10723         esac
10724         case "$endprotoent_r_proto" in
10725         ''|0)   d_endprotoent_r=undef
10726                 endprotoent_r_proto=0
10727                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10728         * )     case "$endprotoent_r_proto" in
10729                 REENTRANT_PROTO*) ;;
10730                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10731                 esac
10732                 echo "Prototype: $try" ;;
10733         esac
10734         ;;
10735         *)      case "$usethreads" in
10736                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10737                 esac
10738                 d_endprotoent_r=undef
10739                 endprotoent_r_proto=0
10740                 ;;
10741         esac
10742         ;;
10743 *)      endprotoent_r_proto=0
10744         ;;
10745 esac
10746
10747 : see if endpwent exists
10748 set endpwent d_endpwent
10749 eval $inlibc
10750
10751 : see if this is a pwd.h system
10752 set pwd.h i_pwd
10753 eval $inhdr
10754
10755 case "$i_pwd" in
10756 $define)
10757         xxx=`./findhdr pwd.h`
10758         $cppstdin $cppflags $cppminus < $xxx >$$.h
10759
10760         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10761                 val="$define"
10762         else
10763                 val="$undef"
10764         fi
10765         set d_pwquota
10766         eval $setvar
10767
10768         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10769                 val="$define"
10770         else
10771                 val="$undef"
10772         fi
10773         set d_pwage
10774         eval $setvar
10775
10776         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10777                 val="$define"
10778         else
10779                 val="$undef"
10780         fi
10781         set d_pwchange
10782         eval $setvar
10783
10784         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10785                 val="$define"
10786         else
10787                 val="$undef"
10788         fi
10789         set d_pwclass
10790         eval $setvar
10791
10792         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10793                 val="$define"
10794         else
10795                 val="$undef"
10796         fi
10797         set d_pwexpire
10798         eval $setvar
10799
10800         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10801                 val="$define"
10802         else
10803                 val="$undef"
10804         fi
10805         set d_pwcomment
10806         eval $setvar
10807
10808         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10809                 val="$define"
10810         else
10811                 val="$undef"
10812         fi
10813         set d_pwgecos
10814         eval $setvar
10815
10816         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10817                 val="$define"
10818         else
10819                 val="$undef"
10820         fi
10821         set d_pwpasswd
10822         eval $setvar
10823
10824         $rm -f $$.h
10825         ;;
10826 *)
10827         val="$undef"; 
10828         set d_pwquota; eval $setvar
10829         set d_pwage; eval $setvar
10830         set d_pwchange; eval $setvar
10831         set d_pwclass; eval $setvar
10832         set d_pwexpire; eval $setvar
10833         set d_pwcomment; eval $setvar
10834         set d_pwgecos; eval $setvar
10835         set d_pwpasswd; eval $setvar
10836         ;;
10837 esac
10838
10839 : see if endpwent_r exists
10840 set endpwent_r d_endpwent_r
10841 eval $inlibc
10842 case "$d_endpwent_r" in
10843 "$define")
10844         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10845         case "pwd" in
10846         time)
10847                 hdrs="$hdrs $i_systime sys/time.h"
10848                 ;;
10849         esac
10850         case "$d_endpwent_r_proto:$usethreads" in
10851         ":define")      d_endpwent_r_proto=define
10852                 set d_endpwent_r_proto endpwent_r $hdrs
10853                 eval $hasproto ;;
10854         *)      ;;
10855         esac
10856         case "$d_endpwent_r_proto" in
10857         define)
10858         case "$endpwent_r_proto" in
10859         ''|0) try='int endpwent_r(FILE**);'
10860         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10861         esac
10862         case "$endpwent_r_proto" in
10863         ''|0) try='void endpwent_r(FILE**);'
10864         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10865         esac
10866         case "$endpwent_r_proto" in
10867         ''|0)   d_endpwent_r=undef
10868                 endpwent_r_proto=0
10869                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10870         * )     case "$endpwent_r_proto" in
10871                 REENTRANT_PROTO*) ;;
10872                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10873                 esac
10874                 echo "Prototype: $try" ;;
10875         esac
10876         ;;
10877         *)      case "$usethreads" in
10878                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10879                 esac
10880                 d_endpwent_r=undef
10881                 endpwent_r_proto=0
10882                 ;;
10883         esac
10884         ;;
10885 *)      endpwent_r_proto=0
10886         ;;
10887 esac
10888
10889 : see if endservent exists
10890 set endservent d_endsent
10891 eval $inlibc
10892
10893 : see if endservent_r exists
10894 set endservent_r d_endservent_r
10895 eval $inlibc
10896 case "$d_endservent_r" in
10897 "$define")
10898         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10899         case "netdb" in
10900         time)
10901                 hdrs="$hdrs $i_systime sys/time.h"
10902                 ;;
10903         esac
10904         case "$d_endservent_r_proto:$usethreads" in
10905         ":define")      d_endservent_r_proto=define
10906                 set d_endservent_r_proto endservent_r $hdrs
10907                 eval $hasproto ;;
10908         *)      ;;
10909         esac
10910         case "$d_endservent_r_proto" in
10911         define)
10912         case "$endservent_r_proto" in
10913         ''|0) try='int endservent_r(struct servent_data*);'
10914         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10915         esac
10916         case "$endservent_r_proto" in
10917         ''|0) try='void endservent_r(struct servent_data*);'
10918         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10919         esac
10920         case "$endservent_r_proto" in
10921         ''|0)   d_endservent_r=undef
10922                 endservent_r_proto=0
10923                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10924         * )     case "$endservent_r_proto" in
10925                 REENTRANT_PROTO*) ;;
10926                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10927                 esac
10928                 echo "Prototype: $try" ;;
10929         esac
10930         ;;
10931         *)      case "$usethreads" in
10932                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10933                 esac
10934                 d_endservent_r=undef
10935                 endservent_r_proto=0
10936                 ;;
10937         esac
10938         ;;
10939 *)      endservent_r_proto=0
10940         ;;
10941 esac
10942
10943 : Locate the flags for 'open()'
10944 echo " "
10945 $cat >try.c <<'EOCP'
10946 #include <sys/types.h>
10947 #ifdef I_FCNTL
10948 #include <fcntl.h>
10949 #endif
10950 #ifdef I_SYS_FILE
10951 #include <sys/file.h>
10952 #endif
10953 int main() {
10954         if(O_RDONLY);
10955 #ifdef O_TRUNC
10956         exit(0);
10957 #else
10958         exit(1);
10959 #endif
10960 }
10961 EOCP
10962 : check sys/file.h first to get FREAD on Sun
10963 if $test `./findhdr sys/file.h` && \
10964                 set try -DI_SYS_FILE && eval $compile; then
10965         h_sysfile=true;
10966         echo "<sys/file.h> defines the O_* constants..." >&4
10967         if $run ./try; then
10968                 echo "and you have the 3 argument form of open()." >&4
10969                 val="$define"
10970         else
10971                 echo "but not the 3 argument form of open().  Oh, well." >&4
10972                 val="$undef"
10973         fi
10974 elif $test `./findhdr fcntl.h` && \
10975                 set try -DI_FCNTL && eval $compile; then
10976         h_fcntl=true;
10977         echo "<fcntl.h> defines the O_* constants..." >&4
10978         if $run ./try; then
10979                 echo "and you have the 3 argument form of open()." >&4
10980                 val="$define"
10981         else
10982                 echo "but not the 3 argument form of open().  Oh, well." >&4
10983                 val="$undef"
10984         fi
10985 else
10986         val="$undef"
10987         echo "I can't find the O_* constant definitions!  You got problems." >&4
10988 fi
10989 set d_open3
10990 eval $setvar
10991 $rm -f try try.*
10992
10993 : see which of string.h or strings.h is needed
10994 echo " "
10995 strings=`./findhdr string.h`
10996 if $test "$strings" && $test -r "$strings"; then
10997         echo "Using <string.h> instead of <strings.h>." >&4
10998         val="$define"
10999 else
11000         val="$undef"
11001         strings=`./findhdr strings.h`
11002         if $test "$strings" && $test -r "$strings"; then
11003                 echo "Using <strings.h> instead of <string.h>." >&4
11004         else
11005                 echo "No string header found -- You'll surely have problems." >&4
11006         fi
11007 fi
11008 set i_string
11009 eval $setvar
11010 case "$i_string" in
11011 "$undef") strings=`./findhdr strings.h`;;
11012 *)        strings=`./findhdr string.h`;;
11013 esac
11014
11015 : see if this is a sys/file.h system
11016 val=''
11017 set sys/file.h val
11018 eval $inhdr
11019
11020 : do we need to include sys/file.h ?
11021 case "$val" in
11022 "$define")
11023         echo " "
11024         if $h_sysfile; then
11025                 val="$define"
11026                 echo "We'll be including <sys/file.h>." >&4
11027         else
11028                 val="$undef"
11029                 echo "We won't be including <sys/file.h>." >&4
11030         fi
11031         ;;
11032 *)
11033         h_sysfile=false
11034         ;;
11035 esac
11036 set i_sysfile
11037 eval $setvar
11038
11039 : see if fcntl.h is there
11040 val=''
11041 set fcntl.h val
11042 eval $inhdr
11043
11044 : see if we can include fcntl.h
11045 case "$val" in
11046 "$define")
11047         echo " "
11048         if $h_fcntl; then
11049                 val="$define"
11050                 echo "We'll be including <fcntl.h>." >&4
11051         else
11052                 val="$undef"
11053                 if $h_sysfile; then
11054         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11055                 else
11056                         echo "We won't be including <fcntl.h>." >&4
11057                 fi
11058         fi
11059         ;;
11060 *)
11061         h_fcntl=false
11062         val="$undef"
11063         ;;
11064 esac
11065 set i_fcntl
11066 eval $setvar
11067
11068 : check for non-blocking I/O stuff
11069 case "$h_sysfile" in
11070 true) echo "#include <sys/file.h>" > head.c;;
11071 *)
11072        case "$h_fcntl" in
11073        true) echo "#include <fcntl.h>" > head.c;;
11074        *) echo "#include <sys/fcntl.h>" > head.c;;
11075        esac
11076        ;;
11077 esac
11078 echo " "
11079 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11080 case "$o_nonblock" in
11081 '')
11082         $cat head.c > try.c
11083         $cat >>try.c <<EOCP
11084 #include <stdio.h>
11085 #include <stdlib.h>
11086 #$i_fcntl I_FCNTL
11087 #ifdef I_FCNTL
11088 #include <fcntl.h>
11089 #endif
11090 int main() {
11091 #ifdef O_NONBLOCK
11092         printf("O_NONBLOCK\n");
11093         exit(0);
11094 #endif
11095 #ifdef O_NDELAY
11096         printf("O_NDELAY\n");
11097         exit(0);
11098 #endif
11099 #ifdef FNDELAY
11100         printf("FNDELAY\n");
11101         exit(0);
11102 #endif
11103         exit(0);
11104 }
11105 EOCP
11106         set try
11107         if eval $compile_ok; then
11108                 o_nonblock=`$run ./try`
11109                 case "$o_nonblock" in
11110                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11111                 *) echo "Seems like we can use $o_nonblock.";;
11112                 esac
11113         else
11114                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11115         fi
11116         ;;
11117 *) echo "Using $hint value $o_nonblock.";;
11118 esac
11119 $rm -f try try.* .out core
11120
11121 echo " "
11122 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11123 case "$eagain" in
11124 '')
11125         $cat head.c > try.c
11126         $cat >>try.c <<EOCP
11127 #include <errno.h>
11128 #include <sys/types.h>
11129 #include <signal.h>
11130 #include <stdio.h> 
11131 #include <stdlib.h> 
11132 #$i_fcntl I_FCNTL
11133 #ifdef I_FCNTL
11134 #include <fcntl.h>
11135 #endif
11136 #define MY_O_NONBLOCK $o_nonblock
11137 #ifndef errno  /* XXX need better Configure test */
11138 extern int errno;
11139 #endif
11140 #$i_unistd I_UNISTD
11141 #ifdef I_UNISTD
11142 #include <unistd.h>
11143 #endif
11144 #$i_string I_STRING
11145 #ifdef I_STRING
11146 #include <string.h>
11147 #else
11148 #include <strings.h>
11149 #endif
11150 $signal_t blech(x) int x; { exit(3); }
11151 EOCP
11152         $cat >> try.c <<'EOCP'
11153 int main()
11154 {
11155         int pd[2];
11156         int pu[2];
11157         char buf[1];
11158         char string[100];
11159
11160         pipe(pd);       /* Down: child -> parent */
11161         pipe(pu);       /* Up: parent -> child */
11162         if (0 != fork()) {
11163                 int ret;
11164                 close(pd[1]);   /* Parent reads from pd[0] */
11165                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11166 #ifdef F_SETFL
11167                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11168                         exit(1);
11169 #else
11170                 exit(4);
11171 #endif
11172                 signal(SIGALRM, blech);
11173                 alarm(5);
11174                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11175                         exit(2);
11176                 sprintf(string, "%d\n", ret);
11177                 write(2, string, strlen(string));
11178                 alarm(0);
11179 #ifdef EAGAIN
11180                 if (errno == EAGAIN) {
11181                         printf("EAGAIN\n");
11182                         goto ok;
11183                 }
11184 #endif
11185 #ifdef EWOULDBLOCK
11186                 if (errno == EWOULDBLOCK)
11187                         printf("EWOULDBLOCK\n");
11188 #endif
11189         ok:
11190                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11191                 sleep(2);                               /* Give it time to close our pipe */
11192                 alarm(5);
11193                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11194                 alarm(0);
11195                 sprintf(string, "%d\n", ret);
11196                 write(4, string, strlen(string));
11197                 exit(0);
11198         }
11199
11200         close(pd[0]);                   /* We write to pd[1] */
11201         close(pu[1]);                   /* We read from pu[0] */
11202         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11203         close(pd[1]);                   /* Pipe pd is now fully closed! */
11204         exit(0);                                /* Bye bye, thank you for playing! */
11205 }
11206 EOCP
11207         set try
11208         if eval $compile_ok; then
11209                 echo "$startsh" >mtry
11210                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11211                 chmod +x mtry
11212                 ./mtry >/dev/null 2>&1
11213                 case $? in
11214                 0) eagain=`$cat try.out`;;
11215                 1) echo "Could not perform non-blocking setting!";;
11216                 2) echo "I did a successful read() for something that was not there!";;
11217                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11218                 4) echo "Could not find F_SETFL!";;
11219                 *) echo "Something terribly wrong happened during testing.";;
11220                 esac
11221                 rd_nodata=`$cat try.ret`
11222                 echo "A read() system call with no data present returns $rd_nodata."
11223                 case "$rd_nodata" in
11224                 0|-1) ;;
11225                 *)
11226                         echo "(That's peculiar, fixing that to be -1.)"
11227                         rd_nodata=-1
11228                         ;;
11229                 esac
11230                 case "$eagain" in
11231                 '')
11232                         echo "Forcing errno EAGAIN on read() with no data available."
11233                         eagain=EAGAIN
11234                         ;;
11235                 *)
11236                         echo "Your read() sets errno to $eagain when no data is available."
11237                         ;;
11238                 esac
11239                 status=`$cat try.err`
11240                 case "$status" in
11241                 0) echo "And it correctly returns 0 to signal EOF.";;
11242                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11243                 *) echo "However, your read() returns '$status' on EOF??";;
11244                 esac
11245                 val="$define"
11246                 if test "$status" = "$rd_nodata"; then
11247                         echo "WARNING: you can't distinguish between EOF and no data!"
11248                         val="$undef"
11249                 fi
11250         else
11251                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11252                 eagain=EAGAIN
11253         fi
11254         set d_eofnblk
11255         eval $setvar
11256         ;;
11257 *)
11258         echo "Using $hint value $eagain."
11259         echo "Your read() returns $rd_nodata when no data is present."
11260         case "$d_eofnblk" in
11261         "$define") echo "And you can see EOF because read() returns 0.";;
11262         "$undef") echo "But you can't see EOF status from read() returned value.";;
11263         *)
11264                 echo "(Assuming you can't see EOF status from read anyway.)"
11265                 d_eofnblk=$undef
11266                 ;;
11267         esac
11268         ;;
11269 esac
11270 $rm -f try try.* .out core head.c mtry
11271
11272 : see if fchdir exists
11273 set fchdir d_fchdir
11274 eval $inlibc
11275
11276 : see if fchmod exists
11277 set fchmod d_fchmod
11278 eval $inlibc
11279
11280 : see if fchown exists
11281 set fchown d_fchown
11282 eval $inlibc
11283
11284 : see if this is an fcntl system
11285 set fcntl d_fcntl
11286 eval $inlibc
11287
11288 echo " "
11289 : See if fcntl-based locking works.
11290 $cat >try.c <<EOCP
11291 #include <stdlib.h>
11292 #include <unistd.h>
11293 #include <fcntl.h>
11294 #include <signal.h>
11295 $signal_t blech(x) int x; { exit(3); }
11296 int main() {
11297 #if defined(F_SETLK) && defined(F_SETLKW)
11298      struct flock flock;
11299      int retval, fd;
11300      fd = open("try.c", O_RDONLY);
11301      flock.l_type = F_RDLCK;
11302      flock.l_whence = SEEK_SET;
11303      flock.l_start = flock.l_len = 0;
11304      signal(SIGALRM, blech);
11305      alarm(10);
11306      retval = fcntl(fd, F_SETLK, &flock);
11307      close(fd);
11308      (retval < 0 ? exit(2) : exit(0));
11309 #else
11310      exit(2);
11311 #endif
11312 }
11313 EOCP
11314 echo "Checking if fcntl-based file locking works... "
11315 case "$d_fcntl" in
11316 "$define")
11317         set try
11318         if eval $compile_ok; then
11319                 if $run ./try; then
11320                         echo "Yes, it seems to work."
11321                         val="$define"
11322                 else
11323                         echo "Nope, it didn't work."
11324                         val="$undef"
11325                         case "$?" in
11326                         3) $cat >&4 <<EOM
11327 ***
11328 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11329 *** This is (almost) impossible.
11330 *** If your NFS lock daemons are not feeling well, something like
11331 *** this may happen, please investigate.  Cannot continue, aborting.
11332 ***
11333 EOM
11334                                 exit 1
11335                                 ;;
11336                         esac
11337                 fi
11338         else
11339                 echo "I'm unable to compile the test program, so I'll assume not."
11340                 val="$undef"
11341         fi
11342         ;;
11343 *) val="$undef";
11344         echo "Nope, since you don't even have fcntl()."
11345         ;;
11346 esac
11347 set d_fcntl_can_lock
11348 eval $setvar
11349 $rm -f try*
11350
11351
11352 : check for fd_set items
11353 $cat <<EOM
11354
11355 Checking to see how well your C compiler handles fd_set and friends ...
11356 EOM
11357 $cat >try.c <<EOCP
11358 #$i_systime I_SYS_TIME
11359 #$i_sysselct I_SYS_SELECT
11360 #$d_socket HAS_SOCKET
11361 #include <sys/types.h>
11362 #ifdef HAS_SOCKET
11363 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11364 #endif
11365 #ifdef I_SYS_TIME
11366 #include <sys/time.h>
11367 #endif
11368 #ifdef I_SYS_SELECT
11369 #include <sys/select.h>
11370 #endif
11371 int main() {
11372         fd_set fds;
11373
11374 #ifdef TRYBITS
11375         if(fds.fds_bits);
11376 #endif
11377
11378 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11379         exit(0);
11380 #else
11381         exit(1);
11382 #endif
11383 }
11384 EOCP
11385 set try -DTRYBITS
11386 if eval $compile; then
11387         d_fds_bits="$define"
11388         d_fd_set="$define"
11389         echo "Well, your system knows about the normal fd_set typedef..." >&4
11390         if $run ./try; then
11391                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11392                 d_fd_macros="$define"
11393         else
11394                 $cat >&4 <<'EOM'
11395 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11396 EOM
11397                 d_fd_macros="$undef"
11398         fi
11399 else
11400         $cat <<'EOM'
11401 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11402 EOM
11403         set try
11404         if eval $compile; then
11405                 d_fds_bits="$undef"
11406                 d_fd_set="$define"
11407                 echo "Well, your system has some sort of fd_set available..." >&4
11408                 if $run ./try; then
11409                         echo "and you have the normal fd_set macros." >&4
11410                         d_fd_macros="$define"
11411                 else
11412                         $cat <<'EOM'
11413 but not the normal fd_set macros!  Gross!  More work for me...
11414 EOM
11415                         d_fd_macros="$undef"
11416                 fi
11417         else
11418         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11419                 d_fd_set="$undef"
11420                 d_fds_bits="$undef"
11421                 d_fd_macros="$undef"
11422         fi
11423 fi
11424 $rm -f try try.*
11425
11426 : see if fgetpos exists
11427 set fgetpos d_fgetpos
11428 eval $inlibc
11429
11430 : see if finite exists
11431 set finite d_finite
11432 eval $inlibc
11433
11434 : see if finitel exists
11435 set finitel d_finitel
11436 eval $inlibc
11437
11438 : see if flock exists
11439 set flock d_flock
11440 eval $inlibc
11441
11442 : see if prototype for flock is available
11443 echo " "
11444 set d_flockproto flock $i_sysfile sys/file.h
11445 eval $hasproto
11446
11447 : see if fork exists
11448 set fork d_fork
11449 eval $inlibc
11450
11451 : see if fp_class exists
11452 set fp_class d_fp_class
11453 eval $inlibc
11454
11455 : see if pathconf exists
11456 set pathconf d_pathconf
11457 eval $inlibc
11458
11459 : see if fpathconf exists
11460 set fpathconf d_fpathconf
11461 eval $inlibc
11462
11463 : see if fpclass exists
11464 set fpclass d_fpclass
11465 eval $inlibc
11466
11467 : see if fpclassify exists
11468 set fpclassify d_fpclassify
11469 eval $inlibc
11470
11471 : see if fpclassl exists
11472 set fpclassl d_fpclassl
11473 eval $inlibc
11474
11475
11476 : check for fpos64_t
11477 echo " "
11478 echo "Checking to see if you have fpos64_t..." >&4
11479 $cat >try.c <<EOCP
11480 #include <stdio.h>
11481 int main() { fpos64_t x = 7; }
11482 EOCP
11483 set try
11484 if eval $compile; then
11485         val="$define"
11486         echo "You have fpos64_t."
11487 else
11488         val="$undef"
11489         echo "You do not have fpos64_t."
11490         case "$fpossize" in
11491         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11492         esac
11493 fi
11494 $rm -f try.* try
11495 set d_fpos64_t
11496 eval $setvar
11497
11498 : see if frexpl exists
11499 set frexpl d_frexpl
11500 eval $inlibc
11501
11502 : see if this is a sys/param system
11503 set sys/param.h i_sysparam
11504 eval $inhdr
11505
11506 : see if this is a sys/mount.h system
11507 set sys/mount.h i_sysmount
11508 eval $inhdr
11509
11510
11511 echo " "
11512 echo "Checking to see if your system supports struct fs_data..." >&4
11513 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11514 eval $hasstruct
11515 case "$d_fs_data_s" in
11516 "$define")      echo "Yes, it does."   ;;
11517 *)              echo "No, it doesn't." ;;
11518 esac
11519
11520 : see if fseeko exists
11521 set fseeko d_fseeko
11522 eval $inlibc
11523 case "$longsize" in
11524 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11525 esac
11526
11527 : see if fsetpos exists
11528 set fsetpos d_fsetpos
11529 eval $inlibc
11530
11531
11532 : see if fstatfs exists
11533 set fstatfs d_fstatfs
11534 eval $inlibc
11535
11536
11537 : see if statvfs exists
11538 set statvfs d_statvfs
11539 eval $inlibc
11540
11541 : see if fstatvfs exists
11542 set fstatvfs d_fstatvfs
11543 eval $inlibc
11544
11545
11546 : see if fsync exists
11547 set fsync d_fsync
11548 eval $inlibc
11549
11550 : see if ftello exists
11551 set ftello d_ftello
11552 eval $inlibc
11553 case "$longsize" in
11554 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11555 esac
11556
11557 : see if getcwd exists
11558 set getcwd d_getcwd
11559 eval $inlibc
11560
11561 : see if getespwnam exists
11562 set getespwnam d_getespwnam
11563 eval $inlibc
11564
11565
11566 : see if getfsstat exists
11567 set getfsstat d_getfsstat
11568 eval $inlibc
11569
11570 : see if getgrent exists
11571 set getgrent d_getgrent
11572 eval $inlibc
11573
11574 : see if getgrent_r exists
11575 set getgrent_r d_getgrent_r
11576 eval $inlibc
11577 case "$d_getgrent_r" in
11578 "$define")
11579         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11580         case "grp" in
11581         time)
11582                 hdrs="$hdrs $i_systime sys/time.h"
11583                 ;;
11584         esac
11585         case "$d_getgrent_r_proto:$usethreads" in
11586         ":define")      d_getgrent_r_proto=define
11587                 set d_getgrent_r_proto getgrent_r $hdrs
11588                 eval $hasproto ;;
11589         *)      ;;
11590         esac
11591         case "$d_getgrent_r_proto" in
11592         define)
11593         case "$getgrent_r_proto" in
11594         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11595         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11596         esac
11597         case "$getgrent_r_proto" in
11598         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11599         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11600         esac
11601         case "$getgrent_r_proto" in
11602         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11603         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11604         esac
11605         case "$getgrent_r_proto" in
11606         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11607         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11608         esac
11609         case "$getgrent_r_proto" in
11610         ''|0) try='int getgrent_r(struct group*, char*, int);'
11611         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11612         esac
11613         case "$getgrent_r_proto" in
11614         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11615         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11616         esac
11617         case "$getgrent_r_proto" in
11618         ''|0)   d_getgrent_r=undef
11619                 getgrent_r_proto=0
11620                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11621         * )     case "$getgrent_r_proto" in
11622                 REENTRANT_PROTO*) ;;
11623                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11624                 esac
11625                 echo "Prototype: $try" ;;
11626         esac
11627         ;;
11628         *)      case "$usethreads" in
11629                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11630                 esac
11631                 d_getgrent_r=undef
11632                 getgrent_r_proto=0
11633                 ;;
11634         esac
11635         ;;
11636 *)      getgrent_r_proto=0
11637         ;;
11638 esac
11639
11640 : see if getgrgid_r exists
11641 set getgrgid_r d_getgrgid_r
11642 eval $inlibc
11643 case "$d_getgrgid_r" in
11644 "$define")
11645         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11646         case "grp" in
11647         time)
11648                 hdrs="$hdrs $i_systime sys/time.h"
11649                 ;;
11650         esac
11651         case "$d_getgrgid_r_proto:$usethreads" in
11652         ":define")      d_getgrgid_r_proto=define
11653                 set d_getgrgid_r_proto getgrgid_r $hdrs
11654                 eval $hasproto ;;
11655         *)      ;;
11656         esac
11657         case "$d_getgrgid_r_proto" in
11658         define)
11659         case "$getgrgid_r_proto" in
11660         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11661         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11662         esac
11663         case "$getgrgid_r_proto" in
11664         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11665         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11666         esac
11667         case "$getgrgid_r_proto" in
11668         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11669         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11670         esac
11671         case "$getgrgid_r_proto" in
11672         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11673         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11674         esac
11675         case "$getgrgid_r_proto" in
11676         ''|0)   d_getgrgid_r=undef
11677                 getgrgid_r_proto=0
11678                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11679         * )     case "$getgrgid_r_proto" in
11680                 REENTRANT_PROTO*) ;;
11681                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11682                 esac
11683                 echo "Prototype: $try" ;;
11684         esac
11685         ;;
11686         *)      case "$usethreads" in
11687                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11688                 esac
11689                 d_getgrgid_r=undef
11690                 getgrgid_r_proto=0
11691                 ;;
11692         esac
11693         ;;
11694 *)      getgrgid_r_proto=0
11695         ;;
11696 esac
11697
11698 : see if getgrnam_r exists
11699 set getgrnam_r d_getgrnam_r
11700 eval $inlibc
11701 case "$d_getgrnam_r" in
11702 "$define")
11703         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11704         case "grp" in
11705         time)
11706                 hdrs="$hdrs $i_systime sys/time.h"
11707                 ;;
11708         esac
11709         case "$d_getgrnam_r_proto:$usethreads" in
11710         ":define")      d_getgrnam_r_proto=define
11711                 set d_getgrnam_r_proto getgrnam_r $hdrs
11712                 eval $hasproto ;;
11713         *)      ;;
11714         esac
11715         case "$d_getgrnam_r_proto" in
11716         define)
11717         case "$getgrnam_r_proto" in
11718         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11719         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11720         esac
11721         case "$getgrnam_r_proto" in
11722         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11723         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11724         esac
11725         case "$getgrnam_r_proto" in
11726         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11727         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11728         esac
11729         case "$getgrnam_r_proto" in
11730         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11731         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11732         esac
11733         case "$getgrnam_r_proto" in
11734         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11735         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11736         esac
11737         case "$getgrnam_r_proto" in
11738         ''|0)   d_getgrnam_r=undef
11739                 getgrnam_r_proto=0
11740                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11741         * )     case "$getgrnam_r_proto" in
11742                 REENTRANT_PROTO*) ;;
11743                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11744                 esac
11745                 echo "Prototype: $try" ;;
11746         esac
11747         ;;
11748         *)      case "$usethreads" in
11749                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11750                 esac
11751                 d_getgrnam_r=undef
11752                 getgrnam_r_proto=0
11753                 ;;
11754         esac
11755         ;;
11756 *)      getgrnam_r_proto=0
11757         ;;
11758 esac
11759
11760 : see if gethostbyaddr exists
11761 set gethostbyaddr d_gethbyaddr
11762 eval $inlibc
11763
11764 : see if gethostbyname exists
11765 set gethostbyname d_gethbyname
11766 eval $inlibc
11767
11768 : see if gethostent exists
11769 set gethostent d_gethent
11770 eval $inlibc
11771
11772 : see how we will look up host name
11773 echo " "
11774 call=''
11775 if set gethostname val -f d_gethname; eval $csym; $val; then
11776         echo 'gethostname() found.' >&4
11777         d_gethname="$define"
11778         call=gethostname
11779 fi
11780 if set uname val -f d_uname; eval $csym; $val; then
11781         if ./xenix; then
11782                 $cat <<'EOM'
11783 uname() was found, but you're running xenix, and older versions of xenix
11784 have a broken uname(). If you don't really know whether your xenix is old
11785 enough to have a broken system call, use the default answer.
11786
11787 EOM
11788                 dflt=y
11789                 case "$d_uname" in
11790                 "$define") dflt=n;;
11791                 esac
11792                 rp='Is your uname() broken?'
11793                 . ./myread
11794                 case "$ans" in
11795                 n*) d_uname="$define"; call=uname;;
11796                 esac
11797         else
11798                 echo 'uname() found.' >&4
11799                 d_uname="$define"
11800                 case "$call" in
11801                 '') call=uname ;;
11802                 esac
11803         fi
11804 fi
11805 case "$d_gethname" in
11806 '') d_gethname="$undef";;
11807 esac
11808 case "$d_uname" in
11809 '') d_uname="$undef";;
11810 esac
11811 case "$d_uname$d_gethname" in
11812 *define*)
11813         dflt=n
11814         cat <<EOM
11815  
11816 Every now and then someone has a $call() that lies about the hostname
11817 but can't be fixed for political or economic reasons.  If you wish, I can
11818 pretend $call() isn't there and maybe compute hostname at run-time
11819 thanks to the '$phostname' command.
11820
11821 EOM
11822         rp="Shall I ignore $call() from now on?"
11823         . ./myread
11824         case "$ans" in
11825         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11826         esac;;
11827 esac
11828 case "$phostname" in
11829 '') aphostname='';;
11830 *) case "$aphostname" in
11831         /*) ;;
11832         *) set X $phostname
11833                 shift
11834                 file=$1
11835                 shift
11836                 file=`./loc $file $file $pth`
11837                 aphostname=`echo $file $*`
11838                 ;;
11839         esac
11840         ;;
11841 esac
11842 case "$d_uname$d_gethname" in
11843 *define*) ;;
11844 *)
11845         case "$phostname" in
11846         '')
11847                 echo "There will be no way for $package to get your hostname." >&4;;
11848         *)
11849         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11850                 ;;
11851         esac;;
11852 esac
11853 case "$d_phostname" in
11854 '') d_phostname="$undef";;
11855 esac
11856
11857 : see if gethostbyaddr_r exists
11858 set gethostbyaddr_r d_gethostbyaddr_r
11859 eval $inlibc
11860 case "$d_gethostbyaddr_r" in
11861 "$define")
11862         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11863         case "netdb" in
11864         time)
11865                 hdrs="$hdrs $i_systime sys/time.h"
11866                 ;;
11867         esac
11868         case "$d_gethostbyaddr_r_proto:$usethreads" in
11869         ":define")      d_gethostbyaddr_r_proto=define
11870                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11871                 eval $hasproto ;;
11872         *)      ;;
11873         esac
11874         case "$d_gethostbyaddr_r_proto" in
11875         define)
11876         case "$gethostbyaddr_r_proto" in
11877         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11878         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11879         esac
11880         case "$gethostbyaddr_r_proto" in
11881         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11882         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11883         esac
11884         case "$gethostbyaddr_r_proto" in
11885         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11886         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11887         esac
11888         case "$gethostbyaddr_r_proto" in
11889         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11890         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11891         esac
11892         case "$gethostbyaddr_r_proto" in
11893         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11894         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11895         esac
11896         case "$gethostbyaddr_r_proto" in
11897         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11898         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11899         esac
11900         case "$gethostbyaddr_r_proto" in
11901         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11902         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11903         esac
11904         case "$gethostbyaddr_r_proto" in
11905         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11906         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11907         esac
11908         case "$gethostbyaddr_r_proto" in
11909         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11910         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11911         esac
11912         case "$gethostbyaddr_r_proto" in
11913         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11914         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11915         esac
11916         case "$gethostbyaddr_r_proto" in
11917         ''|0)   d_gethostbyaddr_r=undef
11918                 gethostbyaddr_r_proto=0
11919                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11920         * )     case "$gethostbyaddr_r_proto" in
11921                 REENTRANT_PROTO*) ;;
11922                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11923                 esac
11924                 echo "Prototype: $try" ;;
11925         esac
11926         ;;
11927         *)      case "$usethreads" in
11928                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11929                 esac
11930                 d_gethostbyaddr_r=undef
11931                 gethostbyaddr_r_proto=0
11932                 ;;
11933         esac
11934         ;;
11935 *)      gethostbyaddr_r_proto=0
11936         ;;
11937 esac
11938
11939 : see if gethostbyname_r exists
11940 set gethostbyname_r d_gethostbyname_r
11941 eval $inlibc
11942 case "$d_gethostbyname_r" in
11943 "$define")
11944         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11945         case "netdb" in
11946         time)
11947                 hdrs="$hdrs $i_systime sys/time.h"
11948                 ;;
11949         esac
11950         case "$d_gethostbyname_r_proto:$usethreads" in
11951         ":define")      d_gethostbyname_r_proto=define
11952                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11953                 eval $hasproto ;;
11954         *)      ;;
11955         esac
11956         case "$d_gethostbyname_r_proto" in
11957         define)
11958         case "$gethostbyname_r_proto" in
11959         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11960         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11961         esac
11962         case "$gethostbyname_r_proto" in
11963         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11964         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11965         esac
11966         case "$gethostbyname_r_proto" in
11967         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11968         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11969         esac
11970         case "$gethostbyname_r_proto" in
11971         ''|0)   d_gethostbyname_r=undef
11972                 gethostbyname_r_proto=0
11973                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11974         * )     case "$gethostbyname_r_proto" in
11975                 REENTRANT_PROTO*) ;;
11976                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11977                 esac
11978                 echo "Prototype: $try" ;;
11979         esac
11980         ;;
11981         *)      case "$usethreads" in
11982                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11983                 esac
11984                 d_gethostbyname_r=undef
11985                 gethostbyname_r_proto=0
11986                 ;;
11987         esac
11988         ;;
11989 *)      gethostbyname_r_proto=0
11990         ;;
11991 esac
11992
11993 : see if gethostent_r exists
11994 set gethostent_r d_gethostent_r
11995 eval $inlibc
11996 case "$d_gethostent_r" in
11997 "$define")
11998         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11999         case "netdb" in
12000         time)
12001                 hdrs="$hdrs $i_systime sys/time.h"
12002                 ;;
12003         esac
12004         case "$d_gethostent_r_proto:$usethreads" in
12005         ":define")      d_gethostent_r_proto=define
12006                 set d_gethostent_r_proto gethostent_r $hdrs
12007                 eval $hasproto ;;
12008         *)      ;;
12009         esac
12010         case "$d_gethostent_r_proto" in
12011         define)
12012         case "$gethostent_r_proto" in
12013         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12014         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12015         esac
12016         case "$gethostent_r_proto" in
12017         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12018         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12019         esac
12020         case "$gethostent_r_proto" in
12021         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12022         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12023         esac
12024         case "$gethostent_r_proto" in
12025         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12026         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12027         esac
12028         case "$gethostent_r_proto" in
12029         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12030         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12031         esac
12032         case "$gethostent_r_proto" in
12033         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12034         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12035         esac
12036         case "$gethostent_r_proto" in
12037         ''|0)   d_gethostent_r=undef
12038                 gethostent_r_proto=0
12039                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12040         * )     case "$gethostent_r_proto" in
12041                 REENTRANT_PROTO*) ;;
12042                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12043                 esac
12044                 echo "Prototype: $try" ;;
12045         esac
12046         ;;
12047         *)      case "$usethreads" in
12048                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12049                 esac
12050                 d_gethostent_r=undef
12051                 gethostent_r_proto=0
12052                 ;;
12053         esac
12054         ;;
12055 *)      gethostent_r_proto=0
12056         ;;
12057 esac
12058
12059 : see if prototypes for various gethostxxx netdb.h functions are available
12060 echo " "
12061 set d_gethostprotos gethostent $i_netdb netdb.h
12062 eval $hasproto
12063
12064 : see if getitimer exists
12065 set getitimer d_getitimer
12066 eval $inlibc
12067
12068 : see if getlogin exists
12069 set getlogin d_getlogin
12070 eval $inlibc
12071
12072 : see if getlogin_r exists
12073 set getlogin_r d_getlogin_r
12074 eval $inlibc
12075 case "$d_getlogin_r" in
12076 "$define")
12077         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12078         case "unistd" in
12079         time)
12080                 hdrs="$hdrs $i_systime sys/time.h"
12081                 ;;
12082         esac
12083         case "$d_getlogin_r_proto:$usethreads" in
12084         ":define")      d_getlogin_r_proto=define
12085                 set d_getlogin_r_proto getlogin_r $hdrs
12086                 eval $hasproto ;;
12087         *)      ;;
12088         esac
12089         case "$d_getlogin_r_proto" in
12090         define)
12091         case "$getlogin_r_proto" in
12092         ''|0) try='int getlogin_r(char*, size_t);'
12093         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12094         esac
12095         case "$getlogin_r_proto" in
12096         ''|0) try='int getlogin_r(char*, int);'
12097         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12098         esac
12099         case "$getlogin_r_proto" in
12100         ''|0) try='char* getlogin_r(char*, size_t);'
12101         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12102         esac
12103         case "$getlogin_r_proto" in
12104         ''|0) try='char* getlogin_r(char*, int);'
12105         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12106         esac
12107         case "$getlogin_r_proto" in
12108         ''|0)   d_getlogin_r=undef
12109                 getlogin_r_proto=0
12110                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12111         * )     case "$getlogin_r_proto" in
12112                 REENTRANT_PROTO*) ;;
12113                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12114                 esac
12115                 echo "Prototype: $try" ;;
12116         esac
12117         ;;
12118         *)      case "$usethreads" in
12119                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12120                 esac
12121                 d_getlogin_r=undef
12122                 getlogin_r_proto=0
12123                 ;;
12124         esac
12125         ;;
12126 *)      getlogin_r_proto=0
12127         ;;
12128 esac
12129
12130 : see if getmnt exists
12131 set getmnt d_getmnt
12132 eval $inlibc
12133
12134 : see if getmntent exists
12135 set getmntent d_getmntent
12136 eval $inlibc
12137
12138 : see if getnetbyaddr exists
12139 set getnetbyaddr d_getnbyaddr
12140 eval $inlibc
12141
12142 : see if getnetbyname exists
12143 set getnetbyname d_getnbyname
12144 eval $inlibc
12145
12146 : see if getnetent exists
12147 set getnetent d_getnent
12148 eval $inlibc
12149
12150 : see if getnetbyaddr_r exists
12151 set getnetbyaddr_r d_getnetbyaddr_r
12152 eval $inlibc
12153 case "$d_getnetbyaddr_r" in
12154 "$define")
12155         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12156         case "netdb" in
12157         time)
12158                 hdrs="$hdrs $i_systime sys/time.h"
12159                 ;;
12160         esac
12161         case "$d_getnetbyaddr_r_proto:$usethreads" in
12162         ":define")      d_getnetbyaddr_r_proto=define
12163                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12164                 eval $hasproto ;;
12165         *)      ;;
12166         esac
12167         case "$d_getnetbyaddr_r_proto" in
12168         define)
12169         case "$getnetbyaddr_r_proto" in
12170         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12171         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12172         esac
12173         case "$getnetbyaddr_r_proto" in
12174         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12175         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12176         esac
12177         case "$getnetbyaddr_r_proto" in
12178         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12179         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12180         esac
12181         case "$getnetbyaddr_r_proto" in
12182         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12183         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12184         esac
12185         case "$getnetbyaddr_r_proto" in
12186         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12187         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12188         esac
12189         case "$getnetbyaddr_r_proto" in
12190         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12191         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12192         esac
12193         case "$getnetbyaddr_r_proto" in
12194         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12195         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12196         esac
12197         case "$getnetbyaddr_r_proto" in
12198         ''|0)   d_getnetbyaddr_r=undef
12199                 getnetbyaddr_r_proto=0
12200                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12201         * )     case "$getnetbyaddr_r_proto" in
12202                 REENTRANT_PROTO*) ;;
12203                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12204                 esac
12205                 echo "Prototype: $try" ;;
12206         esac
12207         ;;
12208         *)      case "$usethreads" in
12209                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12210                 esac
12211                 d_getnetbyaddr_r=undef
12212                 getnetbyaddr_r_proto=0
12213                 ;;
12214         esac
12215         ;;
12216 *)      getnetbyaddr_r_proto=0
12217         ;;
12218 esac
12219
12220 : see if getnetbyname_r exists
12221 set getnetbyname_r d_getnetbyname_r
12222 eval $inlibc
12223 case "$d_getnetbyname_r" in
12224 "$define")
12225         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12226         case "netdb" in
12227         time)
12228                 hdrs="$hdrs $i_systime sys/time.h"
12229                 ;;
12230         esac
12231         case "$d_getnetbyname_r_proto:$usethreads" in
12232         ":define")      d_getnetbyname_r_proto=define
12233                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12234                 eval $hasproto ;;
12235         *)      ;;
12236         esac
12237         case "$d_getnetbyname_r_proto" in
12238         define)
12239         case "$getnetbyname_r_proto" in
12240         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12241         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12242         esac
12243         case "$getnetbyname_r_proto" in
12244         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12245         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12246         esac
12247         case "$getnetbyname_r_proto" in
12248         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12249         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12250         esac
12251         case "$getnetbyname_r_proto" in
12252         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12253         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12254         esac
12255         case "$getnetbyname_r_proto" in
12256         ''|0)   d_getnetbyname_r=undef
12257                 getnetbyname_r_proto=0
12258                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12259         * )     case "$getnetbyname_r_proto" in
12260                 REENTRANT_PROTO*) ;;
12261                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12262                 esac
12263                 echo "Prototype: $try" ;;
12264         esac
12265         ;;
12266         *)      case "$usethreads" in
12267                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12268                 esac
12269                 d_getnetbyname_r=undef
12270                 getnetbyname_r_proto=0
12271                 ;;
12272         esac
12273         ;;
12274 *)      getnetbyname_r_proto=0
12275         ;;
12276 esac
12277
12278 : see if getnetent_r exists
12279 set getnetent_r d_getnetent_r
12280 eval $inlibc
12281 case "$d_getnetent_r" in
12282 "$define")
12283         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12284         case "netdb" in
12285         time)
12286                 hdrs="$hdrs $i_systime sys/time.h"
12287                 ;;
12288         esac
12289         case "$d_getnetent_r_proto:$usethreads" in
12290         ":define")      d_getnetent_r_proto=define
12291                 set d_getnetent_r_proto getnetent_r $hdrs
12292                 eval $hasproto ;;
12293         *)      ;;
12294         esac
12295         case "$d_getnetent_r_proto" in
12296         define)
12297         case "$getnetent_r_proto" in
12298         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12299         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12300         esac
12301         case "$getnetent_r_proto" in
12302         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12303         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12304         esac
12305         case "$getnetent_r_proto" in
12306         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12307         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12308         esac
12309         case "$getnetent_r_proto" in
12310         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12311         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12312         esac
12313         case "$getnetent_r_proto" in
12314         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12315         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12316         esac
12317         case "$getnetent_r_proto" in
12318         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12319         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12320         esac
12321         case "$getnetent_r_proto" in
12322         ''|0)   d_getnetent_r=undef
12323                 getnetent_r_proto=0
12324                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12325         * )     case "$getnetent_r_proto" in
12326                 REENTRANT_PROTO*) ;;
12327                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12328                 esac
12329                 echo "Prototype: $try" ;;
12330         esac
12331         ;;
12332         *)      case "$usethreads" in
12333                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12334                 esac
12335                 d_getnetent_r=undef
12336                 getnetent_r_proto=0
12337                 ;;
12338         esac
12339         ;;
12340 *)      getnetent_r_proto=0
12341         ;;
12342 esac
12343
12344 : see if prototypes for various getnetxxx netdb.h functions are available
12345 echo " "
12346 set d_getnetprotos getnetent $i_netdb netdb.h
12347 eval $hasproto
12348
12349 : see if getpagesize exists
12350 set getpagesize d_getpagsz
12351 eval $inlibc
12352
12353
12354 : see if getprotobyname exists
12355 set getprotobyname d_getpbyname
12356 eval $inlibc
12357
12358 : see if getprotobynumber exists
12359 set getprotobynumber d_getpbynumber
12360 eval $inlibc
12361
12362 : see if getprotoent exists
12363 set getprotoent d_getpent
12364 eval $inlibc
12365
12366 : see if getpgid exists
12367 set getpgid d_getpgid
12368 eval $inlibc
12369
12370 : see if getpgrp2 exists
12371 set getpgrp2 d_getpgrp2
12372 eval $inlibc
12373
12374 : see if getppid exists
12375 set getppid d_getppid
12376 eval $inlibc
12377
12378 : see if getpriority exists
12379 set getpriority d_getprior
12380 eval $inlibc
12381
12382 : see if getprotobyname_r exists
12383 set getprotobyname_r d_getprotobyname_r
12384 eval $inlibc
12385 case "$d_getprotobyname_r" in
12386 "$define")
12387         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12388         case "netdb" in
12389         time)
12390                 hdrs="$hdrs $i_systime sys/time.h"
12391                 ;;
12392         esac
12393         case "$d_getprotobyname_r_proto:$usethreads" in
12394         ":define")      d_getprotobyname_r_proto=define
12395                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12396                 eval $hasproto ;;
12397         *)      ;;
12398         esac
12399         case "$d_getprotobyname_r_proto" in
12400         define)
12401         case "$getprotobyname_r_proto" in
12402         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12403         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12404         esac
12405         case "$getprotobyname_r_proto" in
12406         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12407         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12408         esac
12409         case "$getprotobyname_r_proto" in
12410         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12411         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12412         esac
12413         case "$getprotobyname_r_proto" in
12414         ''|0)   d_getprotobyname_r=undef
12415                 getprotobyname_r_proto=0
12416                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12417         * )     case "$getprotobyname_r_proto" in
12418                 REENTRANT_PROTO*) ;;
12419                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12420                 esac
12421                 echo "Prototype: $try" ;;
12422         esac
12423         ;;
12424         *)      case "$usethreads" in
12425                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12426                 esac
12427                 d_getprotobyname_r=undef
12428                 getprotobyname_r_proto=0
12429                 ;;
12430         esac
12431         ;;
12432 *)      getprotobyname_r_proto=0
12433         ;;
12434 esac
12435
12436 : see if getprotobynumber_r exists
12437 set getprotobynumber_r d_getprotobynumber_r
12438 eval $inlibc
12439 case "$d_getprotobynumber_r" in
12440 "$define")
12441         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12442         case "netdb" in
12443         time)
12444                 hdrs="$hdrs $i_systime sys/time.h"
12445                 ;;
12446         esac
12447         case "$d_getprotobynumber_r_proto:$usethreads" in
12448         ":define")      d_getprotobynumber_r_proto=define
12449                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12450                 eval $hasproto ;;
12451         *)      ;;
12452         esac
12453         case "$d_getprotobynumber_r_proto" in
12454         define)
12455         case "$getprotobynumber_r_proto" in
12456         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12457         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12458         esac
12459         case "$getprotobynumber_r_proto" in
12460         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12461         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12462         esac
12463         case "$getprotobynumber_r_proto" in
12464         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12465         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12466         esac
12467         case "$getprotobynumber_r_proto" in
12468         ''|0)   d_getprotobynumber_r=undef
12469                 getprotobynumber_r_proto=0
12470                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12471         * )     case "$getprotobynumber_r_proto" in
12472                 REENTRANT_PROTO*) ;;
12473                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12474                 esac
12475                 echo "Prototype: $try" ;;
12476         esac
12477         ;;
12478         *)      case "$usethreads" in
12479                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12480                 esac
12481                 d_getprotobynumber_r=undef
12482                 getprotobynumber_r_proto=0
12483                 ;;
12484         esac
12485         ;;
12486 *)      getprotobynumber_r_proto=0
12487         ;;
12488 esac
12489
12490 : see if getprotoent_r exists
12491 set getprotoent_r d_getprotoent_r
12492 eval $inlibc
12493 case "$d_getprotoent_r" in
12494 "$define")
12495         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12496         case "netdb" in
12497         time)
12498                 hdrs="$hdrs $i_systime sys/time.h"
12499                 ;;
12500         esac
12501         case "$d_getprotoent_r_proto:$usethreads" in
12502         ":define")      d_getprotoent_r_proto=define
12503                 set d_getprotoent_r_proto getprotoent_r $hdrs
12504                 eval $hasproto ;;
12505         *)      ;;
12506         esac
12507         case "$d_getprotoent_r_proto" in
12508         define)
12509         case "$getprotoent_r_proto" in
12510         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12511         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12512         esac
12513         case "$getprotoent_r_proto" in
12514         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12515         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12516         esac
12517         case "$getprotoent_r_proto" in
12518         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12519         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12520         esac
12521         case "$getprotoent_r_proto" in
12522         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12523         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12524         esac
12525         case "$getprotoent_r_proto" in
12526         ''|0)   d_getprotoent_r=undef
12527                 getprotoent_r_proto=0
12528                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12529         * )     case "$getprotoent_r_proto" in
12530                 REENTRANT_PROTO*) ;;
12531                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12532                 esac
12533                 echo "Prototype: $try" ;;
12534         esac
12535         ;;
12536         *)      case "$usethreads" in
12537                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12538                 esac
12539                 d_getprotoent_r=undef
12540                 getprotoent_r_proto=0
12541                 ;;
12542         esac
12543         ;;
12544 *)      getprotoent_r_proto=0
12545         ;;
12546 esac
12547
12548 : see if prototypes for various getprotoxxx netdb.h functions are available
12549 echo " "
12550 set d_getprotoprotos getprotoent $i_netdb netdb.h
12551 eval $hasproto
12552
12553 : see if getprpwnam exists
12554 set getprpwnam d_getprpwnam
12555 eval $inlibc
12556
12557 : see if getpwent exists
12558 set getpwent d_getpwent
12559 eval $inlibc
12560
12561 : see if getpwent_r exists
12562 set getpwent_r d_getpwent_r
12563 eval $inlibc
12564 case "$d_getpwent_r" in
12565 "$define")
12566         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12567         case "pwd" in
12568         time)
12569                 hdrs="$hdrs $i_systime sys/time.h"
12570                 ;;
12571         esac
12572         case "$d_getpwent_r_proto:$usethreads" in
12573         ":define")      d_getpwent_r_proto=define
12574                 set d_getpwent_r_proto getpwent_r $hdrs
12575                 eval $hasproto ;;
12576         *)      ;;
12577         esac
12578         case "$d_getpwent_r_proto" in
12579         define)
12580         case "$getpwent_r_proto" in
12581         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12582         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12583         esac
12584         case "$getpwent_r_proto" in
12585         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12586         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12587         esac
12588         case "$getpwent_r_proto" in
12589         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12590         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12591         esac
12592         case "$getpwent_r_proto" in
12593         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12594         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12595         esac
12596         case "$getpwent_r_proto" in
12597         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12598         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12599         esac
12600         case "$getpwent_r_proto" in
12601         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12602         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12603         esac
12604         case "$getpwent_r_proto" in
12605         ''|0)   d_getpwent_r=undef
12606                 getpwent_r_proto=0
12607                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12608         * )     case "$getpwent_r_proto" in
12609                 REENTRANT_PROTO*) ;;
12610                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12611                 esac
12612                 echo "Prototype: $try" ;;
12613         esac
12614         ;;
12615         *)      case "$usethreads" in
12616                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12617                 esac
12618                 d_getpwent_r=undef
12619                 getpwent_r_proto=0
12620                 ;;
12621         esac
12622         ;;
12623 *)      getpwent_r_proto=0
12624         ;;
12625 esac
12626
12627 : see if getpwnam_r exists
12628 set getpwnam_r d_getpwnam_r
12629 eval $inlibc
12630 case "$d_getpwnam_r" in
12631 "$define")
12632         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12633         case "pwd" in
12634         time)
12635                 hdrs="$hdrs $i_systime sys/time.h"
12636                 ;;
12637         esac
12638         case "$d_getpwnam_r_proto:$usethreads" in
12639         ":define")      d_getpwnam_r_proto=define
12640                 set d_getpwnam_r_proto getpwnam_r $hdrs
12641                 eval $hasproto ;;
12642         *)      ;;
12643         esac
12644         case "$d_getpwnam_r_proto" in
12645         define)
12646         case "$getpwnam_r_proto" in
12647         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12648         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12649         esac
12650         case "$getpwnam_r_proto" in
12651         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12652         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12653         esac
12654         case "$getpwnam_r_proto" in
12655         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12656         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12657         esac
12658         case "$getpwnam_r_proto" in
12659         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12660         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12661         esac
12662         case "$getpwnam_r_proto" in
12663         ''|0)   d_getpwnam_r=undef
12664                 getpwnam_r_proto=0
12665                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12666         * )     case "$getpwnam_r_proto" in
12667                 REENTRANT_PROTO*) ;;
12668                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12669                 esac
12670                 echo "Prototype: $try" ;;
12671         esac
12672         ;;
12673         *)      case "$usethreads" in
12674                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12675                 esac
12676                 d_getpwnam_r=undef
12677                 getpwnam_r_proto=0
12678                 ;;
12679         esac
12680         ;;
12681 *)      getpwnam_r_proto=0
12682         ;;
12683 esac
12684
12685 : see if getpwuid_r exists
12686 set getpwuid_r d_getpwuid_r
12687 eval $inlibc
12688 case "$d_getpwuid_r" in
12689 "$define")
12690         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12691         case "pwd" in
12692         time)
12693                 hdrs="$hdrs $i_systime sys/time.h"
12694                 ;;
12695         esac
12696         case "$d_getpwuid_r_proto:$usethreads" in
12697         ":define")      d_getpwuid_r_proto=define
12698                 set d_getpwuid_r_proto getpwuid_r $hdrs
12699                 eval $hasproto ;;
12700         *)      ;;
12701         esac
12702         case "$d_getpwuid_r_proto" in
12703         define)
12704         case "$getpwuid_r_proto" in
12705         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12706         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12707         esac
12708         case "$getpwuid_r_proto" in
12709         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12710         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12711         esac
12712         case "$getpwuid_r_proto" in
12713         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12714         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12715         esac
12716         case "$getpwuid_r_proto" in
12717         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12718         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12719         esac
12720         case "$getpwuid_r_proto" in
12721         ''|0)   d_getpwuid_r=undef
12722                 getpwuid_r_proto=0
12723                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12724         * )     case "$getpwuid_r_proto" in
12725                 REENTRANT_PROTO*) ;;
12726                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12727                 esac
12728                 echo "Prototype: $try" ;;
12729         esac
12730         ;;
12731         *)      case "$usethreads" in
12732                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12733                 esac
12734                 d_getpwuid_r=undef
12735                 getpwuid_r_proto=0
12736                 ;;
12737         esac
12738         ;;
12739 *)      getpwuid_r_proto=0
12740         ;;
12741 esac
12742
12743
12744 : see if getservbyname exists
12745 set getservbyname d_getsbyname
12746 eval $inlibc
12747
12748 : see if getservbyport exists
12749 set getservbyport d_getsbyport
12750 eval $inlibc
12751
12752 : see if getservent exists
12753 set getservent d_getsent
12754 eval $inlibc
12755
12756 : see if getservbyname_r exists
12757 set getservbyname_r d_getservbyname_r
12758 eval $inlibc
12759 case "$d_getservbyname_r" in
12760 "$define")
12761         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12762         case "netdb" in
12763         time)
12764                 hdrs="$hdrs $i_systime sys/time.h"
12765                 ;;
12766         esac
12767         case "$d_getservbyname_r_proto:$usethreads" in
12768         ":define")      d_getservbyname_r_proto=define
12769                 set d_getservbyname_r_proto getservbyname_r $hdrs
12770                 eval $hasproto ;;
12771         *)      ;;
12772         esac
12773         case "$d_getservbyname_r_proto" in
12774         define)
12775         case "$getservbyname_r_proto" in
12776         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12777         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12778         esac
12779         case "$getservbyname_r_proto" in
12780         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12781         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12782         esac
12783         case "$getservbyname_r_proto" in
12784         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12785         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12786         esac
12787         case "$getservbyname_r_proto" in
12788         ''|0)   d_getservbyname_r=undef
12789                 getservbyname_r_proto=0
12790                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12791         * )     case "$getservbyname_r_proto" in
12792                 REENTRANT_PROTO*) ;;
12793                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12794                 esac
12795                 echo "Prototype: $try" ;;
12796         esac
12797         ;;
12798         *)      case "$usethreads" in
12799                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12800                 esac
12801                 d_getservbyname_r=undef
12802                 getservbyname_r_proto=0
12803                 ;;
12804         esac
12805         ;;
12806 *)      getservbyname_r_proto=0
12807         ;;
12808 esac
12809
12810 : see if getservbyport_r exists
12811 set getservbyport_r d_getservbyport_r
12812 eval $inlibc
12813 case "$d_getservbyport_r" in
12814 "$define")
12815         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12816         case "netdb" in
12817         time)
12818                 hdrs="$hdrs $i_systime sys/time.h"
12819                 ;;
12820         esac
12821         case "$d_getservbyport_r_proto:$usethreads" in
12822         ":define")      d_getservbyport_r_proto=define
12823                 set d_getservbyport_r_proto getservbyport_r $hdrs
12824                 eval $hasproto ;;
12825         *)      ;;
12826         esac
12827         case "$d_getservbyport_r_proto" in
12828         define)
12829         case "$getservbyport_r_proto" in
12830         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12831         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12832         esac
12833         case "$getservbyport_r_proto" in
12834         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12835         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12836         esac
12837         case "$getservbyport_r_proto" in
12838         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12839         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12840         esac
12841         case "$getservbyport_r_proto" in
12842         ''|0)   d_getservbyport_r=undef
12843                 getservbyport_r_proto=0
12844                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12845         * )     case "$getservbyport_r_proto" in
12846                 REENTRANT_PROTO*) ;;
12847                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12848                 esac
12849                 echo "Prototype: $try" ;;
12850         esac
12851         ;;
12852         *)      case "$usethreads" in
12853                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12854                 esac
12855                 d_getservbyport_r=undef
12856                 getservbyport_r_proto=0
12857                 ;;
12858         esac
12859         ;;
12860 *)      getservbyport_r_proto=0
12861         ;;
12862 esac
12863
12864 : see if getservent_r exists
12865 set getservent_r d_getservent_r
12866 eval $inlibc
12867 case "$d_getservent_r" in
12868 "$define")
12869         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12870         case "netdb" in
12871         time)
12872                 hdrs="$hdrs $i_systime sys/time.h"
12873                 ;;
12874         esac
12875         case "$d_getservent_r_proto:$usethreads" in
12876         ":define")      d_getservent_r_proto=define
12877                 set d_getservent_r_proto getservent_r $hdrs
12878                 eval $hasproto ;;
12879         *)      ;;
12880         esac
12881         case "$d_getservent_r_proto" in
12882         define)
12883         case "$getservent_r_proto" in
12884         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12885         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12886         esac
12887         case "$getservent_r_proto" in
12888         ''|0) try='int getservent_r(struct servent*, char*, int);'
12889         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12890         esac
12891         case "$getservent_r_proto" in
12892         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12893         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12894         esac
12895         case "$getservent_r_proto" in
12896         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12897         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12898         esac
12899         case "$getservent_r_proto" in
12900         ''|0)   d_getservent_r=undef
12901                 getservent_r_proto=0
12902                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12903         * )     case "$getservent_r_proto" in
12904                 REENTRANT_PROTO*) ;;
12905                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12906                 esac
12907                 echo "Prototype: $try" ;;
12908         esac
12909         ;;
12910         *)      case "$usethreads" in
12911                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12912                 esac
12913                 d_getservent_r=undef
12914                 getservent_r_proto=0
12915                 ;;
12916         esac
12917         ;;
12918 *)      getservent_r_proto=0
12919         ;;
12920 esac
12921
12922 : see if prototypes for various getservxxx netdb.h functions are available
12923 echo " "
12924 set d_getservprotos getservent $i_netdb netdb.h
12925 eval $hasproto
12926
12927 : see if getspnam exists
12928 set getspnam d_getspnam
12929 eval $inlibc
12930
12931 : see if this is a shadow.h system
12932 set shadow.h i_shadow
12933 eval $inhdr
12934
12935 : see if getspnam_r exists
12936 set getspnam_r d_getspnam_r
12937 eval $inlibc
12938 case "$d_getspnam_r" in
12939 "$define")
12940         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12941         case "shadow" in
12942         time)
12943                 hdrs="$hdrs $i_systime sys/time.h"
12944                 ;;
12945         esac
12946         case "$d_getspnam_r_proto:$usethreads" in
12947         ":define")      d_getspnam_r_proto=define
12948                 set d_getspnam_r_proto getspnam_r $hdrs
12949                 eval $hasproto ;;
12950         *)      ;;
12951         esac
12952         case "$d_getspnam_r_proto" in
12953         define)
12954         case "$getspnam_r_proto" in
12955         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12956         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12957         esac
12958         case "$getspnam_r_proto" in
12959         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12960         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12961         esac
12962         case "$getspnam_r_proto" in
12963         ''|0)   d_getspnam_r=undef
12964                 getspnam_r_proto=0
12965                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12966         * )     case "$getspnam_r_proto" in
12967                 REENTRANT_PROTO*) ;;
12968                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12969                 esac
12970                 echo "Prototype: $try" ;;
12971         esac
12972         ;;
12973         *)      case "$usethreads" in
12974                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12975                 esac
12976                 d_getspnam_r=undef
12977                 getspnam_r_proto=0
12978                 ;;
12979         esac
12980         ;;
12981 *)      getspnam_r_proto=0
12982         ;;
12983 esac
12984
12985 : see if gettimeofday or ftime exists
12986 set gettimeofday d_gettimeod
12987 eval $inlibc
12988 case "$d_gettimeod" in
12989 "$undef")
12990         set ftime d_ftime 
12991         eval $inlibc
12992         ;;
12993 *)
12994         val="$undef"; set d_ftime; eval $setvar
12995         ;;
12996 esac
12997 case "$d_gettimeod$d_ftime" in
12998 "$undef$undef")
12999         echo " "
13000         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13001         ;;
13002 esac
13003
13004 : see if gmtime_r exists
13005 set gmtime_r d_gmtime_r
13006 eval $inlibc
13007 case "$d_gmtime_r" in
13008 "$define")
13009         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
13010         case "time" in
13011         time)
13012                 hdrs="$hdrs $i_systime sys/time.h"
13013                 ;;
13014         esac
13015         case "$d_gmtime_r_proto:$usethreads" in
13016         ":define")      d_gmtime_r_proto=define
13017                 set d_gmtime_r_proto gmtime_r $hdrs
13018                 eval $hasproto ;;
13019         *)      ;;
13020         esac
13021         case "$d_gmtime_r_proto" in
13022         define)
13023         case "$gmtime_r_proto" in
13024         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13025         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13026         esac
13027         case "$gmtime_r_proto" in
13028         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13029         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13030         esac
13031         case "$gmtime_r_proto" in
13032         ''|0)   d_gmtime_r=undef
13033                 gmtime_r_proto=0
13034                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13035         * )     case "$gmtime_r_proto" in
13036                 REENTRANT_PROTO*) ;;
13037                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13038                 esac
13039                 echo "Prototype: $try" ;;
13040         esac
13041         ;;
13042         *)      case "$usethreads" in
13043                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13044                 esac
13045                 d_gmtime_r=undef
13046                 gmtime_r_proto=0
13047                 ;;
13048         esac
13049         ;;
13050 *)      gmtime_r_proto=0
13051         ;;
13052 esac
13053
13054 : see if hasmntopt exists
13055 set hasmntopt d_hasmntopt
13056 eval $inlibc
13057
13058 : see if this is a netinet/in.h or sys/in.h system
13059 set netinet/in.h i_niin sys/in.h i_sysin
13060 eval $inhdr
13061
13062 : see if arpa/inet.h has to be included
13063 set arpa/inet.h i_arpainet
13064 eval $inhdr
13065
13066 : see if htonl --and friends-- exists
13067 val=''
13068 set htonl val
13069 eval $inlibc
13070
13071 : Maybe they are macros.
13072 case "$val" in
13073 $undef)
13074         $cat >htonl.c <<EOM
13075 #include <stdio.h>
13076 #include <sys/types.h>
13077 #$i_niin I_NETINET_IN
13078 #$i_sysin I_SYS_IN
13079 #$i_arpainet I_ARPA_INET
13080 #ifdef I_NETINET_IN
13081 #include <netinet/in.h>
13082 #endif
13083 #ifdef I_SYS_IN
13084 #include <sys/in.h>
13085 #endif
13086 #ifdef I_ARPA_INET
13087 #include <arpa/inet.h>
13088 #endif
13089 #ifdef htonl
13090 printf("Defined as a macro.");
13091 #endif
13092 EOM
13093         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13094         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13095                 val="$define"
13096                 echo "But it seems to be defined as a macro." >&4
13097         fi
13098         $rm -f htonl.?
13099         ;;
13100 esac
13101 set d_htonl
13102 eval $setvar
13103
13104 : index or strchr
13105 echo " "
13106 if set index val -f; eval $csym; $val; then
13107         if set strchr val -f d_strchr; eval $csym; $val; then
13108                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13109                         val="$define"
13110                         vali="$undef"
13111                         echo "strchr() found." >&4
13112                 else
13113                         val="$undef"
13114                         vali="$define"
13115                         echo "index() found." >&4
13116                 fi
13117         else
13118                 val="$undef"
13119                 vali="$define"
13120                 echo "index() found." >&4
13121         fi
13122 else
13123         if set strchr val -f d_strchr; eval $csym; $val; then
13124                 val="$define"
13125                 vali="$undef"
13126                 echo "strchr() found." >&4
13127         else
13128                 echo "No index() or strchr() found!" >&4
13129                 val="$undef"
13130                 vali="$undef"
13131         fi
13132 fi
13133 set d_strchr; eval $setvar
13134 val="$vali"
13135 set d_index; eval $setvar
13136
13137 : check whether inet_aton exists
13138 set inet_aton d_inetaton
13139 eval $inlibc
13140
13141 : Look for isascii
13142 echo " "
13143 $cat >isascii.c <<'EOCP'
13144 #include <stdio.h>
13145 #include <ctype.h>
13146 int main() {
13147         int c = 'A';
13148         if (isascii(c))
13149                 exit(0);
13150         else
13151                 exit(1);
13152 }
13153 EOCP
13154 set isascii
13155 if eval $compile; then
13156         echo "isascii() found." >&4
13157         val="$define"
13158 else
13159         echo "isascii() NOT found." >&4
13160         val="$undef"
13161 fi
13162 set d_isascii
13163 eval $setvar
13164 $rm -f isascii*
13165
13166 : see if isfinite exists
13167 set isfinite d_isfinite
13168 eval $inlibc
13169
13170 : see if isinf exists
13171 set isinf d_isinf
13172 eval $inlibc
13173
13174 : see if isnan exists
13175 set isnan d_isnan
13176 eval $inlibc
13177
13178 : see if isnanl exists
13179 set isnanl d_isnanl
13180 eval $inlibc
13181
13182 : see if killpg exists
13183 set killpg d_killpg
13184 eval $inlibc
13185
13186 : see if lchown exists
13187 echo " "
13188 $cat > try.c <<'EOCP'
13189 /* System header to define __stub macros and hopefully few prototypes,
13190     which can conflict with char lchown(); below.  */
13191 #include <assert.h>
13192 /* Override any gcc2 internal prototype to avoid an error.  */
13193 /* We use char because int might match the return type of a gcc2
13194    builtin and then its argument prototype would still apply.  */
13195 char lchown();
13196 int main() {
13197     /*  The GNU C library defines this for functions which it implements
13198         to always fail with ENOSYS.  Some functions are actually named
13199         something starting with __ and the normal name is an alias.  */
13200 #if defined (__stub_lchown) || defined (__stub___lchown)
13201 choke me
13202 #else
13203 lchown();
13204 #endif
13205 ; return 0; }
13206 EOCP
13207 set try
13208 if eval $compile; then
13209     $echo "lchown() found." >&4
13210     val="$define"
13211 else
13212     $echo "lchown() NOT found." >&4
13213     val="$undef"
13214 fi
13215 set d_lchown
13216 eval $setvar
13217
13218 : See if number of significant digits in a double precision number is known
13219 echo " "
13220 $cat >ldbl_dig.c <<EOM
13221 #$i_limits I_LIMITS
13222 #$i_float I_FLOAT
13223 #ifdef I_LIMITS
13224 #include <limits.h>
13225 #endif
13226 #ifdef I_FLOAT
13227 #include <float.h>
13228 #endif
13229 #ifdef LDBL_DIG
13230 printf("Contains LDBL_DIG");
13231 #endif
13232 EOM
13233 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13234 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13235         echo "LDBL_DIG found." >&4
13236         val="$define"
13237 else
13238         echo "LDBL_DIG NOT found." >&4
13239         val="$undef"
13240 fi
13241 $rm -f ldbl_dig.?
13242 set d_ldbl_dig
13243 eval $setvar
13244
13245 : see if link exists
13246 set link d_link
13247 eval $inlibc
13248
13249 : see if localtime_r exists
13250 set localtime_r d_localtime_r
13251 eval $inlibc
13252 case "$d_localtime_r" in
13253 "$define")
13254         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
13255         case "time" in
13256         time)
13257                 hdrs="$hdrs $i_systime sys/time.h"
13258                 ;;
13259         esac
13260         case "$d_localtime_r_proto:$usethreads" in
13261         ":define")      d_localtime_r_proto=define
13262                 set d_localtime_r_proto localtime_r $hdrs
13263                 eval $hasproto ;;
13264         *)      ;;
13265         esac
13266         case "$d_localtime_r_proto" in
13267         define)
13268         case "$localtime_r_proto" in
13269         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13270         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13271         esac
13272         case "$localtime_r_proto" in
13273         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13274         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13275         esac
13276         case "$localtime_r_proto" in
13277         ''|0)   d_localtime_r=undef
13278                 localtime_r_proto=0
13279                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13280         * )     case "$localtime_r_proto" in
13281                 REENTRANT_PROTO*) ;;
13282                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13283                 esac
13284                 echo "Prototype: $try" ;;
13285         esac
13286         ;;
13287         *)      case "$usethreads" in
13288                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13289                 esac
13290                 d_localtime_r=undef
13291                 localtime_r_proto=0
13292                 ;;
13293         esac
13294         ;;
13295 *)      localtime_r_proto=0
13296         ;;
13297 esac
13298
13299 : see if localeconv exists
13300 set localeconv d_locconv
13301 eval $inlibc
13302
13303 : see if lockf exists
13304 set lockf d_lockf
13305 eval $inlibc
13306
13307 : see if prototype for lseek is available
13308 echo " "
13309 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13310 eval $hasproto
13311
13312 : see if lstat exists
13313 set lstat d_lstat
13314 eval $inlibc
13315
13316 : see if madvise exists
13317 set madvise d_madvise
13318 eval $inlibc
13319
13320 : see if mblen exists
13321 set mblen d_mblen
13322 eval $inlibc
13323
13324 : see if mbstowcs exists
13325 set mbstowcs d_mbstowcs
13326 eval $inlibc
13327
13328 : see if mbtowc exists
13329 set mbtowc d_mbtowc
13330 eval $inlibc
13331
13332 : see if memchr exists
13333 set memchr d_memchr
13334 eval $inlibc
13335
13336 : see if memcmp exists
13337 set memcmp d_memcmp
13338 eval $inlibc
13339
13340 : see if memcpy exists
13341 set memcpy d_memcpy
13342 eval $inlibc
13343
13344 : see if memmove exists
13345 set memmove d_memmove
13346 eval $inlibc
13347
13348 : see if memset exists
13349 set memset d_memset
13350 eval $inlibc
13351
13352 : see if mkdir exists
13353 set mkdir d_mkdir
13354 eval $inlibc
13355
13356 : see if mkdtemp exists
13357 set mkdtemp d_mkdtemp
13358 eval $inlibc
13359
13360 : see if mkfifo exists
13361 set mkfifo d_mkfifo
13362 eval $inlibc
13363
13364 : see if mkstemp exists
13365 set mkstemp d_mkstemp
13366 eval $inlibc
13367
13368 : see if mkstemps exists
13369 set mkstemps d_mkstemps
13370 eval $inlibc
13371
13372 : see if mktime exists
13373 set mktime d_mktime
13374 eval $inlibc
13375
13376 : see if this is a sys/mman.h system
13377 set sys/mman.h i_sysmman
13378 eval $inhdr
13379
13380 : see if mmap exists
13381 set mmap d_mmap
13382 eval $inlibc
13383 : see what shmat returns
13384 : default to something harmless
13385 mmaptype='void *'
13386 case "$i_sysmman$d_mmap" in
13387 "$define$define")
13388         $cat >mmap.c <<'END'
13389 #include <sys/mman.h>
13390 void *mmap();
13391 END
13392         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13393                 mmaptype='void *'
13394         else
13395                 mmaptype='caddr_t'
13396         fi
13397         echo "and it returns ($mmaptype)." >&4
13398         ;;
13399 esac
13400
13401
13402
13403 : see if mprotect exists
13404 set mprotect d_mprotect
13405 eval $inlibc
13406
13407 : see if msgctl exists
13408 set msgctl d_msgctl
13409 eval $inlibc
13410
13411 : see if msgget exists
13412 set msgget d_msgget
13413 eval $inlibc
13414
13415 : see if msgsnd exists
13416 set msgsnd d_msgsnd
13417 eval $inlibc
13418
13419 : see if msgrcv exists
13420 set msgrcv d_msgrcv
13421 eval $inlibc
13422
13423 : see how much of the 'msg*(2)' library is present.
13424 h_msg=true
13425 echo " "
13426 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13427 *"$undef"*) h_msg=false;;
13428 esac
13429 case "$osname" in
13430 freebsd)
13431     case "`ipcs 2>&1`" in
13432     "SVID messages"*"not configured"*)
13433         echo "Your $osname does not have the msg*(2) configured." >&4
13434         h_msg=false
13435         val="$undef"
13436         set msgctl d_msgctl
13437         eval $setvar
13438         set msgget d_msgget
13439         eval $setvar
13440         set msgsnd d_msgsnd
13441         eval $setvar
13442         set msgrcv d_msgrcv
13443         eval $setvar
13444         ;;
13445     esac
13446     ;;
13447 esac
13448 : we could also check for sys/ipc.h ...
13449 if $h_msg && $test `./findhdr sys/msg.h`; then
13450         echo "You have the full msg*(2) library." >&4
13451         val="$define"
13452 else
13453         echo "You don't have the full msg*(2) library." >&4
13454         val="$undef"
13455 fi
13456 set d_msg
13457 eval $setvar
13458
13459
13460 echo " "
13461 echo "Checking to see if your system supports struct msghdr..." >&4
13462 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13463 eval $hasstruct
13464 case "$d_msghdr_s" in
13465 "$define")      echo "Yes, it does."   ;;
13466 *)              echo "No, it doesn't." ;;
13467 esac
13468
13469
13470 : see if msync exists
13471 set msync d_msync
13472 eval $inlibc
13473
13474 : see if munmap exists
13475 set munmap d_munmap
13476 eval $inlibc
13477
13478 : see if nice exists
13479 set nice d_nice
13480 eval $inlibc
13481
13482 : see if this is a langinfo.h system
13483 set langinfo.h i_langinfo
13484 eval $inhdr
13485
13486 : see if nl_langinfo exists
13487 set nl_langinfo d_nl_langinfo
13488 eval $inlibc
13489
13490 : check for length of character
13491 echo " "
13492 case "$charsize" in
13493 '')
13494         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13495         $cat >try.c <<'EOCP'
13496 #include <stdio.h>
13497 int main()
13498 {
13499     printf("%d\n", (int)sizeof(char));
13500     exit(0);
13501 }
13502 EOCP
13503         set try
13504         if eval $compile_ok; then
13505                 dflt=`$run ./try`
13506         else
13507                 dflt='1'
13508                 echo "(I can't seem to compile the test program.  Guessing...)"
13509         fi
13510         ;;
13511 *)
13512         dflt="$charsize"
13513         ;;
13514 esac
13515 rp="What is the size of a character (in bytes)?"
13516 . ./myread
13517 charsize="$ans"
13518 $rm -f try.c try
13519
13520 : check for volatile keyword
13521 echo " "
13522 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13523 $cat >try.c <<'EOCP'
13524 int main()
13525 {
13526         typedef struct _goo_struct goo_struct;
13527         goo_struct * volatile goo = ((goo_struct *)0);
13528         struct _goo_struct {
13529                 long long_int;
13530                 int reg_int;
13531                 char char_var;
13532         };
13533         typedef unsigned short foo_t;
13534         char *volatile foo;
13535         volatile int bar;
13536         volatile foo_t blech;
13537         foo = foo;
13538 }
13539 EOCP
13540 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13541         val="$define"
13542         echo "Yup, it does."
13543 else
13544         val="$undef"
13545         echo "Nope, it doesn't."
13546 fi
13547 set d_volatile
13548 eval $setvar
13549 $rm -f try.*
13550
13551
13552 echo " "
13553 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13554
13555 case "$use64bitint:$d_quad:$quadtype" in
13556 define:define:?*)
13557         ivtype="$quadtype"
13558         uvtype="$uquadtype"
13559         ivsize=8
13560         uvsize=8
13561         ;;
13562 *)      ivtype="long"
13563         uvtype="unsigned long"
13564         ivsize=$longsize
13565         uvsize=$longsize
13566         ;;
13567 esac
13568
13569 case "$uselongdouble:$d_longdbl" in
13570 define:define)
13571         nvtype="long double"
13572         nvsize=$longdblsize
13573         ;;
13574 *)      nvtype=double
13575         nvsize=$doublesize
13576         ;;
13577 esac
13578
13579 $echo "(IV will be "$ivtype", $ivsize bytes)"
13580 $echo "(UV will be "$uvtype", $uvsize bytes)"
13581 $echo "(NV will be "$nvtype", $nvsize bytes)"
13582
13583 $cat >try.c <<EOCP
13584 #$i_inttypes I_INTTYPES
13585 #ifdef I_INTTYPES
13586 #include <inttypes.h>
13587 #endif
13588 #include <stdio.h>
13589 int main() {
13590 #ifdef INT8
13591    int8_t i =  INT8_MAX;
13592   uint8_t u = UINT8_MAX;
13593   printf("int8_t\n");
13594 #endif
13595 #ifdef INT16
13596    int16_t i =  INT16_MAX;
13597   uint16_t i = UINT16_MAX;
13598   printf("int16_t\n");
13599 #endif
13600 #ifdef INT32
13601    int32_t i =  INT32_MAX;
13602   uint32_t u = UINT32_MAX;
13603   printf("int32_t\n");
13604 #endif
13605 }
13606 EOCP
13607
13608 case "$i8type" in
13609 '')     case "$charsize" in
13610         1)      i8type=char
13611                 u8type="unsigned char"
13612                 i8size=$charsize
13613                 u8size=$charsize
13614                 ;;
13615         esac
13616         ;;
13617 esac
13618 case "$i8type" in
13619 '')     set try -DINT8
13620         if eval $compile; then
13621                 case "`$run ./try`" in
13622                 int8_t) i8type=int8_t
13623                         u8type=uint8_t
13624                         i8size=1
13625                         u8size=1
13626                         ;;
13627                 esac
13628         fi
13629         ;;
13630 esac
13631 case "$i8type" in
13632 '')     if $test $charsize -ge 1; then
13633                 i8type=char
13634                 u8type="unsigned char"
13635                 i8size=$charsize
13636                 u8size=$charsize
13637         fi
13638         ;;
13639 esac
13640
13641 case "$i16type" in
13642 '')     case "$shortsize" in
13643         2)      i16type=short
13644                 u16type="unsigned short"
13645                 i16size=$shortsize
13646                 u16size=$shortsize
13647                 ;;
13648         esac
13649         ;;
13650 esac
13651 case "$i16type" in
13652 '')     set try -DINT16
13653         if eval $compile; then
13654                 case "`$run ./try`" in
13655                 int16_t)
13656                         i16type=int16_t
13657                         u16type=uint16_t
13658                         i16size=2
13659                         u16size=2
13660                         ;;
13661                 esac
13662         fi
13663         ;;
13664 esac
13665 case "$i16type" in
13666 '')     if $test $shortsize -ge 2; then
13667                 i16type=short
13668                 u16type="unsigned short"
13669                 i16size=$shortsize
13670                 u16size=$shortsize
13671         fi
13672         ;;
13673 esac
13674
13675 case "$i32type" in
13676 '')     case "$longsize" in
13677         4)      i32type=long
13678                 u32type="unsigned long"
13679                 i32size=$longsize
13680                 u32size=$longsize
13681                 ;;
13682         *)      case "$intsize" in
13683                 4)      i32type=int
13684                         u32type="unsigned int"
13685                         i32size=$intsize
13686                         u32size=$intsize
13687                         ;;
13688                 esac
13689                 ;;
13690         esac
13691         ;;
13692 esac
13693 case "$i32type" in
13694 '')     set try -DINT32
13695         if eval $compile; then
13696                 case "`$run ./try`" in
13697                 int32_t)
13698                         i32type=int32_t
13699                         u32type=uint32_t
13700                         i32size=4
13701                         u32size=4
13702                         ;;
13703                 esac
13704         fi
13705         ;;
13706 esac
13707 case "$i32type" in
13708 '')     if $test $intsize -ge 4; then
13709                 i32type=int
13710                 u32type="unsigned int"
13711                 i32size=$intsize
13712                 u32size=$intsize
13713         fi
13714         ;;
13715 esac
13716
13717 case "$i64type" in
13718 '')     case "$d_quad:$quadtype" in
13719         define:?*)
13720                 i64type="$quadtype"
13721                 u64type="$uquadtype"
13722                 i64size=8
13723                 u64size=8
13724                 ;;
13725         esac
13726         ;;
13727 esac
13728
13729 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13730 : volatile so that the compiler has to store it out to memory.
13731 if test X"$d_volatile" = X"$define"; then
13732         volatile=volatile
13733 fi
13734 $cat <<EOP >try.c
13735 #include <stdio.h>
13736 #include <sys/types.h>
13737 #include <signal.h>
13738 #ifdef SIGFPE
13739 $volatile int bletched = 0;
13740 $signal_t blech(s) int s; { bletched = 1; }
13741 #endif
13742 int main() {
13743     $uvtype u = 0;
13744     $nvtype d;
13745     int     n = 8 * $uvsize;
13746     int     i;
13747 #ifdef SIGFPE
13748     signal(SIGFPE, blech);
13749 #endif
13750
13751     for (i = 0; i < n; i++) {
13752       u = u << 1 | ($uvtype)1;
13753       d = ($nvtype)u;
13754       if (($uvtype)d != u)
13755         break;
13756       if (d <= 0)
13757         break;
13758       d = ($nvtype)(u - 1);
13759       if (($uvtype)d != (u - 1))
13760         break;
13761 #ifdef SIGFPE
13762       if (bletched) {
13763         break;
13764 #endif
13765       } 
13766     }
13767     printf("%d\n", ((i == n) ? -n : i));
13768     exit(0);
13769 }
13770 EOP
13771 set try
13772
13773 d_nv_preserves_uv="$undef"
13774 if eval $compile; then
13775         nv_preserves_uv_bits="`$run ./try`"
13776 fi
13777 case "$nv_preserves_uv_bits" in
13778 \-[1-9]*)       
13779         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13780         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13781         d_nv_preserves_uv="$define"
13782         ;;
13783 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13784         d_nv_preserves_uv="$undef" ;;
13785 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13786         nv_preserves_uv_bits="$undef" ;;
13787 esac
13788
13789 $rm -f try.* try
13790
13791
13792 : check for off64_t
13793 echo " "
13794 echo "Checking to see if you have off64_t..." >&4
13795 $cat >try.c <<EOCP
13796 #include <sys/types.h>
13797 #include <unistd.h>
13798 int main() { off64_t x = 7; }
13799 EOCP
13800 set try
13801 if eval $compile; then
13802         val="$define"
13803         echo "You have off64_t."
13804 else
13805         val="$undef"
13806         echo "You do not have off64_t."
13807         case "$lseeksize" in
13808         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13809         esac
13810 fi
13811 $rm -f try.* try
13812 set d_off64_t
13813 eval $setvar
13814
13815 : see if POSIX threads are available
13816 set pthread.h i_pthread
13817 eval $inhdr
13818
13819
13820
13821
13822 : how to create joinable pthreads
13823 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13824         echo " "
13825         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13826         $cat >try.c <<'EOCP'
13827 #include <pthread.h>
13828 int main() {
13829     int detachstate = JOINABLE;
13830 }
13831 EOCP
13832         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13833         if eval $compile; then
13834                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13835                 val="$undef" # Yes, undef.
13836                 set d_old_pthread_create_joinable
13837                 eval $setvar
13838                 val=""
13839                 set old_pthread_create_joinable
13840                 eval $setvar
13841         else
13842                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13843                 if eval $compile; then
13844                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13845                         val="$define"
13846                         set d_old_pthread_create_joinable
13847                         eval $setvar
13848                         val=PTHREAD_CREATE_UNDETACHED
13849                         set old_pthread_create_joinable
13850                         eval $setvar
13851                 else            
13852                         set try -DJOINABLE=__UNDETACHED
13853                         if eval $compile; then
13854                                 echo "You seem to use __UNDETACHED." >&4
13855                                 val="$define"
13856                                 set d_old_pthread_create_joinable
13857                                 eval $setvar
13858                                 val=__UNDETACHED
13859                                 set old_pthread_create_joinable
13860                                 eval $setvar
13861                         else
13862                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13863                                 val="$define"
13864                                 set d_old_pthread_create_joinable
13865                                 eval $setvar
13866                                 val=0
13867                                 set old_pthread_create_joinable
13868                                 eval $setvar
13869                         fi
13870                 fi
13871         fi
13872         $rm -f try try.*
13873 else
13874     d_old_pthread_create_joinable="$undef"
13875     old_pthread_create_joinable=""
13876 fi
13877
13878 : see if pause exists
13879 set pause d_pause
13880 eval $inlibc
13881
13882 : see if pipe exists
13883 set pipe d_pipe
13884 eval $inlibc
13885
13886 : see if poll exists
13887 set poll d_poll
13888 eval $inlibc
13889
13890 : see if readlink exists
13891 set readlink d_readlink
13892 eval $inlibc
13893
13894 echo " "
13895 procselfexe=''
13896 val="$undef"
13897 case "$d_readlink" in
13898 "$define")
13899         if $issymlink /proc/self/exe ; then
13900                 $ls -l /proc/self/exe > reflect
13901                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13902                         echo "You have Linux-like /proc/self/exe."
13903                         procselfexe='"/proc/self/exe"'
13904                         val="$define"
13905                 fi
13906         fi
13907         if $issymlink /proc/curproc/file ; then
13908                 $ls -l /proc/curproc/file > reflect
13909                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13910                         echo "You have BSD-like /proc/curproc/file."
13911                         procselfexe='"/proc/curproc/file"'
13912                         val="$define"
13913                 fi
13914         fi
13915         ;;
13916 esac
13917 $rm -f reflect
13918 set d_procselfexe
13919 eval $setvar
13920
13921 : see whether the pthread_atfork exists
13922 $cat >try.c <<EOP
13923 #include <pthread.h>
13924 #include <stdio.h>
13925 int main() {
13926 #ifdef  PTHREAD_ATFORK
13927         pthread_atfork(NULL,NULL,NULL);
13928 #endif
13929 }
13930 EOP
13931
13932 : see if pthread_atfork exists
13933 set try -DPTHREAD_ATFORK
13934 if eval $compile; then
13935     val="$define"
13936 else
13937     val="$undef"
13938 fi
13939 case "$usethreads" in
13940 $define)
13941         case "$val" in
13942         $define) echo 'pthread_atfork found.' >&4        ;;
13943         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13944         esac
13945 esac
13946 set d_pthread_atfork
13947 eval $setvar
13948
13949
13950 : see whether the various POSIXish _yields exist
13951 $cat >try.c <<EOP
13952 #include <pthread.h>
13953 #include <stdio.h>
13954 int main() {
13955 #ifdef SCHED_YIELD
13956         sched_yield();
13957 #else
13958 #ifdef PTHREAD_YIELD
13959         pthread_yield();
13960 #else
13961 #ifdef PTHREAD_YIELD_NULL
13962         pthread_yield(NULL);
13963 #endif
13964 #endif
13965 #endif
13966 }
13967 EOP
13968 : see if sched_yield exists
13969 set try -DSCHED_YIELD
13970 if eval $compile; then
13971     val="$define"
13972     sched_yield='sched_yield()'
13973 else
13974     val="$undef"
13975 fi
13976 case "$usethreads" in
13977 $define)
13978         case "$val" in
13979         $define) echo 'sched_yield() found.' >&4        ;;
13980         *)       echo 'sched_yield() NOT found.' >&4    ;;
13981         esac
13982 esac
13983 set d_sched_yield
13984 eval $setvar
13985
13986 : see if pthread_yield exists
13987 set try -DPTHREAD_YIELD
13988 if eval $compile; then
13989     val="$define"
13990     case "$sched_yield" in
13991     '') sched_yield='pthread_yield()' ;;
13992     esac
13993 else
13994     set try -DPTHREAD_YIELD_NULL
13995     if eval $compile; then
13996         val="$define"
13997         case "$sched_yield" in
13998         '') sched_yield='pthread_yield(NULL)' ;;
13999         esac
14000     else
14001         val="$undef"
14002     fi
14003 fi
14004 case "$usethreads" in
14005 $define)
14006         case "$val" in
14007         $define) echo 'pthread_yield() found.' >&4      ;;
14008         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14009         esac
14010         ;;
14011 esac
14012 set d_pthread_yield
14013 eval $setvar
14014
14015 case "$sched_yield" in
14016 '') sched_yield=undef ;;
14017 esac
14018
14019 $rm -f try try.*
14020
14021 : see if random_r exists
14022 set random_r d_random_r
14023 eval $inlibc
14024 case "$d_random_r" in
14025 "$define")
14026         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14027         case "stdlib" in
14028         time)
14029                 hdrs="$hdrs $i_systime sys/time.h"
14030                 ;;
14031         esac
14032         case "$d_random_r_proto:$usethreads" in
14033         ":define")      d_random_r_proto=define
14034                 set d_random_r_proto random_r $hdrs
14035                 eval $hasproto ;;
14036         *)      ;;
14037         esac
14038         case "$d_random_r_proto" in
14039         define)
14040         case "$random_r_proto" in
14041         ''|0) try='int random_r(int*, struct random_data*);'
14042         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
14043         esac
14044         case "$random_r_proto" in
14045         ''|0)   d_random_r=undef
14046                 random_r_proto=0
14047                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14048         * )     case "$random_r_proto" in
14049                 REENTRANT_PROTO*) ;;
14050                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14051                 esac
14052                 echo "Prototype: $try" ;;
14053         esac
14054         ;;
14055         *)      case "$usethreads" in
14056                 define) echo "random_r has no prototype, not using it." >&4 ;;
14057                 esac
14058                 d_random_r=undef
14059                 random_r_proto=0
14060                 ;;
14061         esac
14062         ;;
14063 *)      random_r_proto=0
14064         ;;
14065 esac
14066
14067 : see if readdir and friends exist
14068 set readdir d_readdir
14069 eval $inlibc
14070 set seekdir d_seekdir
14071 eval $inlibc
14072 set telldir d_telldir
14073 eval $inlibc
14074 set rewinddir d_rewinddir
14075 eval $inlibc
14076
14077 : see if readdir64_r exists
14078 set readdir64_r d_readdir64_r
14079 eval $inlibc
14080 case "$d_readdir64_r" in
14081 "$define")
14082         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14083         case "dirent" in
14084         time)
14085                 hdrs="$hdrs $i_systime sys/time.h"
14086                 ;;
14087         esac
14088         case "$d_readdir64_r_proto:$usethreads" in
14089         ":define")      d_readdir64_r_proto=define
14090                 set d_readdir64_r_proto readdir64_r $hdrs
14091                 eval $hasproto ;;
14092         *)      ;;
14093         esac
14094         case "$d_readdir64_r_proto" in
14095         define)
14096         case "$readdir64_r_proto" in
14097         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14098         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14099         esac
14100         case "$readdir64_r_proto" in
14101         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14102         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14103         esac
14104         case "$readdir64_r_proto" in
14105         ''|0)   d_readdir64_r=undef
14106                 readdir64_r_proto=0
14107                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14108         * )     case "$readdir64_r_proto" in
14109                 REENTRANT_PROTO*) ;;
14110                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14111                 esac
14112                 echo "Prototype: $try" ;;
14113         esac
14114         ;;
14115         *)      case "$usethreads" in
14116                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14117                 esac
14118                 d_readdir64_r=undef
14119                 readdir64_r_proto=0
14120                 ;;
14121         esac
14122         ;;
14123 *)      readdir64_r_proto=0
14124         ;;
14125 esac
14126
14127 : see if readdir_r exists
14128 set readdir_r d_readdir_r
14129 eval $inlibc
14130 case "$d_readdir_r" in
14131 "$define")
14132         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14133         case "dirent" in
14134         time)
14135                 hdrs="$hdrs $i_systime sys/time.h"
14136                 ;;
14137         esac
14138         case "$d_readdir_r_proto:$usethreads" in
14139         ":define")      d_readdir_r_proto=define
14140                 set d_readdir_r_proto readdir_r $hdrs
14141                 eval $hasproto ;;
14142         *)      ;;
14143         esac
14144         case "$d_readdir_r_proto" in
14145         define)
14146         case "$readdir_r_proto" in
14147         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14148         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14149         esac
14150         case "$readdir_r_proto" in
14151         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14152         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14153         esac
14154         case "$readdir_r_proto" in
14155         ''|0)   d_readdir_r=undef
14156                 readdir_r_proto=0
14157                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14158         * )     case "$readdir_r_proto" in
14159                 REENTRANT_PROTO*) ;;
14160                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14161                 esac
14162                 echo "Prototype: $try" ;;
14163         esac
14164         ;;
14165         *)      case "$usethreads" in
14166                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14167                 esac
14168                 d_readdir_r=undef
14169                 readdir_r_proto=0
14170                 ;;
14171         esac
14172         ;;
14173 *)      readdir_r_proto=0
14174         ;;
14175 esac
14176
14177 : see if readv exists
14178 set readv d_readv
14179 eval $inlibc
14180
14181 : see if recvmsg exists
14182 set recvmsg d_recvmsg
14183 eval $inlibc
14184
14185 : see if rename exists
14186 set rename d_rename
14187 eval $inlibc
14188
14189 : see if rmdir exists
14190 set rmdir d_rmdir
14191 eval $inlibc
14192
14193 : see if memory.h is available.
14194 val=''
14195 set memory.h val
14196 eval $inhdr
14197
14198 : See if it conflicts with string.h
14199 case "$val" in
14200 $define)
14201         case "$strings" in
14202         '') ;;
14203         *)
14204                 $cppstdin $cppflags $cppminus < $strings > mem.h
14205                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14206                         echo " "
14207                         echo "We won't be including <memory.h>."
14208                         val="$undef"
14209                 fi
14210                 $rm -f mem.h
14211                 ;;
14212         esac
14213 esac
14214 set i_memory
14215 eval $setvar
14216
14217 : can bcopy handle overlapping blocks?
14218 echo " "
14219 val="$undef"
14220 case "$d_memmove" in
14221 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14222 *)      case "$d_bcopy" in
14223         "$define")
14224                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14225                 $cat >try.c <<EOCP
14226 #$i_memory I_MEMORY
14227 #$i_stdlib I_STDLIB
14228 #$i_string I_STRING
14229 #$i_unistd I_UNISTD
14230 EOCP
14231         $cat >>try.c <<'EOCP'
14232 #include <stdio.h>
14233 #ifdef I_MEMORY
14234 #  include <memory.h>
14235 #endif
14236 #ifdef I_STDLIB
14237 #  include <stdlib.h>
14238 #endif
14239 #ifdef I_STRING
14240 #  include <string.h>
14241 #else
14242 #  include <strings.h>
14243 #endif
14244 #ifdef I_UNISTD
14245 #  include <unistd.h>  /* Needed for NetBSD */
14246 #endif
14247 int main()
14248 {
14249 char buf[128], abc[128];
14250 char *b;
14251 int len;
14252 int off;
14253 int align;
14254
14255 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14256    try to store the string in read-only memory. */
14257 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14258
14259 for (align = 7; align >= 0; align--) {
14260         for (len = 36; len; len--) {
14261                 b = buf+align;
14262                 bcopy(abc, b, len);
14263                 for (off = 1; off <= len; off++) {
14264                         bcopy(b, b+off, len);
14265                         bcopy(b+off, b, len);
14266                         if (bcmp(b, abc, len))
14267                                 exit(1);
14268                 }
14269         }
14270 }
14271 exit(0);
14272 }
14273 EOCP
14274                 set try
14275                 if eval $compile_ok; then
14276                         if ./try 2>/dev/null; then
14277                                 echo "Yes, it can."
14278                                 val="$define"
14279                         else
14280                                 echo "It can't, sorry."
14281                         fi
14282                 else
14283                         echo "(I can't compile the test program, so we'll assume not...)"
14284                 fi
14285                 ;;
14286         esac
14287         $rm -f try.* try core
14288         ;;
14289 esac
14290 set d_safebcpy
14291 eval $setvar
14292
14293 : can memcpy handle overlapping blocks?
14294 echo " "
14295 val="$undef"
14296 case "$d_memmove" in
14297 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14298 *)      case "$d_memcpy" in
14299         "$define")
14300                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14301                 $cat >try.c <<EOCP
14302 #$i_memory I_MEMORY
14303 #$i_stdlib I_STDLIB
14304 #$i_string I_STRING
14305 #$i_unistd I_UNISTD
14306 EOCP
14307         $cat >>try.c <<'EOCP'
14308 #include <stdio.h>
14309 #ifdef I_MEMORY
14310 #  include <memory.h>
14311 #endif
14312 #ifdef I_STDLIB
14313 #  include <stdlib.h>
14314 #endif
14315 #ifdef I_STRING
14316 #  include <string.h>
14317 #else
14318 #  include <strings.h>
14319 #endif
14320 #ifdef I_UNISTD
14321 #  include <unistd.h>  /* Needed for NetBSD */
14322 #endif
14323 int main()
14324 {
14325 char buf[128], abc[128];
14326 char *b;
14327 int len;
14328 int off;
14329 int align;
14330
14331 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14332    try to store the string in read-only memory. */
14333 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14334
14335 for (align = 7; align >= 0; align--) {
14336         for (len = 36; len; len--) {
14337                 b = buf+align;
14338                 memcpy(b, abc, len);
14339                 for (off = 1; off <= len; off++) {
14340                         memcpy(b+off, b, len);
14341                         memcpy(b, b+off, len);
14342                         if (memcmp(b, abc, len))
14343                                 exit(1);
14344                 }
14345         }
14346 }
14347 exit(0);
14348 }
14349 EOCP
14350                 set try
14351                 if eval $compile_ok; then
14352                         if ./try 2>/dev/null; then
14353                                 echo "Yes, it can."
14354                                 val="$define"
14355                         else
14356                                 echo "It can't, sorry."
14357                         fi
14358                 else
14359                         echo "(I can't compile the test program, so we'll assume not...)"
14360                 fi
14361                 ;;
14362         esac
14363         $rm -f try.* try core
14364         ;;
14365 esac
14366 set d_safemcpy
14367 eval $setvar
14368
14369 : can memcmp be trusted to compare relative magnitude?
14370 val="$undef"
14371 case "$d_memcmp" in
14372 "$define")
14373         echo " "
14374         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14375         $cat >try.c <<EOCP
14376 #$i_memory I_MEMORY
14377 #$i_stdlib I_STDLIB
14378 #$i_string I_STRING
14379 #$i_unistd I_UNISTD
14380 EOCP
14381         $cat >>try.c <<'EOCP'
14382 #include <stdio.h>
14383 #ifdef I_MEMORY
14384 #  include <memory.h>
14385 #endif
14386 #ifdef I_STDLIB
14387 #  include <stdlib.h>
14388 #endif
14389 #ifdef I_STRING
14390 #  include <string.h>
14391 #else
14392 #  include <strings.h>
14393 #endif
14394 #ifdef I_UNISTD
14395 #  include <unistd.h>  /* Needed for NetBSD */
14396 #endif
14397 int main()
14398 {
14399 char a = -1;
14400 char b = 0;
14401 if ((a < b) && memcmp(&a, &b, 1) < 0)
14402         exit(1);
14403 exit(0);
14404 }
14405 EOCP
14406         set try
14407         if eval $compile_ok; then
14408                 if $run ./try 2>/dev/null; then
14409                         echo "Yes, it can."
14410                         val="$define"
14411                 else
14412                         echo "No, it can't (it uses signed chars)."
14413                 fi
14414         else
14415                 echo "(I can't compile the test program, so we'll assume not...)"
14416         fi
14417         ;;
14418 esac
14419 $rm -f try.* try core
14420 set d_sanemcmp
14421 eval $setvar
14422
14423 : see if prototype for sbrk is available
14424 echo " "
14425 set d_sbrkproto sbrk $i_unistd unistd.h
14426 eval $hasproto
14427
14428 : see if select exists
14429 set select d_select
14430 eval $inlibc
14431
14432 : see if semctl exists
14433 set semctl d_semctl
14434 eval $inlibc
14435
14436 : see if semget exists
14437 set semget d_semget
14438 eval $inlibc
14439
14440 : see if semop exists
14441 set semop d_semop
14442 eval $inlibc
14443
14444 : see how much of the 'sem*(2)' library is present.
14445 h_sem=true
14446 echo " "
14447 case "$d_semctl$d_semget$d_semop" in
14448 *"$undef"*) h_sem=false;;
14449 esac
14450 case "$osname" in
14451 freebsd)
14452     case "`ipcs 2>&1`" in
14453     "SVID messages"*"not configured"*)
14454         echo "Your $osname does not have the sem*(2) configured." >&4
14455         h_sem=false
14456         val="$undef"
14457         set semctl d_semctl
14458         eval $setvar
14459         set semget d_semget
14460         eval $setvar
14461         set semop d_semop
14462         eval $setvar
14463         ;;
14464     esac
14465     ;;
14466 esac
14467 : we could also check for sys/ipc.h ...
14468 if $h_sem && $test `./findhdr sys/sem.h`; then
14469         echo "You have the full sem*(2) library." >&4
14470         val="$define"
14471 else
14472         echo "You don't have the full sem*(2) library." >&4
14473         val="$undef"
14474 fi
14475 set d_sem
14476 eval $setvar
14477
14478 : see whether sys/sem.h defines union semun
14479 echo " "
14480 $cat > try.c <<'END'
14481 #include <sys/types.h>
14482 #include <sys/ipc.h>
14483 #include <sys/sem.h>
14484 int main () { union semun semun; semun.buf = 0; }
14485 END
14486 set try
14487 if eval $compile; then
14488     echo "You have union semun in <sys/sem.h>." >&4
14489     val="$define"
14490 else
14491     echo "You do not have union semun in <sys/sem.h>." >&4
14492     val="$undef"
14493 fi
14494 $rm -f try try.c try.h
14495 set d_union_semun
14496 eval $setvar
14497
14498 : see how to do semctl IPC_STAT
14499 case "$d_sem" in
14500 $define)
14501     : see whether semctl IPC_STAT can use union semun
14502     echo " "
14503     $cat > try.h <<END
14504 #ifndef S_IRUSR
14505 #   ifdef S_IREAD
14506 #       define S_IRUSR S_IREAD
14507 #       define S_IWUSR S_IWRITE
14508 #       define S_IXUSR S_IEXEC
14509 #   else
14510 #       define S_IRUSR 0400
14511 #       define S_IWUSR 0200
14512 #       define S_IXUSR 0100
14513 #   endif
14514 #   define S_IRGRP (S_IRUSR>>3)
14515 #   define S_IWGRP (S_IWUSR>>3)
14516 #   define S_IXGRP (S_IXUSR>>3)
14517 #   define S_IROTH (S_IRUSR>>6)
14518 #   define S_IWOTH (S_IWUSR>>6)
14519 #   define S_IXOTH (S_IXUSR>>6)
14520 #endif
14521 #ifndef S_IRWXU
14522 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14523 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14524 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14525 #endif
14526 END
14527
14528     $cat > try.c <<END
14529 #include <sys/types.h>
14530 #include <sys/ipc.h>
14531 #include <sys/sem.h>
14532 #include <sys/stat.h>
14533 #include <stdio.h>
14534 #include <errno.h>
14535 #include "try.h"
14536 #ifndef errno
14537 extern int errno;
14538 #endif
14539 #$d_union_semun HAS_UNION_SEMUN
14540 int main() {
14541     union semun
14542 #ifndef HAS_UNION_SEMUN
14543     {
14544         int val;
14545         struct semid_ds *buf;
14546         unsigned short *array;
14547     }
14548 #endif
14549     arg;
14550     int sem, st;
14551
14552 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14553     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14554     if (sem > -1) {
14555         struct semid_ds argbuf;
14556         arg.buf = &argbuf;
14557 #       ifdef IPC_STAT
14558         st = semctl(sem, 0, IPC_STAT, arg);
14559         if (st == 0)
14560             printf("semun\n");
14561         else
14562 #       endif /* IPC_STAT */
14563             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14564 #       ifdef IPC_RMID
14565         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14566 #       endif /* IPC_RMID */
14567             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14568     } else
14569 #endif /* IPC_PRIVATE && ... */
14570         printf("semget failed: errno = %d\n", errno);
14571   return 0;
14572 }
14573 END
14574     val="$undef"
14575     set try
14576     if eval $compile; then
14577         xxx=`$run ./try`
14578         case "$xxx" in
14579         semun) val="$define" ;;
14580         esac
14581     fi
14582     $rm -f try try.c
14583     set d_semctl_semun
14584     eval $setvar
14585     case "$d_semctl_semun" in
14586     $define)
14587         echo "You can use union semun for semctl IPC_STAT." >&4
14588         also='also'
14589         ;;
14590     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14591         also=''
14592         ;;
14593     esac
14594
14595     : see whether semctl IPC_STAT can use struct semid_ds pointer
14596     $cat > try.c <<'END'
14597 #include <sys/types.h>
14598 #include <sys/ipc.h>
14599 #include <sys/sem.h>
14600 #include <sys/stat.h>
14601 #include "try.h"
14602 #include <stdio.h>
14603 #include <errno.h>
14604 #ifndef errno
14605 extern int errno;
14606 #endif
14607 int main() {
14608     struct semid_ds arg;
14609     int sem, st;
14610
14611 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14612     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14613     if (sem > -1) {
14614 #       ifdef IPC_STAT
14615         st = semctl(sem, 0, IPC_STAT, &arg);
14616         if (st == 0)
14617             printf("semid_ds\n");
14618         else
14619 #       endif /* IPC_STAT */
14620             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14621 #       ifdef IPC_RMID
14622         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14623 #       endif /* IPC_RMID */
14624             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14625     } else
14626 #endif /* IPC_PRIVATE && ... */
14627         printf("semget failed: errno = %d\n", errno);
14628
14629     return 0;
14630 }
14631 END
14632     val="$undef"
14633     set try
14634     if eval $compile; then
14635         xxx=`$run ./try`
14636         case "$xxx" in
14637         semid_ds) val="$define" ;;
14638         esac
14639     fi
14640     $rm -f try try.c
14641     set d_semctl_semid_ds
14642     eval $setvar
14643     case "$d_semctl_semid_ds" in
14644     $define)
14645         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14646         ;;
14647     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14648         ;;
14649     esac
14650     $rm -f try.h
14651     ;;
14652 *)  val="$undef"
14653
14654     # We do not have the full sem*(2) library, so assume we can not
14655     # use either.
14656
14657     set d_semctl_semun
14658     eval $setvar
14659
14660     set d_semctl_semid_ds
14661     eval $setvar
14662     ;;
14663 esac
14664
14665 : see if sendmsg exists
14666 set sendmsg d_sendmsg
14667 eval $inlibc
14668
14669 : see if setegid exists
14670 set setegid d_setegid
14671 eval $inlibc
14672
14673 : see if seteuid exists
14674 set seteuid d_seteuid
14675 eval $inlibc
14676
14677 : see if setgrent exists
14678 set setgrent d_setgrent
14679 eval $inlibc
14680
14681 : see if setgrent_r exists
14682 set setgrent_r d_setgrent_r
14683 eval $inlibc
14684 case "$d_setgrent_r" in
14685 "$define")
14686         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14687         case "grp" in
14688         time)
14689                 hdrs="$hdrs $i_systime sys/time.h"
14690                 ;;
14691         esac
14692         case "$d_setgrent_r_proto:$usethreads" in
14693         ":define")      d_setgrent_r_proto=define
14694                 set d_setgrent_r_proto setgrent_r $hdrs
14695                 eval $hasproto ;;
14696         *)      ;;
14697         esac
14698         case "$d_setgrent_r_proto" in
14699         define)
14700         case "$setgrent_r_proto" in
14701         ''|0) try='int setgrent_r(FILE**);'
14702         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14703         esac
14704         case "$setgrent_r_proto" in
14705         ''|0) try='void setgrent_r(FILE**);'
14706         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14707         esac
14708         case "$setgrent_r_proto" in
14709         ''|0)   d_setgrent_r=undef
14710                 setgrent_r_proto=0
14711                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14712         * )     case "$setgrent_r_proto" in
14713                 REENTRANT_PROTO*) ;;
14714                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14715                 esac
14716                 echo "Prototype: $try" ;;
14717         esac
14718         ;;
14719         *)      case "$usethreads" in
14720                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14721                 esac
14722                 d_setgrent_r=undef
14723                 setgrent_r_proto=0
14724                 ;;
14725         esac
14726         ;;
14727 *)      setgrent_r_proto=0
14728         ;;
14729 esac
14730
14731 : see if sethostent exists
14732 set sethostent d_sethent
14733 eval $inlibc
14734
14735 : see if sethostent_r exists
14736 set sethostent_r d_sethostent_r
14737 eval $inlibc
14738 case "$d_sethostent_r" in
14739 "$define")
14740         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14741         case "netdb" in
14742         time)
14743                 hdrs="$hdrs $i_systime sys/time.h"
14744                 ;;
14745         esac
14746         case "$d_sethostent_r_proto:$usethreads" in
14747         ":define")      d_sethostent_r_proto=define
14748                 set d_sethostent_r_proto sethostent_r $hdrs
14749                 eval $hasproto ;;
14750         *)      ;;
14751         esac
14752         case "$d_sethostent_r_proto" in
14753         define)
14754         case "$sethostent_r_proto" in
14755         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14756         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14757         esac
14758         case "$sethostent_r_proto" in
14759         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14760         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14761         esac
14762         case "$sethostent_r_proto" in
14763         ''|0)   d_sethostent_r=undef
14764                 sethostent_r_proto=0
14765                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14766         * )     case "$sethostent_r_proto" in
14767                 REENTRANT_PROTO*) ;;
14768                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14769                 esac
14770                 echo "Prototype: $try" ;;
14771         esac
14772         ;;
14773         *)      case "$usethreads" in
14774                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14775                 esac
14776                 d_sethostent_r=undef
14777                 sethostent_r_proto=0
14778                 ;;
14779         esac
14780         ;;
14781 *)      sethostent_r_proto=0
14782         ;;
14783 esac
14784
14785 : see if setitimer exists
14786 set setitimer d_setitimer
14787 eval $inlibc
14788
14789 : see if setlinebuf exists
14790 set setlinebuf d_setlinebuf
14791 eval $inlibc
14792
14793 : see if setlocale exists
14794 set setlocale d_setlocale
14795 eval $inlibc
14796
14797 : see if locale.h is available
14798 set locale.h i_locale
14799 eval $inhdr
14800
14801 : see if setlocale_r exists
14802 set setlocale_r d_setlocale_r
14803 eval $inlibc
14804 case "$d_setlocale_r" in
14805 "$define")
14806         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14807         case "locale" in
14808         time)
14809                 hdrs="$hdrs $i_systime sys/time.h"
14810                 ;;
14811         esac
14812         case "$d_setlocale_r_proto:$usethreads" in
14813         ":define")      d_setlocale_r_proto=define
14814                 set d_setlocale_r_proto setlocale_r $hdrs
14815                 eval $hasproto ;;
14816         *)      ;;
14817         esac
14818         case "$d_setlocale_r_proto" in
14819         define)
14820         case "$setlocale_r_proto" in
14821         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14822         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14823         esac
14824         case "$setlocale_r_proto" in
14825         ''|0)   d_setlocale_r=undef
14826                 setlocale_r_proto=0
14827                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14828         * )     case "$setlocale_r_proto" in
14829                 REENTRANT_PROTO*) ;;
14830                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14831                 esac
14832                 echo "Prototype: $try" ;;
14833         esac
14834         ;;
14835         *)      case "$usethreads" in
14836                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14837                 esac
14838                 d_setlocale_r=undef
14839                 setlocale_r_proto=0
14840                 ;;
14841         esac
14842         ;;
14843 *)      setlocale_r_proto=0
14844         ;;
14845 esac
14846
14847 : see if setnetent exists
14848 set setnetent d_setnent
14849 eval $inlibc
14850
14851 : see if setnetent_r exists
14852 set setnetent_r d_setnetent_r
14853 eval $inlibc
14854 case "$d_setnetent_r" in
14855 "$define")
14856         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14857         case "netdb" in
14858         time)
14859                 hdrs="$hdrs $i_systime sys/time.h"
14860                 ;;
14861         esac
14862         case "$d_setnetent_r_proto:$usethreads" in
14863         ":define")      d_setnetent_r_proto=define
14864                 set d_setnetent_r_proto setnetent_r $hdrs
14865                 eval $hasproto ;;
14866         *)      ;;
14867         esac
14868         case "$d_setnetent_r_proto" in
14869         define)
14870         case "$setnetent_r_proto" in
14871         ''|0) try='int setnetent_r(int, struct netent_data*);'
14872         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14873         esac
14874         case "$setnetent_r_proto" in
14875         ''|0) try='void setnetent_r(int, struct netent_data*);'
14876         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14877         esac
14878         case "$setnetent_r_proto" in
14879         ''|0)   d_setnetent_r=undef
14880                 setnetent_r_proto=0
14881                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14882         * )     case "$setnetent_r_proto" in
14883                 REENTRANT_PROTO*) ;;
14884                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14885                 esac
14886                 echo "Prototype: $try" ;;
14887         esac
14888         ;;
14889         *)      case "$usethreads" in
14890                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14891                 esac
14892                 d_setnetent_r=undef
14893                 setnetent_r_proto=0
14894                 ;;
14895         esac
14896         ;;
14897 *)      setnetent_r_proto=0
14898         ;;
14899 esac
14900
14901 : see if setprotoent exists
14902 set setprotoent d_setpent
14903 eval $inlibc
14904
14905 : see if setpgid exists
14906 set setpgid d_setpgid
14907 eval $inlibc
14908
14909 : see if setpgrp2 exists
14910 set setpgrp2 d_setpgrp2
14911 eval $inlibc
14912
14913 : see if setpriority exists
14914 set setpriority d_setprior
14915 eval $inlibc
14916
14917 : see if setproctitle exists
14918 set setproctitle d_setproctitle
14919 eval $inlibc
14920
14921 : see if setprotoent_r exists
14922 set setprotoent_r d_setprotoent_r
14923 eval $inlibc
14924 case "$d_setprotoent_r" in
14925 "$define")
14926         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14927         case "netdb" in
14928         time)
14929                 hdrs="$hdrs $i_systime sys/time.h"
14930                 ;;
14931         esac
14932         case "$d_setprotoent_r_proto:$usethreads" in
14933         ":define")      d_setprotoent_r_proto=define
14934                 set d_setprotoent_r_proto setprotoent_r $hdrs
14935                 eval $hasproto ;;
14936         *)      ;;
14937         esac
14938         case "$d_setprotoent_r_proto" in
14939         define)
14940         case "$setprotoent_r_proto" in
14941         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14942         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14943         esac
14944         case "$setprotoent_r_proto" in
14945         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14946         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14947         esac
14948         case "$setprotoent_r_proto" in
14949         ''|0)   d_setprotoent_r=undef
14950                 setprotoent_r_proto=0
14951                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14952         * )     case "$setprotoent_r_proto" in
14953                 REENTRANT_PROTO*) ;;
14954                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14955                 esac
14956                 echo "Prototype: $try" ;;
14957         esac
14958         ;;
14959         *)      case "$usethreads" in
14960                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14961                 esac
14962                 d_setprotoent_r=undef
14963                 setprotoent_r_proto=0
14964                 ;;
14965         esac
14966         ;;
14967 *)      setprotoent_r_proto=0
14968         ;;
14969 esac
14970
14971 : see if setpwent exists
14972 set setpwent d_setpwent
14973 eval $inlibc
14974
14975 : see if setpwent_r exists
14976 set setpwent_r d_setpwent_r
14977 eval $inlibc
14978 case "$d_setpwent_r" in
14979 "$define")
14980         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14981         case "pwd" in
14982         time)
14983                 hdrs="$hdrs $i_systime sys/time.h"
14984                 ;;
14985         esac
14986         case "$d_setpwent_r_proto:$usethreads" in
14987         ":define")      d_setpwent_r_proto=define
14988                 set d_setpwent_r_proto setpwent_r $hdrs
14989                 eval $hasproto ;;
14990         *)      ;;
14991         esac
14992         case "$d_setpwent_r_proto" in
14993         define)
14994         case "$setpwent_r_proto" in
14995         ''|0) try='int setpwent_r(FILE**);'
14996         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14997         esac
14998         case "$setpwent_r_proto" in
14999         ''|0) try='void setpwent_r(FILE**);'
15000         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15001         esac
15002         case "$setpwent_r_proto" in
15003         ''|0)   d_setpwent_r=undef
15004                 setpwent_r_proto=0
15005                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15006         * )     case "$setpwent_r_proto" in
15007                 REENTRANT_PROTO*) ;;
15008                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15009                 esac
15010                 echo "Prototype: $try" ;;
15011         esac
15012         ;;
15013         *)      case "$usethreads" in
15014                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15015                 esac
15016                 d_setpwent_r=undef
15017                 setpwent_r_proto=0
15018                 ;;
15019         esac
15020         ;;
15021 *)      setpwent_r_proto=0
15022         ;;
15023 esac
15024
15025 : see if setregid exists
15026 set setregid d_setregid
15027 eval $inlibc
15028 set setresgid d_setresgid
15029 eval $inlibc
15030
15031 : see if setreuid exists
15032 set setreuid d_setreuid
15033 eval $inlibc
15034 set setresuid d_setresuid
15035 eval $inlibc
15036
15037 : see if setrgid exists
15038 set setrgid d_setrgid
15039 eval $inlibc
15040
15041 : see if setruid exists
15042 set setruid d_setruid
15043 eval $inlibc
15044
15045 : see if setservent exists
15046 set setservent d_setsent
15047 eval $inlibc
15048
15049 : see if setservent_r exists
15050 set setservent_r d_setservent_r
15051 eval $inlibc
15052 case "$d_setservent_r" in
15053 "$define")
15054         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15055         case "netdb" in
15056         time)
15057                 hdrs="$hdrs $i_systime sys/time.h"
15058                 ;;
15059         esac
15060         case "$d_setservent_r_proto:$usethreads" in
15061         ":define")      d_setservent_r_proto=define
15062                 set d_setservent_r_proto setservent_r $hdrs
15063                 eval $hasproto ;;
15064         *)      ;;
15065         esac
15066         case "$d_setservent_r_proto" in
15067         define)
15068         case "$setservent_r_proto" in
15069         ''|0) try='int setservent_r(int, struct servent_data*);'
15070         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15071         esac
15072         case "$setservent_r_proto" in
15073         ''|0) try='void setservent_r(int, struct servent_data*);'
15074         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15075         esac
15076         case "$setservent_r_proto" in
15077         ''|0)   d_setservent_r=undef
15078                 setservent_r_proto=0
15079                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15080         * )     case "$setservent_r_proto" in
15081                 REENTRANT_PROTO*) ;;
15082                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15083                 esac
15084                 echo "Prototype: $try" ;;
15085         esac
15086         ;;
15087         *)      case "$usethreads" in
15088                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15089                 esac
15090                 d_setservent_r=undef
15091                 setservent_r_proto=0
15092                 ;;
15093         esac
15094         ;;
15095 *)      setservent_r_proto=0
15096         ;;
15097 esac
15098
15099 : see if setsid exists
15100 set setsid d_setsid
15101 eval $inlibc
15102
15103 : see if setvbuf exists
15104 set setvbuf d_setvbuf
15105 eval $inlibc
15106
15107 : see if sfio.h is available
15108 set sfio.h i_sfio
15109 eval $inhdr
15110
15111
15112 : see if sfio library is available
15113 case "$i_sfio" in
15114 $define)
15115         val=''
15116         set sfreserve val
15117         eval $inlibc
15118         ;;
15119 *)
15120         val="$undef"
15121         ;;
15122 esac
15123 : Ok, but do we want to use it.
15124 case "$val" in
15125 $define)
15126         case "$usesfio" in
15127         true|$define|[yY]*) dflt='y';;
15128         *) dflt='n';;
15129         esac
15130         echo "$package can use the sfio library, but it is experimental."
15131         case "$useperlio" in
15132         "$undef")
15133             echo "For sfio also the PerlIO abstraction layer is needed."
15134             echo "Earlier you said you wouldn't want that."
15135             ;;
15136         esac
15137         rp="You seem to have sfio available, do you want to try using it?"
15138         . ./myread
15139         case "$ans" in
15140         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15141                 useperlio="$define"
15142                 val="$define"
15143                 ;;
15144         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15145                 val="$undef"
15146                 ;;
15147         esac
15148         ;;
15149 *)      case "$usesfio" in
15150         true|$define|[yY]*)
15151                 echo "Sorry, cannot find sfio on this machine." >&4
15152                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15153                 val="$undef"
15154                 ;;
15155         esac
15156         ;;
15157 esac
15158 set d_sfio
15159 eval $setvar
15160 case "$d_sfio" in
15161 $define) usesfio='true';;
15162 *) usesfio='false';;
15163 esac
15164 case "$d_sfio" in
15165 $define) ;;
15166 *)      : Remove sfio from list of libraries to use
15167         case "$libs" in
15168         *-lsfio*)
15169                 echo "Removing unneeded -lsfio from library list" >&4
15170                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15171                 shift
15172                 libs="$*"
15173                 echo "libs = $libs" >&4
15174                 ;;
15175         esac
15176 ;;
15177 esac
15178
15179
15180 : see if shmctl exists
15181 set shmctl d_shmctl
15182 eval $inlibc
15183
15184 : see if shmget exists
15185 set shmget d_shmget
15186 eval $inlibc
15187
15188 : see if shmat exists
15189 set shmat d_shmat
15190 eval $inlibc
15191 : see what shmat returns
15192 case "$d_shmat" in
15193 "$define")
15194         $cat >shmat.c <<'END'
15195 #include <sys/shm.h>
15196 void *shmat();
15197 END
15198         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15199                 shmattype='void *'
15200         else
15201                 shmattype='char *'
15202         fi
15203         echo "and it returns ($shmattype)." >&4
15204         : see if a prototype for shmat is available
15205         xxx=`./findhdr sys/shm.h`
15206         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15207         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15208                 val="$define"
15209         else
15210                 val="$undef"
15211         fi
15212         $rm -f shmat.[co]
15213         ;;
15214 *)
15215         val="$undef"
15216         ;;
15217 esac
15218 set d_shmatprototype
15219 eval $setvar
15220
15221 : see if shmdt exists
15222 set shmdt d_shmdt
15223 eval $inlibc
15224
15225 : see how much of the 'shm*(2)' library is present.
15226 h_shm=true
15227 echo " "
15228 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15229 *"$undef"*) h_shm=false;;
15230 esac
15231 case "$osname" in
15232 freebsd)
15233     case "`ipcs 2>&1`" in
15234     "SVID shared memory"*"not configured"*)
15235         echo "Your $osname does not have the shm*(2) configured." >&4
15236         h_shm=false
15237         val="$undef"
15238         set shmctl d_shmctl
15239         evat $setvar
15240         set shmget d_shmget
15241         evat $setvar
15242         set shmat d_shmat
15243         evat $setvar
15244         set shmdt d_shmdt
15245         evat $setvar
15246         ;;
15247     esac
15248     ;;
15249 esac
15250 : we could also check for sys/ipc.h ...
15251 if $h_shm && $test `./findhdr sys/shm.h`; then
15252         echo "You have the full shm*(2) library." >&4
15253         val="$define"
15254 else
15255         echo "You don't have the full shm*(2) library." >&4
15256         val="$undef"
15257 fi
15258 set d_shm
15259 eval $setvar
15260
15261 echo " "
15262 : see if we have sigaction
15263 if set sigaction val -f d_sigaction; eval $csym; $val; then
15264         echo 'sigaction() found.' >&4
15265         $cat > try.c <<'EOP'
15266 #include <stdio.h>
15267 #include <sys/types.h>
15268 #include <signal.h>
15269 int main()
15270 {
15271     struct sigaction act, oact;
15272     act.sa_flags = 0;
15273     oact.sa_handler = 0;
15274     /* so that act and oact are used */
15275     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15276 }
15277 EOP
15278         set try
15279         if eval $compile_ok; then
15280                 val="$define"
15281         else
15282                 echo "But you don't seem to have a useable struct sigaction." >&4
15283                 val="$undef"
15284         fi
15285 else
15286         echo 'sigaction NOT found.' >&4
15287         val="$undef"
15288 fi
15289 set d_sigaction; eval $setvar
15290 $rm -f try try$_o try.c
15291
15292 : see if sigprocmask exists
15293 set sigprocmask d_sigprocmask
15294 eval $inlibc
15295
15296 : see if sigsetjmp exists
15297 echo " "
15298 case "$d_sigsetjmp" in
15299 '')
15300         $cat >try.c <<'EOP'
15301 #include <setjmp.h>
15302 sigjmp_buf env;
15303 int set = 1;
15304 int main()
15305 {
15306         if (sigsetjmp(env,1))
15307                 exit(set);
15308         set = 0;
15309         siglongjmp(env, 1);
15310         exit(1);
15311 }
15312 EOP
15313         set try
15314         if eval $compile; then
15315                 if $run ./try >/dev/null 2>&1; then
15316                         echo "POSIX sigsetjmp found." >&4
15317                         val="$define"
15318                 else
15319                         $cat >&4 <<EOM
15320 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15321 I'll ignore them.
15322 EOM
15323                         val="$undef"
15324                 fi
15325         else
15326                 echo "sigsetjmp not found." >&4
15327                 val="$undef"
15328         fi
15329         ;;
15330 *) val="$d_sigsetjmp"
15331         case "$d_sigsetjmp" in
15332         $define) echo "POSIX sigsetjmp found." >&4;;
15333         $undef) echo "sigsetjmp not found." >&4;;
15334         esac
15335         ;;
15336 esac
15337 set d_sigsetjmp
15338 eval $setvar
15339 $rm -f try.c try
15340
15341 : see if sockatmark exists
15342 set sockatmark d_sockatmark
15343 eval $inlibc
15344
15345 : see if prototype for sockatmark is available
15346 echo " "
15347 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15348 eval $hasproto
15349
15350 : see if socks5_init exists
15351 set socks5_init d_socks5_init
15352 eval $inlibc
15353
15354 : see if srand48_r exists
15355 set srand48_r d_srand48_r
15356 eval $inlibc
15357 case "$d_srand48_r" in
15358 "$define")
15359         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15360         case "stdlib" in
15361         time)
15362                 hdrs="$hdrs $i_systime sys/time.h"
15363                 ;;
15364         esac
15365         case "$d_srand48_r_proto:$usethreads" in
15366         ":define")      d_srand48_r_proto=define
15367                 set d_srand48_r_proto srand48_r $hdrs
15368                 eval $hasproto ;;
15369         *)      ;;
15370         esac
15371         case "$d_srand48_r_proto" in
15372         define)
15373         case "$srand48_r_proto" in
15374         ''|0) try='int srand48_r(long, struct drand48_data*);'
15375         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15376         esac
15377         case "$srand48_r_proto" in
15378         ''|0)   d_srand48_r=undef
15379                 srand48_r_proto=0
15380                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15381         * )     case "$srand48_r_proto" in
15382                 REENTRANT_PROTO*) ;;
15383                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15384                 esac
15385                 echo "Prototype: $try" ;;
15386         esac
15387         ;;
15388         *)      case "$usethreads" in
15389                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15390                 esac
15391                 d_srand48_r=undef
15392                 srand48_r_proto=0
15393                 ;;
15394         esac
15395         ;;
15396 *)      srand48_r_proto=0
15397         ;;
15398 esac
15399
15400 : see if srandom_r exists
15401 set srandom_r d_srandom_r
15402 eval $inlibc
15403 case "$d_srandom_r" in
15404 "$define")
15405         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15406         case "stdlib" in
15407         time)
15408                 hdrs="$hdrs $i_systime sys/time.h"
15409                 ;;
15410         esac
15411         case "$d_srandom_r_proto:$usethreads" in
15412         ":define")      d_srandom_r_proto=define
15413                 set d_srandom_r_proto srandom_r $hdrs
15414                 eval $hasproto ;;
15415         *)      ;;
15416         esac
15417         case "$d_srandom_r_proto" in
15418         define)
15419         case "$srandom_r_proto" in
15420         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15421         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15422         esac
15423         case "$srandom_r_proto" in
15424         ''|0)   d_srandom_r=undef
15425                 srandom_r_proto=0
15426                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15427         * )     case "$srandom_r_proto" in
15428                 REENTRANT_PROTO*) ;;
15429                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15430                 esac
15431                 echo "Prototype: $try" ;;
15432         esac
15433         ;;
15434         *)      case "$usethreads" in
15435                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15436                 esac
15437                 d_srandom_r=undef
15438                 srandom_r_proto=0
15439                 ;;
15440         esac
15441         ;;
15442 *)      srandom_r_proto=0
15443         ;;
15444 esac
15445
15446 : see if prototype for setresgid is available
15447 echo " "
15448 set d_sresgproto setresgid $i_unistd unistd.h
15449 eval $hasproto
15450
15451 : see if prototype for setresuid is available
15452 echo " "
15453 set d_sresuproto setresuid $i_unistd unistd.h
15454 eval $hasproto
15455
15456 : see if sys/stat.h is available
15457 set sys/stat.h i_sysstat
15458 eval $inhdr
15459
15460
15461 : see if stat knows about block sizes
15462 echo " "
15463 echo "Checking to see if your struct stat has st_blocks field..." >&4
15464 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15465 eval $hasfield
15466
15467
15468 : see if this is a sys/vfs.h system
15469 set sys/vfs.h i_sysvfs
15470 eval $inhdr
15471
15472
15473 : see if this is a sys/statfs.h system
15474 set sys/statfs.h i_sysstatfs
15475 eval $inhdr
15476
15477
15478 echo " "
15479 echo "Checking to see if your system supports struct statfs..." >&4
15480 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
15481 eval $hasstruct
15482 case "$d_statfs_s" in
15483 "$define")      echo "Yes, it does."   ;;
15484 *)              echo "No, it doesn't." ;;
15485 esac
15486
15487
15488
15489 : see if struct statfs knows about f_flags
15490 case "$d_statfs_s" in
15491 define) 
15492         echo " "
15493         echo "Checking to see if your struct statfs has f_flags field..." >&4
15494         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
15495         eval $hasfield
15496         ;;
15497 *)      val="$undef"
15498         set d_statfs_f_flags
15499         eval $setvar
15500         ;;
15501 esac
15502 case "$d_statfs_f_flags" in
15503 "$define")      echo "Yes, it does."   ;;
15504 *)              echo "No, it doesn't." ;;
15505 esac
15506
15507 : see if _ptr and _cnt from stdio act std
15508 echo " "
15509
15510 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15511         echo "(Looks like you have stdio.h from BSD.)"
15512         case "$stdio_ptr" in
15513         '') stdio_ptr='((fp)->_p)'
15514                 ptr_lval=$define
15515                 ;;
15516         *)      ptr_lval=$d_stdio_ptr_lval;;
15517         esac
15518         case "$stdio_cnt" in
15519         '') stdio_cnt='((fp)->_r)'
15520                 cnt_lval=$define
15521                 ;;
15522         *)      cnt_lval=$d_stdio_cnt_lval;;
15523         esac
15524         case "$stdio_base" in
15525         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15526         esac
15527         case "$stdio_bufsiz" in
15528         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15529         esac
15530 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15531         echo "(Looks like you have stdio.h from Linux.)"
15532         case "$stdio_ptr" in
15533         '') stdio_ptr='((fp)->_IO_read_ptr)'
15534                 ptr_lval=$define
15535                 ;;
15536         *)      ptr_lval=$d_stdio_ptr_lval;;
15537         esac
15538         case "$stdio_cnt" in
15539         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15540                 cnt_lval=$undef
15541                 ;;
15542         *)      cnt_lval=$d_stdio_cnt_lval;;
15543         esac
15544         case "$stdio_base" in
15545         '') stdio_base='((fp)->_IO_read_base)';;
15546         esac
15547         case "$stdio_bufsiz" in
15548         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15549         esac
15550 else
15551         case "$stdio_ptr" in
15552         '') stdio_ptr='((fp)->_ptr)'
15553                 ptr_lval=$define
15554                 ;;
15555         *)      ptr_lval=$d_stdio_ptr_lval;;
15556         esac
15557         case "$stdio_cnt" in
15558         '') stdio_cnt='((fp)->_cnt)'
15559                 cnt_lval=$define
15560                 ;;
15561         *)      cnt_lval=$d_stdio_cnt_lval;;
15562         esac
15563         case "$stdio_base" in
15564         '') stdio_base='((fp)->_base)';;
15565         esac
15566         case "$stdio_bufsiz" in
15567         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15568         esac
15569 fi
15570
15571 : test whether _ptr and _cnt really work
15572 echo "Checking how std your stdio is..." >&4
15573 $cat >try.c <<EOP
15574 #include <stdio.h>
15575 #define FILE_ptr(fp)    $stdio_ptr
15576 #define FILE_cnt(fp)    $stdio_cnt
15577 int main() {
15578         FILE *fp = fopen("try.c", "r");
15579         char c = getc(fp);
15580         if (
15581                 18 <= FILE_cnt(fp) &&
15582                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15583         )
15584                 exit(0);
15585         exit(1);
15586 }
15587 EOP
15588 val="$undef"
15589 set try
15590 if eval $compile && $to try.c; then
15591         if $run ./try; then
15592                 echo "Your stdio acts pretty std."
15593                 val="$define"
15594         else
15595                 echo "Your stdio isn't very std."
15596         fi
15597 else
15598         echo "Your stdio doesn't appear very std."
15599 fi
15600 $rm -f try.c try
15601 set d_stdstdio
15602 eval $setvar
15603
15604 : Can _ptr be used as an lvalue?
15605 case "$d_stdstdio$ptr_lval" in
15606 $define$define) val=$define ;;
15607 *) val=$undef ;;
15608 esac
15609 set d_stdio_ptr_lval
15610 eval $setvar
15611
15612 : Can _cnt be used as an lvalue?
15613 case "$d_stdstdio$cnt_lval" in
15614 $define$define) val=$define ;;
15615 *) val=$undef ;;
15616 esac
15617 set d_stdio_cnt_lval
15618 eval $setvar
15619
15620
15621 : test whether setting _ptr sets _cnt as a side effect
15622 d_stdio_ptr_lval_sets_cnt="$undef"
15623 d_stdio_ptr_lval_nochange_cnt="$undef"
15624 case "$d_stdio_ptr_lval$d_stdstdio" in
15625 $define$define)
15626         echo "Checking to see what happens if we set the stdio ptr..." >&4
15627 $cat >try.c <<EOP
15628 #include <stdio.h>
15629 /* Can we scream? */
15630 /* Eat dust sed :-) */
15631 /* In the buffer space, no one can hear you scream. */
15632 #define FILE_ptr(fp)    $stdio_ptr
15633 #define FILE_cnt(fp)    $stdio_cnt
15634 #include <sys/types.h>
15635 int main() {
15636         FILE *fp = fopen("try.c", "r");
15637         int c;
15638         char *ptr;
15639         size_t cnt;
15640         if (!fp) {
15641             puts("Fail even to read");
15642             exit(1);
15643         }
15644         c = getc(fp); /* Read away the first # */
15645         if (c == EOF) {
15646             puts("Fail even to read");
15647             exit(1);
15648         }
15649         if (!(
15650                 18 <= FILE_cnt(fp) &&
15651                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15652         )) {
15653                 puts("Fail even to read");
15654                 exit (1);
15655         }
15656         ptr = (char*) FILE_ptr(fp);
15657         cnt = (size_t)FILE_cnt(fp);
15658
15659         FILE_ptr(fp) += 42;
15660
15661         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15662                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15663                 exit (1);
15664         }
15665         if (FILE_cnt(fp) <= 20) {
15666                 printf ("Fail (<20 chars to test)");
15667                 exit (1);
15668         }
15669         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15670                 puts("Fail compare");
15671                 exit (1);
15672         }
15673         if (cnt == FILE_cnt(fp)) {
15674                 puts("Pass_unchanged");
15675                 exit (0);
15676         }       
15677         if (FILE_cnt(fp) == (cnt - 42)) {
15678                 puts("Pass_changed");
15679                 exit (0);
15680         }
15681         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15682         return 1;
15683
15684 }
15685 EOP
15686         set try
15687         if eval $compile && $to try.c; then
15688                 case `$run ./try` in
15689                 Pass_changed)
15690                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15691                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15692                 Pass_unchanged)
15693                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15694                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15695                 Fail*)
15696                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15697                 *)
15698                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15699         esac
15700         else
15701                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15702         fi
15703         $rm -f try.c try
15704         ;;
15705 esac
15706
15707 : see if _base is also standard
15708 val="$undef"
15709 case "$d_stdstdio" in
15710 $define)
15711         $cat >try.c <<EOP
15712 #include <stdio.h>
15713 #define FILE_base(fp)   $stdio_base
15714 #define FILE_bufsiz(fp) $stdio_bufsiz
15715 int main() {
15716         FILE *fp = fopen("try.c", "r");
15717         char c = getc(fp);
15718         if (
15719                 19 <= FILE_bufsiz(fp) &&
15720                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15721         )
15722                 exit(0);
15723         exit(1);
15724 }
15725 EOP
15726         set try
15727         if eval $compile && $to try.c; then
15728                 if $run ./try; then
15729                         echo "And its _base field acts std."
15730                         val="$define"
15731                 else
15732                         echo "But its _base field isn't std."
15733                 fi
15734         else
15735                 echo "However, it seems to be lacking the _base field."
15736         fi
15737         $rm -f try.c try
15738         ;;
15739 esac
15740 set d_stdiobase
15741 eval $setvar
15742
15743 $cat >&4 <<EOM
15744 Checking how to access stdio streams by file descriptor number...
15745 EOM
15746 case "$stdio_stream_array" in
15747 '')     $cat >try.c <<EOCP
15748 #include <stdio.h>
15749 int main() {
15750   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15751     printf("yes\n");
15752 }
15753 EOCP
15754         for s in _iob __iob __sF
15755         do
15756                 set try -DSTDIO_STREAM_ARRAY=$s
15757                 if eval $compile; then
15758                         case "`$run ./try`" in
15759                         yes)    stdio_stream_array=$s; break ;;
15760                         esac
15761                 fi
15762         done
15763         $rm -f try.* try$exe_ext
15764 esac
15765 case "$stdio_stream_array" in
15766 '')     $cat >&4 <<EOM
15767 I can't figure out how to access stdio streams by file descriptor number.
15768 EOM
15769         d_stdio_stream_array="$undef"
15770         ;;
15771 *)      $cat >&4 <<EOM
15772 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15773 EOM
15774         d_stdio_stream_array="$define"
15775         ;;
15776 esac
15777
15778 : see if strcoll exists
15779 set strcoll d_strcoll
15780 eval $inlibc
15781
15782 : check for structure copying
15783 echo " "
15784 echo "Checking to see if your C compiler can copy structs..." >&4
15785 $cat >try.c <<'EOCP'
15786 int main()
15787 {
15788         struct blurfl {
15789                 int dyick;
15790         } foo, bar;
15791
15792         foo = bar;
15793 }
15794 EOCP
15795 if $cc -c try.c >/dev/null 2>&1 ; then
15796         val="$define"
15797         echo "Yup, it can."
15798 else
15799         val="$undef"
15800         echo "Nope, it can't."
15801 fi
15802 set d_strctcpy
15803 eval $setvar
15804 $rm -f try.*
15805
15806 : see if strerror and/or sys_errlist[] exist
15807 echo " "
15808 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15809     if set strerror val -f d_strerror; eval $csym; $val; then
15810                 echo 'strerror() found.' >&4
15811                 d_strerror="$define"
15812                 d_strerrm='strerror(e)'
15813                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15814                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15815                         d_syserrlst="$define"
15816                 else
15817                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15818                         d_syserrlst="$undef"
15819                 fi
15820     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15821                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15822                 echo 'strerror() found in string header.' >&4
15823                 d_strerror="$define"
15824                 d_strerrm='strerror(e)'
15825                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15826                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15827                                 d_syserrlst="$define"
15828                 else
15829                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15830                         d_syserrlst="$undef"
15831                 fi
15832     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15833                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15834                 d_strerror="$undef"
15835                 d_syserrlst="$define"
15836                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15837     else
15838                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15839                 d_strerror="$undef"
15840                 d_syserrlst="$undef"
15841                 d_strerrm='"unknown"'
15842     fi
15843 fi
15844
15845 : see if strerror_r exists
15846 set strerror_r d_strerror_r
15847 eval $inlibc
15848 case "$d_strerror_r" in
15849 "$define")
15850         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15851         case "string" in
15852         time)
15853                 hdrs="$hdrs $i_systime sys/time.h"
15854                 ;;
15855         esac
15856         case "$d_strerror_r_proto:$usethreads" in
15857         ":define")      d_strerror_r_proto=define
15858                 set d_strerror_r_proto strerror_r $hdrs
15859                 eval $hasproto ;;
15860         *)      ;;
15861         esac
15862         case "$d_strerror_r_proto" in
15863         define)
15864         case "$strerror_r_proto" in
15865         ''|0) try='int strerror_r(int, char*, size_t);'
15866         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15867         esac
15868         case "$strerror_r_proto" in
15869         ''|0) try='int strerror_r(int, char*, int);'
15870         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15871         esac
15872         case "$strerror_r_proto" in
15873         ''|0) try='char* strerror_r(int, char*, size_t);'
15874         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15875         esac
15876         case "$strerror_r_proto" in
15877         ''|0)   d_strerror_r=undef
15878                 strerror_r_proto=0
15879                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15880         * )     case "$strerror_r_proto" in
15881                 REENTRANT_PROTO*) ;;
15882                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15883                 esac
15884                 echo "Prototype: $try" ;;
15885         esac
15886         ;;
15887         *)      case "$usethreads" in
15888                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15889                 esac
15890                 d_strerror_r=undef
15891                 strerror_r_proto=0
15892                 ;;
15893         esac
15894         ;;
15895 *)      strerror_r_proto=0
15896         ;;
15897 esac
15898
15899 : see if strftime exists
15900 set strftime d_strftime
15901 eval $inlibc
15902
15903 : see if strtod exists
15904 set strtod d_strtod
15905 eval $inlibc
15906
15907 : see if strtol exists
15908 set strtol d_strtol
15909 eval $inlibc
15910
15911 : see if strtold exists
15912 set strtold d_strtold
15913 eval $inlibc
15914
15915 : see if strtoll exists
15916 set strtoll d_strtoll
15917 eval $inlibc
15918
15919 case "$d_longlong-$d_strtoll" in
15920 "$define-$define")
15921         $cat <<EOM
15922 Checking whether your strtoll() works okay...
15923 EOM
15924         $cat >try.c <<'EOCP'
15925 #include <errno.h>
15926 #ifdef __hpux
15927 #define strtoll __strtoll
15928 #endif
15929 #ifdef __EMX__
15930 #define strtoll _strtoll
15931 #endif
15932 #include <stdio.h>
15933 extern long long int strtoll(char *s, char **, int); 
15934 static int bad = 0;
15935 int check(char *s, long long ell, int een) {
15936         long long gll;
15937         errno = 0;
15938         gll = strtoll(s, 0, 10);
15939         if (!((gll == ell) && (errno == een)))
15940                 bad++;
15941 }
15942 int main() {
15943         check(" 1",                                      1LL, 0);
15944         check(" 0",                                      0LL, 0);
15945         check("-1",                                     -1LL, 0);
15946         check("-9223372036854775808", -9223372036854775808LL, 0);
15947         check("-9223372036854775808", -9223372036854775808LL, 0);
15948         check(" 9223372036854775807",  9223372036854775807LL, 0);
15949         check("-9223372036854775808", -9223372036854775808LL, 0);
15950         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15951         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15952         if (!bad)
15953                 printf("ok\n");
15954 }
15955 EOCP
15956         set try
15957         if eval $compile; then
15958                 yyy=`$run ./try`
15959                 case "$yyy" in
15960                 ok) echo "Your strtoll() seems to be working okay." ;;
15961                 *) cat <<EOM >&4
15962 Your strtoll() doesn't seem to be working okay.
15963 EOM
15964                    d_strtoll="$undef"
15965                    ;;
15966                 esac
15967         else
15968                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15969                 d_strtoll="$undef"
15970         fi
15971         ;;
15972 esac
15973
15974 : see if strtoq exists
15975 set strtoq d_strtoq
15976 eval $inlibc
15977
15978 : see if strtoul exists
15979 set strtoul d_strtoul
15980 eval $inlibc
15981
15982 case "$d_strtoul" in
15983 "$define")
15984         $cat <<EOM
15985 Checking whether your strtoul() works okay...
15986 EOM
15987         $cat >try.c <<'EOCP'
15988 #include <errno.h>
15989 #include <stdio.h>
15990 extern unsigned long int strtoul(char *s, char **, int); 
15991 static int bad = 0;
15992 void check(char *s, unsigned long eul, int een) {
15993         unsigned long gul;
15994         errno = 0;
15995         gul = strtoul(s, 0, 10);
15996         if (!((gul == eul) && (errno == een)))
15997                 bad++;
15998 }
15999 int main() {
16000         check(" 1", 1L, 0);
16001         check(" 0", 0L, 0);
16002 EOCP
16003         case "$longsize" in
16004         8)
16005             $cat >>try.c <<'EOCP'
16006         check("18446744073709551615", 18446744073709551615UL, 0);
16007         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16008 #if 0 /* strtoul() for /^-/ strings is undefined. */
16009         check("-1", 18446744073709551615UL, 0);
16010         check("-18446744073709551614", 2, 0);
16011         check("-18446744073709551615", 1, 0);
16012         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16013         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16014 #endif
16015 EOCP
16016                 ;;
16017         4)
16018                     $cat >>try.c <<'EOCP'
16019         check("4294967295", 4294967295UL, 0);
16020         check("4294967296", 4294967295UL, ERANGE);
16021 #if 0 /* strtoul() for /^-/ strings is undefined. */
16022         check("-1", 4294967295UL, 0);
16023         check("-4294967294", 2, 0);
16024         check("-4294967295", 1, 0);
16025         check("-4294967296", 4294967295UL, ERANGE);
16026         check("-4294967297", 4294967295UL, ERANGE);
16027 #endif
16028 EOCP
16029                 ;;
16030         *)
16031 : Should we write these tests to be more portable by sprintf-ing
16032 : ~0 and then manipulating that char string as input for strtol?
16033                 ;;
16034         esac
16035         $cat >>try.c <<'EOCP'
16036         if (!bad)
16037                 printf("ok\n");
16038         return 0;
16039 }
16040 EOCP
16041         set try
16042         if eval $compile; then
16043                 case "`$run ./try`" in
16044                 ok) echo "Your strtoul() seems to be working okay." ;;
16045                 *) cat <<EOM >&4
16046 Your strtoul() doesn't seem to be working okay.
16047 EOM
16048                    d_strtoul="$undef"
16049                    ;;
16050                 esac
16051         fi
16052         ;;
16053 esac
16054
16055 : see if strtoull exists
16056 set strtoull d_strtoull
16057 eval $inlibc
16058
16059 case "$d_longlong-$d_strtoull" in
16060 "$define-$define")
16061         $cat <<EOM
16062 Checking whether your strtoull() works okay...
16063 EOM
16064         $cat >try.c <<'EOCP'
16065 #include <errno.h>
16066 #ifdef __hpux
16067 #define strtoull __strtoull
16068 #endif
16069 #include <stdio.h>
16070 extern unsigned long long int strtoull(char *s, char **, int); 
16071 static int bad = 0;
16072 int check(char *s, long long eull, int een) {
16073         long long gull;
16074         errno = 0;
16075         gull = strtoull(s, 0, 10);
16076         if (!((gull == eull) && (errno == een)))
16077                 bad++;
16078 }
16079 int main() {
16080         check(" 1",                                        1LL, 0);
16081         check(" 0",                                        0LL, 0);
16082         check("18446744073709551615",  18446744073709551615ULL, 0);
16083         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16084 #if 0 /* strtoull() for /^-/ strings is undefined. */
16085         check("-1",                    18446744073709551615ULL, 0);
16086         check("-18446744073709551614",                     2LL, 0);
16087         check("-18446744073709551615",                     1LL, 0);
16088         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16089         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16090 #endif
16091         if (!bad)
16092                 printf("ok\n");
16093 }
16094 EOCP
16095         set try
16096         if eval $compile; then
16097                 case "`$run ./try`" in
16098                 ok) echo "Your strtoull() seems to be working okay." ;;
16099                 *) cat <<EOM >&4
16100 Your strtoull() doesn't seem to be working okay.
16101 EOM
16102                    d_strtoull="$undef"
16103                    ;;
16104                 esac
16105         fi
16106         ;;
16107 esac
16108
16109 : see if strtouq exists
16110 set strtouq d_strtouq
16111 eval $inlibc
16112
16113 case "$d_strtouq" in
16114 "$define")
16115         $cat <<EOM
16116 Checking whether your strtouq() works okay...
16117 EOM
16118         $cat >try.c <<'EOCP'
16119 #include <errno.h>
16120 #include <stdio.h>
16121 extern unsigned long long int strtouq(char *s, char **, int); 
16122 static int bad = 0;
16123 void check(char *s, unsigned long long eull, int een) {
16124         unsigned long long gull;
16125         errno = 0;
16126         gull = strtouq(s, 0, 10);
16127         if (!((gull == eull) && (errno == een)))
16128                 bad++;
16129 }
16130 int main() {
16131         check(" 1",                                        1LL, 0);
16132         check(" 0",                                        0LL, 0);
16133         check("18446744073709551615",  18446744073709551615ULL, 0);
16134         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16135 #if 0 /* strtouq() for /^-/ strings is undefined. */
16136         check("-1",                    18446744073709551615ULL, 0);
16137         check("-18446744073709551614",                     2LL, 0);
16138         check("-18446744073709551615",                     1LL, 0);
16139         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16140         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16141 #endif
16142         if (!bad)
16143                 printf("ok\n");
16144         return 0;
16145 }
16146 EOCP
16147         set try
16148         if eval $compile; then
16149                 case "`$run ./try`" in
16150                 ok) echo "Your strtouq() seems to be working okay." ;;
16151                 *) cat <<EOM >&4
16152 Your strtouq() doesn't seem to be working okay.
16153 EOM
16154                    d_strtouq="$undef"
16155                    ;;
16156                 esac
16157         fi
16158         ;;
16159 esac
16160
16161 : see if strxfrm exists
16162 set strxfrm d_strxfrm
16163 eval $inlibc
16164
16165 : see if symlink exists
16166 set symlink d_symlink
16167 eval $inlibc
16168
16169 : see if syscall exists
16170 set syscall d_syscall
16171 eval $inlibc
16172
16173 : see if prototype for syscall is available
16174 echo " "
16175 set d_syscallproto syscall $i_unistd unistd.h
16176 eval $hasproto
16177
16178 : see if sysconf exists
16179 set sysconf d_sysconf
16180 eval $inlibc
16181
16182 : see if system exists
16183 set system d_system
16184 eval $inlibc
16185
16186 : see if tcgetpgrp exists
16187 set tcgetpgrp d_tcgetpgrp
16188 eval $inlibc
16189
16190 : see if tcsetpgrp exists
16191 set tcsetpgrp d_tcsetpgrp
16192 eval $inlibc
16193
16194 : see if prototype for telldir is available
16195 echo " "
16196 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16197 eval $hasproto
16198
16199 : see if time exists
16200 echo " "
16201 if test "X$d_time" = X -o X"$timetype" = X; then
16202     if set time val -f d_time; eval $csym; $val; then
16203                 echo 'time() found.' >&4
16204                 val="$define"
16205                 rp="What is the type returned by time() on this system?"
16206                 set time_t timetype long stdio.h sys/types.h
16207                 eval $typedef_ask
16208     else
16209                 echo 'time() not found, hope that will do.' >&4
16210                 val="$undef"
16211                 timetype='int';
16212     fi
16213     set d_time
16214     eval $setvar
16215 fi
16216
16217 : see if this is a sys/times.h system
16218 set sys/times.h i_systimes
16219 eval $inhdr
16220
16221 : see if times exists
16222 echo " "
16223 if set times val -f d_times; eval $csym; $val; then
16224         echo 'times() found.' >&4
16225         d_times="$define"
16226         inc=''
16227         case "$i_systimes" in
16228         "$define") inc='sys/times.h';;
16229         esac
16230         rp="What is the type returned by times() on this system?"
16231         set clock_t clocktype long stdio.h sys/types.h $inc
16232         eval $typedef_ask
16233 else
16234         echo 'times() NOT found, hope that will do.' >&4
16235         d_times="$undef"
16236         clocktype='int'
16237 fi
16238
16239 : see if tmpnam_r exists
16240 set tmpnam_r d_tmpnam_r
16241 eval $inlibc
16242 case "$d_tmpnam_r" in
16243 "$define")
16244         hdrs="$i_systypes sys/types.h define stdio.h "
16245         case "stdio" in
16246         time)
16247                 hdrs="$hdrs $i_systime sys/time.h"
16248                 ;;
16249         esac
16250         case "$d_tmpnam_r_proto:$usethreads" in
16251         ":define")      d_tmpnam_r_proto=define
16252                 set d_tmpnam_r_proto tmpnam_r $hdrs
16253                 eval $hasproto ;;
16254         *)      ;;
16255         esac
16256         case "$d_tmpnam_r_proto" in
16257         define)
16258         case "$tmpnam_r_proto" in
16259         ''|0) try='char* tmpnam_r(char*);'
16260         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16261         esac
16262         case "$tmpnam_r_proto" in
16263         ''|0)   d_tmpnam_r=undef
16264                 tmpnam_r_proto=0
16265                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16266         * )     case "$tmpnam_r_proto" in
16267                 REENTRANT_PROTO*) ;;
16268                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16269                 esac
16270                 echo "Prototype: $try" ;;
16271         esac
16272         ;;
16273         *)      case "$usethreads" in
16274                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16275                 esac
16276                 d_tmpnam_r=undef
16277                 tmpnam_r_proto=0
16278                 ;;
16279         esac
16280         ;;
16281 *)      tmpnam_r_proto=0
16282         ;;
16283 esac
16284
16285 : see if truncate exists
16286 set truncate d_truncate
16287 eval $inlibc
16288
16289 : see if ttyname_r exists
16290 set ttyname_r d_ttyname_r
16291 eval $inlibc
16292 case "$d_ttyname_r" in
16293 "$define")
16294         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16295         case "unistd" in
16296         time)
16297                 hdrs="$hdrs $i_systime sys/time.h"
16298                 ;;
16299         esac
16300         case "$d_ttyname_r_proto:$usethreads" in
16301         ":define")      d_ttyname_r_proto=define
16302                 set d_ttyname_r_proto ttyname_r $hdrs
16303                 eval $hasproto ;;
16304         *)      ;;
16305         esac
16306         case "$d_ttyname_r_proto" in
16307         define)
16308         case "$ttyname_r_proto" in
16309         ''|0) try='int ttyname_r(int, char*, size_t);'
16310         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16311         esac
16312         case "$ttyname_r_proto" in
16313         ''|0) try='int ttyname_r(int, char*, int);'
16314         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16315         esac
16316         case "$ttyname_r_proto" in
16317         ''|0) try='char* ttyname_r(int, char*, int);'
16318         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16319         esac
16320         case "$ttyname_r_proto" in
16321         ''|0)   d_ttyname_r=undef
16322                 ttyname_r_proto=0
16323                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16324         * )     case "$ttyname_r_proto" in
16325                 REENTRANT_PROTO*) ;;
16326                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16327                 esac
16328                 echo "Prototype: $try" ;;
16329         esac
16330         ;;
16331         *)      case "$usethreads" in
16332                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16333                 esac
16334                 d_ttyname_r=undef
16335                 ttyname_r_proto=0
16336                 ;;
16337         esac
16338         ;;
16339 *)      ttyname_r_proto=0
16340         ;;
16341 esac
16342
16343 : see if tzname[] exists
16344 echo " "
16345 if set tzname val -a d_tzname; eval $csym; $val; then
16346         val="$define"
16347         echo 'tzname[] found.' >&4
16348 else
16349         val="$undef"
16350         echo 'tzname[] NOT found.' >&4
16351 fi
16352 set d_tzname
16353 eval $setvar
16354
16355 case "$osname" in
16356 next|rhapsody|darwin) multiarch="$define" ;;
16357 esac
16358 case "$multiarch" in
16359 ''|[nN]*) multiarch="$undef" ;;
16360 esac
16361
16362 : check for ordering of bytes in a long
16363 echo " "
16364 case "$usecrosscompile$multiarch" in
16365 *$define*)
16366         $cat <<EOM
16367 You seem to be either cross-compiling or doing a multiarchitecture build,
16368 skipping the byteorder check.
16369
16370 EOM
16371         byteorder='ffff'
16372         ;;
16373 *)
16374         case "$byteorder" in
16375         '')
16376                 $cat <<'EOM'
16377 In the following, larger digits indicate more significance.  A big-endian
16378 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16379 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16380 machines may have weird orders like 3412.  A Cray will report 87654321,
16381 an Alpha will report 12345678. If the test program works the default is
16382 probably right.
16383 I'm now running the test program...
16384 EOM
16385                 $cat >try.c <<'EOCP'
16386 #include <stdio.h>
16387 int main()
16388 {
16389         int i;
16390         union {
16391                 unsigned long l;
16392                 char c[sizeof(long)];
16393         } u;
16394
16395         if (sizeof(long) > 4)
16396                 u.l = (0x08070605L << 32) | 0x04030201L;
16397         else
16398                 u.l = 0x04030201L;
16399         for (i = 0; i < sizeof(long); i++)
16400                 printf("%c", u.c[i]+'0');
16401         printf("\n");
16402         exit(0);
16403 }
16404 EOCP
16405                 xxx_prompt=y
16406                 set try
16407                 if eval $compile && ./try > /dev/null; then
16408                         dflt=`$run ./try`
16409                         case "$dflt" in
16410                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16411                                 echo "(The test program ran ok.)"
16412                                 echo "byteorder=$dflt"
16413                                 xxx_prompt=n
16414                         ;;
16415                         ????|????????) echo "(The test program ran ok.)" ;;
16416                         *) echo "(The test program didn't run right for some reason.)" ;;
16417                         esac
16418                 else
16419                         dflt='4321'
16420                         cat <<'EOM'
16421 (I can't seem to compile the test program.  Guessing big-endian...)
16422 EOM
16423                 fi
16424                 case "$xxx_prompt" in
16425                 y)
16426                         rp="What is the order of bytes in a long?"
16427                         . ./myread
16428                         byteorder="$ans"
16429                         ;;
16430                 *)      byteorder=$dflt
16431                         ;;
16432                 esac
16433                 ;;
16434         esac
16435         $rm -f try.c try
16436         ;;
16437 esac
16438
16439
16440 $cat <<EOM
16441
16442 Checking to see whether you can access character data unalignedly...
16443 EOM
16444 case "$d_u32align" in
16445 '')   $cat >try.c <<EOCP
16446 #include <stdio.h>
16447 #define U32 $u32type
16448 #define BYTEORDER 0x$byteorder
16449 #define U8 $u8type
16450 #include <signal.h>
16451 #ifdef SIGBUS
16452 $signal_t bletch(s) int s; { exit(4); }
16453 #endif
16454 int main() {
16455 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16456     U8 buf[8];
16457     U32 *up;
16458     int i;
16459
16460     if (sizeof(U32) != 4) {
16461         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16462         exit(1);
16463     }
16464
16465     fflush(stdout);
16466
16467 #ifdef SIGBUS
16468     signal(SIGBUS, bletch);
16469 #endif
16470
16471     buf[0] = 0;
16472     buf[1] = 0;
16473     buf[2] = 0;
16474     buf[3] = 1;
16475     buf[5] = 0;
16476     buf[6] = 0;
16477     buf[7] = 0;
16478     buf[8] = 1;
16479
16480     for (i = 0; i < 4; i++) {
16481         up = (U32*)(buf + i);
16482         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16483                (*up == 1 << (8*(3-i)))  /* little-endian */
16484               )
16485            )
16486         {
16487             printf("read failed (%x)\n", *up);
16488             exit(2);
16489         }
16490     }
16491
16492     /* write test */
16493     for (i = 0; i < 4; i++) {
16494         up = (U32*)(buf + i);
16495         *up = 0xBeef;
16496         if (*up != 0xBeef) {
16497             printf("write failed (%x)\n", *up);
16498             exit(3);
16499         }
16500     }
16501
16502     exit(0);
16503 #else
16504     printf("1\n");
16505     exit(1);
16506 #endif
16507     return 0;
16508 }
16509 EOCP
16510 set try
16511 if eval $compile_ok; then
16512         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16513         $run ./try 2>&1 >/dev/null
16514         case "$?" in
16515         0)      cat >&4 <<EOM
16516 You can access character data pretty unalignedly.
16517 EOM
16518                 d_u32align="$undef"
16519                 ;;
16520         *)      cat >&4 <<EOM
16521 It seems that you must access character data in an aligned manner.
16522 EOM
16523                 d_u32align="$define"
16524                 ;;
16525         esac
16526 else
16527         rp='Can you access character data at unaligned addresses?'
16528         dflt='n'
16529         . ./myread
16530         case "$ans" in
16531         [yY]*)  d_u32align="$undef"  ;;
16532         *)      d_u32align="$define" ;;
16533         esac
16534 fi
16535 $rm -f core core.try.* try.core
16536 ;;
16537 esac
16538
16539 : see if ualarm exists
16540 set ualarm d_ualarm
16541 eval $inlibc
16542
16543 : see if umask exists
16544 set umask d_umask
16545 eval $inlibc
16546
16547 : see if unordered exists
16548 set unordered d_unordered
16549 eval $inlibc
16550
16551 : see if usleep exists
16552 set usleep d_usleep
16553 eval $inlibc
16554
16555 : see if prototype for usleep is available
16556 echo " "
16557 set d_usleepproto usleep $i_unistd unistd.h
16558 eval $hasproto
16559
16560 : see if ustat exists
16561 set ustat d_ustat
16562 eval $inlibc
16563
16564 : backward compatibility for d_hvfork
16565 if test X$d_hvfork != X; then
16566         d_vfork="$d_hvfork"
16567         d_hvfork=''
16568 fi
16569 : see if there is a vfork
16570 val=''
16571 set vfork val
16572 eval $inlibc
16573
16574 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16575 : perl on Solaris 2.x, and probably elsewhere.
16576 case "$val" in
16577 $define)
16578         echo " "
16579         case "$usevfork" in
16580         false) dflt='n';;
16581         *) dflt='y';;
16582         esac
16583         cat <<'EOM'
16584  
16585 Perl can only use a vfork() that doesn't suffer from strict
16586 restrictions on calling functions or modifying global data in
16587 the child.  For example, glibc-2.1 contains such a vfork()
16588 that is unsuitable.  If your system provides a proper fork()
16589 call, chances are that you do NOT want perl to use vfork().
16590
16591 EOM
16592         rp="Do you still want to use vfork()?"
16593         . ./myread
16594         case "$ans" in
16595         y|Y) ;;
16596         *)
16597                 echo "Ok, we won't use vfork()."
16598                 val="$undef"
16599                 ;;
16600         esac
16601         ;;
16602 esac
16603 set d_vfork
16604 eval $setvar
16605 case "$d_vfork" in
16606 $define) usevfork='true';;
16607 *) usevfork='false';;
16608 esac
16609
16610 : see if closedir exists
16611 set closedir d_closedir
16612 eval $inlibc
16613
16614 case "$d_closedir" in
16615 "$define")
16616         echo " "
16617         echo "Checking whether closedir() returns a status..." >&4
16618         cat > try.c <<EOM
16619 #$i_dirent I_DIRENT             /**/
16620 #$i_sysdir I_SYS_DIR            /**/
16621 #$i_sysndir I_SYS_NDIR          /**/
16622 #$i_systypes I_SYS_TYPES        /**/
16623
16624 #if defined(I_SYS_TYPES)
16625 #include <sys/types.h>
16626 #endif
16627 #if defined(I_DIRENT)
16628 #include <dirent.h>
16629 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16630 #include <sys/dir.h>
16631 #endif
16632 #else
16633 #ifdef I_SYS_NDIR
16634 #include <sys/ndir.h>
16635 #else
16636 #ifdef I_SYS_DIR
16637 #ifdef hp9000s500
16638 #include <ndir.h>       /* may be wrong in the future */
16639 #else
16640 #include <sys/dir.h>
16641 #endif
16642 #endif
16643 #endif
16644 #endif 
16645 int main() { return closedir(opendir(".")); }
16646 EOM
16647         set try
16648         if eval $compile_ok; then
16649                 if $run ./try > /dev/null 2>&1 ; then
16650                         echo "Yes, it does."
16651                         val="$undef"
16652                 else
16653                         echo "No, it doesn't."
16654                         val="$define"
16655                 fi
16656         else
16657                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16658                 val="$define"
16659         fi
16660         ;;
16661 *)
16662         val="$undef";
16663         ;;
16664 esac
16665 set d_void_closedir
16666 eval $setvar
16667 $rm -f try try.*
16668 : see if there is a wait4
16669 set wait4 d_wait4
16670 eval $inlibc
16671
16672 : see if waitpid exists
16673 set waitpid d_waitpid
16674 eval $inlibc
16675
16676 : see if wcstombs exists
16677 set wcstombs d_wcstombs
16678 eval $inlibc
16679
16680 : see if wctomb exists
16681 set wctomb d_wctomb
16682 eval $inlibc
16683
16684 : see if writev exists
16685 set writev d_writev
16686 eval $inlibc
16687
16688 : preserve RCS keywords in files with variable substitution, grrr
16689 Date='$Date'
16690 Id='$Id'
16691 Log='$Log'
16692 RCSfile='$RCSfile'
16693 Revision='$Revision'
16694
16695 : check for alignment requirements
16696 echo " "
16697 case "$usecrosscompile$multiarch" in
16698 *$define*)
16699         $cat <<EOM
16700 You seem to be either cross-compiling or doing a multiarchitecture build,
16701 skipping the memory alignment check.
16702
16703 EOM
16704         case "$alignbytes" in
16705         '') alignbytes=8 ;;
16706         esac
16707         ;;
16708 *)
16709         case "$alignbytes" in
16710         '') echo "Checking alignment constraints..." >&4
16711                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16712                         $cat >try.c <<'EOCP'
16713 typedef long double NV;
16714 EOCP
16715                 else
16716                         $cat >try.c <<'EOCP'
16717 typedef double NV;
16718 EOCP
16719                 fi
16720                 $cat >>try.c <<'EOCP'
16721 #include <stdio.h>
16722 struct foobar {
16723         char foo;
16724         NV bar;
16725 } try_algn;
16726 int main()
16727 {
16728     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16729     return(0);
16730 }
16731 EOCP
16732                 set try
16733                 if eval $compile_ok; then
16734                         dflt=`$run ./try`
16735                 else
16736                         dflt='8'
16737                         echo "(I can't seem to compile the test program...)"
16738                 fi
16739                 ;;
16740         *) dflt="$alignbytes"
16741                 ;;
16742         esac
16743         rp="Doubles must be aligned on a how-many-byte boundary?"
16744         . ./myread
16745         alignbytes="$ans"
16746         $rm -f try.c try
16747         ;;
16748 esac
16749
16750
16751 : set the base revision
16752 baserev=5.0
16753
16754 : how do we catenate cpp tokens here?
16755 echo " "
16756 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16757 $cat >cpp_stuff.c <<'EOCP'
16758 #define RCAT(a,b)a/**/b
16759 #define ACAT(a,b)a ## b
16760 RCAT(Rei,ser)
16761 ACAT(Cir,cus)
16762 EOCP
16763 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16764 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16765         echo "Oh!  Smells like ANSI's been here." >&4
16766         echo "We can catify or stringify, separately or together!"
16767         cpp_stuff=42
16768 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16769         echo "Ah, yes!  The good old days!" >&4
16770         echo "However, in the good old days we don't know how to stringify and"
16771         echo "catify at the same time."
16772         cpp_stuff=1
16773 else
16774         $cat >&4 <<EOM
16775 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16776 to have to edit the values of CAT[2-5] in config.h...
16777 EOM
16778         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16779 fi
16780 $rm -f cpp_stuff.*
16781
16782 : see if this is a db.h system
16783 set db.h i_db
16784 eval $inhdr
16785
16786 case "$i_db" in
16787 $define)
16788         : Check db version.
16789         echo " "
16790         echo "Checking Berkeley DB version ..." >&4
16791         $cat >try.c <<EOCP
16792 #$d_const HASCONST
16793 #ifndef HASCONST
16794 #define const
16795 #endif
16796 #include <sys/types.h>
16797 #include <stdio.h>
16798 #include <db.h>
16799 int main(int argc, char *argv[])
16800 {
16801 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16802     int Major, Minor, Patch ;
16803     unsigned long Version ;
16804     (void)db_version(&Major, &Minor, &Patch) ;
16805     if (argc == 2) {
16806         printf("%d %d %d %d %d %d\n",
16807                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16808                Major, Minor, Patch);
16809         exit(0);
16810     }
16811     printf("You have Berkeley DB Version 2 or greater.\n");
16812
16813     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16814                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16815     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16816                 Major, Minor, Patch) ;
16817
16818     /* check that db.h & libdb are compatible */
16819     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16820         printf("db.h and libdb are incompatible.\n") ;
16821         exit(3);        
16822     }
16823
16824     printf("db.h and libdb are compatible.\n") ;
16825
16826     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16827                 + DB_VERSION_PATCH ;
16828
16829     /* needs to be >= 2.3.4 */
16830     if (Version < 2003004) {
16831     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16832         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16833         exit(2);        
16834     }
16835
16836     exit(0);
16837 #else
16838 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16839     if (argc == 2) {
16840         printf("1 0 0\n");
16841         exit(0);
16842     }
16843     printf("You have Berkeley DB Version 1.\n");
16844     exit(0);    /* DB version < 2: the coast is clear. */
16845 #else
16846     exit(1);    /* <db.h> not Berkeley DB? */
16847 #endif
16848 #endif
16849 }
16850 EOCP
16851         set try
16852         if eval $compile_ok && $run ./try; then
16853                 echo 'Looks OK.' >&4
16854                 set `$run ./try 1`
16855                 db_version_major=$1
16856                 db_version_minor=$2
16857                 db_version_patch=$3
16858         else
16859                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16860                 i_db=$undef
16861                 case " $libs " in
16862                 *"-ldb "*)
16863                         : Remove db from list of libraries to use
16864                         echo "Removing unusable -ldb from library list" >&4
16865                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16866                         shift
16867                         libs="$*"
16868                         echo "libs = $libs" >&4
16869                         ;;
16870                 esac
16871         fi
16872         $rm -f try.*
16873         ;;
16874 esac
16875
16876 case "$i_db" in
16877 define)
16878         : Check the return type needed for hash 
16879         echo " "
16880         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16881         $cat >try.c <<EOCP
16882 #$d_const HASCONST
16883 #ifndef HASCONST
16884 #define const
16885 #endif
16886 #include <sys/types.h>
16887 #include <db.h>
16888
16889 #ifndef DB_VERSION_MAJOR
16890 u_int32_t hash_cb (ptr, size)
16891 const void *ptr;
16892 size_t size;
16893 {
16894 }
16895 HASHINFO info;
16896 int main()
16897 {
16898         info.hash = hash_cb;
16899 }
16900 #endif
16901 EOCP
16902         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16903                 if $contains warning try.out >>/dev/null 2>&1 ; then
16904                         db_hashtype='int'
16905                 else
16906                         db_hashtype='u_int32_t'
16907                 fi
16908         else
16909                 : XXX Maybe we should just give up here.
16910                 db_hashtype=u_int32_t
16911                 $cat try.out >&4
16912                 echo "Help:  I can't seem to compile the db test program." >&4
16913                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16914         fi
16915         $rm -f try.*
16916         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16917         ;;
16918 *)      db_hashtype=u_int32_t
16919         ;;
16920 esac
16921 case "$i_db" in
16922 define)
16923         : Check the return type needed for prefix 
16924         echo " "
16925         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16926         cat >try.c <<EOCP
16927 #$d_const HASCONST
16928 #ifndef HASCONST
16929 #define const
16930 #endif
16931 #include <sys/types.h>
16932 #include <db.h>
16933
16934 #ifndef DB_VERSION_MAJOR
16935 size_t prefix_cb (key1, key2)
16936 const DBT *key1;
16937 const DBT *key2;
16938 {
16939 }
16940 BTREEINFO info;
16941 int main()
16942 {
16943         info.prefix = prefix_cb;
16944 }
16945 #endif
16946 EOCP
16947         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16948                 if $contains warning try.out >>/dev/null 2>&1 ; then
16949                         db_prefixtype='int'
16950                 else
16951                         db_prefixtype='size_t'
16952                 fi
16953         else
16954                 db_prefixtype='size_t'
16955                 : XXX Maybe we should just give up here.
16956                 $cat try.out >&4
16957                 echo "Help:  I can't seem to compile the db test program." >&4
16958                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16959         fi
16960         $rm -f try.*
16961         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16962         ;;
16963 *)      db_prefixtype='size_t'
16964         ;;
16965 esac
16966
16967
16968 : How can we generate normalized random numbers ?
16969 echo " "
16970 echo "Looking for a random number function..." >&4
16971 case "$randfunc" in
16972 '')
16973         if set drand48 val -f; eval $csym; $val; then
16974                 dflt="drand48"
16975                 echo "Good, found drand48()." >&4
16976         elif set random val -f; eval $csym; $val; then
16977                 dflt="random"
16978                 echo "OK, found random()." >&4
16979         else
16980                 dflt="rand"
16981                 echo "Yick, looks like I have to use rand()." >&4
16982         fi
16983         echo " "
16984         ;;
16985 *)
16986         dflt="$randfunc"
16987         ;;
16988 esac
16989 cont=true
16990
16991 case "$ccflags" in
16992 *-Dmy_rand=*|*-Dmy_srand=*)
16993         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16994         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16995         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16996         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16997         ;;
16998 esac
16999
17000 while $test "$cont"; do
17001         rp="Use which function to generate random numbers?"
17002         . ./myread
17003         if $test "$ans" = "$dflt"; then
17004                 : null
17005         else
17006                 randbits=''
17007         fi
17008         randfunc="$ans"
17009         if set $ans val -f; eval $csym; $val; then
17010                 cont=''
17011         else
17012                 dflt=y
17013                 rp="I cannot find function $ans. Use that name anyway?"
17014                 . ./myread
17015                 dflt=rand
17016                 case "$ans" in
17017                         [yY]*) cont='';;
17018                 esac
17019         fi
17020         case "$cont" in
17021         '')
17022                 case "$randfunc" in
17023                 drand48)
17024                         drand01="drand48()"
17025                         seedfunc="srand48"
17026                         randbits=48
17027                         randseedtype=long
17028                         ;;
17029                 rand|random)
17030                         case "$randbits" in
17031                         '')
17032 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17033                                 $cat >try.c <<EOCP
17034 #$i_unistd I_UNISTD
17035 #$i_stdlib I_STDLIB
17036 #include <stdio.h>
17037 #ifdef I_UNISTD
17038 #  include <unistd.h>
17039 #endif
17040 #ifdef I_STDLIB
17041 #  include <stdlib.h>
17042 #endif
17043 int main()
17044 {
17045         register int i;
17046         register unsigned long tmp;
17047         register unsigned long max = 0L;
17048
17049         for (i = 1000; i; i--) {
17050                 tmp = (unsigned long) $randfunc();
17051                 if (tmp > max) max = tmp;
17052         }
17053         for (i = 0; max; i++)
17054                 max /= 2;
17055         printf("%d\n",i);
17056 }
17057 EOCP
17058                                 set try
17059                                 if eval $compile_ok; then
17060                                         dflt=`try`
17061                                 else
17062                                         dflt='?'
17063                                         echo "(I can't seem to compile the test program...)"
17064                                 fi
17065                                 ;;
17066                         *)
17067                                 dflt="$randbits"
17068                                 ;;
17069                         esac
17070                         rp="How many bits does your $randfunc() function produce?"
17071                         . ./myread
17072                         randbits="$ans"
17073                         $rm -f try.c try
17074                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17075                         seedfunc="s$randfunc"
17076                         randseedtype=unsigned
17077                         ;;
17078                 *)
17079                         dflt="31"
17080                         rp="How many bits does your $randfunc() function produce?"
17081                         . ./myread
17082                         randbits="$ans"
17083                         seedfunc="s$randfunc"
17084                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17085                         if set $seedfunc val -f; eval $csym; $val; then
17086                                 echo "(Using $seedfunc() to seed random generator)"
17087                         else
17088                                 echo "(Warning: no $seedfunc() to seed random generator)"
17089                                 seedfunc=rand
17090                         fi
17091                         randseedtype=unsigned
17092                         ;;
17093                 esac
17094                 ;;
17095         esac
17096 done
17097
17098 echo " "
17099 echo "Determining whether or not we are on an EBCDIC system..." >&4
17100 $cat >try.c <<'EOM'
17101 int main()
17102 {
17103   if ('M'==0xd4) return 0;
17104   return 1;
17105 }
17106 EOM
17107
17108 val=$undef
17109 set try
17110 if eval $compile_ok; then
17111         if $run ./try; then
17112                 echo "You seem to speak EBCDIC." >&4
17113                 val="$define"
17114         else
17115                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17116         fi
17117 else
17118         echo "I'm unable to compile the test program." >&4
17119         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17120 fi
17121 $rm -f try try.*
17122 set ebcdic
17123 eval $setvar
17124
17125 echo " "
17126 $cat >&4 <<EOM
17127 Checking how to flush all pending stdio output...
17128 EOM
17129 # I only know how to find the first 32 possibly open files on SunOS.
17130 # See also hints/sunos_4_1.sh and util.c  --AD
17131 case "$osname" in
17132 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17133 esac
17134 $cat >>try.c <<EOCP
17135 #include <stdio.h>
17136 #$i_unistd I_UNISTD
17137 #ifdef I_UNISTD
17138 # include <unistd.h>
17139 #endif
17140 #$d_sysconf HAS_SYSCONF
17141 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17142 #ifdef HAS_STDIO_STREAM_ARRAY
17143 # define STDIO_STREAM_ARRAY $stdio_stream_array
17144 #endif
17145 int main() {
17146   FILE* p;
17147   unlink("try.out");
17148   p = fopen("try.out", "w");
17149 #ifdef TRY_FPUTC
17150   fputc('x', p);
17151 #else
17152 # ifdef TRY_FPRINTF
17153   fprintf(p, "x");
17154 # endif
17155 #endif
17156 #ifdef TRY_FFLUSH_NULL
17157   fflush(NULL);
17158 #endif
17159 #ifdef TRY_FFLUSH_ALL
17160   {
17161     long open_max = -1;
17162 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17163     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17164 # else
17165 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17166     open_max = sysconf(_SC_OPEN_MAX);
17167 #  else
17168 #   ifdef FOPEN_MAX
17169     open_max = FOPEN_MAX;
17170 #   else
17171 #    ifdef OPEN_MAX
17172     open_max = OPEN_MAX;
17173 #    else
17174 #     ifdef _NFILE
17175     open_max = _NFILE;
17176 #     endif
17177 #    endif
17178 #   endif
17179 #  endif
17180 # endif 
17181 # ifdef HAS_STDIO_STREAM_ARRAY
17182     if (open_max > 0) {
17183       long i;
17184       for (i = 0; i < open_max; i++)
17185             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17186                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17187                 STDIO_STREAM_ARRAY[i]._flag)
17188                 fflush(&STDIO_STREAM_ARRAY[i]);
17189     }   
17190   }
17191 # endif
17192 #endif
17193   _exit(42);
17194 }
17195 EOCP
17196 : first we have to find out how _not_ to flush
17197 $to try.c
17198 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17199     output=''
17200     set try -DTRY_FPUTC
17201     if eval $compile; then
17202             $run ./try 2>/dev/null
17203             code="$?"
17204             $from try.out
17205             if $test ! -s try.out -a "X$code" = X42; then
17206                 output=-DTRY_FPUTC
17207             fi
17208     fi
17209     case "$output" in
17210     '')
17211             set try -DTRY_FPRINTF
17212             if eval $compile; then
17213                     $run ./try 2>/dev/null
17214                     code="$?"
17215                     $from try.out
17216                     if $test ! -s try.out -a "X$code" = X42; then
17217                         output=-DTRY_FPRINTF
17218                     fi
17219             fi
17220         ;;
17221     esac
17222 fi
17223 : check for fflush NULL behaviour
17224 case "$fflushNULL" in
17225 '')     set try -DTRY_FFLUSH_NULL $output
17226         if eval $compile; then
17227                 $run ./try 2>/dev/null
17228                 code="$?"
17229                 $from try.out
17230                 if $test -s try.out -a "X$code" = X42; then
17231                         fflushNULL="`$cat try.out`"
17232                 else
17233                         if $test "X$code" != X42; then
17234                                 $cat >&4 <<EOM
17235 (If this test failed, don't worry, we'll try another method shortly.)
17236 EOM
17237                         fi
17238                 fi
17239         fi
17240         $rm -f core try.core core.try.*
17241         case "$fflushNULL" in
17242         x)      $cat >&4 <<EOM
17243 Your fflush(NULL) works okay for output streams.
17244 Let's see if it clobbers input pipes...
17245 EOM
17246 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17247 # bug that improperly flushes the input end of pipes.  So we avoid the
17248 # autoflush on fork/system/exec support for now. :-(
17249 $cat >tryp.c <<EOCP
17250 #include <stdio.h>
17251 int
17252 main(int argc, char **argv)
17253 {
17254     char buf[1024];
17255     int i;
17256     char *bp = buf;
17257     while (1) {
17258         while ((i = getc(stdin)) != -1
17259                && (*bp++ = i) != '\n'
17260                && bp < &buf[1024])
17261         /* DO NOTHING */ ;
17262         *bp = '\0';
17263         fprintf(stdout, "%s", buf);
17264         fflush(NULL);
17265         if (i == -1)
17266             return 0;
17267         bp = buf;
17268     }
17269 }
17270 EOCP
17271                 fflushNULL="$define"
17272                 set tryp
17273                 if eval $compile; then
17274                     $rm -f tryp.out
17275                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17276                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17277                        $cat >&4 <<EOM
17278 fflush(NULL) seems to behave okay with input streams.
17279 EOM
17280                         fflushNULL="$define"
17281                     else
17282                         $cat >&4 <<EOM
17283 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17284 EOM
17285                         fflushNULL="$undef"
17286                     fi
17287                 fi
17288                 $rm -f core tryp.c tryp.core core.tryp.*
17289                 ;;
17290         '')     $cat >&4 <<EOM
17291 Your fflush(NULL) isn't working (contrary to ANSI C).
17292 EOM
17293                 fflushNULL="$undef"
17294                 ;;
17295         *)      $cat >&4 <<EOM
17296 Cannot figure out whether your fflush(NULL) works or not.
17297 I'm assuming it doesn't (contrary to ANSI C).
17298 EOM
17299                 fflushNULL="$undef"
17300                 ;;
17301         esac
17302         ;;
17303 $define|true|[yY]*)
17304         fflushNULL="$define"
17305         ;;
17306 *)
17307         fflushNULL="$undef"
17308         ;;
17309 esac
17310 : check explicit looping only if NULL did not work, and if the pipe
17311 : bug does not show up on an explicit flush too
17312 case "$fflushNULL" in
17313 "$undef")
17314         $cat >tryp.c <<EOCP
17315 #include <stdio.h>
17316 int
17317 main(int argc, char **argv)
17318 {
17319     char buf[1024];
17320     int i;
17321     char *bp = buf;
17322     while (1) {
17323         while ((i = getc(stdin)) != -1
17324                && (*bp++ = i) != '\n'
17325                && bp < &buf[1024])
17326         /* DO NOTHING */ ;
17327         *bp = '\0';
17328         fprintf(stdout, "%s", buf);
17329         fflush(stdin);
17330         if (i == -1)
17331             return 0;
17332         bp = buf;
17333     }
17334 }
17335 EOCP
17336         set tryp
17337         if eval $compile; then
17338             $rm -f tryp.out
17339             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17340             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17341                $cat >&4 <<EOM
17342 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17343 EOM
17344                 : now check for fflushall behaviour
17345                 case "$fflushall" in
17346                 '')     set try -DTRY_FFLUSH_ALL $output
17347                         if eval $compile; then
17348                                 $cat >&4 <<EOM
17349 (Now testing the other method--but note that this also may fail.)
17350 EOM
17351                                 $run ./try 2>/dev/null
17352                                 code=$?
17353                                 $from try.out
17354                                 if $test -s try.out -a "X$code" = X42; then
17355                                         fflushall="`$cat try.out`"
17356                                 fi
17357                         fi
17358                         $rm -f core try.core core.try.*
17359                         case "$fflushall" in
17360                         x)      $cat >&4 <<EOM
17361 Whew. Flushing explicitly all the stdio streams works.
17362 EOM
17363                                 fflushall="$define"
17364                                 ;;
17365                         '')     $cat >&4 <<EOM
17366 Sigh. Flushing explicitly all the stdio streams doesn't work.
17367 EOM
17368                                 fflushall="$undef"
17369                                 ;;
17370                         *)      $cat >&4 <<EOM
17371 Cannot figure out whether flushing stdio streams explicitly works or not.
17372 I'm assuming it doesn't.
17373 EOM
17374                                 fflushall="$undef"
17375                                 ;;
17376                         esac
17377                         ;;
17378                 "$define"|true|[yY]*)
17379                         fflushall="$define"
17380                         ;;
17381                 *)
17382                         fflushall="$undef"
17383                         ;;
17384                 esac
17385             else
17386                 $cat >&4 <<EOM
17387 All is futile.  Even fflush(stdin) clobbers input pipes!
17388 EOM
17389                 fflushall="$undef"
17390             fi
17391         else
17392             fflushall="$undef"
17393         fi
17394         $rm -f core tryp.c tryp.core core.tryp.*
17395         ;;
17396 *)      fflushall="$undef"
17397         ;;
17398 esac
17399
17400 case "$fflushNULL$fflushall" in
17401 undefundef)
17402         $cat <<EOM
17403 OK, I give up.  I cannot figure out how to flush pending stdio output.
17404 We won't be flushing handles at all before fork/exec/popen.
17405 EOM
17406         ;;
17407 esac
17408 $rm -f try.* try$exe_ext
17409
17410 : Store the full pathname to the ar program for use in the C program
17411 : Respect a hint or command line value for full_ar.
17412 case "$full_ar" in
17413 '') full_ar=$ar ;;
17414 esac
17415
17416 : Store the full pathname to the sed program for use in the C program
17417 full_sed=$sed
17418
17419 : see what type gids are declared as in the kernel
17420 echo " "
17421 echo "Looking for the type for group ids returned by getgid()."
17422 set gid_t gidtype xxx stdio.h sys/types.h
17423 eval $typedef
17424 case "$gidtype" in
17425 xxx)
17426         xxx=`./findhdr sys/user.h`
17427         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17428         case $1 in
17429         unsigned) dflt="$1 $2" ;;
17430         *) dflt="$1" ;;
17431         esac
17432         ;;
17433 *) dflt="$gidtype";;
17434 esac
17435 case "$gidtype" in
17436 gid_t) echo "gid_t found." ;;
17437 *)      rp="What is the type for group ids returned by getgid()?"
17438         . ./myread
17439         gidtype="$ans"
17440         ;;
17441 esac
17442
17443 echo " "
17444 case "$gidtype" in
17445 *_t) zzz="$gidtype"     ;;
17446 *)   zzz="gid"          ;;
17447 esac
17448 echo "Checking the size of $zzz..." >&4 
17449 cat > try.c <<EOCP
17450 #include <sys/types.h>
17451 #include <stdio.h>
17452 int main() {
17453     printf("%d\n", (int)sizeof($gidtype));
17454     exit(0);
17455 }
17456 EOCP
17457 set try
17458 if eval $compile_ok; then
17459         yyy=`$run ./try`
17460         case "$yyy" in
17461         '')     gidsize=4
17462                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17463                 ;;
17464         *)      gidsize=$yyy
17465                 echo "Your $zzz is $gidsize bytes long."
17466                 ;;
17467         esac
17468 else
17469         gidsize=4
17470         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17471 fi
17472
17473
17474 echo " "
17475 case "$gidtype" in
17476 *_t) zzz="$gidtype"     ;;
17477 *)   zzz="gid"          ;;
17478 esac
17479 echo "Checking the sign of $zzz..." >&4 
17480 cat > try.c <<EOCP
17481 #include <sys/types.h>
17482 #include <stdio.h>
17483 int main() {
17484         $gidtype foo = -1;
17485         if (foo < 0)
17486                 printf("-1\n");
17487         else
17488                 printf("1\n");
17489 }
17490 EOCP
17491 set try
17492 if eval $compile; then
17493         yyy=`$run ./try`
17494         case "$yyy" in
17495         '')     gidsign=1
17496                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17497                 ;;
17498         *)      gidsign=$yyy
17499                 case "$gidsign" in
17500                  1) echo "Your $zzz is unsigned." ;;
17501                 -1) echo "Your $zzz is signed."   ;;
17502                 esac
17503                 ;;
17504         esac
17505 else
17506         gidsign=1
17507         echo "(I can't compile the test program--guessing unsigned.)" >&4
17508 fi
17509
17510
17511 echo " "
17512
17513 if $test X"$quadtype" != X; then
17514
17515 echo "Checking how to print 64-bit integers..." >&4
17516
17517 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17518         $cat >try.c <<'EOCP'
17519 #include <sys/types.h>
17520 #include <stdio.h>
17521 int main() {
17522   int q = 12345678901;
17523   printf("%ld\n", q);
17524 }
17525 EOCP
17526         set try
17527         if eval $compile; then
17528                 yyy=`$run ./try`
17529                 case "$yyy" in
17530                 12345678901)
17531                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17532                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17533                         echo "We will use %d."
17534                         ;;
17535                 esac
17536         fi
17537 fi
17538
17539 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17540         $cat >try.c <<'EOCP'
17541 #include <sys/types.h>
17542 #include <stdio.h>
17543 int main() {
17544   long q = 12345678901;
17545   printf("%ld\n", q);
17546 }
17547 EOCP
17548         set try
17549         if eval $compile; then
17550                 yyy=`$run ./try`
17551                 case "$yyy" in
17552                 12345678901)
17553                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17554                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17555                         echo "We will use %ld."
17556                         ;;
17557                 esac
17558         fi
17559 fi
17560
17561 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17562         $cat >try.c <<'EOCP'
17563 #include <sys/types.h>
17564 #include <inttypes.h>
17565 #include <stdio.h>
17566 int main() {
17567   int64_t q = 12345678901;
17568   printf("%" PRId64 "\n", q);
17569 }
17570 EOCP
17571         set try
17572         if eval $compile; then
17573                 yyy=`$run ./try`
17574                 case "$yyy" in
17575                 12345678901)
17576                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17577                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17578                         echo "We will use the C9X style."
17579                         ;;
17580                 esac
17581         fi
17582 fi
17583
17584 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17585         $cat >try.c <<EOCP
17586 #include <sys/types.h>
17587 #include <stdio.h>
17588 int main() {
17589   $quadtype q = 12345678901;
17590   printf("%Ld\n", q);
17591 }
17592 EOCP
17593         set try
17594         if eval $compile; then
17595                 yyy=`$run ./try`
17596                 case "$yyy" in
17597                 12345678901)
17598                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17599                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17600                         echo "We will use %Ld."
17601                         ;;
17602                 esac
17603         fi
17604 fi
17605
17606 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17607         $cat >try.c <<'EOCP'
17608 #include <sys/types.h>
17609 #include <stdio.h>
17610 int main() {
17611   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17612   printf("%lld\n", q);
17613 }
17614 EOCP
17615         set try
17616         if eval $compile; then
17617                 yyy=`$run ./try`
17618                 case "$yyy" in
17619                 12345678901)
17620                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17621                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17622                         echo "We will use the %lld style."
17623                         ;;
17624                 esac
17625         fi
17626 fi
17627
17628 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17629         $cat >try.c <<EOCP
17630 #include <sys/types.h>
17631 #include <stdio.h>
17632 int main() {
17633   $quadtype q = 12345678901;
17634   printf("%qd\n", q);
17635 }
17636 EOCP
17637         set try
17638         if eval $compile; then
17639                 yyy=`$run ./try`
17640                 case "$yyy" in
17641                 12345678901)
17642                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17643                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17644                         echo "We will use %qd."
17645                         ;;
17646                 esac
17647         fi
17648 fi
17649
17650 if $test X"$sPRId64" = X; then
17651         echo "Cannot figure out how to print 64-bit integers." >&4
17652 fi
17653
17654 $rm -f try try.*
17655
17656 fi
17657
17658 case "$sPRId64" in
17659 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17660         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17661         ;;
17662 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17663         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17664         ;;
17665 esac
17666
17667
17668 echo " "
17669 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17670
17671 if $test X"$ivsize" = X8; then
17672         ivdformat="$sPRId64"
17673         uvuformat="$sPRIu64"
17674         uvoformat="$sPRIo64"
17675         uvxformat="$sPRIx64"
17676         uvXUformat="$sPRIXU64"
17677 else
17678         if $test X"$ivsize" = X"$longsize"; then
17679                 ivdformat='"ld"'
17680                 uvuformat='"lu"'
17681                 uvoformat='"lo"'
17682                 uvxformat='"lx"'
17683                 uvXUformat='"lX"'
17684         else
17685                 if $test X"$ivsize" = X"$intsize"; then
17686                         ivdformat='"d"'
17687                         uvuformat='"u"'
17688                         uvoformat='"o"'
17689                         uvxformat='"x"'
17690                         uvXUformat='"X"'
17691                 else
17692                         : far out
17693                         if $test X"$ivsize" = X"$shortsize"; then
17694                                 ivdformat='"hd"'
17695                                 uvuformat='"hu"'
17696                                 uvoformat='"ho"'
17697                                 uvxformat='"hx"'
17698                                 uvXUformat='"hX"'
17699                         fi
17700                 fi
17701         fi
17702 fi
17703
17704 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17705         nveformat="$sPRIeldbl"
17706         nvfformat="$sPRIfldbl"
17707         nvgformat="$sPRIgldbl"
17708         nvEUformat="$sPRIEUldbl"
17709         nvFUformat="$sPRIFUldbl"
17710         nvGUformat="$sPRIGUldbl"
17711 else
17712         nveformat='"e"'
17713         nvfformat='"f"'
17714         nvgformat='"g"'
17715         nvEUformat='"E"'
17716         nvFUformat='"F"'
17717         nvGUformat='"G"'
17718 fi
17719
17720 case "$ivdformat" in
17721 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17722     exit 1
17723     ;;
17724 esac
17725
17726
17727 echo " "
17728 $echo "Checking the format string to be used for gids..." >&4
17729
17730 case "$gidsign" in
17731 -1)     if $test X"$gidsize" = X"$ivsize"; then
17732                 gidformat="$ivdformat"
17733         else
17734                 if $test X"$gidsize" = X"$longsize"; then
17735                         gidformat='"ld"'
17736                 else
17737                         if $test X"$gidsize" = X"$intsize"; then
17738                                 gidformat='"d"'
17739                         else
17740                                 if $test X"$gidsize" = X"$shortsize"; then
17741                                         gidformat='"hd"'
17742                                 fi
17743                         fi
17744                 fi
17745         fi
17746         ;;
17747 *)      if $test X"$gidsize" = X"$uvsize"; then
17748                 gidformat="$uvuformat"
17749         else
17750                 if $test X"$gidsize" = X"$longsize"; then
17751                         gidformat='"lu"'
17752                 else
17753                         if $test X"$gidsize" = X"$intsize"; then
17754                                 gidformat='"u"'
17755                         else
17756                                 if $test X"$gidsize" = X"$shortsize"; then
17757                                         gidformat='"hu"'
17758                                 fi
17759                         fi
17760                 fi
17761         fi
17762         ;;
17763 esac
17764
17765 : see if getgroups exists
17766 set getgroups d_getgrps
17767 eval $inlibc
17768
17769 : see if setgroups exists
17770 set setgroups d_setgrps
17771 eval $inlibc
17772
17773
17774 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17775 echo " "
17776 case "$d_getgrps$d_setgrps" in
17777 *define*)
17778         case "$groupstype" in
17779         '') dflt="$gidtype" ;;
17780         *)  dflt="$groupstype" ;;
17781         esac
17782         $cat <<EOM
17783 What type of pointer is the second argument to getgroups() and setgroups()?
17784 Usually this is the same as group ids, $gidtype, but not always.
17785
17786 EOM
17787         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17788         . ./myread
17789         groupstype="$ans"
17790         ;;
17791 *)  groupstype="$gidtype";;
17792 esac
17793
17794 echo " "
17795 echo "Checking if your $make program sets \$(MAKE)..." >&4
17796 case "$make_set_make" in
17797 '')
17798         $sed 's/^X //' > testmake.mak << 'EOF'
17799 Xall:
17800 X       @echo 'maketemp="$(MAKE)"'
17801 EOF
17802         case "`$make -f testmake.mak 2>/dev/null`" in
17803         *maketemp=*) make_set_make='#' ;;
17804         *)      make_set_make="MAKE=$make" ;;
17805         esac
17806         $rm -f testmake.mak
17807         ;;
17808 esac
17809 case "$make_set_make" in
17810 '#') echo "Yup, it does.";;
17811 *) echo "Nope, it doesn't.";;
17812 esac
17813
17814 : see what type is used for mode_t
17815 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17816 set mode_t modetype int stdio.h sys/types.h
17817 eval $typedef_ask
17818
17819 : see if stdarg is available
17820 echo " "
17821 if $test `./findhdr stdarg.h`; then
17822         echo "<stdarg.h> found." >&4
17823         valstd="$define"
17824 else
17825         echo "<stdarg.h> NOT found." >&4
17826         valstd="$undef"
17827 fi
17828
17829 : see if varags is available
17830 echo " "
17831 if $test `./findhdr varargs.h`; then
17832         echo "<varargs.h> found." >&4
17833 else
17834         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17835 fi
17836
17837 : set up the varargs testing programs
17838 $cat > varargs.c <<EOP
17839 #ifdef I_STDARG
17840 #include <stdarg.h>
17841 #endif
17842 #ifdef I_VARARGS
17843 #include <varargs.h>
17844 #endif
17845
17846 #ifdef I_STDARG
17847 int f(char *p, ...)
17848 #else
17849 int f(va_alist)
17850 va_dcl
17851 #endif
17852 {
17853         va_list ap;
17854 #ifndef I_STDARG
17855         char *p;
17856 #endif
17857 #ifdef I_STDARG
17858         va_start(ap,p);
17859 #else
17860         va_start(ap);
17861         p = va_arg(ap, char *);
17862 #endif
17863         va_end(ap);
17864 }
17865 EOP
17866 $cat > varargs <<EOP
17867 $startsh
17868 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17869         echo "true"
17870 else
17871         echo "false"
17872 fi
17873 $rm -f varargs$_o
17874 EOP
17875 chmod +x varargs
17876
17877 : now check which varargs header should be included
17878 echo " "
17879 i_varhdr=''
17880 case "$valstd" in
17881 "$define")
17882         if `./varargs I_STDARG`; then
17883                 val='stdarg.h'
17884         elif `./varargs I_VARARGS`; then
17885                 val='varargs.h'
17886         fi
17887         ;;
17888 *)
17889         if `./varargs I_VARARGS`; then
17890                 val='varargs.h'
17891         fi
17892         ;;
17893 esac
17894 case "$val" in
17895 '')
17896 echo "I could not find the definition for va_dcl... You have problems..." >&4
17897         val="$undef"; set i_stdarg; eval $setvar
17898         val="$undef"; set i_varargs; eval $setvar
17899         ;;
17900 *) 
17901         set i_varhdr
17902         eval $setvar
17903         case "$i_varhdr" in
17904         stdarg.h)
17905                 val="$define"; set i_stdarg; eval $setvar
17906                 val="$undef"; set i_varargs; eval $setvar
17907                 ;;
17908         varargs.h)
17909                 val="$undef"; set i_stdarg; eval $setvar
17910                 val="$define"; set i_varargs; eval $setvar
17911                 ;;
17912         esac
17913         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17914 esac
17915 $rm -f varargs*
17916
17917 : see if we need va_copy
17918 echo " "
17919 case "$i_stdarg" in
17920 "$define")
17921         $cat >try.c <<EOCP
17922 #include <stdarg.h>
17923 #include <stdio.h>
17924 #$i_stdlib I_STDLIB
17925 #ifdef I_STDLIB
17926 #include <stdlib.h>
17927 #endif
17928 #include <signal.h>
17929
17930 int
17931 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17932 {
17933   return vfprintf(f, fmt, *valp);
17934 }
17935  
17936 int    
17937 myvfprintf(FILE *f, const  char *fmt, va_list val)
17938 {
17939   return ivfprintf(f, fmt, &val);
17940 }
17941       
17942 int
17943 myprintf(char *fmt, ...) 
17944 {
17945   va_list val;
17946   va_start(val, fmt);
17947   return myvfprintf(stdout, fmt, val); 
17948 }         
17949
17950 int
17951 main(int ac, char **av)
17952 {
17953   signal(SIGSEGV, exit);
17954
17955   myprintf("%s%cs all right, then\n", "that", '\'');                            
17956   exit(0);      
17957 }
17958 EOCP
17959         set try
17960         if eval $compile && $run ./try 2>&1 >/dev/null; then
17961                 case "`$run ./try`" in
17962                 "that's all right, then")
17963                         okay=yes
17964                         ;;
17965                 esac
17966         fi
17967         case "$okay" in
17968         yes)    echo "It seems that you don't need va_copy()." >&4
17969                 need_va_copy="$undef"
17970                 ;;
17971         *)      echo "It seems that va_copy() or similar will be needed." >&4
17972                 need_va_copy="$define"
17973                 ;;
17974         esac
17975         $rm -f try.* core core.* *.core *.core.*
17976         ;;
17977 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17978         ;;
17979 esac
17980
17981 : see what type is used for size_t
17982 rp="What is the type used for the length parameter for string functions?"
17983 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17984 eval $typedef_ask
17985
17986 : check for type of arguments to gethostbyaddr. 
17987 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17988         case "$d_gethbyaddr" in
17989         $define)
17990                 $cat <<EOM
17991
17992 Checking to see what type of arguments are accepted by gethostbyaddr().
17993 EOM
17994                 hdrs="$define sys/types.h
17995                         $d_socket sys/socket.h 
17996                         $i_niin netinet/in.h 
17997                         $i_netdb netdb.h
17998                         $i_unistd unistd.h"
17999                 : The first arg can 'char *' or 'void *'
18000                 : The second arg is some of integral type
18001                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18002                         for yyy in size_t long int; do
18003                                 case "$netdb_host_type" in
18004                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18005                                         if ./protochk "$try" $hdrs; then
18006                                                 echo "Your system accepts $xxx for the first arg."
18007                                                 echo "...and $yyy for the second arg."
18008                                                 netdb_host_type="$xxx"
18009                                                 netdb_hlen_type="$yyy"
18010                                         fi
18011                                         ;;
18012                                 esac
18013                         done
18014                 done
18015                 : In case none of those worked, prompt the user.
18016                 case "$netdb_host_type" in
18017                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18018                         dflt='char *'
18019                         . ./myread
18020                         netdb_host_type=$ans
18021                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18022                         dflt="$sizetype"
18023                         . ./myread
18024                         netdb_hlen_type=$ans
18025                         ;;
18026                 esac
18027                 ;;
18028         *)      : no gethostbyaddr, so pick harmless defaults
18029                 netdb_host_type='char *'
18030                 netdb_hlen_type="$sizetype"
18031                 ;;
18032         esac
18033         # Remove the "const" if needed. -- but then we'll have a 
18034         # prototype clash!
18035         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18036 fi
18037
18038 : check for type of argument to gethostbyname. 
18039 if test "X$netdb_name_type" = X ; then
18040         case "$d_gethbyname" in
18041         $define)
18042                 $cat <<EOM
18043
18044 Checking to see what type of argument is accepted by gethostbyname().
18045 EOM
18046                 hdrs="$define sys/types.h
18047                         $d_socket sys/socket.h 
18048                         $i_niin netinet/in.h 
18049                         $i_netdb netdb.h
18050                         $i_unistd unistd.h"
18051                 for xxx in "const char *" "char *"; do
18052                         case "$netdb_name_type" in
18053                         '')     try="extern struct hostent *gethostbyname($xxx);"
18054                                 if ./protochk "$try" $hdrs; then
18055                                         echo "Your system accepts $xxx."
18056                                         netdb_name_type="$xxx"
18057                                 fi
18058                                 ;;
18059                         esac
18060                 done
18061                 : In case none of those worked, prompt the user.
18062                 case "$netdb_name_type" in
18063                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18064                         dflt='char *'
18065                         . ./myread
18066                         netdb_name_type=$ans
18067                         ;;
18068                 esac
18069                 ;;
18070         *)      : no gethostbyname, so pick harmless default
18071                 netdb_name_type='char *'
18072                 ;;
18073         esac
18074 fi
18075
18076 : check for type of 1st argument to getnetbyaddr. 
18077 if test "X$netdb_net_type" = X ; then
18078         case "$d_getnbyaddr" in
18079         $define)
18080                 $cat <<EOM
18081
18082 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18083 EOM
18084                 hdrs="$define sys/types.h
18085                         $d_socket sys/socket.h 
18086                         $i_niin netinet/in.h 
18087                         $i_netdb netdb.h
18088                         $i_unistd unistd.h"
18089                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18090                         case "$netdb_net_type" in
18091                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18092                                 if ./protochk "$try" $hdrs; then
18093                                         echo "Your system accepts $xxx."
18094                                         netdb_net_type="$xxx"
18095                                 fi
18096                                 ;;
18097                         esac
18098                 done
18099                 : In case none of those worked, prompt the user.
18100                 case "$netdb_net_type" in
18101                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18102                         dflt='long'
18103                         . ./myread
18104                         netdb_net_type=$ans
18105                         ;;
18106                 esac
18107                 ;;
18108         *)      : no getnetbyaddr, so pick harmless default
18109                 netdb_net_type='long'
18110                 ;;
18111         esac
18112 fi
18113 : locate the preferred pager for this system
18114 case "$pager" in
18115 '')
18116         dflt=''
18117         case "$pg" in
18118         /*) dflt=$pg;;
18119         [a-zA-Z]:/*) dflt=$pg;;
18120         esac
18121         case "$more" in
18122         /*) dflt=$more;;
18123         [a-zA-Z]:/*) dflt=$more;;
18124         esac
18125         case "$less" in
18126         /*) dflt=$less;;
18127         [a-zA-Z]:/*) dflt=$less;;
18128         esac
18129         case "$dflt" in
18130         '') dflt=/usr/ucb/more;;
18131         esac
18132         ;;
18133 *) dflt="$pager";;
18134 esac
18135 echo " "
18136 fn=f/
18137 rp='What pager is used on your system?'
18138 . ./getfile
18139 pager="$ans"
18140
18141 : see what type pids are declared as in the kernel
18142 rp="What is the type of process ids on this system?"
18143 set pid_t pidtype int stdio.h sys/types.h
18144 eval $typedef_ask
18145
18146 : Find earliest binary compatible site_perl subdirectory perl can use.
18147 case "$bincompat5005" in
18148 "$define") xs_apiversion='5.005' ;;
18149 *) xs_apiversion=$version ;;   # The current site_perl version.
18150 esac
18151 : Find earliest pure perl site_perl subdirectory perl can use.
18152 : The versioned directories started at 5.005.
18153 pm_apiversion='5.005'
18154
18155 : see if ar generates random libraries by itself
18156 echo " "
18157 echo "Checking how to generate random libraries on your machine..." >&4
18158 echo 'int bar1() { return bar2(); }' > bar1.c
18159 echo 'int bar2() { return 2; }' > bar2.c
18160 $cat > foo.c <<'EOP'
18161 int main() { printf("%d\n", bar1()); exit(0); }
18162 EOP
18163 $cc $ccflags -c bar1.c >/dev/null 2>&1
18164 $cc $ccflags -c bar2.c >/dev/null 2>&1
18165 $cc $ccflags -c foo.c >/dev/null 2>&1
18166 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18167 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18168         $run ./foobar >/dev/null 2>&1; then
18169         echo "$ar appears to generate random libraries itself."
18170         orderlib=false
18171         ranlib=":"
18172 elif $ar ts bar$_a >/dev/null 2>&1 &&
18173         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18174         $run ./foobar >/dev/null 2>&1; then
18175                 echo "a table of contents needs to be added with '$ar ts'."
18176                 orderlib=false
18177                 ranlib="$ar ts"
18178 else
18179         case "$ranlib" in
18180         :) ranlib='';;
18181         '')
18182                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18183                 $test -f $ranlib || ranlib=''
18184                 ;;
18185         esac
18186         if $test -n "$ranlib"; then
18187                 echo "your system has '$ranlib'; we'll use that."
18188                 orderlib=false
18189         else
18190                 echo "your system doesn't seem to support random libraries"
18191                 echo "so we'll use lorder and tsort to order the libraries."
18192                 orderlib=true
18193                 ranlib=":"
18194         fi
18195 fi
18196 $rm -f foo* bar* 
18197
18198 : check for type of arguments to select. 
18199 case "$selecttype" in
18200 '') case "$d_select" in
18201         $define)
18202                 echo " "
18203                 $cat <<EOM
18204 Checking to see what type of arguments are accepted by select().
18205 EOM
18206                 hdrs="$define sys/types.h
18207                         $i_systime sys/time.h 
18208                         $i_sysselct sys/select.h
18209                         $d_socket sys/socket.h"
18210                 : The first arg can be int, unsigned, or size_t
18211                 : The last arg may or may not be 'const'
18212                 val=''
18213                 : void pointer has been seen but using that
18214                 : breaks the selectminbits test
18215                 for xxx in 'fd_set *' 'int *'; do
18216                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18217                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18218                                         case "$val" in
18219                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18220                                                 if ./protochk "$try" $hdrs; then
18221                                                         echo "Your system accepts $xxx."
18222                                                         val="$xxx"
18223                                                 fi
18224                                                 ;;
18225                                         esac
18226                                 done
18227                         done
18228                 done
18229                 case "$val" in
18230                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18231                         case "$d_fd_set" in
18232                                 $define) dflt="fd_set *" ;;
18233                                 *)              dflt="int *" ;;
18234                         esac
18235                         . ./myread
18236                         val=$ans
18237                         ;;
18238                 esac
18239                 selecttype="$val"
18240                 ;;
18241         *)      : no select, so pick a harmless default
18242                 selecttype='int *'
18243                 ;;
18244         esac
18245         ;;
18246 esac
18247
18248 : check for the select 'width'
18249 case "$selectminbits" in
18250 '') case "$d_select" in
18251         $define)
18252                 $cat <<EOM
18253
18254 Checking to see on how many bits at a time your select() operates...
18255 EOM
18256                 $cat >try.c <<EOCP
18257 #include <sys/types.h>
18258 #$i_time I_TIME
18259 #$i_systime I_SYS_TIME
18260 #$i_systimek I_SYS_TIME_KERNEL
18261 #ifdef I_TIME
18262 #   include <time.h>
18263 #endif
18264 #ifdef I_SYS_TIME
18265 #   ifdef I_SYS_TIME_KERNEL
18266 #       define KERNEL
18267 #   endif
18268 #   include <sys/time.h>
18269 #   ifdef I_SYS_TIME_KERNEL
18270 #       undef KERNEL
18271 #   endif
18272 #endif
18273 #$i_sysselct I_SYS_SELECT
18274 #ifdef I_SYS_SELECT
18275 #include <sys/select.h>
18276 #endif
18277 #$d_socket HAS_SOCKET
18278 #ifdef HAS_SOCKET
18279 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18280 #endif
18281 #include <stdio.h>
18282 $selecttype b;
18283 #define S sizeof(*(b))
18284 #define MINBITS 64
18285 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18286 #define NBITS  (NBYTES * 8)
18287 int main() {
18288     char s[NBYTES];
18289     struct timeval t;
18290     int i;
18291     FILE* fp;
18292     int fd;
18293
18294     fclose(stdin);
18295     fp = fopen("try.c", "r");
18296     if (fp == 0)
18297       exit(1);
18298     fd = fileno(fp);
18299     if (fd < 0)
18300       exit(2);
18301     b = ($selecttype)s;
18302     for (i = 0; i < NBITS; i++)
18303         FD_SET(i, b);
18304     t.tv_sec  = 0;
18305     t.tv_usec = 0;
18306     select(fd + 1, b, 0, 0, &t);
18307     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18308     printf("%d\n", i + 1);
18309     return 0;
18310 }
18311 EOCP
18312                 set try
18313                 if eval $compile_ok; then
18314                         selectminbits=`$run ./try`
18315                         case "$selectminbits" in
18316                         '')     cat >&4 <<EOM
18317 Cannot figure out on how many bits at a time your select() operates.
18318 I'll play safe and guess it is 32 bits.
18319 EOM
18320                                 selectminbits=32
18321                                 bits="32 bits"
18322                                 ;;
18323                         1)      bits="1 bit" ;;
18324                         *)      bits="$selectminbits bits" ;;
18325                         esac
18326                         echo "Your select() operates on $bits at a time." >&4
18327                 else
18328                         rp='What is the minimum number of bits your select() operates on?'
18329                         case "$byteorder" in
18330                         1234|12345678)  dflt=32 ;;
18331                         *)              dflt=1  ;;
18332                         esac
18333                         . ./myread
18334                         val=$ans
18335                         selectminbits="$val"
18336                 fi
18337                 $rm -f try.* try
18338                 ;;
18339         *)      : no select, so pick a harmless default
18340                 selectminbits='32'
18341                 ;;
18342         esac
18343         ;;
18344 esac
18345
18346 : Trace out the files included by signal.h, then look for SIGxxx names.
18347 : Remove SIGARRAYSIZE used by HPUX.
18348 : Remove SIGSTKSIZE used by Linux.
18349 : Remove SIGSTKSZ used by Posix.
18350 : Remove SIGTYP void lines used by OS2.
18351 : Some cpps, like os390, dont give the file name anywhere
18352 if [ "X$fieldn" = X ]; then
18353         : Just make some guesses.  We check them later.
18354         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18355 else
18356         xxx=`echo '#include <signal.h>' |
18357         $cppstdin $cppminus $cppflags 2>/dev/null |
18358         $grep '^[       ]*#.*include' | 
18359         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18360 fi
18361 : Check this list of files to be sure we have parsed the cpp output ok.
18362 : This will also avoid potentially non-existent files, such 
18363 : as ../foo/bar.h
18364 xxxfiles=''
18365 for xx in $xxx /dev/null ; do
18366         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18367 done
18368 : If we have found no files, at least try signal.h
18369 case "$xxxfiles" in
18370 '')     xxxfiles=`./findhdr signal.h` ;;
18371 esac
18372 xxx=`awk '
18373 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18374         print substr($2, 4, 20)
18375 }
18376 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18377         print substr($3, 4, 20)
18378 }' $xxxfiles`
18379 : Append some common names just in case the awk scan failed.
18380 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18381 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18382 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18383 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18384 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18385
18386 : generate a few handy files for later
18387 $cat > signal.c <<'EOCP'
18388 #include <sys/types.h>
18389 #include <signal.h>
18390 #include <stdio.h>
18391 int main() {
18392
18393 /* Strange style to avoid deeply-nested #if/#else/#endif */
18394 #ifndef NSIG
18395 #  ifdef _NSIG
18396 #    define NSIG (_NSIG)
18397 #  endif
18398 #endif
18399
18400 #ifndef NSIG
18401 #  ifdef SIGMAX
18402 #    define NSIG (SIGMAX+1)
18403 #  endif
18404 #endif
18405
18406 #ifndef NSIG
18407 #  ifdef SIG_MAX
18408 #    define NSIG (SIG_MAX+1)
18409 #  endif
18410 #endif
18411
18412 #ifndef NSIG
18413 #  ifdef MAXSIG
18414 #    define NSIG (MAXSIG+1)
18415 #  endif
18416 #endif
18417
18418 #ifndef NSIG
18419 #  ifdef MAX_SIG
18420 #    define NSIG (MAX_SIG+1)
18421 #  endif
18422 #endif
18423
18424 #ifndef NSIG
18425 #  ifdef SIGARRAYSIZE
18426 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18427 #  endif
18428 #endif
18429
18430 #ifndef NSIG
18431 #  ifdef _sys_nsig
18432 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18433 #  endif
18434 #endif
18435
18436 /* Default to some arbitrary number that's big enough to get most
18437    of the common signals.
18438 */
18439 #ifndef NSIG
18440 #    define NSIG 50
18441 #endif
18442
18443 printf("NSIG %d\n", NSIG);
18444
18445 #ifndef JUST_NSIG
18446
18447 EOCP
18448
18449 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18450 {
18451         printf "#ifdef SIG"; printf $1; printf "\n"
18452         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18453         printf $1; printf ");\n"
18454         printf "#endif\n"
18455 }
18456 END {
18457         printf "#endif /* JUST_NSIG */\n";
18458         printf "exit(0);\n}\n";
18459 }
18460 ' >>signal.c
18461 $cat >signal.awk <<'EOP'
18462 BEGIN { ndups = 0 }
18463 $1 ~ /^NSIG$/ { nsig = $2 }
18464 ($1 !~ /^NSIG$/) && (NF == 2) {
18465     if ($2 > maxsig) { maxsig = $2 }
18466     if (sig_name[$2]) {
18467         dup_name[ndups] = $1
18468         dup_num[ndups] = $2
18469         ndups++ 
18470     }
18471     else {
18472         sig_name[$2] = $1
18473         sig_num[$2] = $2
18474     }
18475 }
18476 END { 
18477     if (nsig == 0) {
18478         nsig = maxsig + 1
18479     }
18480     printf("NSIG %d\n", nsig);
18481     for (n = 1; n < nsig; n++) {
18482         if (sig_name[n]) {
18483             printf("%s %d\n", sig_name[n], sig_num[n])
18484         }
18485         else {
18486             printf("NUM%d %d\n", n, n) 
18487         }
18488     }
18489     for (n = 0; n < ndups; n++) {
18490         printf("%s %d\n", dup_name[n], dup_num[n])
18491     }
18492 }
18493 EOP
18494 $cat >signal_cmd <<EOS
18495 $startsh
18496 if $test -s signal.lst; then
18497     echo "Using your existing signal.lst file"
18498         exit 0
18499 fi
18500 xxx="$xxx"
18501 EOS
18502 $cat >>signal_cmd <<'EOS'
18503
18504 set signal
18505 if eval $compile_ok; then
18506         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18507 else
18508         echo "(I can't seem be able to compile the whole test program)" >&4
18509         echo "(I'll try it in little pieces.)" >&4
18510         set signal -DJUST_NSIG
18511         if eval $compile_ok; then
18512                 $run ./signal$_exe > signal.nsg
18513                 $cat signal.nsg
18514         else
18515                 echo "I can't seem to figure out how many signals you have." >&4
18516                 echo "Guessing 50." >&4
18517                 echo 'NSIG 50' > signal.nsg
18518         fi
18519         : Now look at all the signal names, one at a time.
18520         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18521                 $cat > signal.c <<EOCP
18522 #include <sys/types.h>
18523 #include <signal.h>
18524 #include <stdio.h>
18525 int main() {
18526 printf("$xx %d\n", SIG${xx});
18527 return 0;
18528 }
18529 EOCP
18530                 set signal
18531                 if eval $compile; then
18532                         echo "SIG${xx} found."
18533                         $run ./signal$_exe  >> signal.ls1
18534                 else
18535                         echo "SIG${xx} NOT found."
18536                 fi
18537         done
18538         if $test -s signal.ls1; then
18539                 $cat signal.nsg signal.ls1 |
18540                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18541         fi
18542
18543 fi
18544 if $test -s signal.lst; then
18545         :
18546 else
18547         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18548         echo 'kill -l' >signal
18549         set X `csh -f <signal`
18550         $rm -f signal
18551         shift
18552         case $# in
18553         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18554         esac
18555         echo $@ | $tr ' ' $trnl | \
18556             $awk '{ printf "%s %d\n", $1, ++s; }
18557                   END { printf "NSIG %d\n", ++s }' >signal.lst
18558 fi
18559 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18560 EOS
18561 chmod a+x signal_cmd
18562 $eunicefix signal_cmd
18563
18564 : generate list of signal names
18565 echo " "
18566 case "$sig_name_init" in
18567 '') doinit=yes ;;
18568 *)  case "$sig_num_init" in
18569     ''|*,*) doinit=yes ;;
18570     esac ;;
18571 esac
18572 case "$doinit" in
18573 yes)
18574         echo "Generating a list of signal names and numbers..." >&4
18575         . ./signal_cmd
18576         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18577         sig_name=`$awk 'BEGIN { printf "ZERO " }
18578                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18579         sig_num=`$awk  'BEGIN { printf "0 " }
18580                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18581         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18582                              !/^NSIG/   { printf "\"%s\", ", $1 }
18583                              END        { printf "0\n" }' signal.lst`
18584         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18585                              !/^NSIG/   { printf "%d, ", $2}
18586                              END        { printf "0\n"}' signal.lst`
18587         ;;
18588 esac
18589 echo "The following $sig_count signals are available:"
18590 echo " "
18591 echo $sig_name | $awk \
18592 'BEGIN { linelen = 0 }
18593 {
18594         for (i = 1; i <= NF; i++) {
18595                 name = "SIG" $i " "
18596                 linelen = linelen + length(name)
18597                 if (linelen > 70) {
18598                         printf "\n"
18599                         linelen = length(name)
18600                 }
18601                 printf "%s", name
18602         }
18603         printf "\n"
18604 }'
18605 sig_size=`echo $sig_name | awk '{print NF}'`
18606 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18607
18608 echo " "
18609 case "$sizetype" in
18610 *_t) zzz="$sizetype"    ;;
18611 *)   zzz="filesize"     ;;
18612 esac
18613 echo "Checking the size of $zzz..." >&4 
18614 cat > try.c <<EOCP
18615 #include <sys/types.h>
18616 #include <stdio.h>
18617 int main() {
18618     printf("%d\n", (int)sizeof($sizetype));
18619     exit(0);
18620 }
18621 EOCP
18622 set try
18623 if eval $compile_ok; then
18624         yyy=`$run ./try`
18625         case "$yyy" in
18626         '')     sizesize=4
18627                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18628                 ;;
18629         *)      sizesize=$yyy
18630                 echo "Your $zzz size is $sizesize bytes."
18631                 ;;
18632         esac
18633 else
18634         sizesize=4
18635         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18636 fi
18637
18638
18639 : check for socklen_t
18640 echo " "
18641 echo "Checking to see if you have socklen_t..." >&4
18642 $cat >try.c <<EOCP
18643 #include <sys/types.h>
18644 #$d_socket HAS_SOCKET
18645 #ifdef HAS_SOCKET
18646 #include <sys/socket.h>
18647 #endif
18648 int main() { socklen_t x = 16; }
18649 EOCP
18650 set try
18651 if eval $compile; then
18652         val="$define"
18653         echo "You have socklen_t."
18654 else
18655         val="$undef"
18656         echo "You do not have socklen_t."
18657         case "$sizetype" in
18658         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18659         esac
18660 fi
18661 $rm -f try try.*
18662 set d_socklen_t
18663 eval $setvar
18664
18665 : see if this is a socks.h system
18666 set socks.h i_socks
18667 eval $inhdr
18668
18669 : check for type of the size argument to socket calls
18670 case "$d_socket" in
18671 "$define")
18672         $cat <<EOM
18673
18674 Checking to see what type is the last argument of accept().
18675 EOM
18676         yyy=''
18677         case "$d_socklen_t" in
18678         "$define") yyy="$yyy socklen_t"
18679         esac
18680         yyy="$yyy $sizetype int long unsigned"
18681         for xxx in $yyy; do
18682                 case "$socksizetype" in
18683                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18684                         case "$usesocks" in
18685                         "$define")
18686                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18687                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18688                                         socksizetype="$xxx"
18689                                 fi
18690                                 ;;
18691                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18692                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18693                                         socksizetype="$xxx"
18694                                 fi
18695                                 ;;
18696                         esac
18697                         ;;
18698                 esac
18699         done
18700 : In case none of those worked, prompt the user.
18701         case "$socksizetype" in
18702         '')     rp='What is the type for socket address structure sizes?'
18703                 dflt='int'
18704                 . ./myread
18705                 socksizetype=$ans
18706                 ;;
18707         esac
18708         ;;
18709 *)      : no sockets, so pick relatively harmless default
18710         socksizetype='int'
18711         ;;
18712 esac
18713
18714 : see what type is used for signed size_t
18715 set ssize_t ssizetype int stdio.h sys/types.h
18716 eval $typedef
18717 dflt="$ssizetype"
18718 $cat > try.c <<EOM
18719 #include <stdio.h>
18720 #include <sys/types.h>
18721 #define Size_t $sizetype
18722 #define SSize_t $dflt
18723 int main()
18724 {
18725         if (sizeof(Size_t) == sizeof(SSize_t))
18726                 printf("$dflt\n");
18727         else if (sizeof(Size_t) == sizeof(int))
18728                 printf("int\n");
18729         else 
18730                 printf("long\n");
18731         exit(0);
18732 }
18733 EOM
18734 echo " "
18735 set try
18736 if eval $compile_ok && $run ./try > /dev/null; then
18737         ssizetype=`$run ./try`
18738         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18739 else
18740         $cat >&4 <<EOM
18741 Help! I can't compile and run the ssize_t test program: please enlighten me!
18742 (This is probably a misconfiguration in your system or libraries, and
18743 you really ought to fix it.  Still, I'll try anyway.)
18744
18745 I need a type that is the same size as $sizetype, but is guaranteed to
18746 be signed.  Common values are ssize_t, int and long.
18747
18748 EOM
18749         rp="What signed type is the same size as $sizetype?"
18750         . ./myread
18751         ssizetype="$ans"
18752 fi
18753 $rm -f try try.*
18754
18755 : see what type of char stdio uses.
18756 echo " "
18757 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18758 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18759         echo "Your stdio uses unsigned chars." >&4
18760         stdchar="unsigned char"
18761 else
18762         echo "Your stdio uses signed chars." >&4
18763         stdchar="char"
18764 fi
18765 $rm -f stdioh
18766
18767
18768
18769 : see what type uids are declared as in the kernel
18770 echo " "
18771 echo "Looking for the type for user ids returned by getuid()."
18772 set uid_t uidtype xxx stdio.h sys/types.h
18773 eval $typedef
18774 case "$uidtype" in
18775 xxx)
18776         xxx=`./findhdr sys/user.h`
18777         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18778         case $1 in
18779         unsigned) dflt="$1 $2" ;;
18780         *) dflt="$1" ;;
18781         esac
18782         ;;
18783 *) dflt="$uidtype";;
18784 esac
18785 case "$uidtype" in
18786 uid_t)  echo "uid_t found." ;;
18787 *)      rp="What is the type for user ids returned by getuid()?"
18788         . ./myread
18789         uidtype="$ans"
18790         ;;
18791 esac
18792
18793 echo " "
18794 case "$uidtype" in
18795 *_t) zzz="$uidtype"     ;;
18796 *)   zzz="uid"          ;;
18797 esac
18798 echo "Checking the size of $zzz..." >&4 
18799 cat > try.c <<EOCP
18800 #include <sys/types.h>
18801 #include <stdio.h>
18802 int main() {
18803     printf("%d\n", (int)sizeof($uidtype));
18804     exit(0);
18805 }
18806 EOCP
18807 set try
18808 if eval $compile_ok; then
18809         yyy=`$run ./try`
18810         case "$yyy" in
18811         '')     uidsize=4
18812                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18813                 ;;
18814         *)      uidsize=$yyy
18815                 echo "Your $zzz is $uidsize bytes long."
18816                 ;;
18817         esac
18818 else
18819         uidsize=4
18820         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18821 fi
18822
18823 echo " "
18824 case "$uidtype" in
18825 *_t) zzz="$uidtype"     ;;
18826 *)   zzz="uid"          ;;
18827 esac
18828 echo "Checking the sign of $zzz..." >&4
18829 cat > try.c <<EOCP
18830 #include <sys/types.h>
18831 #include <stdio.h>
18832 int main() {
18833         $uidtype foo = -1;
18834         if (foo < 0)
18835                 printf("-1\n");
18836         else
18837                 printf("1\n");
18838 }
18839 EOCP
18840 set try
18841 if eval $compile; then
18842         yyy=`$run ./try`
18843         case "$yyy" in
18844         '')     uidsign=1
18845                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18846                 ;;
18847         *)      uidsign=$yyy
18848                 case "$uidsign" in
18849                  1) echo "Your $zzz is unsigned." ;;
18850                 -1) echo "Your $zzz is signed."   ;;
18851                 esac
18852                 ;;
18853         esac
18854 else
18855         uidsign=1
18856         echo "(I can't compile the test program--guessing unsigned.)" >&4
18857 fi
18858
18859
18860
18861 echo " "
18862 $echo "Checking the format string to be used for uids..." >&4
18863
18864 case "$uidsign" in
18865 -1)     if $test X"$uidsize" = X"$ivsize"; then
18866                 uidformat="$ivdformat"
18867         else
18868                 if $test X"$uidsize" = X"$longsize"; then
18869                         uidformat='"ld"'
18870                 else
18871                         if $test X"$uidsize" = X"$intsize"; then
18872                                 uidformat='"d"'
18873                         else
18874                                 if $test X"$uidsize" = X"$shortsize"; then
18875                                         uidformat='"hd"'
18876                                 fi
18877                         fi
18878                 fi
18879         fi
18880         ;;
18881 *)      if $test X"$uidsize" = X"$uvsize"; then
18882                 uidformat="$uvuformat"
18883         else
18884                 if $test X"$uidsize" = X"$longsize"; then
18885                         uidformat='"lu"'
18886                 else
18887                         if $test X"$uidsize" = X"$intsize"; then
18888                                 uidformat='"u"'
18889                         else
18890                                 if $test X"$uidsize" = X"$shortsize"; then
18891                                         uidformat='"hu"'
18892                                 fi
18893                         fi
18894                 fi
18895         fi
18896         ;;
18897 esac
18898
18899 : determine compiler compiler
18900 case "$yacc" in
18901 '')
18902         dflt=yacc;;
18903 *)
18904         dflt="$yacc";;
18905 esac
18906 echo " "
18907 comp='yacc'
18908 if $test -f "$byacc$_exe"; then
18909         dflt="$byacc"
18910         comp="byacc or $comp"
18911 fi
18912 if $test -f "$bison$_exe"; then
18913         comp="$comp or bison -y"
18914 fi
18915 rp="Which compiler compiler ($comp) shall I use?"
18916 . ./myread
18917 yacc="$ans"
18918 case "$yacc" in
18919 *bis*)
18920         case "$yacc" in
18921         *-y*) ;;
18922         *)
18923                 yacc="$yacc -y"
18924                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18925                 ;;
18926         esac
18927         ;;
18928 esac
18929
18930 : see if this is a fp.h system
18931 set fp.h i_fp
18932 eval $inhdr
18933
18934 : see if this is a fp_class.h system
18935 set fp_class.h i_fp_class
18936 eval $inhdr
18937
18938 : see if this is a ieeefp.h system
18939 case "$i_ieeefp" in
18940 '' ) set ieeefp.h i_ieeefp
18941      eval $inhdr
18942      ;;
18943 esac
18944
18945 : see if this is a libutil.h system
18946 set libutil.h i_libutil
18947 eval $inhdr
18948
18949 : see if mach cthreads are available
18950 if test "X$usethreads" = "X$define"; then
18951         set mach/cthreads.h i_machcthr
18952         eval $inhdr
18953 else
18954         i_machcthr="$undef"
18955 fi
18956
18957
18958
18959 : see if this is a math.h system
18960 set math.h i_math
18961 eval $inhdr
18962
18963 : see if this is a mntent.h system
18964 set mntent.h i_mntent
18965 eval $inhdr
18966
18967 : see if ndbm.h is available
18968 set ndbm.h t_ndbm
18969 eval $inhdr
18970
18971 case "$t_ndbm" in
18972 $undef)
18973     # Some Linux distributions such as RedHat 7.1 put the
18974     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18975     if $test -f /usr/include/gdbm/ndbm.h; then
18976         echo '<gdbm/ndbm.h> found.'
18977         ccflags="$ccflags -I/usr/include/gdbm"
18978         cppflags="$cppflags -I/usr/include/gdbm"
18979         t_ndbm=$define
18980     fi
18981     ;;
18982 esac
18983
18984 case "$t_ndbm" in
18985 $define)
18986         : see if dbm_open exists
18987         set dbm_open d_dbm_open
18988         eval $inlibc
18989         case "$d_dbm_open" in
18990         $undef)
18991                 t_ndbm="$undef"
18992                 echo "We won't be including <ndbm.h>"
18993                 ;;
18994         esac
18995         ;;
18996 esac
18997 val="$t_ndbm"
18998 set i_ndbm
18999 eval $setvar
19000
19001 : see if net/errno.h is available
19002 val=''
19003 set net/errno.h val
19004 eval $inhdr
19005
19006 : Unfortunately, it causes problems on some systems.  Arrgh.
19007 case "$val" in
19008 $define)
19009         cat > try.c <<'EOM'
19010 #include <stdio.h>
19011 #include <errno.h>
19012 #include <net/errno.h>
19013 int func()
19014 {
19015         return ENOTSOCK;
19016 }
19017 EOM
19018         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19019                 echo "We'll be including <net/errno.h>." >&4
19020         else
19021                 echo "We won't be including <net/errno.h>." >&4
19022                 val="$undef"
19023         fi
19024         $rm -f try.* try
19025         ;;
19026 esac
19027 set i_neterrno
19028 eval $setvar
19029
19030 : see if netinet/tcp.h is available
19031 set netinet/tcp.h i_netinettcp
19032 eval $inhdr
19033
19034 : see if this is a poll.h system
19035 set poll.h i_poll
19036 eval $inhdr
19037
19038 : see if this is a prot.h system
19039 set prot.h i_prot
19040 eval $inhdr
19041
19042 echo " "
19043 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19044 $cat <<'EOSH' > Cppsym.know
19045 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19046 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19047 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19048 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19049 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19050 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19051 bull c cadmus clipper CMU COFF COMPILER_VERSION
19052 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19053 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19054 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19055 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19056 GLIBC GLIBC_MINOR
19057 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19058 H3050R H3050RX hbullx20 hcx host_mips
19059 hp200 hp300 hp700 HP700 hp800 hp9000
19060 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19061 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19062 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19063 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19064 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19065 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19066 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19067 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19068 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19069 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19070 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19071 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19072 MATH_HAS_NO_SIDE_EFFECTS
19073 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19074 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19075 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19076 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19077 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19078 NetBSD news1500 news1700 news1800 news1900 news3700
19079 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19080 ns32016 ns32332 ns32k nsc32000
19081 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19082 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19083 pc532 pdp11 PGC PIC plexus PORTAR posix
19084 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19085 POSIX_C_SOURCE POSIX_SOURCE POWER
19086 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19087 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19088 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19089 sony sony_news sonyrisc sparc sparclite spectrum
19090 stardent stdc STDC_EXT stratos sun sun3 sun386
19091 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19092 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19093 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19094 sysV68 sysV88 Tek4132 Tek4300 titan
19095 TM3200 TM5400 TM5600
19096 tower tower32 tower32_200 tower32_600 tower32_700
19097 tower32_800 tower32_850 tss
19098 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19099 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19100 unix UNIX95 UNIX99 unixpc unos
19101 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19102 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19103 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19104 USGr4 USGr4_2
19105 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19106 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19107 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19108 z8000
19109 EOSH
19110 # Maybe put other stuff here too.
19111 cat <<EOSH >>Cppsym.know
19112 $osname
19113 EOSH
19114 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19115 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19116 $cat Cppsym.know > Cppsym.c
19117 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19118 $rm -f Cppsym.a Cppsym.b Cppsym.c
19119 cat <<EOSH > Cppsym
19120 $startsh
19121 if $test \$# -gt 0; then
19122     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19123     if $test -s Cppsym.got; then
19124         $rm -f Cppsym.got
19125         exit 0
19126     fi
19127     $rm -f Cppsym.got
19128     exit 1
19129 else
19130     $tr " " "$trnl" | ./Cppsym.try
19131     exit 0
19132 fi
19133 EOSH
19134 chmod +x Cppsym
19135 $eunicefix Cppsym
19136 cat <<EOSH > Cppsym.try
19137 $startsh
19138 cat <<'EOCP' > try.c
19139 #include <stdio.h>
19140 int main() {
19141 EOCP
19142 $awk \\
19143 EOSH
19144 cat <<'EOSH' >> Cppsym.try
19145 'length($1) > 0 {
19146     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19147     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19148     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19149     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19150 }'       >> try.c
19151 echo 'return 0;}' >> try.c
19152 EOSH
19153 cat <<EOSH >> Cppsym.try
19154 ccflags="$ccflags"
19155 case "$osname-$gccversion" in
19156 irix-) ccflags="\$ccflags -woff 1178" ;;
19157 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19158 esac
19159 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19160 EOSH
19161 chmod +x Cppsym.try
19162 $eunicefix Cppsym.try
19163 ./Cppsym < Cppsym.know > Cppsym.true
19164 : now check the C compiler for additional symbols
19165 postprocess_cc_v=''
19166 case "$osname" in
19167 aix) postprocess_cc_v="|$tr , ' '" ;;
19168 esac
19169 $cat >ccsym <<EOS
19170 $startsh
19171 $cat >tmp.c <<EOF
19172 extern int foo;
19173 EOF
19174 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19175 do
19176         case "\$i" in
19177         -D*) echo "\$i" | $sed 's/^-D//';;
19178         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
19179         esac
19180 done
19181 $rm -f try.c
19182 EOS
19183 postprocess_cc_v=''
19184 chmod +x ccsym
19185 $eunicefix ccsym
19186 ./ccsym > ccsym1.raw
19187 if $test -s ccsym1.raw; then
19188        $sort ccsym1.raw | $uniq >ccsym.raw
19189 else
19190        mv ccsym1.raw ccsym.raw
19191 fi
19192
19193 $awk '/\=/ { print $0; next }
19194         { print $0"=1" }' ccsym.raw >ccsym.list
19195 $awk '/\=/ { print $0; next }
19196         { print $0"=1" }' Cppsym.true >ccsym.true
19197 $comm -13 ccsym.true ccsym.list >ccsym.own
19198 $comm -12 ccsym.true ccsym.list >ccsym.com
19199 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19200 also=''
19201 if $test -z ccsym.raw; then
19202         echo "Your C compiler doesn't seem to define any symbols!" >&4
19203         echo " "
19204         echo "However, your C preprocessor defines the following symbols:"
19205         $cat Cppsym.true
19206         ccsymbols=''
19207         cppsymbols=`$cat Cppsym.true`
19208         cppsymbols=`echo $cppsymbols`
19209         cppccsymbols="$cppsymbols"
19210 else
19211         if $test -s ccsym.com; then
19212                 echo "Your C compiler and pre-processor define these symbols:"
19213                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19214                 also='also '
19215                 symbols='ones'
19216                 cppccsymbols=`$cat ccsym.com`
19217                 cppccsymbols=`echo $cppccsymbols`
19218                 $test "$silent" || sleep 1
19219         fi
19220         if $test -s ccsym.cpp; then
19221                 $test "$also" && echo " "
19222                 echo "Your C pre-processor ${also}defines the following symbols:"
19223                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19224                 also='further '
19225                 cppsymbols=`$cat ccsym.cpp`
19226                 cppsymbols=`echo $cppsymbols`
19227                 $test "$silent" || sleep 1
19228         fi
19229         if $test -s ccsym.own; then
19230                 $test "$also" && echo " "
19231                 echo "Your C compiler ${also}defines the following cpp symbols:"
19232                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19233                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19234                 ccsymbols=`$cat ccsym.own`
19235                 ccsymbols=`echo $ccsymbols`
19236                 $test "$silent" || sleep 1
19237         fi
19238 fi
19239
19240 : see if this is a termio system
19241 val="$undef"
19242 val2="$undef"
19243 val3="$undef"
19244 if $test `./findhdr termios.h`; then
19245         set tcsetattr i_termios
19246         eval $inlibc
19247         val3="$i_termios"
19248 fi
19249 echo " "
19250 case "$val3" in
19251 "$define") echo "You have POSIX termios.h... good!" >&4;;
19252 *) if ./Cppsym pyr; then
19253                 case "`/bin/universe`" in
19254                 ucb) if $test `./findhdr sgtty.h`; then
19255                                 val2="$define"
19256                                 echo "<sgtty.h> found." >&4
19257                         else
19258                                 echo "System is pyramid with BSD universe."
19259                                 echo "<sgtty.h> not found--you could have problems." >&4
19260                         fi;;
19261                 *) if $test `./findhdr termio.h`; then
19262                                 val="$define"
19263                                 echo "<termio.h> found." >&4
19264                         else
19265                                 echo "System is pyramid with USG universe."
19266                                 echo "<termio.h> not found--you could have problems." >&4
19267                         fi;;
19268                 esac
19269         elif ./usg; then
19270                 if $test `./findhdr termio.h`; then
19271                         echo "<termio.h> found." >&4
19272                         val="$define"
19273                 elif $test `./findhdr sgtty.h`; then
19274                         echo "<sgtty.h> found." >&4
19275                         val2="$define"
19276                 else
19277 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19278                 fi
19279         else
19280                 if $test `./findhdr sgtty.h`; then
19281                         echo "<sgtty.h> found." >&4
19282                         val2="$define"
19283                 elif $test `./findhdr termio.h`; then
19284                         echo "<termio.h> found." >&4
19285                         val="$define"
19286                 else
19287 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19288                 fi
19289         fi;;
19290 esac
19291 set i_termio; eval $setvar
19292 val=$val2; set i_sgtty; eval $setvar
19293 val=$val3; set i_termios; eval $setvar
19294
19295 : see if stddef is available
19296 set stddef.h i_stddef
19297 eval $inhdr
19298
19299 : see if this is a sunmath.h system
19300 set sunmath.h i_sunmath
19301 eval $inhdr
19302
19303 : see if sys/access.h is available
19304 set sys/access.h i_sysaccess
19305 eval $inhdr
19306
19307 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19308 set sys/filio.h i_sysfilio
19309 eval $inhdr
19310 echo " "
19311 if $test `./findhdr sys/ioctl.h`; then
19312         val="$define"
19313         echo '<sys/ioctl.h> found.' >&4
19314 else
19315         val="$undef"
19316         if $test $i_sysfilio = "$define"; then
19317             echo '<sys/ioctl.h> NOT found.' >&4
19318         else
19319                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19320                 $test $i_termio = "$define" && xxx="termio.h"
19321                 $test $i_termios = "$define" && xxx="termios.h"
19322 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19323         fi
19324 fi
19325 set i_sysioctl
19326 eval $setvar
19327
19328 : see if socket ioctl defs are in sys/sockio.h
19329 echo " "
19330 xxx=`./findhdr sys/sockio.h`
19331 if $test "$xxx"; then
19332         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19333                 val="$define"
19334                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19335         else
19336                 val="$undef"
19337                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19338         fi
19339 else
19340         val="$undef"
19341         $cat <<EOM
19342 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19343 EOM
19344 fi
19345 set i_syssockio
19346 eval $setvar
19347
19348
19349 : see if this is a syslog.h system
19350 set syslog.h i_syslog
19351 eval $inhdr
19352
19353
19354 : see if this is a sys/mode.h system
19355 set sys/mode.h i_sysmode
19356 eval $inhdr
19357
19358 : see if sys/resource.h has to be included
19359 set sys/resource.h i_sysresrc
19360 eval $inhdr
19361
19362 : see if sys/security.h is available
19363 set sys/security.h i_syssecrt
19364 eval $inhdr
19365
19366 : see if this is a sys/statvfs.h system
19367 set sys/statvfs.h i_sysstatvfs
19368 eval $inhdr
19369
19370 : see if this is a sys/un.h system
19371 set sys/un.h i_sysun
19372 eval $inhdr
19373
19374
19375 : see if this is a sys/utsname.h system
19376 set sys/utsname.h i_sysutsname
19377 eval $inhdr
19378
19379 : see if this is a syswait system
19380 set sys/wait.h i_syswait
19381 eval $inhdr
19382
19383 : see if this is a ustat.h system
19384 set ustat.h i_ustat
19385 eval $inhdr
19386
19387 : see if this is an utime system
19388 set utime.h i_utime
19389 eval $inhdr
19390
19391 : see if this is a values.h system
19392 set values.h i_values
19393 eval $inhdr
19394
19395 : see if this is a vfork system
19396 case "$d_vfork" in
19397 "$define")
19398         set vfork.h i_vfork
19399         eval $inhdr
19400         ;;
19401 *)
19402         i_vfork="$undef"
19403         ;;
19404 esac
19405
19406 : see if gdbm.h is available
19407 set gdbm.h t_gdbm
19408 eval $inhdr
19409 case "$t_gdbm" in
19410 $define)
19411         : see if gdbm_open exists
19412         set gdbm_open d_gdbm_open
19413         eval $inlibc
19414         case "$d_gdbm_open" in
19415         $undef)
19416                 t_gdbm="$undef"
19417                 echo "We won't be including <gdbm.h>"
19418                 ;;
19419         esac
19420         ;;
19421 esac
19422 val="$t_gdbm"
19423 set i_gdbm
19424 eval $setvar
19425
19426 echo " "
19427 echo "Looking for extensions..." >&4
19428 : If we are using the old config.sh, known_extensions may contain
19429 : old or inaccurate or duplicate values.
19430 known_extensions=''
19431 nonxs_extensions=''
19432 : We do not use find because it might not be available.
19433 : We do not just use MANIFEST because the user may have dropped
19434 : some additional extensions into the source tree and expect them
19435 : to be built.
19436
19437 : Function to recursively find available extensions, ignoring DynaLoader
19438 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19439 find_extensions='
19440     for xxx in *; do
19441        case "$xxx" in
19442            DynaLoader|dynaload) ;;
19443            *)
19444            if $test -f $xxx/$xxx.xs; then
19445                known_extensions="$known_extensions $1$xxx";
19446            elif $test -f $xxx/Makefile.PL; then
19447                nonxs_extensions="$nonxs_extensions $1$xxx";
19448            else
19449                if $test -d $xxx -a $# -lt 10; then
19450                    set $1$xxx/ $*;
19451                    cd "$xxx";
19452                    eval $find_extensions;
19453                    cd ..;
19454                    shift;
19455                fi;
19456            fi
19457            ;;
19458        esac;
19459     done'
19460 tdir=`pwd`
19461 cd "$rsrc/ext"
19462 set X
19463 shift
19464 eval $find_extensions
19465 # Special case:  Add in threads/shared since it is not picked up by the
19466 # recursive find above (and adding in general recursive finding breaks
19467 # SDBM_File/sdbm).  A.D.  10/25/2001.
19468 known_extensions="$known_extensions threads/shared"
19469 set X $nonxs_extensions
19470 shift
19471 nonxs_extensions="$*"
19472 set X $known_extensions
19473 shift
19474 known_extensions="$*"
19475 cd "$tdir"
19476
19477 : Now see which are supported on this system.
19478 avail_ext=''
19479 for xxx in $known_extensions ; do
19480         case "$xxx" in
19481         DB_File|db_file)
19482                 case "$i_db" in
19483                 $define) avail_ext="$avail_ext $xxx" ;;
19484                 esac
19485                 ;;
19486         GDBM_File|gdbm_fil)
19487                 case "$i_gdbm" in 
19488                 $define) avail_ext="$avail_ext $xxx" ;;
19489                 esac
19490                 ;;
19491         I18N/Langinfo|i18n_lan)
19492                 case "$i_langinfo$d_nl_langinfo" in 
19493                 $define$define) avail_ext="$avail_ext $xxx" ;;
19494                 esac
19495                 ;;
19496         NDBM_File|ndbm_fil)
19497                 case "$i_ndbm" in
19498                 $define)
19499                     case "$osname-$use64bitint" in
19500                     cygwin-*|hpux-define)
19501                         case "$libs" in
19502                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19503                         esac
19504                         ;;
19505                     *) avail_ext="$avail_ext $xxx" ;;
19506                     esac
19507                     ;;
19508                 esac
19509                 ;;
19510         ODBM_File|odbm_fil) 
19511                 case "${i_dbm}${i_rpcsvcdbm}" in
19512                 *"${define}"*)
19513                     case "$osname-$use64bitint" in
19514                     cygwin-*|hpux-define)
19515                         case "$libs" in
19516                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19517                         esac
19518                         ;;
19519                     *) avail_ext="$avail_ext $xxx" ;;
19520                     esac
19521                     ;;
19522                 esac
19523                 ;;
19524         POSIX|posix)
19525                 case "$useposix" in
19526                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19527                 esac
19528                 ;;
19529         Opcode|opcode)
19530                 case "$useopcode" in
19531                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19532                 esac
19533                 ;;
19534         Socket|socket)
19535                 case "$d_socket" in 
19536                 true|$define|y)
19537                     case "$osname" in
19538                     beos) ;; # not unless BONE
19539                     *) avail_ext="$avail_ext $xxx" ;;
19540                     esac
19541                     ;;
19542                 esac
19543                 ;;
19544         Sys/Syslog|sys/syslog)
19545                 : XXX syslog requires socket
19546                 case "$d_socket" in 
19547                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19548                 esac
19549                 ;;
19550         Thread|thread)
19551                 case "$usethreads" in
19552                 true|$define|y)
19553                         case "$useithreads" in
19554                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19555                         esac
19556                 esac
19557                 ;;
19558         threads|threads/shared)
19559                 case "$usethreads" in
19560                 true|$define|y)
19561                         case "$useithreads" in
19562                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
19563                         esac
19564                 esac
19565                 ;;
19566         IPC/SysV|ipc/sysv)
19567                 : XXX Do we need a useipcsysv variable here
19568                 case "${d_msg}${d_sem}${d_shm}" in 
19569                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19570                 esac
19571                 ;;
19572         *)      avail_ext="$avail_ext $xxx"
19573                 ;;
19574         esac
19575 done
19576
19577 set X $avail_ext
19578 shift
19579 avail_ext="$*"
19580
19581 : Now see which nonxs extensions are supported on this system.
19582 : For now assume all are.
19583 nonxs_ext=''
19584 for xxx in $nonxs_extensions ; do
19585         case "$xxx" in
19586         *)      nonxs_ext="$nonxs_ext $xxx"
19587                 ;;
19588         esac
19589 done
19590
19591 set X $nonxs_ext
19592 shift
19593 nonxs_ext="$*"
19594
19595 case $usedl in
19596 $define)
19597         $cat <<EOM
19598 A number of extensions are supplied with $package.  You may choose to
19599 compile these extensions for dynamic loading (the default), compile
19600 them into the $package executable (static loading), or not include
19601 them at all.  Answer "none" to include no extensions.
19602 Note that DynaLoader is always built and need not be mentioned here.
19603
19604 EOM
19605         case "$dynamic_ext" in
19606         '') dflt="$avail_ext" ;;
19607         *)      dflt="$dynamic_ext"
19608                 # Perhaps we are reusing an old out-of-date config.sh.
19609                 case "$hint" in
19610                 previous)
19611                         if test X"$dynamic_ext" != X"$avail_ext"; then
19612                                 $cat <<EOM
19613 NOTICE:  Your previous config.sh list may be incorrect. 
19614 The extensions now available to you are 
19615         ${avail_ext}
19616 but the default list from your previous config.sh is
19617         ${dynamic_ext} 
19618
19619 EOM
19620                         fi
19621                         ;;
19622                 esac
19623                 ;;
19624         esac
19625         case "$dflt" in
19626         '')     dflt=none;;
19627         esac
19628         rp="What extensions do you wish to load dynamically?"
19629         . ./myread
19630         case "$ans" in
19631         none) dynamic_ext=' ' ;;
19632         *) dynamic_ext="$ans" ;;
19633         esac
19634
19635         case "$static_ext" in
19636         '')
19637                 : Exclude those already listed in dynamic linking
19638                 dflt=''
19639                 for xxx in $avail_ext; do
19640                         case " $dynamic_ext " in
19641                         *" $xxx "*) ;;
19642                         *) dflt="$dflt $xxx" ;;
19643                         esac
19644                 done
19645                 set X $dflt
19646                 shift
19647                 dflt="$*"
19648                 ;;
19649         *)  dflt="$static_ext" 
19650                 ;;
19651         esac
19652
19653         case "$dflt" in
19654         '')     dflt=none;;
19655         esac
19656         rp="What extensions do you wish to load statically?"
19657         . ./myread
19658         case "$ans" in
19659         none) static_ext=' ' ;;
19660         *) static_ext="$ans" ;;
19661         esac
19662         ;;
19663 *)
19664         $cat <<EOM
19665 A number of extensions are supplied with $package.  Answer "none" 
19666 to include no extensions. 
19667 Note that DynaLoader is always built and need not be mentioned here.
19668
19669 EOM
19670         case "$static_ext" in
19671         '') dflt="$avail_ext" ;;
19672         *)      dflt="$static_ext"
19673                 # Perhaps we are reusing an old out-of-date config.sh.
19674                 case "$hint" in
19675                 previous)
19676                         if test X"$static_ext" != X"$avail_ext"; then
19677                                 $cat <<EOM
19678 NOTICE:  Your previous config.sh list may be incorrect. 
19679 The extensions now available to you are 
19680         ${avail_ext}
19681 but the default list from your previous config.sh is
19682         ${static_ext} 
19683
19684 EOM
19685                         fi
19686                         ;;
19687                 esac
19688                 ;;
19689         esac
19690         : Exclude those that are not xs extensions
19691         case "$dflt" in
19692         '')     dflt=none;;
19693         *)  case " $dflt " in
19694             *" Encode "*) # Add the subextensions of Encode
19695                 cd "$rsrc/ext"
19696                 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19697                         dflt="$dflt Encode/$xxx"
19698                 done
19699                 cd "$tdir"
19700                 ;;
19701             esac
19702             ;;
19703         esac
19704         rp="What extensions do you wish to include?"
19705         . ./myread
19706         case "$ans" in
19707         none) static_ext=' ' ;;
19708         *) static_ext="$ans" ;;
19709         esac
19710         ;;
19711 esac
19712
19713 set X $dynamic_ext $static_ext $nonxs_ext
19714 shift
19715 extensions="$*"
19716
19717 : Remove libraries needed only for extensions
19718 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19719 : The exception is SunOS 4.x, which needs them.
19720 case "${osname}X${osvers}" in
19721 sunos*X4*)
19722     perllibs="$libs"
19723     ;;
19724 *) case "$usedl" in
19725     $define|true|[yY]*)
19726             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19727             shift
19728             perllibs="$*"
19729             ;;
19730     *)  perllibs="$libs"
19731             ;;
19732     esac
19733     ;;
19734 esac
19735
19736 : Remove build directory name from cppstdin so it can be used from
19737 : either the present location or the final installed location.
19738 echo " "
19739 : Get out of the UU directory to get correct path name.
19740 cd ..
19741 case "$cppstdin" in
19742 `pwd`/cppstdin)
19743         echo "Stripping down cppstdin path name"
19744         cppstdin=cppstdin
19745         ;;
19746 esac
19747 cd UU
19748
19749 : end of configuration questions
19750 echo " "
19751 echo "End of configuration questions."
19752 echo " "
19753
19754 : back to where it started
19755 if test -d ../UU; then
19756         cd ..
19757 fi
19758
19759 : configuration may be patched via a 'config.arch' file
19760 if $test -f config.arch; then
19761         echo "I see a config.arch file, loading it."
19762         . ./config.arch
19763 fi
19764
19765 : configuration may be patched via a 'config.over' file
19766 if $test -f config.over; then
19767         echo " "
19768         dflt=y
19769         rp='I see a config.over file.  Do you wish to load it?'
19770         . UU/myread
19771         case "$ans" in
19772         n*) echo "OK, I'll ignore it.";;
19773         *)      . ./config.over
19774                 echo "Configuration override changes have been loaded."
19775                 ;;
19776         esac
19777 fi
19778
19779 : in case they want portability, strip down executable paths
19780 case "$d_portable" in
19781 "$define")
19782         echo " "
19783         echo "Stripping down executable paths..." >&4
19784         for file in $loclist $trylist; do
19785                 eval temp=\$$file
19786                 eval $file=`basename $temp`
19787         done
19788         ;;
19789 esac
19790
19791 : create config.sh file
19792 echo " "
19793 echo "Creating config.sh..." >&4
19794 $spitshell <<EOT >config.sh
19795 $startsh
19796 #
19797 # This file was produced by running the Configure script. It holds all the
19798 # definitions figured out by Configure. Should you modify one of these values,
19799 # do not forget to propagate your changes by running "Configure -der". You may
19800 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19801 #
19802
19803 # Package name      : $package
19804 # Source directory  : $src
19805 # Configuration time: $cf_time
19806 # Configured by     : $cf_by
19807 # Target system     : $myuname
19808
19809 Author='$Author'
19810 Date='$Date'
19811 Header='$Header'
19812 Id='$Id'
19813 Locker='$Locker'
19814 Log='$Log'
19815 Mcc='$Mcc'
19816 RCSfile='$RCSfile'
19817 Revision='$Revision'
19818 Source='$Source'
19819 State='$State'
19820 _a='$_a'
19821 _exe='$_exe'
19822 _o='$_o'
19823 afs='$afs'
19824 afsroot='$afsroot'
19825 alignbytes='$alignbytes'
19826 ansi2knr='$ansi2knr'
19827 aphostname='$aphostname'
19828 api_revision='$api_revision'
19829 api_subversion='$api_subversion'
19830 api_version='$api_version'
19831 api_versionstring='$api_versionstring'
19832 ar='$ar'
19833 archlib='$archlib'
19834 archlibexp='$archlibexp'
19835 archname64='$archname64'
19836 archname='$archname'
19837 archobjs='$archobjs'
19838 asctime_r_proto='$asctime_r_proto'
19839 awk='$awk'
19840 baserev='$baserev'
19841 bash='$bash'
19842 bin='$bin'
19843 bincompat5005='$bincompat5005'
19844 binexp='$binexp'
19845 bison='$bison'
19846 byacc='$byacc'
19847 byteorder='$byteorder'
19848 c='$c'
19849 castflags='$castflags'
19850 cat='$cat'
19851 cc='$cc'
19852 cccdlflags='$cccdlflags'
19853 ccdlflags='$ccdlflags'
19854 ccflags='$ccflags'
19855 ccflags_uselargefiles='$ccflags_uselargefiles'
19856 ccname='$ccname'
19857 ccsymbols='$ccsymbols'
19858 ccversion='$ccversion'
19859 cf_by='$cf_by'
19860 cf_email='$cf_email'
19861 cf_time='$cf_time'
19862 charsize='$charsize'
19863 chgrp='$chgrp'
19864 chmod='$chmod'
19865 chown='$chown'
19866 clocktype='$clocktype'
19867 comm='$comm'
19868 compress='$compress'
19869 contains='$contains'
19870 cp='$cp'
19871 cpio='$cpio'
19872 cpp='$cpp'
19873 cpp_stuff='$cpp_stuff'
19874 cppccsymbols='$cppccsymbols'
19875 cppflags='$cppflags'
19876 cpplast='$cpplast'
19877 cppminus='$cppminus'
19878 cpprun='$cpprun'
19879 cppstdin='$cppstdin'
19880 cppsymbols='$cppsymbols'
19881 crypt_r_proto='$crypt_r_proto'
19882 cryptlib='$cryptlib'
19883 csh='$csh'
19884 ctermid_r_proto='$ctermid_r_proto'
19885 ctime_r_proto='$ctime_r_proto'
19886 d_Gconvert='$d_Gconvert'
19887 d_PRIEUldbl='$d_PRIEUldbl'
19888 d_PRIFUldbl='$d_PRIFUldbl'
19889 d_PRIGUldbl='$d_PRIGUldbl'
19890 d_PRIXU64='$d_PRIXU64'
19891 d_PRId64='$d_PRId64'
19892 d_PRIeldbl='$d_PRIeldbl'
19893 d_PRIfldbl='$d_PRIfldbl'
19894 d_PRIgldbl='$d_PRIgldbl'
19895 d_PRIi64='$d_PRIi64'
19896 d_PRIo64='$d_PRIo64'
19897 d_PRIu64='$d_PRIu64'
19898 d_PRIx64='$d_PRIx64'
19899 d_SCNfldbl='$d_SCNfldbl'
19900 d__fwalk='$d__fwalk'
19901 d_access='$d_access'
19902 d_accessx='$d_accessx'
19903 d_alarm='$d_alarm'
19904 d_archlib='$d_archlib'
19905 d_asctime_r='$d_asctime_r'
19906 d_atolf='$d_atolf'
19907 d_atoll='$d_atoll'
19908 d_attribut='$d_attribut'
19909 d_bcmp='$d_bcmp'
19910 d_bcopy='$d_bcopy'
19911 d_bincompat5005='$d_bincompat5005'
19912 d_bsd='$d_bsd'
19913 d_bsdgetpgrp='$d_bsdgetpgrp'
19914 d_bsdsetpgrp='$d_bsdsetpgrp'
19915 d_bzero='$d_bzero'
19916 d_casti32='$d_casti32'
19917 d_castneg='$d_castneg'
19918 d_charvspr='$d_charvspr'
19919 d_chown='$d_chown'
19920 d_chroot='$d_chroot'
19921 d_chsize='$d_chsize'
19922 d_class='$d_class'
19923 d_closedir='$d_closedir'
19924 d_cmsghdr_s='$d_cmsghdr_s'
19925 d_const='$d_const'
19926 d_crypt='$d_crypt'
19927 d_crypt_r='$d_crypt_r'
19928 d_csh='$d_csh'
19929 d_ctermid_r='$d_ctermid_r'
19930 d_ctime_r='$d_ctime_r'
19931 d_cuserid='$d_cuserid'
19932 d_dbl_dig='$d_dbl_dig'
19933 d_dbminitproto='$d_dbminitproto'
19934 d_difftime='$d_difftime'
19935 d_dirfd='$d_dirfd'
19936 d_dirnamlen='$d_dirnamlen'
19937 d_dlerror='$d_dlerror'
19938 d_dlopen='$d_dlopen'
19939 d_dlsymun='$d_dlsymun'
19940 d_dosuid='$d_dosuid'
19941 d_drand48_r='$d_drand48_r'
19942 d_drand48proto='$d_drand48proto'
19943 d_dup2='$d_dup2'
19944 d_eaccess='$d_eaccess'
19945 d_endgrent='$d_endgrent'
19946 d_endgrent_r='$d_endgrent_r'
19947 d_endhent='$d_endhent'
19948 d_endhostent_r='$d_endhostent_r'
19949 d_endnent='$d_endnent'
19950 d_endnetent_r='$d_endnetent_r'
19951 d_endpent='$d_endpent'
19952 d_endprotoent_r='$d_endprotoent_r'
19953 d_endpwent='$d_endpwent'
19954 d_endpwent_r='$d_endpwent_r'
19955 d_endsent='$d_endsent'
19956 d_endservent_r='$d_endservent_r'
19957 d_eofnblk='$d_eofnblk'
19958 d_eunice='$d_eunice'
19959 d_fchdir='$d_fchdir'
19960 d_fchmod='$d_fchmod'
19961 d_fchown='$d_fchown'
19962 d_fcntl='$d_fcntl'
19963 d_fcntl_can_lock='$d_fcntl_can_lock'
19964 d_fd_macros='$d_fd_macros'
19965 d_fd_set='$d_fd_set'
19966 d_fds_bits='$d_fds_bits'
19967 d_fgetpos='$d_fgetpos'
19968 d_finite='$d_finite'
19969 d_finitel='$d_finitel'
19970 d_flexfnam='$d_flexfnam'
19971 d_flock='$d_flock'
19972 d_flockproto='$d_flockproto'
19973 d_fork='$d_fork'
19974 d_fp_class='$d_fp_class'
19975 d_fpathconf='$d_fpathconf'
19976 d_fpclass='$d_fpclass'
19977 d_fpclassify='$d_fpclassify'
19978 d_fpclassl='$d_fpclassl'
19979 d_fpos64_t='$d_fpos64_t'
19980 d_frexpl='$d_frexpl'
19981 d_fs_data_s='$d_fs_data_s'
19982 d_fseeko='$d_fseeko'
19983 d_fsetpos='$d_fsetpos'
19984 d_fstatfs='$d_fstatfs'
19985 d_fstatvfs='$d_fstatvfs'
19986 d_fsync='$d_fsync'
19987 d_ftello='$d_ftello'
19988 d_ftime='$d_ftime'
19989 d_getcwd='$d_getcwd'
19990 d_getespwnam='$d_getespwnam'
19991 d_getfsstat='$d_getfsstat'
19992 d_getgrent='$d_getgrent'
19993 d_getgrent_r='$d_getgrent_r'
19994 d_getgrgid_r='$d_getgrgid_r'
19995 d_getgrnam_r='$d_getgrnam_r'
19996 d_getgrps='$d_getgrps'
19997 d_gethbyaddr='$d_gethbyaddr'
19998 d_gethbyname='$d_gethbyname'
19999 d_gethent='$d_gethent'
20000 d_gethname='$d_gethname'
20001 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20002 d_gethostbyname_r='$d_gethostbyname_r'
20003 d_gethostent_r='$d_gethostent_r'
20004 d_gethostprotos='$d_gethostprotos'
20005 d_getitimer='$d_getitimer'
20006 d_getlogin='$d_getlogin'
20007 d_getlogin_r='$d_getlogin_r'
20008 d_getmnt='$d_getmnt'
20009 d_getmntent='$d_getmntent'
20010 d_getnbyaddr='$d_getnbyaddr'
20011 d_getnbyname='$d_getnbyname'
20012 d_getnent='$d_getnent'
20013 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20014 d_getnetbyname_r='$d_getnetbyname_r'
20015 d_getnetent_r='$d_getnetent_r'
20016 d_getnetprotos='$d_getnetprotos'
20017 d_getpagsz='$d_getpagsz'
20018 d_getpbyname='$d_getpbyname'
20019 d_getpbynumber='$d_getpbynumber'
20020 d_getpent='$d_getpent'
20021 d_getpgid='$d_getpgid'
20022 d_getpgrp2='$d_getpgrp2'
20023 d_getpgrp='$d_getpgrp'
20024 d_getppid='$d_getppid'
20025 d_getprior='$d_getprior'
20026 d_getprotobyname_r='$d_getprotobyname_r'
20027 d_getprotobynumber_r='$d_getprotobynumber_r'
20028 d_getprotoent_r='$d_getprotoent_r'
20029 d_getprotoprotos='$d_getprotoprotos'
20030 d_getprpwnam='$d_getprpwnam'
20031 d_getpwent='$d_getpwent'
20032 d_getpwent_r='$d_getpwent_r'
20033 d_getpwnam_r='$d_getpwnam_r'
20034 d_getpwuid_r='$d_getpwuid_r'
20035 d_getsbyname='$d_getsbyname'
20036 d_getsbyport='$d_getsbyport'
20037 d_getsent='$d_getsent'
20038 d_getservbyname_r='$d_getservbyname_r'
20039 d_getservbyport_r='$d_getservbyport_r'
20040 d_getservent_r='$d_getservent_r'
20041 d_getservprotos='$d_getservprotos'
20042 d_getspnam='$d_getspnam'
20043 d_getspnam_r='$d_getspnam_r'
20044 d_gettimeod='$d_gettimeod'
20045 d_gmtime_r='$d_gmtime_r'
20046 d_gnulibc='$d_gnulibc'
20047 d_grpasswd='$d_grpasswd'
20048 d_hasmntopt='$d_hasmntopt'
20049 d_htonl='$d_htonl'
20050 d_index='$d_index'
20051 d_inetaton='$d_inetaton'
20052 d_int64_t='$d_int64_t'
20053 d_isascii='$d_isascii'
20054 d_isfinite='$d_isfinite'
20055 d_isinf='$d_isinf'
20056 d_isnan='$d_isnan'
20057 d_isnanl='$d_isnanl'
20058 d_killpg='$d_killpg'
20059 d_lchown='$d_lchown'
20060 d_ldbl_dig='$d_ldbl_dig'
20061 d_link='$d_link'
20062 d_localtime_r='$d_localtime_r'
20063 d_locconv='$d_locconv'
20064 d_lockf='$d_lockf'
20065 d_longdbl='$d_longdbl'
20066 d_longlong='$d_longlong'
20067 d_lseekproto='$d_lseekproto'
20068 d_lstat='$d_lstat'
20069 d_madvise='$d_madvise'
20070 d_mblen='$d_mblen'
20071 d_mbstowcs='$d_mbstowcs'
20072 d_mbtowc='$d_mbtowc'
20073 d_memchr='$d_memchr'
20074 d_memcmp='$d_memcmp'
20075 d_memcpy='$d_memcpy'
20076 d_memmove='$d_memmove'
20077 d_memset='$d_memset'
20078 d_mkdir='$d_mkdir'
20079 d_mkdtemp='$d_mkdtemp'
20080 d_mkfifo='$d_mkfifo'
20081 d_mkstemp='$d_mkstemp'
20082 d_mkstemps='$d_mkstemps'
20083 d_mktime='$d_mktime'
20084 d_mmap='$d_mmap'
20085 d_modfl='$d_modfl'
20086 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20087 d_mprotect='$d_mprotect'
20088 d_msg='$d_msg'
20089 d_msg_ctrunc='$d_msg_ctrunc'
20090 d_msg_dontroute='$d_msg_dontroute'
20091 d_msg_oob='$d_msg_oob'
20092 d_msg_peek='$d_msg_peek'
20093 d_msg_proxy='$d_msg_proxy'
20094 d_msgctl='$d_msgctl'
20095 d_msgget='$d_msgget'
20096 d_msghdr_s='$d_msghdr_s'
20097 d_msgrcv='$d_msgrcv'
20098 d_msgsnd='$d_msgsnd'
20099 d_msync='$d_msync'
20100 d_munmap='$d_munmap'
20101 d_mymalloc='$d_mymalloc'
20102 d_nice='$d_nice'
20103 d_nl_langinfo='$d_nl_langinfo'
20104 d_nv_preserves_uv='$d_nv_preserves_uv'
20105 d_off64_t='$d_off64_t'
20106 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20107 d_oldpthreads='$d_oldpthreads'
20108 d_oldsock='$d_oldsock'
20109 d_open3='$d_open3'
20110 d_pathconf='$d_pathconf'
20111 d_pause='$d_pause'
20112 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20113 d_phostname='$d_phostname'
20114 d_pipe='$d_pipe'
20115 d_poll='$d_poll'
20116 d_portable='$d_portable'
20117 d_procselfexe='$d_procselfexe'
20118 d_pthread_atfork='$d_pthread_atfork'
20119 d_pthread_yield='$d_pthread_yield'
20120 d_pwage='$d_pwage'
20121 d_pwchange='$d_pwchange'
20122 d_pwclass='$d_pwclass'
20123 d_pwcomment='$d_pwcomment'
20124 d_pwexpire='$d_pwexpire'
20125 d_pwgecos='$d_pwgecos'
20126 d_pwpasswd='$d_pwpasswd'
20127 d_pwquota='$d_pwquota'
20128 d_qgcvt='$d_qgcvt'
20129 d_quad='$d_quad'
20130 d_random_r='$d_random_r'
20131 d_readdir64_r='$d_readdir64_r'
20132 d_readdir='$d_readdir'
20133 d_readdir_r='$d_readdir_r'
20134 d_readlink='$d_readlink'
20135 d_readv='$d_readv'
20136 d_recvmsg='$d_recvmsg'
20137 d_rename='$d_rename'
20138 d_rewinddir='$d_rewinddir'
20139 d_rmdir='$d_rmdir'
20140 d_safebcpy='$d_safebcpy'
20141 d_safemcpy='$d_safemcpy'
20142 d_sanemcmp='$d_sanemcmp'
20143 d_sbrkproto='$d_sbrkproto'
20144 d_sched_yield='$d_sched_yield'
20145 d_scm_rights='$d_scm_rights'
20146 d_seekdir='$d_seekdir'
20147 d_select='$d_select'
20148 d_sem='$d_sem'
20149 d_semctl='$d_semctl'
20150 d_semctl_semid_ds='$d_semctl_semid_ds'
20151 d_semctl_semun='$d_semctl_semun'
20152 d_semget='$d_semget'
20153 d_semop='$d_semop'
20154 d_sendmsg='$d_sendmsg'
20155 d_setegid='$d_setegid'
20156 d_seteuid='$d_seteuid'
20157 d_setgrent='$d_setgrent'
20158 d_setgrent_r='$d_setgrent_r'
20159 d_setgrps='$d_setgrps'
20160 d_sethent='$d_sethent'
20161 d_sethostent_r='$d_sethostent_r'
20162 d_setitimer='$d_setitimer'
20163 d_setlinebuf='$d_setlinebuf'
20164 d_setlocale='$d_setlocale'
20165 d_setlocale_r='$d_setlocale_r'
20166 d_setnent='$d_setnent'
20167 d_setnetent_r='$d_setnetent_r'
20168 d_setpent='$d_setpent'
20169 d_setpgid='$d_setpgid'
20170 d_setpgrp2='$d_setpgrp2'
20171 d_setpgrp='$d_setpgrp'
20172 d_setprior='$d_setprior'
20173 d_setproctitle='$d_setproctitle'
20174 d_setprotoent_r='$d_setprotoent_r'
20175 d_setpwent='$d_setpwent'
20176 d_setpwent_r='$d_setpwent_r'
20177 d_setregid='$d_setregid'
20178 d_setresgid='$d_setresgid'
20179 d_setresuid='$d_setresuid'
20180 d_setreuid='$d_setreuid'
20181 d_setrgid='$d_setrgid'
20182 d_setruid='$d_setruid'
20183 d_setsent='$d_setsent'
20184 d_setservent_r='$d_setservent_r'
20185 d_setsid='$d_setsid'
20186 d_setvbuf='$d_setvbuf'
20187 d_sfio='$d_sfio'
20188 d_shm='$d_shm'
20189 d_shmat='$d_shmat'
20190 d_shmatprototype='$d_shmatprototype'
20191 d_shmctl='$d_shmctl'
20192 d_shmdt='$d_shmdt'
20193 d_shmget='$d_shmget'
20194 d_sigaction='$d_sigaction'
20195 d_sigprocmask='$d_sigprocmask'
20196 d_sigsetjmp='$d_sigsetjmp'
20197 d_sockatmark='$d_sockatmark'
20198 d_sockatmarkproto='$d_sockatmarkproto'
20199 d_socket='$d_socket'
20200 d_socklen_t='$d_socklen_t'
20201 d_sockpair='$d_sockpair'
20202 d_socks5_init='$d_socks5_init'
20203 d_sqrtl='$d_sqrtl'
20204 d_srand48_r='$d_srand48_r'
20205 d_srandom_r='$d_srandom_r'
20206 d_sresgproto='$d_sresgproto'
20207 d_sresuproto='$d_sresuproto'
20208 d_statblks='$d_statblks'
20209 d_statfs_f_flags='$d_statfs_f_flags'
20210 d_statfs_s='$d_statfs_s'
20211 d_statvfs='$d_statvfs'
20212 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20213 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20214 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20215 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20216 d_stdio_stream_array='$d_stdio_stream_array'
20217 d_stdiobase='$d_stdiobase'
20218 d_stdstdio='$d_stdstdio'
20219 d_strchr='$d_strchr'
20220 d_strcoll='$d_strcoll'
20221 d_strctcpy='$d_strctcpy'
20222 d_strerrm='$d_strerrm'
20223 d_strerror='$d_strerror'
20224 d_strerror_r='$d_strerror_r'
20225 d_strftime='$d_strftime'
20226 d_strtod='$d_strtod'
20227 d_strtol='$d_strtol'
20228 d_strtold='$d_strtold'
20229 d_strtoll='$d_strtoll'
20230 d_strtoq='$d_strtoq'
20231 d_strtoul='$d_strtoul'
20232 d_strtoull='$d_strtoull'
20233 d_strtouq='$d_strtouq'
20234 d_strxfrm='$d_strxfrm'
20235 d_suidsafe='$d_suidsafe'
20236 d_symlink='$d_symlink'
20237 d_syscall='$d_syscall'
20238 d_syscallproto='$d_syscallproto'
20239 d_sysconf='$d_sysconf'
20240 d_sysernlst='$d_sysernlst'
20241 d_syserrlst='$d_syserrlst'
20242 d_system='$d_system'
20243 d_tcgetpgrp='$d_tcgetpgrp'
20244 d_tcsetpgrp='$d_tcsetpgrp'
20245 d_telldir='$d_telldir'
20246 d_telldirproto='$d_telldirproto'
20247 d_time='$d_time'
20248 d_times='$d_times'
20249 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20250 d_tm_tm_zone='$d_tm_tm_zone'
20251 d_tmpnam_r='$d_tmpnam_r'
20252 d_truncate='$d_truncate'
20253 d_ttyname_r='$d_ttyname_r'
20254 d_tzname='$d_tzname'
20255 d_u32align='$d_u32align'
20256 d_ualarm='$d_ualarm'
20257 d_umask='$d_umask'
20258 d_uname='$d_uname'
20259 d_union_semun='$d_union_semun'
20260 d_unordered='$d_unordered'
20261 d_usleep='$d_usleep'
20262 d_usleepproto='$d_usleepproto'
20263 d_ustat='$d_ustat'
20264 d_vendorarch='$d_vendorarch'
20265 d_vendorbin='$d_vendorbin'
20266 d_vendorlib='$d_vendorlib'
20267 d_vfork='$d_vfork'
20268 d_void_closedir='$d_void_closedir'
20269 d_voidsig='$d_voidsig'
20270 d_voidtty='$d_voidtty'
20271 d_volatile='$d_volatile'
20272 d_vprintf='$d_vprintf'
20273 d_wait4='$d_wait4'
20274 d_waitpid='$d_waitpid'
20275 d_wcstombs='$d_wcstombs'
20276 d_wctomb='$d_wctomb'
20277 d_writev='$d_writev'
20278 d_xenix='$d_xenix'
20279 date='$date'
20280 db_hashtype='$db_hashtype'
20281 db_prefixtype='$db_prefixtype'
20282 db_version_major='$db_version_major'
20283 db_version_minor='$db_version_minor'
20284 db_version_patch='$db_version_patch'
20285 defvoidused='$defvoidused'
20286 direntrytype='$direntrytype'
20287 dlext='$dlext'
20288 dlsrc='$dlsrc'
20289 doublesize='$doublesize'
20290 drand01='$drand01'
20291 drand48_r_proto='$drand48_r_proto'
20292 dynamic_ext='$dynamic_ext'
20293 eagain='$eagain'
20294 ebcdic='$ebcdic'
20295 echo='$echo'
20296 egrep='$egrep'
20297 emacs='$emacs'
20298 endgrent_r_proto='$endgrent_r_proto'
20299 endhostent_r_proto='$endhostent_r_proto'
20300 endnetent_r_proto='$endnetent_r_proto'
20301 endprotoent_r_proto='$endprotoent_r_proto'
20302 endpwent_r_proto='$endpwent_r_proto'
20303 endservent_r_proto='$endservent_r_proto'
20304 eunicefix='$eunicefix'
20305 exe_ext='$exe_ext'
20306 expr='$expr'
20307 extensions='$extensions'
20308 extras='$extras'
20309 fflushNULL='$fflushNULL'
20310 fflushall='$fflushall'
20311 find='$find'
20312 firstmakefile='$firstmakefile'
20313 flex='$flex'
20314 fpossize='$fpossize'
20315 fpostype='$fpostype'
20316 freetype='$freetype'
20317 from='$from'
20318 full_ar='$full_ar'
20319 full_csh='$full_csh'
20320 full_sed='$full_sed'
20321 gccosandvers='$gccosandvers'
20322 gccversion='$gccversion'
20323 getgrent_r_proto='$getgrent_r_proto'
20324 getgrgid_r_proto='$getgrgid_r_proto'
20325 getgrnam_r_proto='$getgrnam_r_proto'
20326 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20327 gethostbyname_r_proto='$gethostbyname_r_proto'
20328 gethostent_r_proto='$gethostent_r_proto'
20329 getlogin_r_proto='$getlogin_r_proto'
20330 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20331 getnetbyname_r_proto='$getnetbyname_r_proto'
20332 getnetent_r_proto='$getnetent_r_proto'
20333 getprotobyname_r_proto='$getprotobyname_r_proto'
20334 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20335 getprotoent_r_proto='$getprotoent_r_proto'
20336 getpwent_r_proto='$getpwent_r_proto'
20337 getpwnam_r_proto='$getpwnam_r_proto'
20338 getpwuid_r_proto='$getpwuid_r_proto'
20339 getservbyname_r_proto='$getservbyname_r_proto'
20340 getservbyport_r_proto='$getservbyport_r_proto'
20341 getservent_r_proto='$getservent_r_proto'
20342 getspnam_r_proto='$getspnam_r_proto'
20343 gidformat='$gidformat'
20344 gidsign='$gidsign'
20345 gidsize='$gidsize'
20346 gidtype='$gidtype'
20347 glibpth='$glibpth'
20348 gmake='$gmake'
20349 gmtime_r_proto='$gmtime_r_proto'
20350 grep='$grep'
20351 groupcat='$groupcat'
20352 groupstype='$groupstype'
20353 gzip='$gzip'
20354 h_fcntl='$h_fcntl'
20355 h_sysfile='$h_sysfile'
20356 hint='$hint'
20357 hostcat='$hostcat'
20358 i16size='$i16size'
20359 i16type='$i16type'
20360 i32size='$i32size'
20361 i32type='$i32type'
20362 i64size='$i64size'
20363 i64type='$i64type'
20364 i8size='$i8size'
20365 i8type='$i8type'
20366 i_arpainet='$i_arpainet'
20367 i_bsdioctl='$i_bsdioctl'
20368 i_crypt='$i_crypt'
20369 i_db='$i_db'
20370 i_dbm='$i_dbm'
20371 i_dirent='$i_dirent'
20372 i_dld='$i_dld'
20373 i_dlfcn='$i_dlfcn'
20374 i_fcntl='$i_fcntl'
20375 i_float='$i_float'
20376 i_fp='$i_fp'
20377 i_fp_class='$i_fp_class'
20378 i_gdbm='$i_gdbm'
20379 i_grp='$i_grp'
20380 i_ieeefp='$i_ieeefp'
20381 i_inttypes='$i_inttypes'
20382 i_langinfo='$i_langinfo'
20383 i_libutil='$i_libutil'
20384 i_limits='$i_limits'
20385 i_locale='$i_locale'
20386 i_machcthr='$i_machcthr'
20387 i_malloc='$i_malloc'
20388 i_math='$i_math'
20389 i_memory='$i_memory'
20390 i_mntent='$i_mntent'
20391 i_ndbm='$i_ndbm'
20392 i_netdb='$i_netdb'
20393 i_neterrno='$i_neterrno'
20394 i_netinettcp='$i_netinettcp'
20395 i_niin='$i_niin'
20396 i_poll='$i_poll'
20397 i_prot='$i_prot'
20398 i_pthread='$i_pthread'
20399 i_pwd='$i_pwd'
20400 i_rpcsvcdbm='$i_rpcsvcdbm'
20401 i_sfio='$i_sfio'
20402 i_sgtty='$i_sgtty'
20403 i_shadow='$i_shadow'
20404 i_socks='$i_socks'
20405 i_stdarg='$i_stdarg'
20406 i_stddef='$i_stddef'
20407 i_stdlib='$i_stdlib'
20408 i_string='$i_string'
20409 i_sunmath='$i_sunmath'
20410 i_sysaccess='$i_sysaccess'
20411 i_sysdir='$i_sysdir'
20412 i_sysfile='$i_sysfile'
20413 i_sysfilio='$i_sysfilio'
20414 i_sysin='$i_sysin'
20415 i_sysioctl='$i_sysioctl'
20416 i_syslog='$i_syslog'
20417 i_sysmman='$i_sysmman'
20418 i_sysmode='$i_sysmode'
20419 i_sysmount='$i_sysmount'
20420 i_sysndir='$i_sysndir'
20421 i_sysparam='$i_sysparam'
20422 i_sysresrc='$i_sysresrc'
20423 i_syssecrt='$i_syssecrt'
20424 i_sysselct='$i_sysselct'
20425 i_syssockio='$i_syssockio'
20426 i_sysstat='$i_sysstat'
20427 i_sysstatfs='$i_sysstatfs'
20428 i_sysstatvfs='$i_sysstatvfs'
20429 i_systime='$i_systime'
20430 i_systimek='$i_systimek'
20431 i_systimes='$i_systimes'
20432 i_systypes='$i_systypes'
20433 i_sysuio='$i_sysuio'
20434 i_sysun='$i_sysun'
20435 i_sysutsname='$i_sysutsname'
20436 i_sysvfs='$i_sysvfs'
20437 i_syswait='$i_syswait'
20438 i_termio='$i_termio'
20439 i_termios='$i_termios'
20440 i_time='$i_time'
20441 i_unistd='$i_unistd'
20442 i_ustat='$i_ustat'
20443 i_utime='$i_utime'
20444 i_values='$i_values'
20445 i_varargs='$i_varargs'
20446 i_varhdr='$i_varhdr'
20447 i_vfork='$i_vfork'
20448 ignore_versioned_solibs='$ignore_versioned_solibs'
20449 inc_version_list='$inc_version_list'
20450 inc_version_list_init='$inc_version_list_init'
20451 incpath='$incpath'
20452 inews='$inews'
20453 installarchlib='$installarchlib'
20454 installbin='$installbin'
20455 installman1dir='$installman1dir'
20456 installman3dir='$installman3dir'
20457 installprefix='$installprefix'
20458 installprefixexp='$installprefixexp'
20459 installprivlib='$installprivlib'
20460 installscript='$installscript'
20461 installsitearch='$installsitearch'
20462 installsitebin='$installsitebin'
20463 installsitelib='$installsitelib'
20464 installstyle='$installstyle'
20465 installusrbinperl='$installusrbinperl'
20466 installvendorarch='$installvendorarch'
20467 installvendorbin='$installvendorbin'
20468 installvendorlib='$installvendorlib'
20469 intsize='$intsize'
20470 issymlink='$issymlink'
20471 ivdformat='$ivdformat'
20472 ivsize='$ivsize'
20473 ivtype='$ivtype'
20474 known_extensions='$known_extensions'
20475 ksh='$ksh'
20476 ld='$ld'
20477 lddlflags='$lddlflags'
20478 ldflags='$ldflags'
20479 ldflags_uselargefiles='$ldflags_uselargefiles'
20480 ldlibpthname='$ldlibpthname'
20481 less='$less'
20482 lib_ext='$lib_ext'
20483 libc='$libc'
20484 libperl='$libperl'
20485 libpth='$libpth'
20486 libs='$libs'
20487 libsdirs='$libsdirs'
20488 libsfiles='$libsfiles'
20489 libsfound='$libsfound'
20490 libspath='$libspath'
20491 libswanted='$libswanted'
20492 libswanted_uselargefiles='$libswanted_uselargefiles'
20493 line='$line'
20494 lint='$lint'
20495 lkflags='$lkflags'
20496 ln='$ln'
20497 lns='$lns'
20498 localtime_r_proto='$localtime_r_proto'
20499 locincpth='$locincpth'
20500 loclibpth='$loclibpth'
20501 longdblsize='$longdblsize'
20502 longlongsize='$longlongsize'
20503 longsize='$longsize'
20504 lp='$lp'
20505 lpr='$lpr'
20506 ls='$ls'
20507 lseeksize='$lseeksize'
20508 lseektype='$lseektype'
20509 mail='$mail'
20510 mailx='$mailx'
20511 make='$make'
20512 make_set_make='$make_set_make'
20513 mallocobj='$mallocobj'
20514 mallocsrc='$mallocsrc'
20515 malloctype='$malloctype'
20516 man1dir='$man1dir'
20517 man1direxp='$man1direxp'
20518 man1ext='$man1ext'
20519 man3dir='$man3dir'
20520 man3direxp='$man3direxp'
20521 man3ext='$man3ext'
20522 mips_type='$mips_type'
20523 mkdir='$mkdir'
20524 mmaptype='$mmaptype'
20525 modetype='$modetype'
20526 more='$more'
20527 multiarch='$multiarch'
20528 mv='$mv'
20529 myarchname='$myarchname'
20530 mydomain='$mydomain'
20531 myhostname='$myhostname'
20532 myuname='$myuname'
20533 n='$n'
20534 need_va_copy='$need_va_copy'
20535 netdb_hlen_type='$netdb_hlen_type'
20536 netdb_host_type='$netdb_host_type'
20537 netdb_name_type='$netdb_name_type'
20538 netdb_net_type='$netdb_net_type'
20539 nm='$nm'
20540 nm_opt='$nm_opt'
20541 nm_so_opt='$nm_so_opt'
20542 nonxs_ext='$nonxs_ext'
20543 nroff='$nroff'
20544 nvEUformat='$nvEUformat'
20545 nvFUformat='$nvFUformat'
20546 nvGUformat='$nvGUformat'
20547 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20548 nveformat='$nveformat'
20549 nvfformat='$nvfformat'
20550 nvgformat='$nvgformat'
20551 nvsize='$nvsize'
20552 nvtype='$nvtype'
20553 o_nonblock='$o_nonblock'
20554 obj_ext='$obj_ext'
20555 old_pthread_create_joinable='$old_pthread_create_joinable'
20556 optimize='$optimize'
20557 orderlib='$orderlib'
20558 osname='$osname'
20559 osvers='$osvers'
20560 otherlibdirs='$otherlibdirs'
20561 package='$package'
20562 pager='$pager'
20563 passcat='$passcat'
20564 patchlevel='$patchlevel'
20565 path_sep='$path_sep'
20566 perl5='$perl5'
20567 perl='$perl'
20568 perl_patchlevel='$perl_patchlevel'
20569 perladmin='$perladmin'
20570 perllibs='$perllibs'
20571 perlpath='$perlpath'
20572 pg='$pg'
20573 phostname='$phostname'
20574 pidtype='$pidtype'
20575 plibpth='$plibpth'
20576 pm_apiversion='$pm_apiversion'
20577 pmake='$pmake'
20578 pr='$pr'
20579 prefix='$prefix'
20580 prefixexp='$prefixexp'
20581 privlib='$privlib'
20582 privlibexp='$privlibexp'
20583 procselfexe='$procselfexe'
20584 prototype='$prototype'
20585 ptrsize='$ptrsize'
20586 quadkind='$quadkind'
20587 quadtype='$quadtype'
20588 randbits='$randbits'
20589 randfunc='$randfunc'
20590 random_r_proto='$random_r_proto'
20591 randseedtype='$randseedtype'
20592 ranlib='$ranlib'
20593 rd_nodata='$rd_nodata'
20594 readdir64_r_proto='$readdir64_r_proto'
20595 readdir_r_proto='$readdir_r_proto'
20596 revision='$revision'
20597 rm='$rm'
20598 rmail='$rmail'
20599 run='$run'
20600 runnm='$runnm'
20601 sPRIEUldbl='$sPRIEUldbl'
20602 sPRIFUldbl='$sPRIFUldbl'
20603 sPRIGUldbl='$sPRIGUldbl'
20604 sPRIXU64='$sPRIXU64'
20605 sPRId64='$sPRId64'
20606 sPRIeldbl='$sPRIeldbl'
20607 sPRIfldbl='$sPRIfldbl'
20608 sPRIgldbl='$sPRIgldbl'
20609 sPRIi64='$sPRIi64'
20610 sPRIo64='$sPRIo64'
20611 sPRIu64='$sPRIu64'
20612 sPRIx64='$sPRIx64'
20613 sSCNfldbl='$sSCNfldbl'
20614 sched_yield='$sched_yield'
20615 scriptdir='$scriptdir'
20616 scriptdirexp='$scriptdirexp'
20617 sed='$sed'
20618 seedfunc='$seedfunc'
20619 selectminbits='$selectminbits'
20620 selecttype='$selecttype'
20621 sendmail='$sendmail'
20622 setgrent_r_proto='$setgrent_r_proto'
20623 sethostent_r_proto='$sethostent_r_proto'
20624 setlocale_r_proto='$setlocale_r_proto'
20625 setnetent_r_proto='$setnetent_r_proto'
20626 setprotoent_r_proto='$setprotoent_r_proto'
20627 setpwent_r_proto='$setpwent_r_proto'
20628 setservent_r_proto='$setservent_r_proto'
20629 sh='$sh'
20630 shar='$shar'
20631 sharpbang='$sharpbang'
20632 shmattype='$shmattype'
20633 shortsize='$shortsize'
20634 shrpenv='$shrpenv'
20635 shsharp='$shsharp'
20636 sig_count='$sig_count'
20637 sig_name='$sig_name'
20638 sig_name_init='$sig_name_init'
20639 sig_num='$sig_num'
20640 sig_num_init='$sig_num_init'
20641 sig_size='$sig_size'
20642 signal_t='$signal_t'
20643 sitearch='$sitearch'
20644 sitearchexp='$sitearchexp'
20645 sitebin='$sitebin'
20646 sitebinexp='$sitebinexp'
20647 sitelib='$sitelib'
20648 sitelib_stem='$sitelib_stem'
20649 sitelibexp='$sitelibexp'
20650 siteprefix='$siteprefix'
20651 siteprefixexp='$siteprefixexp'
20652 sizesize='$sizesize'
20653 sizetype='$sizetype'
20654 sleep='$sleep'
20655 smail='$smail'
20656 so='$so'
20657 sockethdr='$sockethdr'
20658 socketlib='$socketlib'
20659 socksizetype='$socksizetype'
20660 sort='$sort'
20661 spackage='$spackage'
20662 spitshell='$spitshell'
20663 srand48_r_proto='$srand48_r_proto'
20664 srandom_r_proto='$srandom_r_proto'
20665 src='$src'
20666 ssizetype='$ssizetype'
20667 startperl='$startperl'
20668 startsh='$startsh'
20669 static_ext='$static_ext'
20670 stdchar='$stdchar'
20671 stdio_base='$stdio_base'
20672 stdio_bufsiz='$stdio_bufsiz'
20673 stdio_cnt='$stdio_cnt'
20674 stdio_filbuf='$stdio_filbuf'
20675 stdio_ptr='$stdio_ptr'
20676 stdio_stream_array='$stdio_stream_array'
20677 strerror_r_proto='$strerror_r_proto'
20678 strings='$strings'
20679 submit='$submit'
20680 subversion='$subversion'
20681 sysman='$sysman'
20682 tail='$tail'
20683 tar='$tar'
20684 targetarch='$targetarch'
20685 tbl='$tbl'
20686 tee='$tee'
20687 test='$test'
20688 timeincl='$timeincl'
20689 timetype='$timetype'
20690 tmpnam_r_proto='$tmpnam_r_proto'
20691 to='$to'
20692 touch='$touch'
20693 tr='$tr'
20694 trnl='$trnl'
20695 troff='$troff'
20696 ttyname_r_proto='$ttyname_r_proto'
20697 u16size='$u16size'
20698 u16type='$u16type'
20699 u32size='$u32size'
20700 u32type='$u32type'
20701 u64size='$u64size'
20702 u64type='$u64type'
20703 u8size='$u8size'
20704 u8type='$u8type'
20705 uidformat='$uidformat'
20706 uidsign='$uidsign'
20707 uidsize='$uidsize'
20708 uidtype='$uidtype'
20709 uname='$uname'
20710 uniq='$uniq'
20711 uquadtype='$uquadtype'
20712 use5005threads='$use5005threads'
20713 use64bitall='$use64bitall'
20714 use64bitint='$use64bitint'
20715 usecrosscompile='$usecrosscompile'
20716 usedl='$usedl'
20717 useithreads='$useithreads'
20718 uselargefiles='$uselargefiles'
20719 uselongdouble='$uselongdouble'
20720 usemorebits='$usemorebits'
20721 usemultiplicity='$usemultiplicity'
20722 usemymalloc='$usemymalloc'
20723 usenm='$usenm'
20724 useopcode='$useopcode'
20725 useperlio='$useperlio'
20726 useposix='$useposix'
20727 usereentrant='$usereentrant'
20728 usesfio='$usesfio'
20729 useshrplib='$useshrplib'
20730 usesocks='$usesocks'
20731 usethreads='$usethreads'
20732 usevendorprefix='$usevendorprefix'
20733 usevfork='$usevfork'
20734 usrinc='$usrinc'
20735 uuname='$uuname'
20736 uvXUformat='$uvXUformat'
20737 uvoformat='$uvoformat'
20738 uvsize='$uvsize'
20739 uvtype='$uvtype'
20740 uvuformat='$uvuformat'
20741 uvxformat='$uvxformat'
20742 vendorarch='$vendorarch'
20743 vendorarchexp='$vendorarchexp'
20744 vendorbin='$vendorbin'
20745 vendorbinexp='$vendorbinexp'
20746 vendorlib='$vendorlib'
20747 vendorlib_stem='$vendorlib_stem'
20748 vendorlibexp='$vendorlibexp'
20749 vendorprefix='$vendorprefix'
20750 vendorprefixexp='$vendorprefixexp'
20751 version='$version'
20752 version_patchlevel_string='$version_patchlevel_string'
20753 versiononly='$versiononly'
20754 vi='$vi'
20755 voidflags='$voidflags'
20756 xlibpth='$xlibpth'
20757 xs_apiversion='$xs_apiversion'
20758 yacc='$yacc'
20759 yaccflags='$yaccflags'
20760 zcat='$zcat'
20761 zip='$zip'
20762 EOT
20763
20764 : Add in command line options if available
20765 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20766
20767 : add special variables
20768 $test -f $src/patchlevel.h && \
20769 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20770 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20771 echo "PERL_CONFIG_SH=true" >>config.sh
20772
20773 : propagate old symbols
20774 if $test -f UU/config.sh; then
20775         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20776         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20777         $sort | $uniq -u >UU/oldsyms
20778         set X `cat UU/oldsyms`
20779         shift
20780         case $# in
20781         0) ;;
20782         *)
20783                 cat <<EOM
20784 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20785 EOM
20786                 echo "# Variables propagated from previous config.sh file." >>config.sh
20787                 for sym in `cat UU/oldsyms`; do
20788                         echo "    Propagating $hint variable "'$'"$sym..."
20789                         eval 'tmp="$'"${sym}"'"'
20790                         echo "$tmp" | \
20791                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20792                 done
20793                 ;;
20794         esac
20795 fi
20796
20797 : Finish up by extracting the .SH files
20798 case "$alldone" in
20799 exit)
20800         $rm -rf UU
20801         echo "Extraction done."
20802         exit 0
20803         ;;
20804 cont)
20805         ;;
20806 '')
20807         dflt=''
20808         nostick=true
20809         $cat <<EOM
20810
20811 If you'd like to make any changes to the config.sh file before I begin
20812 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20813
20814 EOM
20815         rp="Press return or use a shell escape to edit config.sh:"
20816         . UU/myread
20817         nostick=''
20818         case "$ans" in
20819         '') ;;
20820         *) : in case they cannot read
20821                 sh 1>&4 -c "$ans";;
20822         esac
20823         ;;
20824 esac
20825
20826 : if this fails, just run all the .SH files by hand
20827 . ./config.sh
20828
20829 echo " "
20830 exec 1>&4
20831 pwd=`pwd`
20832 . ./UU/extract
20833 cd "$pwd"
20834
20835 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20836         dflt=y
20837         case "$silent" in
20838         true) ;;
20839         *)
20840                 $cat <<EOM
20841
20842 Now you need to generate make dependencies by running "$make depend".
20843 You might prefer to run it in background: "$make depend > makedepend.out &"
20844 It can take a while, so you might not want to run it right now.
20845
20846 EOM
20847                 ;;
20848         esac
20849         rp="Run $make depend now?"
20850         . UU/myread
20851         case "$ans" in
20852         y*)
20853                 $make depend && echo "Now you must run '$make'."
20854                 ;;
20855         *)
20856                 echo "You must run '$make depend' then '$make'."
20857                 ;;
20858         esac
20859 elif test -f [Mm]akefile; then
20860         echo " "
20861         echo "Now you must run a $make."
20862 else
20863         echo "Configure done."
20864 fi
20865
20866 if $test -f Policy.sh; then
20867     $cat <<EOM
20868
20869 If you compile $package on a different machine or from a different object
20870 directory, copy the Policy.sh file from this object directory to the
20871 new one before you run Configure -- this will help you with most of
20872 the policy defaults.
20873
20874 EOM
20875 fi
20876 if $test -f config.msg; then
20877     echo "Hmm.  I also noted the following information while running:"
20878     echo " "
20879     $cat config.msg >&4
20880     $rm -f config.msg
20881 fi
20882 $rm -f kit*isdone ark*isdone
20883 $rm -rf UU
20884
20885 : End of Configure
20886