[perl #16796] Configure script buglet
[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 Fri Sep 13 16:29:01 METDST 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 byteorder=''
305 cc=''
306 ccflags=''
307 cppflags=''
308 ldflags=''
309 lkflags=''
310 locincpth=''
311 optimize=''
312 cf_email=''
313 cf_by=''
314 cf_time=''
315 charsize=''
316 contains=''
317 cpp_stuff=''
318 cpplast=''
319 cppminus=''
320 cpprun=''
321 cppstdin=''
322 d__fwalk=''
323 d_access=''
324 d_accessx=''
325 d_alarm=''
326 asctime_r_proto=''
327 d_asctime_r=''
328 d_attribut=''
329 d_bcmp=''
330 d_bcopy=''
331 d_bzero=''
332 d_casti32=''
333 castflags=''
334 d_castneg=''
335 d_chown=''
336 d_chroot=''
337 d_chsize=''
338 d_class=''
339 d_closedir=''
340 d_void_closedir=''
341 d_cmsghdr_s=''
342 d_const=''
343 cryptlib=''
344 d_crypt=''
345 crypt_r_proto=''
346 d_crypt_r=''
347 d_csh=''
348 full_csh=''
349 ctermid_r_proto=''
350 d_ctermid_r=''
351 ctime_r_proto=''
352 d_ctime_r=''
353 d_cuserid=''
354 d_dbl_dig=''
355 d_dbminitproto=''
356 d_difftime=''
357 d_dirfd=''
358 d_dlerror=''
359 d_dlopen=''
360 d_dlsymun=''
361 d_dosuid=''
362 d_suidsafe=''
363 d_drand48_r=''
364 drand48_r_proto=''
365 d_drand48proto=''
366 d_dup2=''
367 d_eaccess=''
368 d_endgrent=''
369 d_endgrent_r=''
370 endgrent_r_proto=''
371 d_endhent=''
372 d_endhostent_r=''
373 endhostent_r_proto=''
374 d_endnent=''
375 d_endnetent_r=''
376 endnetent_r_proto=''
377 d_endpent=''
378 d_endprotoent_r=''
379 endprotoent_r_proto=''
380 d_endpwent=''
381 d_endpwent_r=''
382 endpwent_r_proto=''
383 d_endsent=''
384 d_endservent_r=''
385 endservent_r_proto=''
386 d_fchdir=''
387 d_fchmod=''
388 d_fchown=''
389 d_fcntl=''
390 d_fcntl_can_lock=''
391 d_fd_macros=''
392 d_fd_set=''
393 d_fds_bits=''
394 d_fgetpos=''
395 d_finite=''
396 d_finitel=''
397 d_flexfnam=''
398 d_flock=''
399 d_flockproto=''
400 d_fork=''
401 d_fp_class=''
402 d_fpclass=''
403 d_fpclassify=''
404 d_fpclassl=''
405 d_fpos64_t=''
406 d_frexpl=''
407 d_fs_data_s=''
408 d_fseeko=''
409 d_fsetpos=''
410 d_fstatfs=''
411 d_fsync=''
412 d_ftello=''
413 d_ftime=''
414 d_gettimeod=''
415 d_Gconvert=''
416 d_getcwd=''
417 d_getespwnam=''
418 d_getfsstat=''
419 d_getgrent=''
420 d_getgrent_r=''
421 getgrent_r_proto=''
422 d_getgrgid_r=''
423 getgrgid_r_proto=''
424 d_getgrnam_r=''
425 getgrnam_r_proto=''
426 d_getgrps=''
427 d_gethbyaddr=''
428 d_gethbyname=''
429 d_gethent=''
430 aphostname=''
431 d_gethname=''
432 d_phostname=''
433 d_uname=''
434 d_gethostbyaddr_r=''
435 gethostbyaddr_r_proto=''
436 d_gethostbyname_r=''
437 gethostbyname_r_proto=''
438 d_gethostent_r=''
439 gethostent_r_proto=''
440 d_gethostprotos=''
441 d_getitimer=''
442 d_getlogin=''
443 d_getlogin_r=''
444 getlogin_r_proto=''
445 d_getmnt=''
446 d_getmntent=''
447 d_getnbyaddr=''
448 d_getnbyname=''
449 d_getnent=''
450 d_getnetbyaddr_r=''
451 getnetbyaddr_r_proto=''
452 d_getnetbyname_r=''
453 getnetbyname_r_proto=''
454 d_getnetent_r=''
455 getnetent_r_proto=''
456 d_getnetprotos=''
457 d_getpagsz=''
458 d_getpent=''
459 d_getpgid=''
460 d_getpgrp2=''
461 d_bsdgetpgrp=''
462 d_getpgrp=''
463 d_getppid=''
464 d_getprior=''
465 d_getpbyname=''
466 d_getpbynumber=''
467 d_getprotobyname_r=''
468 getprotobyname_r_proto=''
469 d_getprotobynumber_r=''
470 getprotobynumber_r_proto=''
471 d_getprotoent_r=''
472 getprotoent_r_proto=''
473 d_getprotoprotos=''
474 d_getprpwnam=''
475 d_getpwent=''
476 d_getpwent_r=''
477 getpwent_r_proto=''
478 d_getpwnam_r=''
479 getpwnam_r_proto=''
480 d_getpwuid_r=''
481 getpwuid_r_proto=''
482 d_getsent=''
483 d_getservbyname_r=''
484 getservbyname_r_proto=''
485 d_getservbyport_r=''
486 getservbyport_r_proto=''
487 d_getservent_r=''
488 getservent_r_proto=''
489 d_getservprotos=''
490 d_getspnam=''
491 d_getspnam_r=''
492 getspnam_r_proto=''
493 d_getsbyname=''
494 d_getsbyport=''
495 d_gmtime_r=''
496 gmtime_r_proto=''
497 d_gnulibc=''
498 gnulibc_version=''
499 d_hasmntopt=''
500 d_htonl=''
501 d_inetaton=''
502 d_int64_t=''
503 d_isascii=''
504 d_isfinite=''
505 d_isinf=''
506 d_isnan=''
507 d_isnanl=''
508 d_killpg=''
509 d_lchown=''
510 d_ldbl_dig=''
511 d_link=''
512 d_localtime_r=''
513 localtime_r_proto=''
514 d_locconv=''
515 d_lockf=''
516 d_longdbl=''
517 longdblsize=''
518 d_longlong=''
519 longlongsize=''
520 d_lseekproto=''
521 d_lstat=''
522 d_madvise=''
523 d_mblen=''
524 d_mbstowcs=''
525 d_mbtowc=''
526 d_memchr=''
527 d_memcmp=''
528 d_memcpy=''
529 d_memmove=''
530 d_memset=''
531 d_mkdir=''
532 d_mkdtemp=''
533 d_mkfifo=''
534 d_mkstemp=''
535 d_mkstemps=''
536 d_mktime=''
537 d_mmap=''
538 mmaptype=''
539 d_modfl=''
540 d_modfl_pow32_bug=''
541 d_modflproto=''
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 gccansipedantic=''
1121 yacc=''
1122 yaccflags=''
1123 CONFIG=''
1124
1125 define='define'
1126 undef='undef'
1127 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1128 rmlist=''
1129
1130 : We must find out about Eunice early
1131 eunicefix=':'
1132 if test -f /etc/unixtovms; then
1133         eunicefix=/etc/unixtovms
1134 fi
1135 if test -f /etc/unixtovms.exe; then
1136         eunicefix=/etc/unixtovms.exe
1137 fi
1138
1139 : Set executable suffix now -- needed before hints available
1140 if test -f "/libs/version.library"; then
1141 : Amiga OS
1142     _exe=""
1143 elif test -f "/system/gnu_library/bin/ar.pm"; then
1144 : Stratus VOS
1145     _exe=".pm"
1146 elif test -n "$DJGPP"; then
1147 : DOS DJGPP
1148     _exe=".exe"
1149 elif test -d c:/. ; then
1150 : OS/2 or cygwin
1151     _exe=".exe"
1152 fi
1153
1154 i_whoami=''
1155 ccname=''
1156 ccversion=''
1157 perllibs=''
1158 : set useposix=false in your hint file to disable the POSIX extension.
1159 useposix=true
1160 : set useopcode=false in your hint file to disable the Opcode extension.
1161 useopcode=true
1162 : Trailing extension.  Override this in a hint file, if needed.
1163 : Extra object files, if any, needed on this platform.
1164 archobjs=''
1165 archname=''
1166 : Possible local include directories to search.
1167 : Set locincpth to "" in a hint file to defeat local include searches.
1168 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1169 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1170 :
1171 : no include file wanted by default
1172 inclwanted=''
1173
1174 groupstype=''
1175 libnames=''
1176 : change the next line if compiling for Xenix/286 on Xenix/386
1177 xlibpth='/usr/lib/386 /lib/386'
1178 : Possible local library directories to search.
1179 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1180 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1181
1182 : general looking path for locating libraries
1183 glibpth="/lib /usr/lib $xlibpth"
1184 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1185 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1186 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1187
1188 : Private path used by Configure to find libraries.  Its value
1189 : is prepended to libpth. This variable takes care of special
1190 : machines, like the mips.  Usually, it should be empty.
1191 plibpth=''
1192
1193 : default library list
1194 libswanted=''
1195 : some systems want to use only the non-versioned libso:s
1196 ignore_versioned_solibs=''
1197 archname64=''
1198 ccflags_uselargefiles=''
1199 ldflags_uselargefiles=''
1200 libswanted_uselargefiles=''
1201 : set usemultiplicity on the Configure command line to enable multiplicity.
1202 : set usesocks on the Configure command line to enable socks.
1203 : set usethreads on the Configure command line to enable threads.
1204 usereentrant='undef'
1205 : full support for void wanted by default
1206 defvoidused=15
1207
1208 : List of libraries we want.
1209 : If anyone needs -lnet, put it in a hint file.
1210 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1211 libswanted="$libswanted dld ld sun m c cposix posix"
1212 libswanted="$libswanted ndir dir crypt sec"
1213 libswanted="$libswanted ucb bsd BSD PW x util"
1214 : We probably want to search /usr/shlib before most other libraries.
1215 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1216 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1217 glibpth="/usr/shlib $glibpth"
1218 : Do not use vfork unless overridden by a hint file.
1219 usevfork=false
1220
1221 : Find the basic shell for Bourne shell scripts
1222 case "$sh" in
1223 '')
1224         case "$SYSTYPE" in
1225         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1226         *) xxx='/bin/sh';;
1227         esac
1228         if test -f "$xxx"; then
1229                 sh="$xxx"
1230         else
1231                 : Build up a list and do a single loop so we can 'break' out.
1232                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1233                 for xxx in sh bash ksh pdksh ash; do
1234                         for p in $pth; do
1235                                 try="$try ${p}/${xxx}"
1236                         done
1237                 done
1238                 for xxx in $try; do
1239                         if test -f "$xxx"; then
1240                                 sh="$xxx";
1241                                 break
1242                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1243                                 sh="$xxx";
1244                                 break
1245                         elif test -f "$xxx.exe"; then
1246                                 sh="$xxx";
1247                                 break
1248                         fi
1249                 done
1250         fi
1251         ;;
1252 esac
1253
1254 case "$sh" in
1255 '')     cat >&2 <<EOM
1256 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1257
1258 Usually it's in /bin/sh.  How did you even get this far?
1259 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1260 we'll try to straighten this all out.
1261 EOM
1262         exit 1
1263         ;;
1264 esac
1265
1266 : see if sh knows # comments
1267 if `$sh -c '#' >/dev/null 2>&1`; then
1268         shsharp=true
1269         spitshell=cat
1270         xcat=/bin/cat
1271         test -f $xcat$_exe || xcat=/usr/bin/cat
1272         if test ! -f $xcat$_exe; then
1273                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1274                         if test -f $p/cat$_exe; then
1275                                 xcat=$p/cat
1276                                 break
1277                         fi
1278                 done
1279                 if test ! -f $xcat$_exe; then
1280                         echo "Can't find cat anywhere!"
1281                         exit 1
1282                 fi
1283         fi
1284         echo "#!$xcat" >sharp
1285         $eunicefix sharp
1286         chmod +x sharp
1287         ./sharp > today
1288         if test -s today; then
1289                 sharpbang='#!'
1290         else
1291                 echo "#! $xcat" > sharp
1292                 $eunicefix sharp
1293                 chmod +x sharp
1294                 ./sharp > today
1295                 if test -s today; then
1296                         sharpbang='#! '
1297                 else
1298                         sharpbang=': use '
1299                 fi
1300         fi
1301 else
1302         echo " "
1303         echo "Your $sh doesn't grok # comments--I will strip them later on."
1304         shsharp=false
1305         cd ..
1306         echo "exec grep -v '^[  ]*#'" >spitshell
1307         chmod +x spitshell
1308         $eunicefix spitshell
1309         spitshell=`pwd`/spitshell
1310         cd UU
1311         echo "I presume that if # doesn't work, #! won't work either!"
1312         sharpbang=': use '
1313 fi
1314 rm -f sharp today
1315
1316 : figure out how to guarantee sh startup
1317 case "$startsh" in
1318 '') startsh=${sharpbang}${sh} ;;
1319 *)
1320 esac
1321 cat >sharp <<EOSS
1322 $startsh
1323 set abc
1324 test "$?abc" != 1
1325 EOSS
1326
1327 chmod +x sharp
1328 $eunicefix sharp
1329 if ./sharp; then
1330         : echo "Yup, it does."
1331 else
1332         echo "Hmm... '$startsh' does not guarantee sh startup..."
1333         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1334 fi
1335 rm -f sharp
1336
1337
1338 : Save command line options in file UU/cmdline.opt for later use in
1339 : generating config.sh.
1340 cat > cmdline.opt <<EOSH
1341 # Configure command line arguments.
1342 config_arg0='$0'
1343 config_args='$*'
1344 config_argc=$#
1345 EOSH
1346 argn=1
1347 args_exp=''
1348 args_sep=''
1349 for arg in "$@"; do
1350         cat >>cmdline.opt <<EOSH
1351 config_arg$argn='$arg'
1352 EOSH
1353         # Extreme backslashitis: replace each ' by '"'"'
1354         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1355 $arg
1356 EOC
1357         arg_exp=`cat cmdl.opt`
1358         args_exp="$args_exp$args_sep'$arg_exp'"
1359         argn=`expr $argn + 1`
1360         args_sep=' '
1361 done
1362 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1363 # used by ./hints/os2.sh
1364 rm -f cmdl.opt
1365
1366 : produce awk script to parse command line options
1367 cat >options.awk <<'EOF'
1368 BEGIN {
1369         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1370
1371         len = length(optstr);
1372         for (i = 1; i <= len; i++) {
1373                 c = substr(optstr, i, 1);
1374                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1375                 if (a == ":") {
1376                         arg[c] = 1;
1377                         i++;
1378                 }
1379                 opt[c] = 1;
1380         }
1381 }
1382 {
1383         expect = 0;
1384         str = $0;
1385         if (substr(str, 1, 1) != "-") {
1386                 printf("'%s'\n", str);
1387                 next;
1388         }
1389         len = length($0);
1390         for (i = 2; i <= len; i++) {
1391                 c = substr(str, i, 1);
1392                 if (!opt[c]) {
1393                         printf("-%s\n", substr(str, i));
1394                         next;
1395                 }
1396                 printf("-%s\n", c);
1397                 if (arg[c]) {
1398                         if (i < len)
1399                                 printf("'%s'\n", substr(str, i + 1));
1400                         else
1401                                 expect = 1;
1402                         next;
1403                 }
1404         }
1405 }
1406 END {
1407         if (expect)
1408                 print "?";
1409 }
1410 EOF
1411
1412 : process the command line options
1413 set X `for arg in "$@"; do echo "X$arg"; done |
1414         sed -e s/X// | awk -f options.awk`
1415 eval "set $*"
1416 shift
1417 rm -f options.awk
1418
1419 : set up default values
1420 fastread=''
1421 reuseval=false
1422 config_sh=''
1423 alldone=''
1424 error=''
1425 silent=''
1426 extractsh=''
1427 override=''
1428 knowitall=''
1429 rm -f optdef.sh posthint.sh
1430 cat >optdef.sh <<EOS
1431 $startsh
1432 EOS
1433
1434
1435 : option parsing
1436 while test $# -gt 0; do
1437         case "$1" in
1438         -d) shift; fastread=yes;;
1439         -e) shift; alldone=cont;;
1440         -f)
1441                 shift
1442                 cd ..
1443                 if test -r "$1"; then
1444                         config_sh="$1"
1445                 else
1446                         echo "$me: cannot read config file $1." >&2
1447                         error=true
1448                 fi
1449                 cd UU
1450                 shift;;
1451         -h) shift; error=true;;
1452         -r) shift; reuseval=true;;
1453         -s) shift; silent=true; realsilent=true;;
1454         -E) shift; alldone=exit;;
1455         -K) shift; knowitall=true;;
1456         -O) shift; override=true;;
1457         -S) shift; silent=true; extractsh=true;;
1458         -D)
1459                 shift
1460                 case "$1" in
1461                 *=)
1462                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1463                         echo "$me: ignoring -D $1" >&2
1464                         ;;
1465                 *=*) echo "$1" | \
1466                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1467                 *) echo "$1='define'" >> optdef.sh;;
1468                 esac
1469                 shift
1470                 ;;
1471         -U)
1472                 shift
1473                 case "$1" in
1474                 *=) echo "$1" >> optdef.sh;;
1475                 *=*)
1476                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1477                         echo "$me: ignoring -U $1" >&2
1478                         ;;
1479                 *) echo "$1='undef'" >> optdef.sh;;
1480                 esac
1481                 shift
1482                 ;;
1483         -A)
1484             shift
1485             xxx=''
1486             yyy="$1"
1487             zzz=''
1488             uuu=undef
1489             case "$yyy" in
1490             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1491                  case "$zzz" in
1492                  *:*) zzz='' ;;
1493                  *)   xxx=append
1494                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1495                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1496                  esac
1497                  ;;
1498             esac
1499             case "$xxx" in
1500             '')  case "$yyy" in
1501                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1502                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1503                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1504                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1505                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1506                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1507                  esac
1508                  ;;       
1509             esac
1510             case "$xxx" in
1511             append)
1512                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1513             clear)
1514                 echo "$yyy=''"                  >> posthint.sh ;;
1515             define)
1516                 case "$zzz" in
1517                 '') zzz=define ;;
1518                 esac
1519                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1520             eval)
1521                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1522             prepend)
1523                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1524             undef)
1525                 case "$zzz" in
1526                 '') zzz="$uuu" ;;
1527                 esac
1528                 echo "$yyy=$zzz"                >> posthint.sh ;;
1529             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1530             esac
1531             shift
1532             ;;
1533         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1534             exit 0;;
1535         --) break;;
1536         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1537         *) break;;
1538         esac
1539 done
1540
1541 case "$error" in
1542 true)
1543         cat >&2 <<EOM
1544 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1545                  [-U symbol] [-U symbol=] [-A command:symbol...]
1546   -d : use defaults for all answers.
1547   -e : go on without questioning past the production of config.sh.
1548   -f : specify an alternate default configuration file.
1549   -h : print this help message and exit (with an error status).
1550   -r : reuse C symbols value if possible (skips costly nm extraction).
1551   -s : silent mode, only echoes questions and essential information.
1552   -D : define symbol to have some value:
1553          -D symbol         symbol gets the value 'define'
1554          -D symbol=value   symbol gets the value 'value'
1555   -E : stop at the end of questions, after having produced config.sh.
1556   -K : do not use unless you know what you are doing.
1557   -O : let -D and -U override definitions from loaded configuration file.
1558   -S : perform variable substitutions on all .SH files (can mix with -f)
1559   -U : undefine symbol:
1560          -U symbol    symbol gets the value 'undef'
1561          -U symbol=   symbol gets completely empty
1562   -A : manipulate symbol after the platform specific hints have been applied:
1563          -A symbol=value                append " "value to symbol
1564          -A append:symbol=value         append value to symbol
1565          -A define:symbol=value         define symbol to have value
1566          -A clear:symbol                define symbol to be ''
1567          -A define:symbol               define symbol to be 'define'
1568          -A eval:symbol=value           define symbol to be eval of value
1569          -A prepend:symbol=value        prepend value to symbol
1570          -A undef:symbol                define symbol to be 'undef'
1571          -A undef:symbol=               define symbol to be ''
1572   -V : print version number and exit (with a zero status).
1573 EOM
1574         exit 1
1575         ;;
1576 esac
1577
1578 : Sanity checks
1579 case "$fastread$alldone" in
1580 yescont|yesexit) ;;
1581 *)
1582         case "$extractsh" in
1583         true) ;;
1584         *)
1585                 if test ! -t 0; then
1586                         echo "Say 'sh Configure', not 'sh <Configure'"
1587                         exit 1
1588                 fi
1589                 ;;
1590         esac
1591         ;;
1592 esac
1593
1594 exec 4>&1
1595 case "$silent" in
1596 true) exec 1>/dev/null;;
1597 esac
1598
1599 : run the defines and the undefines, if any, but leave the file out there...
1600 touch optdef.sh
1601 . ./optdef.sh
1602 : create the posthint manipulation script and leave the file out there...
1603 touch posthint.sh
1604
1605 : set package name
1606 package=perl5
1607 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1608 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1609 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1610 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1611 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1612 esac
1613
1614 : Some greps do not return status, grrr.
1615 echo "grimblepritz" >grimble
1616 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1617         contains=contains
1618 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1619         contains=grep
1620 else
1621         contains=contains
1622 fi
1623 rm -f grimble
1624 : the following should work in any shell
1625 case "$contains" in
1626 contains*)
1627         echo " "
1628         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1629         cat >contains <<'EOSS'
1630 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1631 EOSS
1632 chmod +x contains
1633 esac
1634
1635 : Find the path to the source tree
1636 case "$src" in
1637 '') case "$0" in
1638     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1639          case "$src" in
1640          /*)    ;;
1641          .)     ;;
1642          *)     src=`cd ../$src && pwd` ;;
1643          esac
1644          ;;
1645     *)   src='.';;
1646     esac;;
1647 esac
1648 case "$src" in
1649 '')     src=/
1650         rsrc=/
1651         ;;
1652 /*) rsrc="$src";;
1653 *) rsrc="../$src";;
1654 esac
1655 if test -f $rsrc/Configure && \
1656         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1657 then
1658    : found it, so we are ok.
1659 else
1660         rsrc=''
1661         for src in . .. ../.. ../../.. ../../../..; do
1662                 if test -f ../$src/Configure && \
1663                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1664                 then
1665                         rsrc=../$src
1666                         break
1667                 fi
1668         done
1669 fi
1670 case "$rsrc" in
1671 '')
1672         cat <<EOM >&4
1673
1674 Sorry, I can't seem to locate the source dir for $package.  Please start
1675 Configure with an explicit path -- i.e. /some/path/Configure.
1676
1677 EOM
1678         exit 1
1679         ;;
1680 ../.)   rsrc='..';;
1681 *)
1682         echo " "
1683         echo "Sources for $package found in \"$src\"." >&4
1684         ;;
1685 esac
1686
1687 : script used to extract .SH files with variable substitutions
1688 cat >extract <<'EOS'
1689 PERL_CONFIG_SH=true
1690 echo "Doing variable substitutions on .SH files..."
1691 if test -f MANIFEST; then
1692         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1693 else
1694         echo "(Looking for .SH files under the source directory.)"
1695         set x `(cd "$src"; find . -name "*.SH" -print)`
1696 fi
1697 shift
1698 case $# in
1699 0) set x `(cd "$src"; echo *.SH)`; shift;;
1700 esac
1701 if test ! -f "$src/$1"; then
1702         shift
1703 fi
1704 mkdir_p='
1705 name=$1;
1706 create="";
1707 while test $name; do
1708         if test ! -d "$name"; then
1709                 create="$name $create";
1710                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1711                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1712         else
1713                 name="";
1714         fi;
1715 done;
1716 for file in $create; do
1717         mkdir $file;
1718 done
1719 '
1720 for file in $*; do
1721         case "$src" in
1722         ".")
1723                 case "$file" in
1724                 */*)
1725                         dir=`expr X$file : 'X\(.*\)/'`
1726                         file=`expr X$file : 'X.*/\(.*\)'`
1727                         (cd "$dir" && . ./$file)
1728                         ;;
1729                 *)
1730                         . ./$file
1731                         ;;
1732                 esac
1733                 ;;
1734         *)
1735                 case "$file" in
1736                 */*)
1737                         dir=`expr X$file : 'X\(.*\)/'`
1738                         file=`expr X$file : 'X.*/\(.*\)'`
1739                         (set x $dir; shift; eval $mkdir_p)
1740                         sh <"$src/$dir/$file"
1741                         ;;
1742                 *)
1743                         sh <"$src/$file"
1744                         ;;
1745                 esac
1746                 ;;
1747         esac
1748 done
1749 if test -f "$src/config_h.SH"; then
1750         if test ! -f config.h; then
1751         : oops, they left it out of MANIFEST, probably, so do it anyway.
1752         . "$src/config_h.SH"
1753         fi
1754 fi
1755 EOS
1756
1757 : extract files and exit if asked to do so
1758 case "$extractsh" in
1759 true)
1760         case "$realsilent" in
1761         true) ;;
1762         *) exec 1>&4;;
1763         esac
1764         case "$config_sh" in
1765         '') config_sh='config.sh';;
1766         esac
1767         echo " "
1768         echo "Fetching answers from $config_sh..."
1769         cd ..
1770         . $config_sh
1771         test "$override" && . ./optdef.sh
1772         echo " "
1773         . UU/extract
1774         rm -rf UU
1775         echo "Extraction done."
1776         exit 0
1777         ;;
1778 esac
1779
1780 : Eunice requires " " instead of "", can you believe it
1781 echo " "
1782 : Here we go...
1783 echo "Beginning of configuration questions for $package."
1784
1785 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1786
1787 : first determine how to suppress newline on echo command
1788 echo " "
1789 echo "Checking echo to see how to suppress newlines..."
1790 (echo "hi there\c" ; echo " ") >.echotmp
1791 if $contains c .echotmp >/dev/null 2>&1 ; then
1792         echo "...using -n."
1793         n='-n'
1794         c=''
1795 else
1796         cat <<'EOM'
1797 ...using \c
1798 EOM
1799         n=''
1800         c='\c'
1801 fi
1802 echo $n "The star should be here-->$c"
1803 echo '*'
1804 rm -f .echotmp
1805
1806 : Now test for existence of everything in MANIFEST
1807 echo " "
1808 if test -f "$rsrc/MANIFEST"; then
1809         echo "First let's make sure your kit is complete.  Checking..." >&4
1810         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1811         rm -f missing
1812         tmppwd=`pwd`
1813         for filelist in x??; do
1814                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1815         done
1816         if test -s missing; then
1817                 cat missing >&4
1818                 cat >&4 <<'EOM'
1819
1820 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1821
1822 You have the option of continuing the configuration process, despite the
1823 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1824 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1825 and contact the author (perlbug@perl.org).
1826
1827 EOM
1828                 echo $n "Continue? [n] $c" >&4
1829                 read ans
1830                 case "$ans" in
1831                 y*)
1832                         echo "Continuing..." >&4
1833                         rm -f missing
1834                         ;;
1835                 *)
1836                         echo "ABORTING..." >&4
1837                         kill $$
1838                         ;;
1839                 esac
1840         else
1841                 echo "Looks good..."
1842         fi
1843 else
1844         echo "There is no MANIFEST file.  I hope your kit is complete !"
1845 fi
1846 rm -f missing x??
1847
1848 echo " "
1849 : Find the appropriate value for a newline for tr
1850 if test -n "$DJGPP"; then
1851        trnl='\012'
1852 fi
1853 if test X"$trnl" = X; then
1854         case "`echo foo|tr '\n' x 2>/dev/null`" in
1855         foox) trnl='\n' ;;
1856         esac
1857 fi
1858 if test X"$trnl" = X; then
1859         case "`echo foo|tr '\012' x 2>/dev/null`" in
1860         foox) trnl='\012' ;;
1861         esac
1862 fi
1863 if test X"$trnl" = X; then
1864        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1865        fooxy) trnl='\n\r' ;;
1866        esac
1867 fi
1868 if test X"$trnl" = X; then
1869         cat <<EOM >&2
1870
1871 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1872
1873 EOM
1874         exit 1
1875 fi
1876
1877 : compute the number of columns on the terminal for proper question formatting
1878 case "$COLUMNS" in
1879 '') COLUMNS='80';;
1880 esac
1881
1882 : set up the echo used in my read
1883 myecho="case \"\$xxxm\" in
1884 '') echo $n \"\$rp $c\" >&4;;
1885 *) case \"\$rp\" in
1886         '') echo $n \"[\$xxxm] $c\";;
1887         *)
1888                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1889                         echo \"\$rp\" >&4
1890                         echo $n \"[\$xxxm] $c\" >&4
1891                 else
1892                         echo $n \"\$rp [\$xxxm] $c\" >&4
1893                 fi
1894                 ;;
1895         esac;;
1896 esac"
1897
1898 : now set up to do reads with possible shell escape and default assignment
1899 cat <<EOSC >myread
1900 $startsh
1901 xxxm=\$dflt
1902 $myecho
1903 ans='!'
1904 case "\$fastread" in
1905 yes) case "\$dflt" in
1906         '') ;;
1907         *) ans='';
1908                 case "\$silent-\$rp" in
1909                 true-) ;;
1910                 *) echo " " >&4;;
1911                 esac;;
1912         esac;;
1913 *) case "\$silent" in
1914         true) case "\$rp" in
1915                 '') ans='';;
1916                 esac;;
1917         esac;;
1918 esac
1919 while expr "X\$ans" : "X!" >/dev/null; do
1920         read answ
1921         set x \$xxxm
1922         shift
1923         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1924         case  "\$answ" in
1925         "!")
1926                 sh 1>&4
1927                 echo " "
1928                 $myecho
1929                 ;;
1930         !*)
1931                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1932                 shift
1933                 sh 1>&4 -c "\$*"
1934                 echo " "
1935                 $myecho
1936                 ;;
1937         "\$ans")
1938                 case "\$ans" in
1939                 \\&*)
1940                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1941                         shift
1942                         case "\$1" in
1943                         -d)
1944                                 fastread=yes
1945                                 echo "(OK, I'll run with -d after this question.)" >&4
1946                                 ;;
1947                         -*)
1948                                 echo "*** Sorry, \$1 not supported yet." >&4
1949                                 ;;
1950                         esac
1951                         $myecho
1952                         ans=!
1953                         ;;
1954                 esac;;
1955         *)
1956                 case "\$aok" in
1957                 y)
1958                         echo "*** Substitution done -- please confirm."
1959                         xxxm="\$ans"
1960                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1961                         xxxm="\$ans"
1962                         ans=!
1963                         ;;
1964                 *)
1965                         echo "*** Error -- try again."
1966                         ans=!
1967                         ;;
1968                 esac
1969                 $myecho
1970                 ;;
1971         esac
1972         case "\$ans\$xxxm\$nostick" in
1973         '')
1974                 ans=!
1975                 $myecho
1976                 ;;
1977         esac
1978 done
1979 case "\$ans" in
1980 '') ans="\$xxxm";;
1981 esac
1982 EOSC
1983
1984 : create .config dir to save info across Configure sessions
1985 test -d ../.config || mkdir ../.config
1986 cat >../.config/README <<EOF
1987 This directory created by Configure to save information that should
1988 persist across sessions for $package.
1989
1990 You may safely delete it if you wish.
1991 EOF
1992
1993 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1994 case "$usedevel" in
1995 $define|true|[yY]*) ;;
1996 *) case "$xversion" in
1997    *[13579])
1998         cat >&4 <<EOH
1999 *** WHOA THERE!!! ***
2000
2001     This is an UNSTABLE DEVELOPMENT release.
2002     The version of this $package distribution is $xversion, that is, odd,
2003     (as opposed to even) and that signifies a development release.
2004     If you want a maintenance release, you want an even-numbered version.
2005
2006     Do ***NOT*** install this into production use.
2007     Data corruption and crashes are possible.
2008
2009     It is most seriously suggested that you do not continue any further
2010     unless you want to help in developing and debugging Perl.
2011
2012     If you *still* want to build perl, you can answer 'y' now,
2013     or pass -Dusedevel to Configure.
2014
2015 EOH
2016         rp='Do you really want to continue?'
2017         dflt='n'
2018         . ./myread
2019         case "$ans" in
2020         [yY]) echo >&4 "Okay, continuing."
2021               usedevel="$define" ;;
2022         *) echo >&4 "Okay, bye."
2023            exit 1
2024            ;;
2025         esac
2026         ;;
2027     esac
2028     ;;
2029 esac
2030 case "$usedevel" in
2031 $define|true|[yY]*)
2032         case "$versiononly" in
2033         '') versiononly="$define" ;;
2034         esac
2035         case "$installusrbinperl" in
2036         '') installusrbinperl="$undef" ;;
2037         esac
2038         ;;
2039 esac
2040
2041 : general instructions
2042 needman=true
2043 firsttime=true
2044 user=`(logname) 2>/dev/null`
2045 case "$user" in
2046 '') user=`whoami 2>&1`;;
2047 esac
2048 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2049         firsttime=false
2050         echo " "
2051         rp='Would you like to see the instructions?'
2052         dflt=n
2053         . ./myread
2054         case "$ans" in
2055         [yY]*) ;;
2056         *) needman=false;;
2057         esac
2058 fi
2059 if $needman; then
2060         cat <<EOH
2061
2062 This installation shell script will examine your system and ask you questions
2063 to determine how the perl5 package should be installed. If you get
2064 stuck on a question, you may use a ! shell escape to start a subshell or
2065 execute a command.  Many of the questions will have default answers in square
2066 brackets; typing carriage return will give you the default.
2067
2068 On some of the questions which ask for file or directory names you are allowed
2069 to use the ~name construct to specify the login directory belonging to "name",
2070 even if you don't have a shell which knows about that.  Questions where this is
2071 allowed will be marked "(~name ok)".
2072
2073 EOH
2074         rp=''
2075         dflt='Type carriage return to continue'
2076         . ./myread
2077         cat <<'EOH'
2078
2079 The prompter used in this script allows you to use shell variables and
2080 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2081 in the default answer, as if the default line was a set of arguments given to a
2082 script shell.  This means you may also use $* to repeat the whole default line,
2083 so you do not have to re-type everything to add something to the default.
2084
2085 Everytime there is a substitution, you will have to confirm.  If there is an
2086 error (e.g. an unmatched backtick), the default answer will remain unchanged
2087 and you will be prompted again.
2088
2089 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2090 the questions and use the computed defaults (or the previous answers if there
2091 was already a config.sh file). Type 'Configure -h' for a list of options.
2092 You may also start interactively and then answer '& -d' at any prompt to turn
2093 on the non-interactive behaviour for the remainder of the execution.
2094
2095 EOH
2096         . ./myread
2097         cat <<EOH
2098
2099 Much effort has been expended to ensure that this shell script will run on any
2100 Unix system.  If despite that it blows up on yours, your best bet is to edit
2101 Configure and run it again.  If you can't run Configure for some reason,
2102 you'll have to generate a config.sh file by hand.  Whatever problems you
2103 have, let me (perlbug@perl.org) know how I blew it.
2104
2105 This installation script affects things in two ways:
2106
2107 1) it may do direct variable substitutions on some of the files included
2108    in this kit.
2109 2) it builds a config.h file for inclusion in C programs.  You may edit
2110    any of these files as the need arises after running this script.
2111
2112 If you make a mistake on a question, there is no easy way to back up to it
2113 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2114 files.  Configure will offer to let you do this before it runs the SH files.
2115
2116 EOH
2117         dflt='Type carriage return to continue'
2118         . ./myread
2119         case "$firsttime" in
2120         true) echo $user >>../.config/instruct;;
2121         esac
2122 fi
2123
2124 : find out where common programs are
2125 echo " "
2126 echo "Locating common programs..." >&4
2127 cat <<EOSC >loc
2128 $startsh
2129 case \$# in
2130 0) exit 1;;
2131 esac
2132 thing=\$1
2133 shift
2134 dflt=\$1
2135 shift
2136 for dir in \$*; do
2137         case "\$thing" in
2138         .)
2139         if test -d \$dir/\$thing; then
2140                 echo \$dir
2141                 exit 0
2142         fi
2143         ;;
2144         *)
2145         for thisthing in \$dir/\$thing; do
2146                 : just loop through to pick last item
2147         done
2148         if test -f \$thisthing; then
2149                 echo \$thisthing
2150                 exit 0
2151         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2152                 echo \$thisthing
2153                 exit 0
2154         elif test -f \$dir/\$thing.exe; then
2155                 if test -n "$DJGPP"; then
2156                         echo \$dir/\$thing.exe
2157                         exit 0
2158                 elif test "$eunicefix" != ":"; then
2159                         : on Eunice apparently
2160                         echo \$dir/\$thing
2161                         exit 0
2162                 fi
2163         fi
2164         ;;
2165         esac
2166 done
2167 echo \$dflt
2168 exit 1
2169 EOSC
2170 chmod +x loc
2171 $eunicefix loc
2172 loclist="
2173 awk
2174 cat
2175 chmod
2176 comm
2177 cp
2178 echo
2179 expr
2180 grep
2181 ls
2182 mkdir
2183 rm
2184 sed
2185 sort
2186 touch
2187 tr
2188 uniq
2189 "
2190 trylist="
2191 Mcc
2192 ar
2193 bison
2194 byacc
2195 cpp
2196 csh
2197 date
2198 egrep
2199 gmake
2200 gzip
2201 less
2202 ln
2203 make
2204 more
2205 nm
2206 nroff
2207 pg
2208 test
2209 uname
2210 zip
2211 "
2212 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2213 pth="$pth /lib /usr/lib"
2214 for file in $loclist; do
2215         eval xxx=\$$file
2216         case "$xxx" in
2217         /*|?:[\\/]*)
2218                 if test -f "$xxx"; then
2219                         : ok
2220                 else
2221                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2222                         xxx=`./loc $file $file $pth`
2223                 fi
2224                 ;;
2225         '') xxx=`./loc $file $file $pth`;;
2226         *) xxx=`./loc $xxx $xxx $pth`;;
2227         esac
2228         eval $file=$xxx$_exe
2229         eval _$file=$xxx
2230         case "$xxx" in
2231         /*)
2232                 echo $file is in $xxx.
2233                 ;;
2234         ?:[\\/]*)
2235                 echo $file is in $xxx.
2236                 ;;
2237         *)
2238                 echo "I don't know where '$file' is, and my life depends on it." >&4
2239                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2240                 exit 1
2241                 ;;
2242         esac
2243 done
2244 echo " "
2245 echo "Don't worry if any of the following aren't found..."
2246 say=offhand
2247 for file in $trylist; do
2248         eval xxx=\$$file
2249         case "$xxx" in
2250         /*|?:[\\/]*)
2251                 if test -f "$xxx"; then
2252                         : ok
2253                 else
2254                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2255                         xxx=`./loc $file $file $pth`
2256                 fi
2257                 ;;
2258         '') xxx=`./loc $file $file $pth`;;
2259         *) xxx=`./loc $xxx $xxx $pth`;;
2260         esac
2261         eval $file=$xxx$_exe
2262         eval _$file=$xxx
2263         case "$xxx" in
2264         /*)
2265                 echo $file is in $xxx.
2266                 ;;
2267         ?:[\\/]*)
2268                 echo $file is in $xxx.
2269                 ;;
2270         *)
2271                 echo "I don't see $file out there, $say."
2272                 say=either
2273                 ;;
2274         esac
2275 done
2276 case "$egrep" in
2277 egrep)
2278         echo "Substituting grep for egrep."
2279         egrep=$grep
2280         _egrep=$grep
2281         ;;
2282 esac
2283 case "$ln" in
2284 ln)
2285         echo "Substituting cp for ln."
2286         ln=$cp
2287         _ln=$cp
2288         ;;
2289 esac
2290 case "$make" in
2291 make)   
2292         case "$gmake" in
2293         gmake)
2294         echo "I can't find make or gmake, and my life depends on it." >&4
2295         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2296         exit 1
2297         ;;
2298         esac
2299         ;;
2300 esac    
2301 case "$gmake" in
2302 gmake)  ;;
2303 *)      # We can't have osname yet.
2304         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2305                 # Assume that gmake, if found, is definitely GNU make
2306                 # and prefer it over the system make.
2307                 echo "Substituting gmake for make."
2308                 make=$gmake
2309                 _make=$gmake
2310         fi
2311         ;;
2312 esac
2313 case "$test" in
2314 test)
2315         echo "Hopefully test is built into your sh."
2316         ;;
2317 *)
2318         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2319                 echo "Using the test built into your sh."
2320                 test=test
2321                 _test=test
2322         fi
2323         ;;
2324 esac
2325 case "$echo" in
2326 echo)
2327         echo "Hopefully echo is built into your sh."
2328         ;;
2329 '') ;;
2330 *)
2331         echo " "
2332 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2333         $echo $n "hi there$c" >foo1
2334         echo $n "hi there$c" >foo2
2335         if cmp foo1 foo2 >/dev/null 2>&1; then
2336                 echo "They are compatible.  In fact, they may be identical."
2337         else
2338                 case "$n" in
2339                 '-n') n='' c='\c';;
2340                 *) n='-n' c='';;
2341                 esac
2342                 cat <<FOO
2343 They are not compatible!  You are probably running ksh on a non-USG system.
2344 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2345 have echo built in and we may have to run some Bourne shell scripts.  That
2346 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2347
2348 FOO
2349                 $echo $n "The star should be here-->$c"
2350                 $echo "*"
2351         fi
2352         $rm -f foo1 foo2
2353         ;;
2354 esac
2355
2356 cat <<EOS >trygcc
2357 $startsh
2358 EOS
2359 cat <<'EOSC' >>trygcc
2360 case "$cc" in
2361 '') ;;
2362 *)  $rm -f try try.*
2363     $cat >try.c <<EOM
2364 int main(int argc, char *argv[]) {
2365   return 0;
2366 }
2367 EOM
2368     if $cc -o try $ccflags $ldflags try.c; then
2369        :
2370     else
2371         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2372         despair=yes
2373         trygcc=yes
2374         case "$cc" in
2375         *gcc*) trygcc=no ;;
2376         esac
2377         case "`$cc -v -c try.c 2>&1`" in
2378         *gcc*) trygcc=no ;;
2379         esac
2380         if $test X"$trygcc" = Xyes; then
2381             if gcc -o try -c try.c; then
2382                 echo " "
2383                 echo "You seem to have a working gcc, though." >&4
2384                 rp="Would you like to use it?"
2385                 dflt=y
2386                 if $test -f myread; then
2387                     . ./myread
2388                 else
2389                     if $test -f UU/myread; then
2390                         . ./UU/myread
2391                     else
2392                         echo "Cannot find myread, sorry.  Aborting." >&2
2393                         exit 1
2394                     fi
2395                 fi  
2396                 case "$ans" in
2397                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2398                        if $test -f usethreads.cbu; then
2399                            $cat >&4 <<EOM 
2400
2401 *** However, any setting of the C compiler flags (e.g. for thread support)
2402 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2403 *** (together with e.g. -Dusethreads).
2404
2405 EOM
2406                        fi;;
2407                 esac
2408             fi
2409         fi
2410     fi
2411     $rm -f try try.*
2412     ;;
2413 esac
2414 EOSC
2415
2416 cat <<EOS >checkcc
2417 $startsh
2418 EOS
2419 cat <<'EOSC' >>checkcc
2420 case "$cc" in        
2421 '') ;;
2422 *)  $rm -f try try.*              
2423     $cat >try.c <<EOM
2424 int main(int argc, char *argv[]) {
2425   return 0;
2426 }
2427 EOM
2428     if $cc -o try $ccflags $ldflags try.c; then
2429        :
2430     else
2431         if $test X"$despair" = Xyes; then
2432            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2433         fi
2434         $cat >&4 <<EOM         
2435 You need to find a working C compiler.
2436 Either (purchase and) install the C compiler supplied by your OS vendor,
2437 or for a free C compiler try http://gcc.gnu.org/
2438 I cannot continue any further, aborting.
2439 EOM
2440         exit 1
2441     fi
2442     $rm -f try try.*
2443     ;;
2444 esac
2445 EOSC
2446
2447 : determine whether symbolic links are supported
2448 echo " "
2449 $touch blurfl
2450 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2451         echo "Symbolic links are supported." >&4
2452         lns="$ln -s"
2453 else
2454         echo "Symbolic links are NOT supported." >&4
2455         lns="$ln"
2456 fi
2457 $rm -f blurfl sym
2458
2459 : determine whether symbolic links are supported
2460 echo " "
2461 case "$lns" in
2462 *"ln"*" -s")
2463         echo "Checking how to test for symbolic links..." >&4
2464         $lns blurfl sym
2465         if $test "X$issymlink" = X; then
2466                 case "$newsh" in
2467                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2468                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2469                 esac
2470                 if test $? = 0; then
2471                         issymlink="test -h"
2472                 else
2473                         echo "Your builtin 'test -h' may be broken." >&4
2474                         case "$test" in
2475                         /*)     ;;
2476                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2477                                 for p in $pth
2478                                 do
2479                                         if test -f "$p/$test"; then
2480                                                 test="$p/$test"
2481                                                 break
2482                                         fi
2483                                 done
2484                                 ;;
2485                         esac
2486                         case "$test" in
2487                         /*)
2488                                 echo "Trying external '$test -h'." >&4
2489                                 issymlink="$test -h"
2490                                 if $test ! -h sym >/dev/null 2>&1; then
2491                                         echo "External '$test -h' is broken, too." >&4
2492                                         issymlink=''
2493                                 fi
2494                                 ;;
2495                         *)      issymlink='' ;;
2496                         esac
2497                 fi              
2498         fi
2499         if $test "X$issymlink" = X; then
2500                 if $test -L sym 2>/dev/null; then
2501                         issymlink="$test -L"
2502                         echo "The builtin '$test -L' worked." >&4
2503                 fi
2504         fi
2505         if $test "X$issymlink" != X; then
2506                 echo "You can test for symbolic links with '$issymlink'." >&4
2507         else
2508                 echo "I do not know how you can test for symbolic links." >&4
2509         fi
2510         $rm -f blurfl sym
2511         ;;
2512 *)      echo "No symbolic links, so not testing for their testing..." >&4
2513         ;;
2514 esac
2515 echo " "
2516
2517
2518 case "$mksymlinks" in
2519 $define|true|[yY]*)
2520         case "$src" in
2521         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2522                 exit 1
2523                 ;;
2524         *)      case "$lns:$issymlink" in
2525                 *"ln"*" -s:"*"test -"?)
2526                         echo "Creating the symbolic links..." >&4
2527                         echo "(First creating the subdirectories...)" >&4
2528                         cd ..
2529                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2530                                 read directory
2531                                 test -z "$directory" && break
2532                                 mkdir -p $directory
2533                         done
2534                         # Sanity check 1.
2535                         if test ! -d t/base; then
2536                                 echo "Failed to create the subdirectories.  Aborting." >&4
2537                                 exit 1
2538                         fi
2539                         echo "(Then creating the symlinks...)" >&4
2540                         awk '{print $1}' $src/MANIFEST | while true; do
2541                                 read filename
2542                                 test -z "$filename" && break
2543                                 if test -f $filename; then
2544                                         if $issymlink $filename; then
2545                                                 rm -f $filename
2546                                         fi
2547                                 fi
2548                                 if test -f $filename; then
2549                                         echo "$filename already exists, not symlinking."
2550                                 else
2551                                         ln -s $src/$filename $filename
2552                                 fi
2553                         done
2554                         # Sanity check 2.
2555                         if test ! -f t/base/lex.t; then
2556                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2557                                 exit 1
2558                         fi
2559                         cd UU
2560                         ;;
2561                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2562                         ;;
2563                 esac
2564                 ;;
2565         esac
2566         ;;
2567 esac
2568
2569
2570 case "$usecrosscompile" in
2571 $define|true|[yY]*)
2572         $echo "Cross-compiling..."
2573         croak=''
2574         case "$cc" in
2575         *-*-gcc) # A cross-compiling gcc, probably.
2576             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2577             ar=$targetarch-ar
2578             # leave out ld, choosing it is more complex
2579             nm=$targetarch-nm
2580             ranlib=$targetarch-ranlib
2581             $echo 'extern int foo;' > try.c
2582             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2583             shift
2584             if $test $# -gt 0; then
2585                 incpth="$incpth $*"
2586                 incpth="`$echo $incpth|$sed 's/^ //'`"
2587                 echo "Guessing incpth '$incpth'." >&4
2588                 for i in $*; do
2589                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2590                     if $test -d $j; then
2591                         libpth="$libpth $j"
2592                     fi
2593                 done   
2594                 libpth="`$echo $libpth|$sed 's/^ //'`"
2595                 echo "Guessing libpth '$libpth'." >&4
2596             fi
2597             $rm -f try.c
2598             ;;
2599         esac
2600         case "$targetarch" in
2601         '') echo "Targetarch not defined." >&4; croak=y ;;
2602         *)  echo "Using targetarch $targetarch." >&4 ;;
2603         esac
2604         case "$incpth" in
2605         '') echo "Incpth not defined." >&4; croak=y ;;
2606         *)  echo "Using incpth '$incpth'." >&4 ;;
2607         esac
2608         case "$libpth" in
2609         '') echo "Libpth not defined." >&4; croak=y ;;
2610         *)  echo "Using libpth '$libpth'." >&4 ;;
2611         esac
2612         case "$usrinc" in
2613         '') for i in $incpth; do
2614                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2615                     usrinc=$i
2616                     echo "Guessing usrinc $usrinc." >&4
2617                     break
2618                 fi
2619             done
2620             case "$usrinc" in
2621             '') echo "Usrinc not defined." >&4; croak=y ;;
2622             esac
2623             ;;
2624         *)  echo "Using usrinc $usrinc." >&4 ;;
2625         esac
2626         case "$targethost" in
2627         '') echo "Targethost not defined." >&4; croak=y ;;
2628         *)  echo "Using targethost $targethost." >&4
2629         esac
2630         locincpth=' '
2631         loclibpth=' '
2632         case "$croak" in
2633         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2634         esac
2635         case "$src" in
2636         /*) run=$src/Cross/run
2637             targetmkdir=$src/Cross/mkdir
2638             to=$src/Cross/to
2639             from=$src/Cross/from
2640             ;;
2641         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2642             run=$pwd/Cross/run
2643             targetmkdir=$pwd/Cross/mkdir
2644             to=$pwd/Cross/to
2645             from=$pwd/Cross/from
2646             ;;
2647         esac
2648         case "$targetrun" in
2649         '') targetrun=ssh ;;
2650         esac
2651         case "$targetto" in
2652         '') targetto=scp ;;
2653         esac
2654         case "$targetfrom" in
2655         '') targetfrom=scp ;;
2656         esac
2657         run=$run-$targetrun
2658         to=$to-$targetto
2659         from=$from-$targetfrom
2660         case "$targetdir" in
2661         '')  targetdir=/tmp
2662              echo "Guessing targetdir $targetdir." >&4
2663              ;;
2664         esac
2665         case "$targetuser" in
2666         '')  targetuser=root
2667              echo "Guessing targetuser $targetuser." >&4
2668              ;;
2669         esac
2670         case "$targetfrom" in
2671         scp)    q=-q ;;
2672         *)      q='' ;;
2673         esac
2674         case "$targetrun" in
2675         ssh|rsh)
2676             cat >$run <<EOF
2677 #!/bin/sh
2678 case "\$1" in
2679 -cwd)
2680   shift
2681   cwd=\$1
2682   shift
2683   ;;
2684 esac
2685 case "\$cwd" in
2686 '') cwd=$targetdir ;;
2687 esac
2688 exe=\$1
2689 shift
2690 if $test ! -f \$exe.xok; then
2691   $to \$exe
2692   $touch \$exe.xok
2693 fi
2694 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2695 EOF
2696             ;;
2697         *)  echo "Unknown targetrun '$targetrun'" >&4
2698             exit 1
2699             ;;
2700         esac
2701         case "$targetmkdir" in
2702         */Cross/mkdir)
2703             cat >$targetmkdir <<EOF
2704 #!/bin/sh
2705 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2706 EOF
2707             $chmod a+rx $targetmkdir
2708             ;;
2709         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2710             exit 1
2711             ;;
2712         esac
2713         case "$targetto" in
2714         scp|rcp)
2715             cat >$to <<EOF
2716 #!/bin/sh
2717 for f in \$@
2718 do
2719   case "\$f" in
2720   /*)
2721     $targetmkdir \`dirname \$f\`
2722     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2723     ;;
2724   *)
2725     $targetmkdir $targetdir/\`dirname \$f\`
2726     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2727     ;;
2728   esac
2729 done
2730 exit 0
2731 EOF
2732             ;;
2733         cp) cat >$to <<EOF
2734 #!/bin/sh
2735 for f in \$@
2736 do
2737   case "\$f" in
2738   /*)
2739     $mkdir -p $targetdir/\`dirname \$f\`
2740     $cp \$f $targetdir/\$f || exit 1
2741     ;;
2742   *)
2743     $targetmkdir $targetdir/\`dirname \$f\`
2744     $cp \$f $targetdir/\$f || exit 1
2745     ;;
2746   esac
2747 done
2748 exit 0
2749 EOF
2750             ;;
2751         *)  echo "Unknown targetto '$targetto'" >&4
2752             exit 1
2753             ;;
2754         esac
2755         case "$targetfrom" in
2756         scp|rcp)
2757           cat >$from <<EOF
2758 #!/bin/sh
2759 for f in \$@
2760 do
2761   $rm -f \$f
2762   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2763 done
2764 exit 0
2765 EOF
2766             ;;
2767         cp) cat >$from <<EOF
2768 #!/bin/sh
2769 for f in \$@
2770 do
2771   $rm -f \$f
2772   cp $targetdir/\$f . || exit 1
2773 done
2774 exit 0
2775 EOF
2776             ;;
2777         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2778             exit 1
2779             ;;
2780         esac
2781         if $test ! -f $run; then
2782             echo "Target 'run' script '$run' not found." >&4
2783         else
2784             $chmod a+rx $run
2785         fi
2786         if $test ! -f $to; then
2787             echo "Target 'to' script '$to' not found." >&4
2788         else
2789             $chmod a+rx $to
2790         fi
2791         if $test ! -f $from; then
2792             echo "Target 'from' script '$from' not found." >&4
2793         else
2794             $chmod a+rx $from
2795         fi
2796         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2797             exit 1
2798         fi
2799         cat >&4 <<EOF
2800 Using '$run' for remote execution,
2801 and '$from' and '$to'
2802 for remote file transfer.
2803 EOF
2804         ;;
2805 *)      run=''
2806         to=:
2807         from=:
2808         usecrosscompile='undef'
2809         targetarch=''
2810         ;;
2811 esac
2812
2813 : see whether [:lower:] and [:upper:] are supported character classes
2814 echo " "
2815 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2816 ABYZ)
2817         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2818         up='[:upper:]'
2819         low='[:lower:]'
2820         ;;
2821 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2822         # (0xc9 and 0xd1), therefore that is a nice testing point.
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 | $tr I-J i-j 2>/dev/null`" in
2832             ij) up='A-Z'
2833                 low='a-z'
2834                 ;;
2835             esac
2836         fi
2837         if test "X$up" = X -o "X$low" = X; then
2838             case "`echo IJ | od -x 2>/dev/null`" in
2839             *C9D1*|*c9d1*)
2840                 echo "Hey, this might be EBCDIC." >&4
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                 if test "X$up" = X -o "X$low" = X; then
2849                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2850                     ij) up='A-IJ-RS-Z'
2851                         low='a-ij-rs-z'
2852                         ;;
2853                     esac
2854                 fi
2855                 ;;
2856             esac
2857         fi
2858 esac
2859 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2860 ij)
2861     echo "Using $up and $low to convert case." >&4
2862     ;;
2863 *)
2864     echo "I don't know how to translate letters from upper to lower case." >&4
2865     echo "Your tr is not acting any way I know of." >&4
2866     exit 1
2867     ;;
2868 esac
2869 : set up the translation script tr, must be called with ./tr of course
2870 cat >tr <<EOSC
2871 $startsh
2872 case "\$1\$2" in
2873 '[A-Z][a-z]') exec $tr '$up' '$low';;
2874 '[a-z][A-Z]') exec $tr '$low' '$up';;
2875 esac
2876 exec $tr "\$@"
2877 EOSC
2878 chmod +x tr
2879 $eunicefix tr
2880
2881 : Try to determine whether config.sh was made on this system
2882 case "$config_sh" in
2883 '')
2884 myuname=`$uname -a 2>/dev/null`
2885 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2886 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2887 # because the A-Z/a-z are not consecutive.
2888 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2889         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2890 newmyuname="$myuname"
2891 dflt=n
2892 case "$knowitall" in
2893 '')
2894         if test -f ../config.sh; then
2895                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2896                         eval "`grep myuname= ../config.sh`"
2897                 fi
2898                 if test "X$myuname" = "X$newmyuname"; then
2899                         dflt=y
2900                 fi
2901         fi
2902         ;;
2903 *) dflt=y;;
2904 esac
2905
2906 : Get old answers from old config file if Configure was run on the
2907 : same system, otherwise use the hints.
2908 hint=default
2909 cd ..
2910 if test -f config.sh; then
2911         echo " "
2912         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2913         . UU/myread
2914         case "$ans" in
2915         n*|N*) echo "OK, I'll ignore it."
2916                 mv config.sh config.sh.old
2917                 myuname="$newmyuname"
2918                 ;;
2919         *)  echo "Fetching default answers from your old config.sh file..." >&4
2920                 tmp_n="$n"
2921                 tmp_c="$c"
2922                 tmp_sh="$sh"
2923                 . ./config.sh
2924                 cp config.sh UU
2925                 n="$tmp_n"
2926                 c="$tmp_c"
2927                 : Older versions did not always set $sh.  Catch re-use of such
2928                 : an old config.sh.
2929                 case "$sh" in
2930                 '') sh="$tmp_sh" ;;
2931                 esac
2932                 hint=previous
2933                 ;;
2934         esac
2935 fi
2936 . ./UU/checkcc
2937 if test ! -f config.sh; then
2938         $cat <<EOM
2939
2940 First time through, eh?  I have some defaults handy for some systems
2941 that need some extra help getting the Configure answers right:
2942
2943 EOM
2944         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2945         dflt=''
2946         : Half the following guesses are probably wrong... If you have better
2947         : tests or hints, please send them to perlbug@perl.org
2948         : The metaconfig authors would also appreciate a copy...
2949         $test -f /irix && osname=irix
2950         $test -f /xenix && osname=sco_xenix
2951         $test -f /dynix && osname=dynix
2952         $test -f /dnix && osname=dnix
2953         $test -f /lynx.os && osname=lynxos
2954         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2955         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2956         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2957         $test -f /bin/mips && /bin/mips && osname=mips
2958         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2959                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2960         $test -d /usr/apollo/bin && osname=apollo
2961         $test -f /etc/saf/_sactab && osname=svr4
2962         $test -d /usr/include/minix && osname=minix
2963         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2964         if $test -d /MachTen -o -d /MachTen_Folder; then
2965                 osname=machten
2966                 if $test -x /sbin/version; then
2967                         osvers=`/sbin/version | $awk '{print $2}' |
2968                         $sed -e 's/[A-Za-z]$//'`
2969                 elif $test -x /usr/etc/version; then
2970                         osvers=`/usr/etc/version | $awk '{print $2}' |
2971                         $sed -e 's/[A-Za-z]$//'`
2972                 else
2973                         osvers="$2.$3"
2974                 fi
2975         fi
2976
2977         $test -f /sys/posix.dll &&
2978                 $test -f /usr/bin/what &&
2979                 set X `/usr/bin/what /sys/posix.dll` &&
2980                 $test "$3" = UWIN &&
2981                 osname=uwin &&
2982                 osvers="$5"
2983
2984         if $test -f $uname; then
2985                 set X $myuname
2986                 shift
2987
2988                 case "$5" in
2989                 fps*) osname=fps ;;
2990                 mips*)
2991                         case "$4" in
2992                         umips) osname=umips ;;
2993                         *) osname=mips ;;
2994                         esac;;
2995                 [23]100) osname=mips ;;
2996                 next*) osname=next ;;
2997                 i386*)
2998                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2999                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3000                                 osname='sco'
3001                                 osvers=$tmp
3002                         elif $test -f /etc/kconfig; then
3003                                 osname=isc
3004                                 if test "$lns" = "$ln -s"; then
3005                                         osvers=4
3006                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3007                                         osvers=3
3008                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3009                                         osvers=2
3010                                 fi
3011                         fi
3012                         tmp=''
3013                         ;;
3014                 pc*)
3015                         if test -n "$DJGPP"; then
3016                                 osname=dos
3017                                 osvers=djgpp
3018                         fi
3019                         ;;
3020                 esac
3021
3022                 case "$1" in
3023                 aix) osname=aix
3024                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3025                         case "$tmp" in
3026                         'not found') osvers="$4"."$3" ;;
3027                         '<3240'|'<>3240') osvers=3.2.0 ;;
3028                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3029                         '=3250'|'>3250') osvers=3.2.5 ;;
3030                         *) osvers=$tmp;;
3031                         esac
3032                         ;;
3033                 bsd386) osname=bsd386
3034                         osvers=`$uname -r`
3035                         ;;
3036                 cygwin*) osname=cygwin
3037                         osvers="$3"
3038                         ;;
3039                 *dc.osx) osname=dcosx
3040                         osvers="$3"
3041                         ;;
3042                 dnix) osname=dnix
3043                         osvers="$3"
3044                         ;;
3045                 domainos) osname=apollo
3046                         osvers="$3"
3047                         ;;
3048                 dgux) osname=dgux 
3049                         osvers="$3"
3050                         ;;
3051                 dynixptx*) osname=dynixptx
3052                         osvers=`echo "$4"|sed 's/^v//'`
3053                         ;;
3054                 freebsd) osname=freebsd 
3055                         osvers="$3" ;;
3056                 genix) osname=genix ;;
3057                 hp*) osname=hpux 
3058                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3059                         ;;
3060                 irix*) osname=irix
3061                         case "$3" in
3062                         4*) osvers=4 ;;
3063                         5*) osvers=5 ;;
3064                         *)      osvers="$3" ;;
3065                         esac
3066                         ;;
3067                 linux) osname=linux
3068                         case "$3" in
3069                         *)      osvers="$3" ;;
3070                         esac
3071                         ;;
3072                 MiNT) osname=mint
3073                         ;;
3074                 netbsd*) osname=netbsd
3075                         osvers="$3"
3076                         ;;
3077                 news-os) osvers="$3"
3078                         case "$3" in
3079                         4*) osname=newsos4 ;;
3080                         *) osname=newsos ;;
3081                         esac
3082                         ;;
3083                 next*) osname=next ;;
3084                 nonstop-ux) osname=nonstopux ;;
3085                 openbsd) osname=openbsd
3086                         osvers="$3"
3087                         ;;
3088                 POSIX-BC | posix-bc ) osname=posix-bc
3089                         osvers="$3"
3090                         ;;
3091                 powerux | power_ux | powermax_os | powermaxos | \
3092                 powerunix | power_unix) osname=powerux
3093                         osvers="$3"
3094                         ;;
3095                 qnx) osname=qnx
3096                         osvers="$4"
3097                         ;;
3098                 solaris) osname=solaris
3099                         case "$3" in
3100                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3101                         *)      osvers="$3" ;;
3102                         esac
3103                         ;;
3104                 sunos) osname=sunos
3105                         case "$3" in
3106                         5*) osname=solaris
3107                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3108                         *)      osvers="$3" ;;
3109                         esac
3110                         ;;
3111                 titanos) osname=titanos
3112                         case "$3" in
3113                         1*) osvers=1 ;;
3114                         2*) osvers=2 ;;
3115                         3*) osvers=3 ;;
3116                         4*) osvers=4 ;;
3117                         *)      osvers="$3" ;;
3118                         esac
3119                         ;;
3120                 ultrix) osname=ultrix
3121                         osvers="$3"
3122                         ;;
3123                 osf1|mls+)      case "$5" in
3124                                 alpha)
3125                                         osname=dec_osf
3126                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3127                                         case "$osvers" in
3128                                         [1-9].[0-9]*) ;;
3129                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3130                                         esac
3131                                         ;;
3132                         hp*)    osname=hp_osf1  ;;
3133                         mips)   osname=mips_osf1 ;;
3134                         esac
3135                         ;;
3136                 unixware) osname=svr5
3137                         osvers="$4"
3138                         ;;
3139                 uts)    osname=uts
3140                         osvers="$3"
3141                         ;;
3142                 vos) osvers="$3"
3143                         ;;
3144                 $2) case "$osname" in
3145                         *isc*) ;;
3146                         *freebsd*) ;;
3147                         svr*)
3148                                 : svr4.x or possibly later
3149                                 case "svr$3" in 
3150                                 ${osname}*)
3151                                         osname=svr$3
3152                                         osvers=$4
3153                                         ;;
3154                                 esac
3155                                 case "$osname" in
3156                                 svr4.0)
3157                                         : Check for ESIX
3158                                         if test -f /stand/boot ; then
3159                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3160                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3161                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3162                                                         if test -n "$isesix"; then
3163                                                                 osname=esix4
3164                                                         fi
3165                                                 fi
3166                                         fi
3167                                         ;;
3168                                 esac
3169                                 ;;
3170                         *)      if test -f /etc/systemid; then
3171                                         osname=sco
3172                                         set `echo $3 | $sed 's/\./ /g'` $4
3173                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3174                                                 osvers=$1.$2.$3
3175                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3176                                                 osvers=$1.$2
3177                                         elif $test -f $src/hints/sco_$1.sh; then
3178                                                 osvers=$1
3179                                         fi
3180                                 else
3181                                         case "$osname" in
3182                                         '') : Still unknown.  Probably a generic Sys V.
3183                                                 osname="sysv"
3184                                                 osvers="$3"
3185                                                 ;;
3186                                         esac
3187                                 fi
3188                                 ;;
3189                         esac
3190                         ;;
3191                 *)      case "$osname" in
3192                         '') : Still unknown.  Probably a generic BSD.
3193                                 osname="$1"
3194                                 osvers="$3"
3195                                 ;;
3196                         esac
3197                         ;;
3198                 esac
3199         else
3200                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3201                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3202                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3203                                 osname=news_os
3204                         fi
3205                         $rm -f UU/kernel.what
3206                 elif test -d c:/.; then
3207                         set X $myuname
3208                         osname=os2
3209                         osvers="$5"
3210                 fi
3211         fi
3212         
3213         case "$targetarch" in
3214         '') ;;
3215         *)  hostarch=$osname
3216             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3217             osvers=''
3218             ;;
3219         esac
3220
3221         : Now look for a hint file osname_osvers, unless one has been
3222         : specified already.
3223         case "$hintfile" in
3224         ''|' ')
3225                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3226                 : Also try without trailing minor version numbers.
3227                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3228                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3229                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3230                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3231                 case "$file" in
3232                 '') dflt=none ;;
3233                 *)  case "$osvers" in
3234                         '') dflt=$file
3235                                 ;;
3236                         *)  if $test -f $src/hints/$file.sh ; then
3237                                         dflt=$file
3238                                 elif $test -f $src/hints/$xfile.sh ; then
3239                                         dflt=$xfile
3240                                 elif $test -f $src/hints/$xxfile.sh ; then
3241                                         dflt=$xxfile
3242                                 elif $test -f $src/hints/$xxxfile.sh ; then
3243                                         dflt=$xxxfile
3244                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3245                                         dflt=$xxxxfile
3246                                 elif $test -f "$src/hints/${osname}.sh" ; then
3247                                         dflt="${osname}"
3248                                 else
3249                                         dflt=none
3250                                 fi
3251                                 ;;
3252                         esac
3253                         ;;
3254                 esac
3255                 if $test -f Policy.sh ; then
3256                         case "$dflt" in
3257                         *Policy*) ;;
3258                         none) dflt="Policy" ;;
3259                         *) dflt="Policy $dflt" ;;
3260                         esac
3261                 fi
3262                 ;;
3263         *)
3264                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3265                 ;;
3266         esac
3267
3268         if $test -f Policy.sh ; then
3269                 $cat <<EOM
3270
3271 There's also a Policy hint file available, which should make the
3272 site-specific (policy) questions easier to answer.
3273 EOM
3274
3275         fi
3276
3277         $cat <<EOM
3278
3279 You may give one or more space-separated answers, or "none" if appropriate.
3280 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3281 is a good thing.  DO NOT give a wrong version or a wrong OS.
3282
3283 EOM
3284
3285         rp="Which of these apply, if any?"
3286         . UU/myread
3287         tans=$ans
3288         for file in $tans; do
3289                 if $test X$file = XPolicy -a -f Policy.sh; then
3290                         . Policy.sh
3291                         $cat Policy.sh >> UU/config.sh
3292                 elif $test -f $src/hints/$file.sh; then
3293                         . $src/hints/$file.sh
3294                         $cat $src/hints/$file.sh >> UU/config.sh
3295                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3296                         : nothing
3297                 else
3298                         : Give one chance to correct a possible typo.
3299                         echo "$file.sh does not exist"
3300                         dflt=$file
3301                         rp="hint to use instead?"
3302                         . UU/myread
3303                         for file in $ans; do
3304                                 if $test -f "$src/hints/$file.sh"; then
3305                                         . $src/hints/$file.sh
3306                                         $cat $src/hints/$file.sh >> UU/config.sh
3307                                 elif $test X$ans = X -o X$ans = Xnone ; then
3308                                         : nothing
3309                                 else
3310                                         echo "$file.sh does not exist -- ignored."
3311                                 fi
3312                         done
3313                 fi
3314         done
3315
3316         hint=recommended
3317         : Remember our hint file for later.
3318         if $test -f "$src/hints/$file.sh" ; then
3319                 hintfile="$file"
3320         else
3321                 hintfile=''
3322         fi
3323 fi
3324 cd UU
3325 ;;
3326 *)
3327         echo " "
3328         echo "Fetching default answers from $config_sh..." >&4
3329         tmp_n="$n"
3330         tmp_c="$c"
3331         cd ..
3332         cp $config_sh config.sh 2>/dev/null
3333         chmod +w config.sh
3334         . ./config.sh
3335         cd UU
3336         cp ../config.sh .
3337         n="$tmp_n"
3338         c="$tmp_c"
3339         hint=previous
3340         ;;
3341 esac
3342 test "$override" && . ./optdef.sh
3343
3344 : Restore computed paths
3345 for file in $loclist $trylist; do
3346         eval $file="\$_$file"
3347 done
3348
3349 cat << EOM
3350
3351 Configure uses the operating system name and version to set some defaults.
3352 The default value is probably right if the name rings a bell. Otherwise,
3353 since spelling matters for me, either accept the default or answer "none"
3354 to leave it blank.
3355
3356 EOM
3357 case "$osname" in
3358         ''|' ')
3359                 case "$hintfile" in
3360                 ''|' '|none) dflt=none ;;
3361                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3362                 esac
3363                 ;;
3364         *) dflt="$osname" ;;
3365 esac
3366 rp="Operating system name?"
3367 . ./myread
3368 case "$ans" in
3369 none)  osname='' ;;
3370 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3371 esac
3372 echo " "
3373 case "$osvers" in
3374         ''|' ')
3375                 case "$hintfile" in
3376                 ''|' '|none) dflt=none ;;
3377                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3378                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3379                         case "$dflt" in
3380                         ''|' ') dflt=none ;;
3381                         esac
3382                         ;;
3383                 esac
3384                 ;;
3385         *) dflt="$osvers" ;;
3386 esac
3387 rp="Operating system version?"
3388 . ./myread
3389 case "$ans" in
3390 none)  osvers='' ;;
3391 *) osvers="$ans" ;;
3392 esac
3393
3394
3395 . ./posthint.sh
3396
3397 : who configured the system
3398 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3399 cf_by=`(logname) 2>/dev/null`
3400 case "$cf_by" in
3401 "")
3402         cf_by=`(whoami) 2>/dev/null`
3403         case "$cf_by" in
3404         "") cf_by=unknown ;;
3405         esac ;;
3406 esac
3407
3408 : set up the script used to warn in case of inconsistency
3409 cat <<EOS >whoa
3410 $startsh
3411 EOS
3412 cat <<'EOSC' >>whoa
3413 dflt=y
3414 echo " "
3415 echo "*** WHOA THERE!!! ***" >&4
3416 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3417 rp="    Keep the $hint value?"
3418 . ./myread
3419 case "$ans" in
3420 y) td=$was; tu=$was;;
3421 esac
3422 EOSC
3423
3424 : function used to set $1 to $val
3425 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3426 case "$val$was" in
3427 $define$undef) . ./whoa; eval "$var=\$td";;
3428 $undef$define) . ./whoa; eval "$var=\$tu";;
3429 *) eval "$var=$val";;
3430 esac'
3431
3432 case "$usesocks" in
3433 $define|true|[yY]*)     dflt='y';;
3434 *) dflt='n';;
3435 esac
3436 cat <<EOM
3437
3438 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3439 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3440 to use the PerlIO abstraction layer, this will be implicitly selected.
3441
3442 If this doesn't make any sense to you, just accept the default '$dflt'.
3443 EOM
3444 rp='Build Perl for SOCKS?'
3445 . ./myread
3446 case "$ans" in
3447 y|Y)    val="$define" ;;     
3448 *)      val="$undef" ;;
3449 esac
3450 set usesocks
3451 eval $setvar
3452
3453 case "$usesocks" in
3454 $define|true|[yY]*) useperlio="$define";;
3455 esac
3456
3457 case "$useperlio" in
3458 $define|true|[yY]*|'')  dflt='y';;
3459 *) dflt='n';;
3460 esac
3461 cat <<EOM
3462
3463 Previous version of $package used the standard IO mechanisms as
3464 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3465 alternate IO mechanisms via the PerlIO abstraction layer, but the
3466 stdio mechanism is still available if needed.  The abstraction layer
3467 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3468 Using PerlIO with sfio may cause problems with some extension modules.
3469
3470 If this doesn't make any sense to you, just accept the default '$dflt'.
3471 EOM
3472 rp='Use the PerlIO abstraction layer?'
3473 . ./myread
3474 case "$ans" in
3475 y|Y) 
3476         val="$define"
3477         ;;
3478 *)      
3479         echo "Ok, doing things the stdio way."
3480         val="$undef"
3481         ;;
3482 esac
3483 set useperlio
3484 eval $setvar 
3485
3486 case "$usesocks" in
3487 $define|true|[yY]*)
3488         case "$useperlio" in
3489         $define|true|[yY]*) ;;
3490         *)      cat >&4 <<EOM
3491
3492 You are using the SOCKS proxy protocol library which means that you
3493 should also use the PerlIO layer.  You may be headed for trouble.
3494
3495 EOM
3496                 ;;
3497         esac
3498         ;;
3499 esac
3500
3501         
3502 case "$usethreads" in
3503 $define|true|[yY]*)     dflt='y';;
3504 *)     # Catch case where user specified ithreads or 5005threads but
3505        # forgot -Dusethreads (A.D. 4/2002)
3506        case "$useithreads$use5005threads" in
3507        *$define*)      
3508                 case "$useperlio" in
3509                 "$define")      dflt='y' ;;
3510                 *)              dflt='n' ;;
3511                 esac
3512                 ;;
3513        *)       dflt='n';;
3514        esac
3515        ;;
3516 esac
3517 cat <<EOM
3518
3519 Perl can be built to take advantage of threads on some systems.
3520 To do so, Configure can be run with -Dusethreads.
3521
3522 Note that Perl built with threading support runs slightly slower
3523 and uses more memory than plain Perl. The current implementation
3524 is believed to be stable, but it is fairly new, and so should be
3525 treated with caution.
3526
3527 If this doesn't make any sense to you, just accept the default '$dflt'.
3528 EOM
3529 rp='Build a threading Perl?'
3530 . ./myread
3531 case "$ans" in
3532 y|Y)    val="$define" ;;
3533 *)      val="$undef" ;;
3534 esac
3535 set usethreads
3536 eval $setvar
3537
3538 case "$usethreads" in
3539 $define)
3540         $cat <<EOM
3541
3542 Since release 5.6, Perl has had two different threading implementations,
3543 the newer interpreter-based version (ithreads) with one interpreter per
3544 thread, and the older 5.005 version (5005threads).
3545 The 5005threads version is effectively unmaintained and will probably be
3546 removed in Perl 5.10, so there should be no need to build a Perl using it
3547 unless needed for backwards compatibility with some existing 5.005threads
3548 code.
3549
3550 EOM
3551         : Default to ithreads unless overridden on command line or with
3552         : old config.sh
3553         dflt='y'
3554         case "$use5005threads" in
3555                 $define|true|[yY]*) dflt='n';;
3556         esac
3557         case "$useithreads" in
3558                 $undef|false|[nN]*) dflt='n';;
3559         esac
3560         rp='Use the newer interpreter-based ithreads?'
3561         . ./myread
3562         case "$ans" in
3563         y|Y)    val="$define" ;;
3564         *)      val="$undef" ;;
3565         esac
3566         set useithreads
3567         eval $setvar
3568         : Now set use5005threads to the opposite value.
3569         case "$useithreads" in
3570         $define) val="$undef" ;;
3571         *) val="$define" ;;
3572         esac
3573         set use5005threads
3574         eval $setvar
3575         ;;
3576 *)
3577         useithreads="$undef"
3578         use5005threads="$undef"
3579         ;;
3580 esac
3581
3582 case "$useithreads$use5005threads" in
3583 "$define$define")
3584         $cat >&4 <<EOM
3585
3586 You cannot have both the ithreads and the 5.005 threads enabled
3587 at the same time.  Disabling the 5.005 threads since they are
3588 much less stable than the ithreads.
3589
3590 EOM
3591         use5005threads="$undef"
3592         ;;
3593 esac
3594
3595 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3596         cat >&4 <<EOF
3597 ***
3598 *** To build with ithreads you must also use the PerlIO layer.
3599 *** Cannot continue, aborting.
3600 ***
3601 EOF
3602         exit 1
3603 fi
3604
3605 case "$d_oldpthreads" in
3606 '')     : Configure tests would be welcome here.  For now, assume undef.
3607         val="$undef" ;;
3608 *)      val="$d_oldpthreads" ;;
3609 esac
3610 set d_oldpthreads
3611 eval $setvar
3612
3613
3614 case "$usethreads" in
3615 "$define"|true|[yY]*)
3616 : Look for a hint-file generated 'call-back-unit'.  If the
3617 : user has specified that a threading perl is to be built,
3618 : we may need to set or change some other defaults.
3619         if $test -f usethreads.cbu; then
3620                 echo "Your platform has some specific hints for threaded builds, using them..."
3621                 . ./usethreads.cbu
3622         else
3623                 $cat <<EOM
3624 (Your platform doesn't have any specific hints for threaded builds.
3625  Assuming POSIX threads, then.)
3626 EOM
3627         fi
3628         ;;
3629 esac
3630
3631 cat <<EOM
3632
3633 Perl can be built so that multiple Perl interpreters can coexist
3634 within the same Perl executable.
3635 EOM
3636
3637 case "$useithreads" in
3638 $define)
3639         cat <<EOM
3640 This multiple interpreter support is required for interpreter-based threads.
3641 EOM
3642         val="$define"
3643         ;;
3644 *)      case "$usemultiplicity" in
3645         $define|true|[yY]*)     dflt='y';;
3646         *) dflt='n';;
3647         esac
3648         echo " "
3649         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3650         rp='Build Perl for multiplicity?'
3651         . ./myread
3652         case "$ans" in
3653         y|Y)    val="$define" ;;
3654         *)      val="$undef" ;;
3655         esac
3656         ;;
3657 esac
3658 set usemultiplicity
3659 eval $setvar
3660
3661
3662 case "$usemorebits" in
3663 "$define"|true|[yY]*)
3664         use64bitint="$define"
3665         uselongdouble="$define"
3666         usemorebits="$define"
3667         ;;
3668 *)      usemorebits="$undef"
3669         ;;
3670 esac
3671
3672 : make some quick guesses about what we are up against
3673 echo " "
3674 $echo $n "Hmm...  $c"
3675 echo exit 1 >bsd
3676 echo exit 1 >usg
3677 echo exit 1 >v7
3678 echo exit 1 >osf1
3679 echo exit 1 >eunice
3680 echo exit 1 >xenix
3681 echo exit 1 >venix
3682 echo exit 1 >os2
3683 d_bsd="$undef"
3684 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3685 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3686 then
3687         echo "Looks kind of like an OSF/1 system, but we'll see..."
3688         echo exit 0 >osf1
3689 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3690         xxx=`./loc addbib blurfl $pth`
3691         if $test -f $xxx; then
3692         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3693                 echo exit 0 >bsd
3694                 echo exit 0 >usg
3695         else
3696                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3697                         echo "Looks kind of like an extended USG system, but we'll see..."
3698                 else
3699                         echo "Looks kind of like a USG system, but we'll see..."
3700                 fi
3701                 echo exit 0 >usg
3702         fi
3703 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3704         echo "Looks kind of like a BSD system, but we'll see..."
3705         d_bsd="$define"
3706         echo exit 0 >bsd
3707 else
3708         echo "Looks kind of like a Version 7 system, but we'll see..."
3709         echo exit 0 >v7
3710 fi
3711 case "$eunicefix" in
3712 *unixtovms*)
3713         $cat <<'EOI'
3714 There is, however, a strange, musty smell in the air that reminds me of
3715 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3716 EOI
3717         echo exit 0 >eunice
3718         d_eunice="$define"
3719 : it so happens the Eunice I know will not run shell scripts in Unix format
3720         ;;
3721 *)
3722         echo " "
3723         echo "Congratulations.  You aren't running Eunice."
3724         d_eunice="$undef"
3725         ;;
3726 esac
3727 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3728 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3729 : semicolon as a patch separator
3730 case "$p_" in
3731 :) ;;
3732 *)
3733         $cat <<'EOI'
3734 I have the feeling something is not exactly right, however...don't tell me...
3735 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3736 (Or you may be running DOS with DJGPP.)
3737 EOI
3738         echo exit 0 >os2
3739         ;;
3740 esac
3741 if test -f /xenix; then
3742         echo "Actually, this looks more like a XENIX system..."
3743         echo exit 0 >xenix
3744         d_xenix="$define"
3745 else
3746         echo " "
3747         echo "It's not Xenix..."
3748         d_xenix="$undef"
3749 fi
3750 chmod +x xenix
3751 $eunicefix xenix
3752 if test -f /venix; then
3753         echo "Actually, this looks more like a VENIX system..."
3754         echo exit 0 >venix
3755 else
3756         echo " "
3757         if ./xenix; then
3758                 : null
3759         else
3760                 echo "Nor is it Venix..."
3761         fi
3762 fi
3763 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3764 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3765 $rm -f foo
3766
3767 case "$cc" in
3768 '') dflt=cc;;
3769 *) dflt="$cc";;
3770 esac
3771 rp="Use which C compiler?"
3772 . ./myread
3773 cc="$ans"
3774
3775 : See if they have not cc but they do have gcc
3776 . ./trygcc
3777 : Look for a hint-file generated 'call-back-unit'.  Now that the
3778 : user has specified the compiler, we may need to set or change some
3779 : other defaults.
3780 if $test -f cc.cbu; then
3781     . ./cc.cbu
3782 fi
3783 . ./checkcc
3784
3785 echo " "
3786 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3787 $cat >try.c <<EOM
3788 #include <stdio.h>
3789 int main() {
3790 #ifdef __GNUC__
3791 #ifdef __VERSION__
3792         printf("%s\n", __VERSION__);
3793 #else
3794         printf("%s\n", "1");
3795 #endif
3796 #endif
3797         exit(0);
3798 }
3799 EOM
3800 if $cc -o try $ccflags $ldflags try.c; then
3801         gccversion=`$run ./try`
3802         case "$gccversion" in
3803         '') echo "You are not using GNU cc." ;;
3804         *)  echo "You are using GNU cc $gccversion."
3805             ccname=gcc  
3806             ;;
3807         esac
3808 else
3809         echo " "
3810         echo "*** WHOA THERE!!! ***" >&4
3811         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3812         case "$knowitall" in
3813         '')
3814         echo "    You'd better start hunting for one and let me know about it." >&4
3815                 exit 1
3816                 ;;
3817         esac
3818 fi
3819 $rm -f try try.*
3820 case "$gccversion" in
3821 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3822 esac
3823 case "$gccversion" in
3824 '') gccosandvers='' ;;
3825 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3826    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3827    gccshortvers=''
3828    case "$gccosandvers" in
3829    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3830    $osname$osvers) ;; # looking good
3831    $osname*) cat <<EOM >&4
3832
3833 *** WHOA THERE!!! ***
3834
3835     Your gcc has not been compiled for the exact release of
3836     your operating system ($gccosandvers versus $osname$osvers).
3837
3838     In general it is a good idea to keep gcc synchronized with
3839     the operating system because otherwise serious problems
3840     may ensue when trying to compile software, like Perl.
3841
3842     I'm trying to be optimistic here, though, and will continue.
3843     If later during the configuration and build icky compilation
3844     problems appear (headerfile conflicts being the most common
3845     manifestation), I suggest reinstalling the gcc to match
3846     your operating system release.
3847
3848 EOM
3849       ;;
3850    *) gccosandvers='' ;; # failed to parse, better be silent
3851    esac
3852    ;;
3853 esac
3854 case "$ccname" in
3855 '') ccname="$cc" ;;
3856 esac
3857
3858 # gcc 3.* complain about adding -Idirectories that they already know about,
3859 # so we will take those off from locincpth.
3860 case "$gccversion" in
3861 3*)
3862     echo "main(){}">try.c
3863     for incdir in $locincpth; do
3864        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3865              grep '^cc1: warning: changing search order '`
3866        if test "X$warn" != X; then
3867            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3868        fi
3869     done
3870     $rm -f try try.*
3871 esac
3872
3873 : decide how portable to be.  Allow command line overrides.
3874 case "$d_portable" in
3875 "$undef") ;;
3876 *)      d_portable="$define" ;;
3877 esac
3878
3879 : set up shell script to do ~ expansion
3880 cat >filexp <<EOSS
3881 $startsh
3882 : expand filename
3883 case "\$1" in
3884  ~/*|~)
3885         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3886         ;;
3887  ~*)
3888         if $test -f /bin/csh; then
3889                 /bin/csh -f -c "glob \$1"
3890                 failed=\$?
3891                 echo ""
3892                 exit \$failed
3893         else
3894                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3895                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3896                 if $test ! -d "\$dir"; then
3897                         me=\`basename \$0\`
3898                         echo "\$me: can't locate home directory for: \$name" >&2
3899                         exit 1
3900                 fi
3901                 case "\$1" in
3902                 */*)
3903                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3904                         ;;
3905                 *)
3906                         echo \$dir
3907                         ;;
3908                 esac
3909         fi
3910         ;;
3911 *)
3912         echo \$1
3913         ;;
3914 esac
3915 EOSS
3916 chmod +x filexp
3917 $eunicefix filexp
3918
3919 : now set up to get a file name
3920 cat <<EOS >getfile
3921 $startsh
3922 EOS
3923 cat <<'EOSC' >>getfile
3924 tilde=''
3925 fullpath=''
3926 already=''
3927 skip=''
3928 none_ok=''
3929 exp_file=''
3930 nopath_ok=''
3931 orig_rp="$rp"
3932 orig_dflt="$dflt"
3933 case "$gfpth" in
3934 '') gfpth='.' ;;
3935 esac
3936
3937 case "$fn" in
3938 *\(*)
3939         : getfile will accept an answer from the comma-separated list
3940         : enclosed in parentheses even if it does not meet other criteria.
3941         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3942         fn=`echo $fn | sed 's/(.*)//'`
3943         ;;
3944 esac
3945
3946 case "$fn" in
3947 *:*)
3948         loc_file=`expr $fn : '.*:\(.*\)'`
3949         fn=`expr $fn : '\(.*\):.*'`
3950         ;;
3951 esac
3952
3953 case "$fn" in
3954 *~*) tilde=true;;
3955 esac
3956 case "$fn" in
3957 */*) fullpath=true;;
3958 esac
3959 case "$fn" in
3960 *+*) skip=true;;
3961 esac
3962 case "$fn" in
3963 *n*) none_ok=true;;
3964 esac
3965 case "$fn" in
3966 *e*) exp_file=true;;
3967 esac
3968 case "$fn" in
3969 *p*) nopath_ok=true;;
3970 esac
3971
3972 case "$fn" in
3973 *f*) type='File';;
3974 *d*) type='Directory';;
3975 *l*) type='Locate';;
3976 esac
3977
3978 what="$type"
3979 case "$what" in
3980 Locate) what='File';;
3981 esac
3982
3983 case "$exp_file" in
3984 '')
3985         case "$d_portable" in
3986         "$define") ;;
3987         *) exp_file=true;;
3988         esac
3989         ;;
3990 esac
3991
3992 cd ..
3993 while test "$type"; do
3994         redo=''
3995         rp="$orig_rp"
3996         dflt="$orig_dflt"
3997         case "$tilde" in
3998         true) rp="$rp (~name ok)";;
3999         esac
4000         . UU/myread
4001         if test -f UU/getfile.ok && \
4002                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4003         then
4004                 value="$ans"
4005                 ansexp="$ans"
4006                 break
4007         fi
4008         case "$ans" in
4009         none)
4010                 value=''
4011                 ansexp=''
4012                 case "$none_ok" in
4013                 true) type='';;
4014                 esac
4015                 ;;
4016         *)
4017                 case "$tilde" in
4018                 '') value="$ans"
4019                         ansexp="$ans";;
4020                 *)
4021                         value=`UU/filexp $ans`
4022                         case $? in
4023                         0)
4024                                 if test "$ans" != "$value"; then
4025                                         echo "(That expands to $value on this system.)"
4026                                 fi
4027                                 ;;
4028                         *) value="$ans";;
4029                         esac
4030                         ansexp="$value"
4031                         case "$exp_file" in
4032                         '') value="$ans";;
4033                         esac
4034                         ;;
4035                 esac
4036                 case "$fullpath" in
4037                 true)
4038                         case "$ansexp" in
4039                         /*) value="$ansexp" ;;
4040                         [a-zA-Z]:/*) value="$ansexp" ;;
4041                         *)
4042                                 redo=true
4043                                 case "$already" in
4044                                 true)
4045                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4046                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4047                                         ;;
4048                                 *)
4049                                 echo "Please give a full path name, starting with slash." >&4
4050                                         case "$tilde" in
4051                                         true)
4052                                 echo "Note that using ~name is ok provided it expands well." >&4
4053                                                 already=true
4054                                                 ;;
4055                                         esac
4056                                 esac
4057                                 ;;
4058                         esac
4059                         ;;
4060                 esac
4061                 case "$redo" in
4062                 '')
4063                         case "$type" in
4064                         File)
4065                                 for fp in $gfpth; do
4066                                         if test "X$fp" = X.; then
4067                                             pf="$ansexp"
4068                                         else    
4069                                             pf="$fp/$ansexp"
4070                                         fi
4071                                         if test -f "$pf"; then
4072                                                 type=''
4073                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4074                                         then
4075                                                 echo "($value is not a plain file, but that's ok.)"
4076                                                 type=''
4077                                         fi
4078                                         if test X"$type" = X; then
4079                                             value="$pf"
4080                                             break
4081                                         fi
4082                                 done
4083                                 ;;
4084                         Directory)
4085                                 for fp in $gfpth; do
4086                                         if test "X$fp" = X.; then
4087                                             dir="$ans"
4088                                             direxp="$ansexp"
4089                                         else    
4090                                             dir="$fp/$ansexp"
4091                                             direxp="$fp/$ansexp"
4092                                         fi
4093                                         if test -d "$direxp"; then
4094                                                 type=''
4095                                                 value="$dir"
4096                                                 break
4097                                         fi
4098                                 done
4099                                 ;;
4100                         Locate)
4101                                 if test -d "$ansexp"; then
4102                                         echo "(Looking for $loc_file in directory $value.)"
4103                                         value="$value/$loc_file"
4104                                         ansexp="$ansexp/$loc_file"
4105                                 fi
4106                                 if test -f "$ansexp"; then
4107                                         type=''
4108                                 fi
4109                                 case "$nopath_ok" in
4110                                 true)   case "$value" in
4111                                         */*) ;;
4112                                         *)      echo "Assuming $value will be in people's path."
4113                                                 type=''
4114                                                 ;;
4115                                         esac
4116                                         ;;
4117                                 esac
4118                                 ;;
4119                         esac
4120
4121                         case "$skip" in
4122                         true) type='';
4123                         esac
4124
4125                         case "$type" in
4126                         '') ;;
4127                         *)
4128                                 if test "$fastread" = yes; then
4129                                         dflt=y
4130                                 else
4131                                         dflt=n
4132                                 fi
4133                                 rp="$what $value doesn't exist.  Use that name anyway?"
4134                                 . UU/myread
4135                                 dflt=''
4136                                 case "$ans" in
4137                                 y*) type='';;
4138                                 *) echo " ";;
4139                                 esac
4140                                 ;;
4141                         esac
4142                         ;;
4143                 esac
4144                 ;;
4145         esac
4146 done
4147 cd UU
4148 ans="$value"
4149 rp="$orig_rp"
4150 dflt="$orig_dflt"
4151 rm -f getfile.ok
4152 test "X$gfpthkeep" != Xy && gfpth=""
4153 EOSC
4154
4155 : What should the include directory be ?
4156 echo " "
4157 $echo $n "Hmm...  $c"
4158 dflt='/usr/include'
4159 incpath=''
4160 mips_type=''
4161 if $test -f /bin/mips && /bin/mips; then
4162         echo "Looks like a MIPS system..."
4163         $cat >usr.c <<'EOCP'
4164 #ifdef SYSTYPE_BSD43
4165 /bsd43
4166 #endif
4167 EOCP
4168         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4169                 dflt='/bsd43/usr/include'
4170                 incpath='/bsd43'
4171                 mips_type='BSD 4.3'
4172         else
4173                 mips_type='System V'
4174         fi
4175         $rm -f usr.c usr.out
4176         echo "and you're compiling with the $mips_type compiler and libraries."
4177         xxx_prompt=y
4178         echo "exit 0" >mips
4179 else
4180         echo "Doesn't look like a MIPS system."
4181         xxx_prompt=n
4182         echo "exit 1" >mips
4183 fi
4184 chmod +x mips
4185 $eunicefix mips
4186 case "$usrinc" in
4187 '') ;;
4188 *) dflt="$usrinc";;
4189 esac
4190 case "$xxx_prompt" in
4191 y)      fn=d/
4192         echo " "
4193         rp='Where are the include files you want to use?'
4194         . ./getfile
4195         usrinc="$ans"
4196         ;;
4197 *)      usrinc="$dflt"
4198         ;;
4199 esac
4200
4201 : see how we invoke the C preprocessor
4202 echo " "
4203 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4204 cat <<'EOT' >testcpp.c
4205 #define ABC abc
4206 #define XYZ xyz
4207 ABC.XYZ
4208 EOT
4209 cd ..
4210 if test ! -f cppstdin; then
4211         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4212                 # AIX cc -E doesn't show the absolute headerfile
4213                 # locations but we'll cheat by using the -M flag.
4214                 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
4215         else
4216                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4217         fi
4218 else
4219         echo "Keeping your $hint cppstdin wrapper."
4220 fi
4221 chmod 755 cppstdin
4222 wrapper=`pwd`/cppstdin
4223 ok='false'
4224 cd UU
4225
4226 if $test "X$cppstdin" != "X" && \
4227         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4228         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4229 then
4230         echo "You used to use $cppstdin $cppminus so we'll use that again."
4231         case "$cpprun" in
4232         '') echo "But let's see if we can live without a wrapper..." ;;
4233         *)
4234                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4235                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4236                 then
4237                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4238                         ok='true'
4239                 else
4240                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4241                 fi
4242                 ;;
4243         esac
4244 else
4245         case "$cppstdin" in
4246         '') ;;
4247         *)
4248                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4249                 ;;
4250         esac
4251 fi
4252
4253 if $ok; then
4254         : nothing
4255 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4256         $cc -E <testcpp.c >testcpp.out 2>&1; \
4257         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4258         echo "Yup, it does."
4259         x_cpp="$cc -E"
4260         x_minus='';
4261 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4262         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4263         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4264         echo "Yup, it does."
4265         x_cpp="$cc -E"
4266         x_minus='-';
4267 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4268         $cc -P <testcpp.c >testcpp.out 2>&1; \
4269         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4270         echo "Yipee, that works!"
4271         x_cpp="$cc -P"
4272         x_minus='';
4273 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4274         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4275         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4276         echo "At long last!"
4277         x_cpp="$cc -P"
4278         x_minus='-';
4279 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4280         $cpp <testcpp.c >testcpp.out 2>&1; \
4281         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4282         echo "It works!"
4283         x_cpp="$cpp"
4284         x_minus='';
4285 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4286         $cpp - <testcpp.c >testcpp.out 2>&1; \
4287         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4288         echo "Hooray, it works!  I was beginning to wonder."
4289         x_cpp="$cpp"
4290         x_minus='-';
4291 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4292         $wrapper <testcpp.c >testcpp.out 2>&1; \
4293         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4294         x_cpp="$wrapper"
4295         x_minus=''
4296         echo "Eureka!"
4297 else
4298         dflt=''
4299         rp="No dice.  I can't find a C preprocessor.  Name one:"
4300         . ./myread
4301         x_cpp="$ans"
4302         x_minus=''
4303         $x_cpp <testcpp.c >testcpp.out 2>&1
4304         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4305                 echo "OK, that will do." >&4
4306         else
4307 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4308                 exit 1
4309         fi
4310 fi
4311
4312 case "$ok" in
4313 false)
4314         cppstdin="$x_cpp"
4315         cppminus="$x_minus"
4316         cpprun="$x_cpp"
4317         cpplast="$x_minus"
4318         set X $x_cpp
4319         shift
4320         case "$1" in
4321         "$cpp")
4322                 echo "Perhaps can we force $cc -E using a wrapper..."
4323                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4324                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4325                 then
4326                         echo "Yup, we can."
4327                         cppstdin="$wrapper"
4328                         cppminus='';
4329                 else
4330                         echo "Nope, we'll have to live without it..."
4331                 fi
4332                 ;;
4333         esac
4334         case "$cpprun" in
4335         "$wrapper")
4336                 cpprun=''
4337                 cpplast=''
4338                 ;;
4339         esac
4340         ;;
4341 esac
4342
4343 case "$cppstdin" in
4344 "$wrapper"|'cppstdin') ;;
4345 *) $rm -f $wrapper;;
4346 esac
4347 $rm -f testcpp.c testcpp.out
4348
4349 : Set private lib path
4350 case "$plibpth" in
4351 '') if ./mips; then
4352                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4353         fi;;
4354 esac
4355 case "$libpth" in
4356 ' ') dlist='';;
4357 '') dlist="$loclibpth $plibpth $glibpth";;
4358 *) dlist="$libpth";;
4359 esac
4360
4361 : Now check and see which directories actually exist, avoiding duplicates
4362 libpth=''
4363 for xxx in $dlist
4364 do
4365     if $test -d $xxx; then
4366                 case " $libpth " in
4367                 *" $xxx "*) ;;
4368                 *) libpth="$libpth $xxx";;
4369                 esac
4370     fi
4371 done
4372 $cat <<'EOM'
4373
4374 Some systems have incompatible or broken versions of libraries.  Among
4375 the directories listed in the question below, please remove any you
4376 know not to be holding relevant libraries, and add any that are needed.
4377 Say "none" for none.
4378
4379 EOM
4380 case "$libpth" in
4381 '') dflt='none';;
4382 *)
4383         set X $libpth
4384         shift
4385         dflt=${1+"$@"}
4386         ;;
4387 esac
4388 rp="Directories to use for library searches?"
4389 . ./myread
4390 case "$ans" in
4391 none) libpth=' ';;
4392 *) libpth="$ans";;
4393 esac
4394
4395 : compute shared library extension
4396 case "$so" in
4397 '')
4398         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4399                 dflt='sl'
4400         else
4401                 dflt='so'
4402         fi
4403         ;;
4404 *) dflt="$so";;
4405 esac
4406 $cat <<EOM
4407
4408 On some systems, shared libraries may be available.  Answer 'none' if
4409 you want to suppress searching of shared libraries for the remainder
4410 of this configuration.
4411
4412 EOM
4413 rp='What is the file extension used for shared libraries?'
4414 . ./myread
4415 so="$ans"
4416
4417 : Define several unixisms.
4418 : Hints files or command line option can be used to override them.
4419 : The convoluted testing is in case hints files set either the old
4420 : or the new name.
4421 case "$_exe" in
4422 '')     case "$exe_ext" in
4423         '')     ;;
4424         *)      _exe="$exe_ext" ;;
4425         esac
4426         ;;
4427 esac
4428 case "$_a" in
4429 '')     case "$lib_ext" in
4430     '') _a='.a';;
4431         *)      _a="$lib_ext" ;;
4432         esac
4433         ;;
4434 esac
4435 case "$_o" in
4436 '') case "$obj_ext" in
4437         '')     _o='.o';;
4438         *)      _o="$obj_ext";;
4439         esac
4440         ;;
4441 esac
4442 case "$p_" in
4443 '') case "$path_sep" in
4444         '')     p_=':';;
4445         *)      p_="$path_sep";;
4446         esac
4447         ;;
4448 esac
4449 exe_ext=$_exe
4450 lib_ext=$_a
4451 obj_ext=$_o
4452 path_sep=$p_
4453
4454 : Which makefile gets called first.  This is used by make depend.
4455 case "$firstmakefile" in
4456 '') firstmakefile='makefile';;
4457 esac
4458
4459 : Looking for optional libraries
4460 echo " "
4461 echo "Checking for optional libraries..." >&4
4462 case "$libs" in
4463 ' '|'') dflt='';;
4464 *) dflt="$libs";;
4465 esac
4466 case "$libswanted" in
4467 '') libswanted='c_s';;
4468 esac
4469 case "$usesocks" in
4470 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4471 esac
4472 libsfound=''
4473 libsfiles=''
4474 libsdirs=''
4475 libspath=''
4476 for thisdir in $libpth $xlibpth; do
4477   test -d $thisdir && libspath="$libspath $thisdir"
4478 done
4479 for thislib in $libswanted; do
4480         for thisdir in $libspath; do
4481             xxx=''
4482             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4483                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4484                 $test -f "$xxx" && eval $libscheck
4485                 $test -f "$xxx" && libstyle=shared
4486             fi
4487             if test ! -f "$xxx"; then
4488                 xxx=$thisdir/lib$thislib.$so
4489                 $test -f "$xxx" && eval $libscheck
4490                 $test -f "$xxx" && libstyle=shared
4491             fi  
4492             if test ! -f "$xxx"; then
4493                 xxx=$thisdir/lib$thislib$_a
4494                 $test -f "$xxx" && eval $libscheck
4495                 $test -f "$xxx" && libstyle=static
4496             fi
4497             if test ! -f "$xxx"; then
4498                 xxx=$thisdir/$thislib$_a
4499                 $test -f "$xxx" && eval $libscheck
4500                 $test -f "$xxx" && libstyle=static
4501             fi
4502             if test ! -f "$xxx"; then
4503                 xxx=$thisdir/lib${thislib}_s$_a
4504                 $test -f "$xxx" && eval $libscheck
4505                 $test -f "$xxx" && libstyle=static
4506                 $test -f "$xxx" && thislib=${thislib}_s
4507             fi
4508             if test ! -f "$xxx"; then
4509                 xxx=$thisdir/Slib$thislib$_a
4510                 $test -f "$xxx" && eval $libscheck
4511                 $test -f "$xxx" && libstyle=static
4512             fi
4513             if $test -f "$xxx"; then
4514                 case "$libstyle" in
4515                 shared) echo "Found -l$thislib (shared)." ;;
4516                 static) echo "Found -l$thislib." ;;
4517                 *)      echo "Found -l$thislib ($libstyle)." ;;
4518                 esac
4519                 case " $dflt " in
4520                 *"-l$thislib "*);;
4521                 *) dflt="$dflt -l$thislib"
4522                    libsfound="$libsfound $xxx"
4523                    yyy=`basename $xxx`
4524                    libsfiles="$libsfiles $yyy"
4525                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4526                    case " $libsdirs " in
4527                    *" $yyy "*) ;;
4528                    *) libsdirs="$libsdirs $yyy" ;;
4529                    esac
4530                    ;;
4531                 esac
4532                 break
4533             fi  
4534         done
4535         if $test ! -f "$xxx"; then
4536             echo "No -l$thislib."
4537         fi
4538 done
4539 set X $dflt
4540 shift
4541 dflt="$*"
4542 case "$libs" in
4543 '') dflt="$dflt";;
4544 *) dflt="$libs";;
4545 esac
4546 case "$dflt" in
4547 ' '|'') dflt='none';;
4548 esac
4549
4550 $cat <<EOM
4551
4552 In order to compile $package on your machine, a number of libraries
4553 are usually needed.  Include any other special libraries here as well.
4554 Say "none" for none.  The default list is almost always right.
4555 EOM
4556
4557 echo " "
4558 rp="What libraries to use?"
4559 . ./myread
4560 case "$ans" in
4561 none) libs=' ';;
4562 *) libs="$ans";;
4563 esac
4564
4565 : determine optimization, if desired, or use for debug flag also
4566 case "$optimize" in
4567 ' '|$undef) dflt='none';;
4568 '') dflt='-O';;
4569 *) dflt="$optimize";;
4570 esac
4571 $cat <<EOH
4572
4573 By default, $package compiles with the -O flag to use the optimizer.
4574 Alternately, you might want to use the symbolic debugger, which uses
4575 the -g flag (on traditional Unix systems).  Either flag can be
4576 specified here.  To use neither flag, specify the word "none".
4577
4578 EOH
4579 rp="What optimizer/debugger flag should be used?"
4580 . ./myread
4581 optimize="$ans"
4582 case "$optimize" in
4583 'none') optimize=" ";;
4584 esac
4585
4586 dflt=''
4587 : We will not override a previous value, but we might want to
4588 : augment a hint file
4589 case "$hint" in
4590 default|recommended)
4591         case "$gccversion" in
4592         1*) dflt='-fpcc-struct-return' ;;
4593         esac
4594         case "$optimize" in
4595         *-g*) dflt="$dflt -DDEBUGGING";;
4596         esac
4597         case "$gccversion" in
4598         2*) if test -d /etc/conf/kconfig.d &&
4599                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4600                 then
4601                         dflt="$dflt -posix"
4602                 fi
4603                 ;;
4604         esac
4605         case "$gccversion" in
4606         1*) ;;
4607         2.[0-8]*) ;;
4608         ?*)     echo " "
4609                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4610                 echo 'int main(void) { return 0; }' > gcctest.c
4611                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4612                         echo "Yes, it does." 2>&1
4613                         case "$ccflags" in
4614                         *strict-aliasing*) 
4615                                 echo "Leaving current flags $ccflags alone." 2>&1
4616                                 ;;
4617                         *) dflt="$dflt -fno-strict-aliasing" ;;
4618                         esac
4619                 else
4620                         echo "Nope, it doesn't, but that's ok." 2>&1
4621                 fi
4622                 ;;
4623         esac
4624         ;;
4625 esac
4626
4627 case "$mips_type" in
4628 *BSD*|'') inclwanted="$locincpth $usrinc";;
4629 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4630 esac
4631 for thisincl in $inclwanted; do
4632         if $test -d $thisincl; then
4633                 if $test x$thisincl != x$usrinc; then
4634                         case "$dflt" in
4635                         *" -I$thisincl "*);;
4636                         *) dflt="$dflt -I$thisincl ";;
4637                         esac
4638                 fi
4639         fi
4640 done
4641
4642 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4643         xxx=true;
4644 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4645         xxx=true;
4646 else
4647         xxx=false;
4648 fi;
4649 if $xxx; then
4650         case "$dflt" in
4651         *$2*);;
4652         *) dflt="$dflt -D$2";;
4653         esac;
4654 fi'
4655
4656 set signal.h LANGUAGE_C; eval $inctest
4657
4658 case "$usesocks" in
4659 $define)
4660         ccflags="$ccflags -DSOCKS"
4661         ;;
4662 esac
4663
4664 case "$hint" in
4665 default|recommended) dflt="$ccflags $dflt" ;;
4666 *) dflt="$ccflags";;
4667 esac
4668
4669 case "$dflt" in
4670 ''|' ') dflt=none;;
4671 esac
4672
4673 $cat <<EOH
4674
4675 Your C compiler may want other flags.  For this question you should include
4676 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4677 but you should NOT include libraries or ld flags like -lwhatever.  If you
4678 want $package to honor its debug switch, you should include -DDEBUGGING here.
4679 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4680
4681 To use no flags, specify the word "none".
4682
4683 EOH
4684 set X $dflt
4685 shift
4686 dflt=${1+"$@"}
4687 rp="Any additional cc flags?"
4688 . ./myread
4689 case "$ans" in
4690 none) ccflags='';;
4691 *) ccflags="$ans";;
4692 esac
4693
4694 : the following weeds options from ccflags that are of no interest to cpp
4695 case "$cppflags" in
4696 '') cppflags="$ccflags" ;;
4697 *)  cppflags="$cppflags $ccflags" ;;
4698 esac
4699 case "$gccversion" in
4700 1*) cppflags="$cppflags -D__GNUC__"
4701 esac
4702 case "$mips_type" in
4703 '');;
4704 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4705 esac
4706 case "$cppflags" in
4707 '');;
4708 *)
4709         echo " "
4710         echo "Let me guess what the preprocessor flags are..." >&4
4711         set X $cppflags
4712         shift
4713         cppflags=''
4714         $cat >cpp.c <<'EOM'
4715 #define BLURFL foo
4716
4717 BLURFL xx LFRULB
4718 EOM
4719         previous=''
4720         for flag in $*
4721         do
4722                 case "$flag" in
4723                 -*) ftry="$flag";;
4724                 *) ftry="$previous $flag";;
4725                 esac
4726                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4727                         >cpp1.out 2>/dev/null && \
4728                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4729                         >cpp2.out 2>/dev/null && \
4730                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4731                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4732                 then
4733                         cppflags="$cppflags $ftry"
4734                         previous=''
4735                 else
4736                         previous="$flag"
4737                 fi
4738         done
4739         set X $cppflags
4740         shift
4741         cppflags=${1+"$@"}
4742         case "$cppflags" in
4743         *-*)  echo "They appear to be: $cppflags";;
4744         esac
4745         $rm -f cpp.c cpp?.out
4746         ;;
4747 esac
4748
4749 : flags used in final linking phase
4750 case "$ldflags" in
4751 '') if ./venix; then
4752                 dflt='-i -z'
4753         else
4754                 dflt=''
4755         fi
4756         case "$ccflags" in
4757         *-posix*) dflt="$dflt -posix" ;;
4758         esac
4759         ;;
4760 *) dflt="$ldflags";;
4761 esac
4762
4763 : Try to guess additional flags to pick up local libraries.
4764 for thislibdir in $libpth; do
4765         case " $loclibpth " in
4766         *" $thislibdir "*)
4767                 case "$dflt " in 
4768                 *"-L$thislibdir "*) ;;
4769                 *)  dflt="$dflt -L$thislibdir" ;;
4770                 esac
4771                 ;;
4772         esac
4773 done
4774
4775 case "$dflt" in
4776 '') dflt='none' ;;
4777 esac
4778
4779 $cat <<EOH
4780
4781 Your C linker may need flags.  For this question you should
4782 include -L/whatever and any other flags used by the C linker, but you
4783 should NOT include libraries like -lwhatever.
4784
4785 Make sure you include the appropriate -L/path flags if your C linker
4786 does not normally search all of the directories you specified above,
4787 namely
4788         $libpth
4789 To use no flags, specify the word "none".
4790
4791 EOH
4792
4793 rp="Any additional ld flags (NOT including libraries)?"
4794 . ./myread
4795 case "$ans" in
4796 none) ldflags='';;
4797 *) ldflags="$ans";;
4798 esac
4799 rmlist="$rmlist pdp11"
4800
4801 : coherency check
4802 echo " "
4803 echo "Checking your choice of C compiler and flags for coherency..." >&4
4804 $cat > try.c <<'EOF'
4805 #include <stdio.h>
4806 int main() { printf("Ok\n"); exit(0); }
4807 EOF
4808 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4809 shift
4810 $cat >try.msg <<'EOM'
4811 I've tried to compile and run the following simple program:
4812
4813 EOM
4814 $cat try.c >> try.msg
4815
4816 $cat >> try.msg <<EOM
4817
4818 I used the command:
4819
4820         $*
4821         $run ./try
4822
4823 and I got the following output:
4824
4825 EOM
4826 dflt=y
4827 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4828         if $sh -c "$run ./try" >>try.msg 2>&1; then
4829                 xxx=`$run ./try`
4830                 case "$xxx" in
4831                 "Ok") dflt=n ;;
4832                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4833                         case " $libs " in
4834                         *" -lsfio "*)
4835                                 cat >> try.msg <<'EOQS'
4836 If $libs contains -lsfio, and sfio is mis-configured, then it
4837 sometimes (apparently) runs and exits with a 0 status, but with no
4838 output!  It may have to do with sfio's use of _exit vs. exit.
4839
4840 EOQS
4841                                 rp="You have a big problem.  Shall I abort Configure"
4842                                 dflt=y
4843                                 ;;
4844                         esac
4845                         ;;
4846                 esac
4847         else
4848                 echo "The program compiled OK, but exited with status $?." >>try.msg
4849                 rp="You have a problem.  Shall I abort Configure"
4850                 dflt=y
4851         fi
4852 else
4853         echo "I can't compile the test program." >>try.msg
4854         rp="You have a BIG problem.  Shall I abort Configure"
4855         dflt=y
4856 fi
4857 case "$dflt" in
4858 y)
4859         $cat try.msg >&4
4860         case "$knowitall" in
4861         '')
4862                 echo "(The supplied flags or libraries might be incorrect.)"
4863                 ;;
4864         *) dflt=n;;
4865         esac
4866         echo " "
4867         . ./myread
4868         case "$ans" in
4869         n*|N*) ;;
4870         *)      echo "Ok.  Stopping Configure." >&4
4871                 exit 1
4872                 ;;
4873         esac
4874         ;;
4875 n) echo "OK, that should do.";;
4876 esac
4877 $rm -f try try.* core
4878
4879 : define a shorthand compile call
4880 compile='
4881 mc_file=$1;
4882 shift;
4883 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4884 : define a shorthand compile call for compilations that should be ok.
4885 compile_ok='
4886 mc_file=$1;
4887 shift;
4888 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4889
4890 : check for lengths of integral types
4891 echo " "
4892 case "$intsize" in
4893 '')
4894         echo "Checking to see how big your integers are..." >&4
4895         $cat >try.c <<'EOCP'
4896 #include <stdio.h>
4897 int main()
4898 {
4899         printf("intsize=%d;\n", (int)sizeof(int));
4900         printf("longsize=%d;\n", (int)sizeof(long));
4901         printf("shortsize=%d;\n", (int)sizeof(short));
4902         exit(0);
4903 }
4904 EOCP
4905         set try
4906         if eval $compile_ok && $run ./try > /dev/null; then
4907                 eval `$run ./try`
4908                 echo "Your integers are $intsize bytes long."
4909                 echo "Your long integers are $longsize bytes long."
4910                 echo "Your short integers are $shortsize bytes long."
4911         else
4912                 $cat >&4 <<EOM
4913 !
4914 Help! I can't compile and run the intsize test program: please enlighten me!
4915 (This is probably a misconfiguration in your system or libraries, and
4916 you really ought to fix it.  Still, I'll try anyway.)
4917 !
4918 EOM
4919                 dflt=4
4920                 rp="What is the size of an integer (in bytes)?"
4921                 . ./myread
4922                 intsize="$ans"
4923                 dflt=$intsize
4924                 rp="What is the size of a long integer (in bytes)?"
4925                 . ./myread
4926                 longsize="$ans"
4927                 dflt=2
4928                 rp="What is the size of a short integer (in bytes)?"
4929                 . ./myread
4930                 shortsize="$ans"
4931         fi
4932         ;;
4933 esac
4934 $rm -f try try.*
4935
4936 : check for long long
4937 echo " "
4938 echo "Checking to see if you have long long..." >&4
4939 echo 'int main() { long long x = 7; return 0; }' > try.c
4940 set try
4941 if eval $compile; then
4942         val="$define"
4943         echo "You have long long."
4944 else
4945         val="$undef"
4946         echo "You do not have long long."
4947 fi
4948 $rm try.*
4949 set d_longlong
4950 eval $setvar
4951
4952 : check for length of long long
4953 case "${d_longlong}${longlongsize}" in
4954 $define)
4955         echo " "
4956         echo "Checking to see how big your long longs are..." >&4
4957         $cat >try.c <<'EOCP'
4958 #include <stdio.h>
4959 int main()
4960 {
4961     printf("%d\n", (int)sizeof(long long));
4962     return(0);
4963 }
4964 EOCP
4965         set try
4966         if eval $compile_ok; then
4967                 longlongsize=`$run ./try`
4968                 echo "Your long longs are $longlongsize bytes long."
4969         else
4970                 dflt='8'
4971                 echo " "
4972                 echo "(I can't seem to compile the test program.  Guessing...)"
4973                 rp="What is the size of a long long (in bytes)?"
4974                 . ./myread
4975                 longlongsize="$ans"
4976         fi
4977         if $test "X$longsize" = "X$longlongsize"; then
4978                 echo "(That isn't any different from an ordinary long.)"
4979         fi      
4980         ;;
4981 esac
4982 $rm -f try.* try
4983
4984 : determine filename position in cpp output
4985 echo " "
4986 echo "Computing filename position in cpp output for #include directives..." >&4
4987 case "$osname" in
4988 vos) testaccess=-e ;;
4989 *)   testaccess=-r ;;
4990 esac
4991 echo '#include <stdio.h>' > foo.c
4992 $cat >fieldn <<EOF
4993 $startsh
4994 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4995 $grep '^[       ]*#.*stdio\.h' | \
4996 while read cline; do
4997         pos=1
4998         set \$cline
4999         while $test \$# -gt 0; do
5000                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5001                         echo "\$pos"
5002                         exit 0
5003                 fi
5004                 shift
5005                 pos=\`expr \$pos + 1\`
5006         done
5007 done
5008 EOF
5009 chmod +x fieldn
5010 fieldn=`./fieldn`
5011 $rm -f foo.c fieldn
5012 case $fieldn in
5013 '') pos='???';;
5014 1) pos=first;;
5015 2) pos=second;;
5016 3) pos=third;;
5017 *) pos="${fieldn}th";;
5018 esac
5019 echo "Your cpp writes the filename in the $pos field of the line."
5020
5021 case "$osname" in
5022 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5023 *)   cppfilter='' ;;
5024 esac
5025 : locate header file
5026 $cat >findhdr <<EOF
5027 $startsh
5028 wanted=\$1
5029 name=''
5030 for usrincdir in $usrinc
5031 do
5032         if test -f \$usrincdir/\$wanted; then
5033                 echo "\$usrincdir/\$wanted"
5034                 exit 0
5035         fi
5036 done
5037 awkprg='{ print \$$fieldn }'
5038 echo "#include <\$wanted>" > foo\$\$.c
5039 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5040 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5041 while read cline; do
5042         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5043         case "\$name" in
5044         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5045         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5046         *) exit 2;;
5047         esac;
5048 done;
5049 #
5050 # status = 0: grep returned 0 lines, case statement not executed
5051 # status = 1: headerfile found
5052 # status = 2: while loop executed, no headerfile found
5053 #
5054 status=\$?
5055 $rm -f foo\$\$.c;
5056 if test \$status -eq 1; then
5057         exit 0;
5058 fi
5059 exit 1
5060 EOF
5061 chmod +x findhdr
5062
5063 : define an alternate in-header-list? function
5064 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5065 cont=true; xxf="echo \"<\$1> found.\" >&4";
5066 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5067 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5068 esac;
5069 case $# in 4) instead=instead;; *) instead="at last";; esac;
5070 while $test "$cont"; do
5071         xxx=`./findhdr $1`
5072         var=$2; eval "was=\$$2";
5073         if $test "$xxx" && $test -r "$xxx";
5074         then eval $xxf;
5075         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5076                 cont="";
5077         else eval $xxnf;
5078         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5079         set $yyy; shift; shift; yyy=$@;
5080         case $# in 0) cont="";;
5081         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5082                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5083         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5084                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5085         esac;
5086 done;
5087 while $test "$yyy";
5088 do set $yyy; var=$2; eval "was=\$$2";
5089         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5090         set $yyy; shift; shift; yyy=$@;
5091 done'
5092
5093 : see if inttypes.h is available
5094 : we want a real compile instead of Inhdr because some systems
5095 : have an inttypes.h which includes non-existent headers
5096 echo " "
5097 $cat >try.c <<EOCP
5098 #include <inttypes.h>
5099 int main() {
5100         static int32_t foo32 = 0x12345678;
5101 }
5102 EOCP
5103 set try
5104 if eval $compile; then
5105         echo "<inttypes.h> found." >&4
5106         val="$define"
5107 else
5108         echo "<inttypes.h> NOT found." >&4
5109         val="$undef"
5110 fi
5111 $rm -f try.c try
5112 set i_inttypes
5113 eval $setvar
5114
5115 : check for int64_t
5116 echo " "
5117 echo "Checking to see if you have int64_t..." >&4
5118 $cat >try.c <<EOCP
5119 #include <sys/types.h>
5120 #$i_inttypes I_INTTYPES
5121 #ifdef I_INTTYPES
5122 #include <inttypes.h>
5123 #endif
5124 int main() { int64_t x = 7; }
5125 EOCP
5126 set try
5127 if eval $compile; then
5128         val="$define"
5129         echo "You have int64_t."
5130 else
5131         val="$undef"
5132         echo "You do not have int64_t."
5133 fi
5134 $rm -f try try.*
5135 set d_int64_t
5136 eval $setvar
5137
5138
5139 echo " "
5140 echo "Checking which 64-bit integer type we could use..." >&4
5141
5142 case "$intsize" in
5143 8) val=int
5144    set quadtype
5145    eval $setvar
5146    val='"unsigned int"'
5147    set uquadtype
5148    eval $setvar
5149    quadkind=1
5150    ;;
5151 *) case "$longsize" in
5152    8) val=long
5153       set quadtype
5154       eval $setvar
5155       val='"unsigned long"'
5156       set uquadtype
5157       eval $setvar
5158       quadkind=2
5159       ;;
5160    *) case "$d_longlong:$longlongsize" in
5161       define:8)
5162         val='"long long"'
5163         set quadtype
5164         eval $setvar
5165         val='"unsigned long long"'
5166         set uquadtype
5167         eval $setvar
5168         quadkind=3
5169         ;;
5170       *) case "$d_int64_t" in
5171          define)
5172            val=int64_t
5173            set quadtype
5174            eval $setvar
5175            val=uint64_t
5176            set uquadtype
5177            eval $setvar
5178            quadkind=4
5179            ;;
5180          esac
5181          ;;
5182       esac
5183       ;;
5184    esac
5185    ;;
5186 esac
5187
5188 case "$quadtype" in
5189 '')     echo "Alas, no 64-bit integer types in sight." >&4
5190         d_quad="$undef"
5191         ;;
5192 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5193         d_quad="$define"
5194         ;;
5195 esac
5196
5197
5198 case "$uselonglong" in
5199 "$define"|true|[yY]*)
5200         cat <<EOM >&4
5201
5202 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5203 EOM
5204         use64bitint="$define"
5205         ;;
5206 esac                          
5207 case "$use64bits" in
5208 "$define"|true|[yY]*)
5209         cat <<EOM >&4
5210
5211 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5212 EOM
5213         use64bitint="$define"
5214         ;;
5215 esac                          
5216 case "$use64bitints" in
5217 "$define"|true|[yY]*)
5218         cat <<EOM >&4
5219
5220 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5221 EOM
5222         use64bitint="$define"
5223         ;;
5224 esac                          
5225 case "$use64bitsint" in
5226 "$define"|true|[yY]*)
5227         cat <<EOM >&4
5228
5229 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5230 EOM
5231         use64bitint="$define"
5232         ;;
5233 esac                          
5234 case "$uselonglongs" in
5235 "$define"|true|[yY]*)
5236         cat <<EOM >&4
5237
5238 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5239 EOM
5240         use64bitint="$define"
5241         ;;
5242 esac                          
5243 case "$use64bitsall" in
5244 "$define"|true|[yY]*)
5245         cat <<EOM >&4
5246
5247 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5248 EOM
5249         use64bitall="$define"
5250         ;;
5251 esac                          
5252
5253 case "$ccflags" in
5254 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5255 esac
5256 case "$use64bitall" in
5257 "$define"|true|[yY]*) use64bitint="$define" ;;
5258 esac
5259
5260 case "$longsize" in
5261 8) cat <<EOM
5262
5263 You have natively 64-bit long integers.
5264 EOM
5265    val="$define"
5266    ;;
5267 *) case "$use64bitint" in
5268    "$define"|true|[yY]*) dflt='y';;
5269    *) dflt='n';;
5270    esac
5271    case "$d_quad" in
5272    "$define") ;;
5273    *) dflt='n' ;;
5274    esac
5275    cat <<EOM
5276
5277 Perl can be built to take advantage of 64-bit integer types
5278 on some systems.  To do so, Configure can be run with -Duse64bitint.
5279 Choosing this option will most probably introduce binary incompatibilities.
5280
5281 If this doesn't make any sense to you, just accept the default '$dflt'.
5282 (The default has been chosen based on your configuration.)
5283 EOM
5284    rp='Try to use 64-bit integers, if available?'
5285    . ./myread
5286    case "$ans" in
5287    [yY]*) val="$define" ;;
5288    *)     val="$undef"  ;;
5289    esac
5290    ;;
5291 esac
5292 set use64bitint
5293 eval $setvar
5294
5295 case "$use64bitall" in
5296 "$define"|true|[yY]*) dflt='y' ;;
5297 *) case "$longsize" in
5298    8) dflt='y' ;;
5299    *) dflt='n' ;;
5300    esac
5301    ;;
5302 esac    
5303 cat <<EOM
5304
5305 You may also choose to try maximal 64-bitness.  It means using as much
5306 64-bitness as possible on the platform.  This in turn means even more
5307 binary incompatibilities.  On the other hand, your platform may not
5308 have any more 64-bitness available than what you already have chosen.
5309
5310 If this doesn't make any sense to you, just accept the default '$dflt'.
5311 (The default has been chosen based on your configuration.)
5312 EOM
5313 rp='Try to use maximal 64-bit support, if available?'
5314 . ./myread
5315 case "$ans" in
5316 [yY]*) val="$define" ;;
5317 *)     val="$undef"  ;;
5318 esac
5319 set use64bitall
5320 eval $setvar
5321 case "$use64bitall" in
5322 "$define")
5323         case "$use64bitint" in
5324         "$undef")
5325                 cat <<EOM
5326
5327 Since you have chosen a maximally 64-bit build, I'm also turning on
5328 the use of 64-bit integers.
5329 EOM
5330                 use64bitint="$define" ;;
5331         esac
5332         ;;
5333 esac
5334
5335 case "$use64bitint" in
5336 "$define"|true|[yY]*)
5337 : Look for a hint-file generated 'call-back-unit'.  If the
5338 : user has specified that a 64-bit perl is to be built,
5339 : we may need to set or change some other defaults.
5340         if $test -f use64bitint.cbu; then
5341                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5342                 . ./use64bitint.cbu
5343         fi
5344         case "$longsize" in
5345         4) case "$archname64" in
5346            '') archname64=64int ;;
5347            esac
5348            ;;
5349         esac
5350         ;;
5351 esac
5352
5353 case "$use64bitall" in
5354 "$define"|true|[yY]*)
5355 : Look for a hint-file generated 'call-back-unit'.  If the
5356 : user has specified that a maximally 64-bit perl is to be built,
5357 : we may need to set or change some other defaults.
5358         if $test -f use64bitall.cbu; then
5359                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5360                 . ./use64bitall.cbu
5361         fi
5362         case "$longsize" in
5363         4) case "$archname64" in
5364            ''|64int) archname64=64all ;;
5365            esac
5366            ;;
5367         esac
5368         ;;
5369 esac
5370
5371 echo " "
5372 echo "Checking for GNU C Library..." >&4
5373 cat >try.c <<'EOCP'
5374 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5375    alone are insufficient to distinguish different versions, such as
5376    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5377    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5378 */
5379 #include <stdio.h>
5380 int main(void)
5381 {
5382 #ifdef __GLIBC__
5383 #   ifdef __GLIBC_MINOR__
5384 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5385 #           include <gnu/libc-version.h>
5386             printf("%s\n",  gnu_get_libc_version());
5387 #       else
5388             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5389 #       endif
5390 #   else
5391         printf("%d\n",  __GLIBC__);
5392 #   endif
5393     return 0;
5394 #else
5395     return 1;
5396 #endif
5397 }
5398 EOCP
5399 set try
5400 if eval $compile_ok && $run ./try > glibc.ver; then
5401         val="$define"
5402         gnulibc_version=`$cat glibc.ver`
5403         echo "You are using the GNU C Library version $gnulibc_version"
5404 else
5405         val="$undef"
5406         gnulibc_version=''
5407         echo "You are not using the GNU C Library"
5408 fi
5409 $rm -f try try.* glibc.ver
5410 set d_gnulibc
5411 eval $setvar
5412
5413 : see if nm is to be used to determine whether a symbol is defined or not
5414 case "$usenm" in
5415 '')
5416         dflt=''
5417         case "$d_gnulibc" in
5418         "$define")
5419                 echo " "
5420                 echo "nm probably won't work on the GNU C Library." >&4
5421                 dflt=n
5422                 ;;
5423         esac
5424         case "$dflt" in
5425         '') 
5426                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
5427                         echo " "
5428                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5429                         echo "'nm' won't be sufficient on this sytem." >&4
5430                         dflt=n
5431                 fi
5432                 ;;
5433         esac
5434         case "$dflt" in
5435         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5436                 if $test $dflt -gt 20; then
5437                         dflt=y
5438                 else
5439                         dflt=n
5440                 fi
5441                 ;;
5442         esac
5443         ;;
5444 *)
5445         case "$usenm" in
5446         true|$define) dflt=y;;
5447         *) dflt=n;;
5448         esac
5449         ;;
5450 esac
5451 $cat <<EOM
5452
5453 I can use $nm to extract the symbols from your C libraries. This
5454 is a time consuming task which may generate huge output on the disk (up
5455 to 3 megabytes) but that should make the symbols extraction faster. The
5456 alternative is to skip the 'nm' extraction part and to compile a small
5457 test program instead to determine whether each symbol is present. If
5458 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5459 this may be the best solution.
5460
5461 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5462
5463 EOM
5464 rp="Shall I use $nm to extract C symbols from the libraries?"
5465 . ./myread
5466 case "$ans" in
5467 [Nn]*) usenm=false;;
5468 *) usenm=true;;
5469 esac
5470
5471 runnm=$usenm
5472 case "$reuseval" in
5473 true) runnm=false;;
5474 esac
5475
5476 : nm options which may be necessary
5477 case "$nm_opt" in
5478 '') if $test -f /mach_boot; then
5479                 nm_opt=''       # Mach
5480         elif $test -d /usr/ccs/lib; then
5481                 nm_opt='-p'     # Solaris (and SunOS?)
5482         elif $test -f /dgux; then
5483                 nm_opt='-p'     # DG-UX
5484         elif $test -f /lib64/rld; then
5485                 nm_opt='-p'     # 64-bit Irix
5486         else
5487                 nm_opt=''
5488         fi;;
5489 esac
5490
5491 : nm options which may be necessary for shared libraries but illegal
5492 : for archive libraries.  Thank you, Linux.
5493 case "$nm_so_opt" in
5494 '')     case "$myuname" in
5495         *linux*)
5496                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5497                         nm_so_opt='--dynamic'
5498                 fi
5499                 ;;
5500         esac
5501         ;;
5502 esac
5503
5504 case "$runnm" in
5505 true)
5506 : get list of predefined functions in a handy place
5507 echo " "
5508 case "$libc" in
5509 '') libc=unknown
5510         case "$libs" in
5511         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5512         esac
5513         ;;
5514 esac
5515 case "$libs" in
5516 '') ;;
5517 *)  for thislib in $libs; do
5518         case "$thislib" in
5519         -lc|-lc_s)
5520                 : Handle C library specially below.
5521                 ;;
5522         -l*)
5523                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5524                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5525                         :
5526                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5527                         :
5528                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5529                         :
5530                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5531                         :
5532                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5533                         :
5534                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5535                         :
5536                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5537                         :
5538                 else
5539                         try=''
5540                 fi
5541                 libnames="$libnames $try"
5542                 ;;
5543         *) libnames="$libnames $thislib" ;;
5544         esac
5545         done
5546         ;;
5547 esac
5548 xxx=normal
5549 case "$libc" in
5550 unknown)
5551         set /lib/libc.$so
5552         for xxx in $libpth; do
5553                 $test -r $1 || set $xxx/libc.$so
5554                 : The messy sed command sorts on library version numbers.
5555                 $test -r $1 || \
5556                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5557                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5558                                 h
5559                                 s/[0-9][0-9]*/0000&/g
5560                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5561                                 G
5562                                 s/\n/ /' | \
5563                          $sort | $sed -e 's/^.* //'`
5564                 eval set \$$#
5565         done
5566         $test -r $1 || set /usr/ccs/lib/libc.$so
5567         $test -r $1 || set /lib/libsys_s$_a
5568         ;;
5569 *)
5570         set blurfl
5571         ;;
5572 esac
5573 if $test -r "$1"; then
5574         echo "Your (shared) C library seems to be in $1."
5575         libc="$1"
5576 elif $test -r /lib/libc && $test -r /lib/clib; then
5577         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5578         xxx=apollo
5579         libc='/lib/clib /lib/libc'
5580         if $test -r /lib/syslib; then
5581                 echo "(Your math library is in /lib/syslib.)"
5582                 libc="$libc /lib/syslib"
5583         fi
5584 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5585         echo "Your C library seems to be in $libc, as you said before."
5586 elif $test -r $incpath/usr/lib/libc$_a; then
5587         libc=$incpath/usr/lib/libc$_a;
5588         echo "Your C library seems to be in $libc.  That's fine."
5589 elif $test -r /lib/libc$_a; then
5590         libc=/lib/libc$_a;
5591         echo "Your C library seems to be in $libc.  You're normal."
5592 else
5593         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5594                 :
5595         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5596                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5597         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5598                 :
5599         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5600                 :
5601         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5602                 :
5603         else
5604                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5605         fi
5606         if $test -r "$tans"; then
5607                 echo "Your C library seems to be in $tans, of all places."
5608                 libc=$tans
5609         else
5610                 libc='blurfl'
5611         fi
5612 fi
5613 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5614         dflt="$libc"
5615         cat <<EOM
5616
5617 If the guess above is wrong (which it might be if you're using a strange
5618 compiler, or your machine supports multiple models), you can override it here.
5619
5620 EOM
5621 else
5622         dflt=''
5623         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5624         cat >&4 <<EOM
5625 I can't seem to find your C library.  I've looked in the following places:
5626
5627 EOM
5628         $sed 's/^/      /' libpath
5629         cat <<EOM
5630
5631 None of these seems to contain your C library. I need to get its name...
5632
5633 EOM
5634 fi
5635 fn=f
5636 rp='Where is your C library?'
5637 . ./getfile
5638 libc="$ans"
5639
5640 echo " "
5641 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5642 set X `cat libnames`
5643 shift
5644 xxx=files
5645 case $# in 1) xxx=file; esac
5646 echo "Extracting names from the following $xxx for later perusal:" >&4
5647 echo " "
5648 $sed 's/^/      /' libnames >&4
5649 echo " "
5650 $echo $n "This may take a while...$c" >&4
5651
5652 for file in $*; do
5653         case $file in
5654         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5655         *) $nm $nm_opt $file 2>/dev/null;;
5656         esac
5657 done >libc.tmp
5658
5659 $echo $n ".$c"
5660 $grep fprintf libc.tmp > libc.ptf
5661 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5662 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5663 xxx='[ADTSIW]'
5664 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5665         eval $xscan;\
5666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5667                 eval $xrun
5668 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5669         eval $xscan;\
5670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5671                 eval $xrun
5672 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5673         eval $xscan;\
5674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5675                 eval $xrun
5676 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5677         eval $xscan;\
5678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5679                 eval $xrun
5680 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5681         eval $xscan;\
5682         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5683                 eval $xrun
5684 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5685         eval $xscan;\
5686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5687                 eval $xrun
5688 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5689                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5690         eval $xscan;\
5691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5692                 eval $xrun
5693 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5694         eval $xscan;\
5695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5696                 eval $xrun
5697 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5698         eval $xscan;\
5699         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5700                 eval $xrun
5701 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5702         eval $xscan;\
5703         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5704                 eval $xrun
5705 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5706         eval $xscan;\
5707         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5708                 eval $xrun
5709 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5710         eval $xscan;\
5711         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5712                 eval $xrun
5713 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5714         eval $xscan;\
5715         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5716                 eval $xrun
5717 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5718         eval $xscan;\
5719         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5720                 eval $xrun
5721 else
5722         $nm -p $* 2>/dev/null >libc.tmp
5723         $grep fprintf libc.tmp > libc.ptf
5724         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5725                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5726         then
5727                 nm_opt='-p'
5728                 eval $xrun
5729         else
5730                 echo " "
5731                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5732                 com=''
5733                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5734                         for thisname in $libnames $libc; do
5735                                 $ar t $thisname >>libc.tmp
5736                         done
5737                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5738                         echo "Ok." >&4
5739                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5740                         # Repeat libc to extract forwarders to DLL entries too
5741                         for thisname in $libnames $libc; do
5742                                 $ar tv $thisname >>libc.tmp
5743                                 # Revision 50 of EMX has bug in $ar.
5744                                 # it will not extract forwarders to DLL entries
5745                                 # Use emximp which will extract exactly them.
5746                                 emximp -o tmp.imp $thisname \
5747                                     2>/dev/null && \
5748                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5749                                     < tmp.imp >>libc.tmp
5750                                 $rm tmp.imp
5751                         done
5752                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5753                         echo "Ok." >&4
5754                 else
5755                         echo "$ar didn't seem to work right." >&4
5756                         echo "Maybe this is a Cray...trying bld instead..." >&4
5757                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5758                         then
5759                                 for thisname in $libnames; do
5760                                         bld t $libnames | \
5761                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5762                                         $ar t $thisname >>libc.tmp
5763                                 done
5764                                 echo "Ok." >&4
5765                         else
5766                                 echo "That didn't work either.  Giving up." >&4
5767                                 exit 1
5768                         fi
5769                 fi
5770         fi
5771 fi
5772 nm_extract="$com"
5773 case "$PASE" in
5774 define)
5775     echo " "
5776     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
5777     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
5778     ;;
5779 *)  if $test -f /lib/syscalls.exp; then
5780         echo " "
5781         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5782         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5783     fi
5784     ;;
5785 esac
5786 ;;
5787 esac
5788 $rm -f libnames libpath
5789
5790 : is a C symbol defined?
5791 csym='tlook=$1;
5792 case "$3" in
5793 -v) tf=libc.tmp; tc=""; tdc="";;
5794 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5795 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5796 esac;
5797 tx=yes;
5798 case "$reuseval-$4" in
5799 true-) ;;
5800 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5801 esac;
5802 case "$tx" in
5803 yes)
5804         case "$runnm" in
5805         true)
5806                 if $contains $tlook $tf >/dev/null 2>&1;
5807                 then tval=true;
5808                 else tval=false;
5809                 fi;;
5810         *)
5811                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5812                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5813                 then tval=true;
5814                 else tval=false;
5815                 fi;
5816                 $rm -f t t.c;;
5817         esac;;
5818 *)
5819         case "$tval" in
5820         $define) tval=true;;
5821         *) tval=false;;
5822         esac;;
5823 esac;
5824 eval "$2=$tval"'
5825
5826 : define an is-in-libc? function
5827 inlibc='echo " "; td=$define; tu=$undef;
5828 sym=$1; var=$2; eval "was=\$$2";
5829 tx=yes;
5830 case "$reuseval$was" in
5831 true) ;;
5832 true*) tx=no;;
5833 esac;
5834 case "$tx" in
5835 yes)
5836         set $sym tres -f;
5837         eval $csym;
5838         case "$tres" in
5839         true)
5840                 echo "$sym() found." >&4;
5841                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5842         *)
5843                 echo "$sym() NOT found." >&4;
5844                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5845         esac;;
5846 *)
5847         case "$was" in
5848         $define) echo "$sym() found." >&4;;
5849         *) echo "$sym() NOT found." >&4;;
5850         esac;;
5851 esac'
5852
5853 : see if sqrtl exists
5854 set sqrtl d_sqrtl
5855 eval $inlibc
5856
5857 hasproto='varname=$1; func=$2; shift; shift;
5858 while $test $# -ge 2; do
5859         case "$1" in
5860         $define) echo "#include <$2>";;
5861         esac ;
5862     shift 2;
5863 done > try.c;
5864 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
5865 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
5866         echo "$func() prototype found.";
5867         val="$define";
5868 else
5869         echo "$func() prototype NOT found.";
5870         val="$undef";
5871 fi;
5872 set $varname;
5873 eval $setvar;
5874 $rm -f try.c tryout.c'
5875
5876 : check for length of double
5877 echo " "
5878 case "$doublesize" in
5879 '')
5880         echo "Checking to see how big your double precision numbers are..." >&4
5881         $cat >try.c <<'EOCP'
5882 #include <stdio.h>
5883 int main()
5884 {
5885     printf("%d\n", (int)sizeof(double));
5886     exit(0);
5887 }
5888 EOCP
5889         set try
5890         if eval $compile_ok; then
5891                 doublesize=`$run ./try`
5892                 echo "Your double is $doublesize bytes long."
5893         else
5894                 dflt='8'
5895                 echo "(I can't seem to compile the test program.  Guessing...)"
5896                 rp="What is the size of a double precision number (in bytes)?"
5897                 . ./myread
5898                 doublesize="$ans"
5899         fi
5900         ;;
5901 esac
5902 $rm -f try.c try
5903
5904 : check for long doubles
5905 echo " "
5906 echo "Checking to see if you have long double..." >&4
5907 echo 'int main() { long double x = 7.0; }' > try.c
5908 set try
5909 if eval $compile; then
5910         val="$define"
5911         echo "You have long double."
5912 else
5913         val="$undef"
5914         echo "You do not have long double."
5915 fi
5916 $rm try.*
5917 set d_longdbl
5918 eval $setvar
5919
5920 : check for length of long double
5921 case "${d_longdbl}${longdblsize}" in
5922 $define)
5923         echo " "
5924         echo "Checking to see how big your long doubles are..." >&4
5925         $cat >try.c <<'EOCP'
5926 #include <stdio.h>
5927 int main()
5928 {
5929         printf("%d\n", sizeof(long double));
5930 }
5931 EOCP
5932         set try
5933         set try
5934         if eval $compile; then
5935                 longdblsize=`$run ./try`
5936                 echo "Your long doubles are $longdblsize bytes long."
5937         else
5938                 dflt='8'
5939                 echo " "
5940                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5941                 rp="What is the size of a long double (in bytes)?"
5942                 . ./myread
5943                 longdblsize="$ans"
5944         fi
5945         if $test "X$doublesize" = "X$longdblsize"; then
5946                 echo "(That isn't any different from an ordinary double.)"
5947         fi      
5948         ;;
5949 esac
5950 $rm -f try.* try
5951
5952 echo " "
5953
5954 if $test X"$d_longdbl" = X"$define"; then
5955
5956 echo "Checking how to print long doubles..." >&4
5957
5958 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5959         $cat >try.c <<'EOCP'
5960 #include <sys/types.h>
5961 #include <stdio.h>
5962 int main() {
5963   double d = 123.456;
5964   printf("%.3f\n", d);
5965 }
5966 EOCP
5967         set try
5968         if eval $compile; then
5969                 yyy=`$run ./try`
5970                 case "$yyy" in
5971                 123.456)
5972                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5973                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5974                         echo "We will use %f."
5975                         ;;
5976                 esac
5977         fi
5978 fi
5979
5980 if $test X"$sPRIfldbl" = X; then
5981         $cat >try.c <<'EOCP'
5982 #include <sys/types.h>
5983 #include <stdio.h>
5984 int main() {
5985   long double d = 123.456;
5986   printf("%.3Lf\n", d);
5987 }
5988 EOCP
5989         set try
5990         if eval $compile; then
5991                 yyy=`$run ./try`
5992                 case "$yyy" in
5993                 123.456)
5994                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5995                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5996                         echo "We will use %Lf."
5997                         ;;
5998                 esac
5999         fi
6000 fi
6001
6002 if $test X"$sPRIfldbl" = X; then
6003         $cat >try.c <<'EOCP'
6004 #include <sys/types.h>
6005 #include <stdio.h>
6006 int main() {
6007   long double d = 123.456;
6008   printf("%.3llf\n", d);
6009 }
6010 EOCP
6011         set try
6012         if eval $compile; then
6013                 yyy=`$run ./try`
6014                 case "$yyy" in
6015                 123.456)
6016                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6017                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6018                         echo "We will use %llf."
6019                         ;;
6020                 esac
6021         fi
6022 fi
6023
6024 if $test X"$sPRIfldbl" = X; then
6025         $cat >try.c <<'EOCP'
6026 #include <sys/types.h>
6027 #include <stdio.h>
6028 int main() {
6029   long double d = 123.456;
6030   printf("%.3lf\n", d);
6031 }
6032 EOCP
6033         set try
6034         if eval $compile; then
6035                 yyy=`$run ./try`
6036                 case "$yyy" in
6037                 123.456)
6038                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6039                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6040                         echo "We will use %lf."
6041                         ;;
6042                 esac
6043         fi
6044 fi
6045
6046 if $test X"$sPRIfldbl" = X; then
6047         echo "Cannot figure out how to print long doubles." >&4
6048 else
6049         sSCNfldbl=$sPRIfldbl    # expect consistency
6050 fi
6051
6052 $rm -f try try.*
6053
6054 fi # d_longdbl
6055
6056 case "$sPRIfldbl" in
6057 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6058         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6059         d_SCNfldbl="$undef";
6060         ;;
6061 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6062         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6063         d_SCNfldbl="$define";
6064         ;;
6065 esac
6066
6067 : see if modfl exists
6068 set modfl d_modfl
6069 eval $inlibc
6070
6071 : see if prototype for modfl is available
6072 echo " "
6073 set d_modflproto modfl math.h
6074 eval $hasproto
6075
6076 d_modfl_pow32_bug="$undef"
6077
6078 case "$d_longdbl$d_modfl" in
6079 $define$define)
6080         $cat <<EOM
6081 Checking to see whether your modfl() is okay for large values...
6082 EOM
6083 $cat >try.c <<EOCP
6084 #include <math.h> 
6085 #include <stdio.h>
6086 EOCP
6087 if $test "X$d_modflproto" != "X$define"; then
6088         $cat >>try.c <<EOCP
6089 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6090 long double modfl (long double, long double *);
6091 EOCP
6092 fi
6093 $cat >>try.c <<EOCP
6094 int main() {
6095     long double nv = 4294967303.15;
6096     long double v, w;
6097     v = modfl(nv, &w);         
6098 #ifdef __GLIBC__
6099     printf("glibc");
6100 #endif
6101     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6102     return 0;
6103 }
6104 EOCP
6105         case "$osname:$gccversion" in
6106         aix:)   saveccflags="$ccflags"
6107                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6108         esac
6109         set try
6110         if eval $compile; then
6111                 foo=`$run ./try`
6112                 case "$foo" in
6113                 *" 4294967303.150000 1.150000 4294967302.000000")
6114                         echo >&4 "Your modfl() is broken for large values."
6115                         d_modfl_pow32_bug="$define"
6116                         case "$foo" in
6117                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6118                         ;;
6119                         esac
6120                         ;;
6121                 *" 4294967303.150000 0.150000 4294967303.000000")
6122                         echo >&4 "Your modfl() seems okay for large values."
6123                         ;;
6124                 *)      echo >&4 "I don't understand your modfl() at all."
6125                         d_modfl="$undef"
6126                         ;;
6127                 esac
6128                 $rm -f try.* try core core.try.*
6129         else
6130                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6131                 d_modfl="$undef"
6132         fi
6133         case "$osname:$gccversion" in
6134         aix:)   ccflags="$saveccflags" ;; # restore
6135         esac
6136         ;;
6137 esac
6138
6139 case "$ccflags" in
6140 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6141 esac
6142
6143 case "$uselongdouble" in
6144 $define|true|[yY]*)     dflt='y';;
6145 *) dflt='n';;
6146 esac
6147 cat <<EOM
6148
6149 Perl can be built to take advantage of long doubles which
6150 (if available) may give more accuracy and range for floating point numbers.
6151
6152 If this doesn't make any sense to you, just accept the default '$dflt'.
6153 EOM
6154 rp='Try to use long doubles if available?'
6155 . ./myread
6156 case "$ans" in
6157 y|Y)    val="$define"   ;;
6158 *)      val="$undef"    ;;
6159 esac
6160 set uselongdouble
6161 eval $setvar
6162
6163 case "$uselongdouble" in
6164 true|[yY]*) uselongdouble="$define" ;;
6165 esac
6166
6167 case "$uselongdouble" in
6168 $define)
6169 : Look for a hint-file generated 'call-back-unit'.  If the
6170 : user has specified that long doubles should be used,
6171 : we may need to set or change some other defaults.
6172         if $test -f uselongdouble.cbu; then
6173                 echo "Your platform has some specific hints for long doubles, using them..."
6174                 . ./uselongdouble.cbu
6175         else
6176                 $cat <<EOM
6177 (Your platform doesn't have any specific hints for long doubles.)
6178 EOM
6179         fi
6180         ;;
6181 esac
6182
6183 message=X
6184 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6185 $define:$define:$define)
6186         : You have both
6187         ;;
6188 $define:$define:$undef)
6189         message="I could not find modfl"
6190         ;;
6191 $define:$undef:$define)
6192         message="I could not find sqrtl"
6193         ;;
6194 $define:$undef:$undef)
6195         message="I found neither sqrtl nor modfl"
6196         ;;
6197 esac
6198
6199 if $test "$message" != X; then
6200         $cat <<EOM >&4
6201
6202 *** You requested the use of long doubles but you do not seem to have
6203 *** the mathematic functions for long doubles.
6204 *** ($message)
6205 *** I'm disabling the use of long doubles.
6206
6207 EOM
6208
6209         uselongdouble=$undef
6210 fi
6211
6212 : determine the architecture name
6213 echo " "
6214 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6215         tarch=`arch`"-$osname"
6216 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6217         if uname -m > tmparch 2>&1 ; then
6218                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6219                         -e 's/$/'"-$osname/" tmparch`
6220         else
6221                 tarch="$osname"
6222         fi
6223         $rm -f tmparch
6224 else
6225         tarch="$osname"
6226 fi
6227 case "$myarchname" in
6228 ''|"$tarch") ;;
6229 *)
6230         echo "(Your architecture name used to be $myarchname.)"
6231         archname=''
6232         ;;
6233 esac
6234 case "$targetarch" in
6235 '') ;;
6236 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6237 esac
6238 myarchname="$tarch"
6239 case "$archname" in
6240 '') dflt="$tarch";;
6241 *) dflt="$archname";;
6242 esac
6243 rp='What is your architecture name'
6244 . ./myread
6245 archname="$ans"
6246 case "$usethreads" in
6247 $define)
6248         echo "Threads selected." >&4
6249         case "$archname" in
6250         *-thread*) echo "...and architecture name already has -thread." >&4
6251                 ;;
6252         *)      archname="$archname-thread"
6253                 echo "...setting architecture name to $archname." >&4
6254                 ;;
6255         esac
6256         ;;
6257 esac
6258 case "$usemultiplicity" in
6259 $define)
6260         echo "Multiplicity selected." >&4
6261         case "$archname" in
6262         *-multi*) echo "...and architecture name already has -multi." >&4
6263                 ;;
6264         *)      archname="$archname-multi"
6265                 echo "...setting architecture name to $archname." >&4
6266                 ;;
6267         esac
6268         ;;
6269 esac
6270 case "$use64bitint$use64bitall" in
6271 *"$define"*)
6272         case "$archname64" in
6273         '')
6274                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6275                 ;;
6276         *)
6277                 case "$use64bitint" in
6278                 "$define") echo "64 bit integers selected." >&4 ;;
6279                 esac
6280                 case "$use64bitall" in
6281                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6282                 esac
6283                 case "$archname" in
6284                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6285                         ;;
6286                 *)      archname="$archname-$archname64"
6287                         echo "...setting architecture name to $archname." >&4
6288                         ;;
6289                 esac
6290                 ;;
6291         esac
6292 esac
6293 case "$uselongdouble" in
6294 $define)
6295         echo "Long doubles selected." >&4
6296         case "$longdblsize" in
6297         $doublesize)
6298                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6299                 ;;
6300         *)
6301                 case "$archname" in
6302                 *-ld*) echo "...and architecture name already has -ld." >&4
6303                         ;;
6304                 *)      archname="$archname-ld"
6305                         echo "...setting architecture name to $archname." >&4
6306                         ;;
6307                 esac
6308                 ;;
6309         esac
6310         ;;
6311 esac
6312 case "$useperlio" in
6313 $define)
6314         echo "Perlio selected." >&4
6315         ;;
6316 *)
6317         echo "Perlio not selected, using stdio." >&4
6318         case "$archname" in
6319         *-stdio*) echo "...and architecture name already has -stdio." >&4
6320                 ;;
6321         *)      archname="$archname-stdio"
6322                 echo "...setting architecture name to $archname." >&4
6323                 ;;
6324         esac
6325         ;;
6326 esac
6327
6328 : determine root of directory hierarchy where package will be installed.
6329 case "$prefix" in
6330 '')
6331         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6332         ;;
6333 *?/)
6334         dflt=`echo "$prefix" | sed 's/.$//'`
6335         ;;
6336 *)
6337         dflt="$prefix"
6338         ;;
6339 esac
6340 $cat <<EOM
6341
6342 By default, $package will be installed in $dflt/bin, manual pages
6343 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6344 installation directories. Typically this is something like /usr/local.
6345 If you wish to have binaries under /usr/bin but other parts of the
6346 installation under /usr/local, that's ok: you will be prompted
6347 separately for each of the installation directories, the prefix being
6348 only used to set the defaults.
6349
6350 EOM
6351 fn=d~
6352 rp='Installation prefix to use?'
6353 . ./getfile
6354 oldprefix=''
6355 case "$prefix" in
6356 '') ;;
6357 *)
6358         case "$ans" in
6359         "$prefix") ;;
6360         *) oldprefix="$prefix";;
6361         esac
6362         ;;
6363 esac
6364 prefix="$ans"
6365 prefixexp="$ansexp"
6366
6367 case "$afsroot" in
6368 '')     afsroot=/afs ;;
6369 *)      afsroot=$afsroot ;;
6370 esac
6371
6372 : is AFS running?
6373 echo " "
6374 case "$afs" in
6375 $define|true)   afs=true ;;
6376 $undef|false)   afs=false ;;
6377 *)      if test -d $afsroot; then
6378                 afs=true
6379         else
6380                 afs=false
6381         fi
6382         ;;
6383 esac
6384 if $afs; then
6385         echo "AFS may be running... I'll be extra cautious then..." >&4
6386 else
6387         echo "AFS does not seem to be running..." >&4
6388 fi
6389
6390 : determine installation prefix for where package is to be installed.
6391 if $afs; then 
6392 $cat <<EOM
6393
6394 Since you are running AFS, I need to distinguish the directory in which
6395 files will reside from the directory in which they are installed (and from
6396 which they are presumably copied to the former directory by occult means).
6397
6398 EOM
6399         case "$installprefix" in
6400         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6401         *) dflt="$installprefix";;
6402         esac
6403 else
6404 $cat <<EOM
6405
6406 In some special cases, particularly when building $package for distribution,
6407 it is convenient to distinguish between the directory in which files should 
6408 be installed from the directory ($prefix) in which they 
6409 will eventually reside.  For most users, these two directories are the same.
6410
6411 EOM
6412         case "$installprefix" in
6413         '') dflt=$prefix ;;
6414         *) dflt=$installprefix;;
6415         esac
6416 fi
6417 fn=d~
6418 rp='What installation prefix should I use for installing files?'
6419 . ./getfile
6420 installprefix="$ans"
6421 installprefixexp="$ansexp"
6422
6423 : set the prefixit variable, to compute a suitable default value
6424 prefixit='case "$3" in
6425 ""|none)
6426         case "$oldprefix" in
6427         "") eval "$1=\"\$$2\"";;
6428         *)
6429                 case "$3" in
6430                 "") eval "$1=";;
6431                 none)
6432                         eval "tp=\"\$$2\"";
6433                         case "$tp" in
6434                         ""|" ") eval "$1=\"\$$2\"";;
6435                         *) eval "$1=";;
6436                         esac;;
6437                 esac;;
6438         esac;;
6439 *)
6440         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6441         case "$tp" in
6442         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6443         /*-$oldprefix/*|\~*-$oldprefix/*)
6444                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6445         *) eval "$1=\"\$$2\"";;
6446         esac;;
6447 esac'
6448
6449 : get the patchlevel
6450 echo " "
6451 echo "Getting the current patchlevel..." >&4
6452 if $test -r $rsrc/patchlevel.h;then
6453         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6454         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6455         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6456         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6457         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6458         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6459        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6460 else
6461         revision=0
6462         patchlevel=0
6463         subversion=0
6464         api_revision=0
6465         api_version=0
6466         api_subversion=0
6467         perl_patchlevel=0
6468         $echo "(You do not have patchlevel.h.  Eek.)"
6469 fi
6470 if $test -r $rsrc/.patch ; then  
6471         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6472                 perl_patchlevel=`cat $rsrc/.patch`
6473         fi
6474 fi
6475 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6476 version_patchlevel_string="version $patchlevel subversion $subversion"
6477 case "$perl_patchlevel" in
6478 0|'') ;;
6479 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6480 esac
6481
6482 $echo "(You have $package $version_patchlevel_string.)"
6483
6484 case "$osname" in
6485 dos|vms)
6486         : XXX Should be a Configure test for double-dots in filenames.
6487         version=`echo $revision $patchlevel $subversion | \
6488                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6489         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6490                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6491         ;;
6492 *)
6493         version=`echo $revision $patchlevel $subversion | \
6494                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6495         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6496                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6497         ;;
6498 esac
6499 : Special case the 5.005_xx maintenance series, which used 5.005
6500 : without any subversion label as a subdirectory in $sitelib
6501 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6502         api_versionstring='5.005'
6503 fi
6504
6505 : determine installation style
6506 : For now, try to deduce it from prefix unless it is already set.
6507 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6508 case "$installstyle" in
6509 '')     case "$prefix" in
6510                 *perl*) dflt='lib';;
6511                 *) dflt='lib/perl5' ;;
6512         esac
6513         ;;
6514 *)      dflt="$installstyle" ;;
6515 esac
6516 : Probably not worth prompting for this since we prompt for all
6517 : the directories individually, and the prompt would be too long and
6518 : confusing anyway.
6519 installstyle=$dflt
6520
6521 : determine where private library files go
6522 : Usual default is /usr/local/lib/perl5/$version.
6523 : Also allow things like /opt/perl/lib/$version, since 
6524 : /opt/perl/lib/perl5... would be redundant.
6525 : The default "style" setting is made in installstyle.U
6526 case "$installstyle" in
6527 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6528 *)       set dflt privlib lib/$version ;;
6529 esac
6530 eval $prefixit
6531 $cat <<EOM
6532
6533 There are some auxiliary files for $package that need to be put into a
6534 private library directory that is accessible by everyone.
6535
6536 EOM
6537 fn=d~+
6538 rp='Pathname where the private library files will reside?'
6539 . ./getfile
6540 privlib="$ans"
6541 privlibexp="$ansexp"
6542 : Change installation prefix, if necessary.
6543 if $test X"$prefix" != X"$installprefix"; then
6544         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6545 else
6546         installprivlib="$privlibexp"
6547 fi
6548
6549 : set the prefixup variable, to restore leading tilda escape
6550 prefixup='case "$prefixexp" in
6551 "$prefix") ;;
6552 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6553 esac'
6554
6555 : determine where public architecture dependent libraries go
6556 set archlib archlib
6557 eval $prefixit
6558 : privlib default is /usr/local/lib/$package/$version
6559 : archlib default is /usr/local/lib/$package/$version/$archname
6560 : privlib may have an optional trailing /share.
6561 tdflt=`echo $privlib | $sed 's,/share$,,'`
6562 tdflt=$tdflt/$archname
6563 case "$archlib" in
6564 '')     dflt=$tdflt
6565         ;;
6566 *)      dflt="$archlib"
6567     ;;
6568 esac
6569 $cat <<EOM
6570
6571 $spackage contains architecture-dependent library files.  If you are
6572 sharing libraries in a heterogeneous environment, you might store
6573 these files in a separate location.  Otherwise, you can just include
6574 them with the rest of the public library files.
6575
6576 EOM
6577 fn=d+~
6578 rp='Where do you want to put the public architecture-dependent libraries?'
6579 . ./getfile
6580 archlib="$ans"
6581 archlibexp="$ansexp"
6582 if $test X"$archlib" = X"$privlib"; then
6583         d_archlib="$undef"
6584 else
6585         d_archlib="$define"
6586 fi
6587 : Change installation prefix, if necessary.
6588 if $test X"$prefix" != X"$installprefix"; then
6589         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6590 else
6591         installarchlib="$archlibexp"
6592 fi
6593
6594 : see if setuid scripts can be secure
6595 $cat <<EOM
6596
6597 Some kernels have a bug that prevents setuid #! scripts from being
6598 secure.  Some sites have disabled setuid #! scripts because of this.
6599
6600 First let's decide if your kernel supports secure setuid #! scripts.
6601 (If setuid #! scripts would be secure but have been disabled anyway,
6602 don't say that they are secure if asked.)
6603
6604 EOM
6605
6606 val="$undef"
6607 if $test -d /dev/fd; then
6608         echo "#!$ls" >reflect
6609         chmod +x,u+s reflect
6610         ./reflect >flect 2>&1
6611         if $contains "/dev/fd" flect >/dev/null; then
6612                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6613                 val="$define"
6614         else
6615                 $cat <<EOM
6616 If you are not sure if they are secure, I can check but I'll need a
6617 username and password different from the one you are using right now.
6618 If you don't have such a username or don't want me to test, simply
6619 enter 'none'.
6620
6621 EOM
6622                 rp='Other username to test security of setuid scripts with?'
6623                 dflt='none'
6624                 . ./myread
6625                 case "$ans" in
6626                 n|none)
6627                         case "$d_suidsafe" in
6628                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6629                                 dflt=n;;
6630                         "$undef")
6631                                 echo "Well, the $hint value is *not* secure." >&4
6632                                 dflt=n;;
6633                         *)      echo "Well, the $hint value *is* secure." >&4
6634                                 dflt=y;;
6635                         esac
6636                         ;;
6637                 *)
6638                         $rm -f reflect flect
6639                         echo "#!$ls" >reflect
6640                         chmod +x,u+s reflect
6641                         echo >flect
6642                         chmod a+w flect
6643                         echo '"su" will (probably) prompt you for '"$ans's password."
6644                         su $ans -c './reflect >flect'
6645                         if $contains "/dev/fd" flect >/dev/null; then
6646                                 echo "Okay, it looks like setuid scripts are secure." >&4
6647                                 dflt=y
6648                         else
6649                                 echo "I don't think setuid scripts are secure." >&4
6650                                 dflt=n
6651                         fi
6652                         ;;
6653                 esac
6654                 rp='Does your kernel have *secure* setuid scripts?'
6655                 . ./myread
6656                 case "$ans" in
6657                 [yY]*)  val="$define";;
6658                 *)      val="$undef";;
6659                 esac
6660         fi
6661 else
6662         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6663         echo "(That's for file descriptors, not floppy disks.)"
6664         val="$undef"
6665 fi
6666 set d_suidsafe
6667 eval $setvar
6668
6669 $rm -f reflect flect
6670
6671 : now see if they want to do setuid emulation
6672 echo " "
6673 val="$undef"
6674 case "$d_suidsafe" in
6675 "$define")
6676         val="$undef"
6677         echo "No need to emulate SUID scripts since they are secure here." >&4
6678         ;;
6679 *)
6680         $cat <<EOM
6681 Some systems have disabled setuid scripts, especially systems where
6682 setuid scripts cannot be secure.  On systems where setuid scripts have
6683 been disabled, the setuid/setgid bits on scripts are currently
6684 useless.  It is possible for $package to detect those bits and emulate
6685 setuid/setgid in a secure fashion.  This emulation will only work if
6686 setuid scripts have been disabled in your kernel.
6687
6688 EOM
6689         case "$d_dosuid" in
6690         "$define") dflt=y ;;
6691         *) dflt=n ;;
6692         esac
6693         rp="Do you want to do setuid/setgid emulation?"
6694         . ./myread
6695         case "$ans" in
6696         [yY]*)  val="$define";;
6697         *)      val="$undef";;
6698         esac
6699         ;;
6700 esac
6701 set d_dosuid
6702 eval $setvar
6703
6704 : see if this is a malloc.h system
6705 set malloc.h i_malloc
6706 eval $inhdr
6707
6708 : see if stdlib is available
6709 set stdlib.h i_stdlib
6710 eval $inhdr
6711
6712 : check for void type
6713 echo " "
6714 echo "Checking to see how well your C compiler groks the void type..." >&4
6715 case "$voidflags" in
6716 '')
6717         $cat >try.c <<'EOCP'
6718 #if TRY & 1
6719 void sub() {
6720 #else
6721 sub() {
6722 #endif
6723         extern void moo();      /* function returning void */
6724         void (*goo)();          /* ptr to func returning void */
6725 #if TRY & 8
6726         void *hue;              /* generic ptr */
6727 #endif
6728 #if TRY & 2
6729         void (*foo[10])();
6730 #endif
6731
6732 #if TRY & 4
6733         if(goo == moo) {
6734                 exit(0);
6735         }
6736 #endif
6737         exit(0);
6738 }
6739 int main() { sub(); }
6740 EOCP
6741         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6742                 voidflags=$defvoidused
6743         echo "Good.  It appears to support void to the level $package wants.">&4
6744                 if $contains warning .out >/dev/null 2>&1; then
6745                         echo "However, you might get some warnings that look like this:"
6746                         $cat .out
6747                 fi
6748         else
6749 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6750                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6751                         echo "It supports 1..."
6752                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6753                                 echo "It also supports 2..."
6754                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6755                                         voidflags=7
6756                                         echo "And it supports 4 but not 8 definitely."
6757                                 else
6758                                         echo "It doesn't support 4..."
6759                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6760                                                 voidflags=11
6761                                                 echo "But it supports 8."
6762                                         else
6763                                                 voidflags=3
6764                                                 echo "Neither does it support 8."
6765                                         fi
6766                                 fi
6767                         else
6768                                 echo "It does not support 2..."
6769                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6770                                         voidflags=13
6771                                         echo "But it supports 4 and 8."
6772                                 else
6773                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6774                                                 voidflags=5
6775                                                 echo "And it supports 4 but has not heard about 8."
6776                                         else
6777                                                 echo "However it supports 8 but not 4."
6778                                         fi
6779                                 fi
6780                         fi
6781                 else
6782                         echo "There is no support at all for void."
6783                         voidflags=0
6784                 fi
6785         fi
6786 esac
6787 case "$voidflags" in
6788 "$defvoidused") ;;
6789 *)      $cat >&4 <<'EOM'
6790   Support flag bits are:
6791     1: basic void declarations.
6792     2: arrays of pointers to functions returning void.
6793     4: operations between pointers to and addresses of void functions.
6794     8: generic void pointers.
6795 EOM
6796         dflt="$voidflags";
6797         rp="Your void support flags add up to what?"
6798         . ./myread
6799         voidflags="$ans"
6800         ;;
6801 esac
6802 $rm -f try.* .out
6803
6804 : check for length of pointer
6805 echo " "
6806 case "$ptrsize" in
6807 '')
6808         echo "Checking to see how big your pointers are..." >&4
6809         if test "$voidflags" -gt 7; then
6810                 echo '#define VOID_PTR char *' > try.c
6811         else
6812                 echo '#define VOID_PTR void *' > try.c
6813         fi
6814         $cat >>try.c <<'EOCP'
6815 #include <stdio.h>
6816 int main()
6817 {
6818     printf("%d\n", (int)sizeof(VOID_PTR));
6819     exit(0);
6820 }
6821 EOCP
6822         set try
6823         if eval $compile_ok; then
6824                 ptrsize=`$run ./try`
6825                 echo "Your pointers are $ptrsize bytes long."
6826         else
6827                 dflt='4'
6828                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6829                 rp="What is the size of a pointer (in bytes)?"
6830                 . ./myread
6831                 ptrsize="$ans"
6832         fi
6833         ;;
6834 esac
6835 $rm -f try.c try
6836 case "$use64bitall" in
6837 "$define"|true|[yY]*)
6838         case "$ptrsize" in
6839         4)      cat <<EOM >&4
6840
6841 *** You have chosen a maximally 64-bit build, but your pointers
6842 *** are only 4 bytes wide, disabling maximal 64-bitness.
6843
6844 EOM
6845                 use64bitall="$undef"
6846                 case "$use64bitint" in
6847                 "$define"|true|[yY]*) ;;
6848                 *)      cat <<EOM >&4
6849
6850 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6851
6852 EOM
6853                         use64bitint="$define"
6854                         ;;
6855                 esac
6856                 ;;
6857         esac
6858         ;;
6859 esac
6860
6861
6862 : determine which malloc to compile in
6863 echo " "
6864 case "$usemymalloc" in
6865 [yY]*|true|$define)     dflt='y' ;;
6866 [nN]*|false|$undef)     dflt='n' ;;
6867 *)      case "$ptrsize" in
6868         4) dflt='y' ;;
6869         *) dflt='n' ;;
6870         esac
6871         ;;
6872 esac
6873 rp="Do you wish to attempt to use the malloc that comes with $package?"
6874 . ./myread
6875 usemymalloc="$ans"
6876 case "$ans" in
6877 y*|true)
6878         usemymalloc='y'
6879         mallocsrc='malloc.c'
6880         mallocobj="malloc$_o"
6881         d_mymalloc="$define"
6882         case "$libs" in
6883         *-lmalloc*)
6884                 : Remove malloc from list of libraries to use
6885                 echo "Removing unneeded -lmalloc from library list" >&4
6886                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6887                 shift
6888                 libs="$*"
6889                 echo "libs = $libs" >&4
6890                 ;;
6891         esac
6892         ;;
6893 *)
6894         usemymalloc='n'
6895         mallocsrc=''
6896         mallocobj=''
6897         d_mymalloc="$undef"
6898         ;;
6899 esac
6900
6901 : compute the return types of malloc and free
6902 echo " "
6903 $cat >malloc.c <<END
6904 #$i_malloc I_MALLOC
6905 #$i_stdlib I_STDLIB
6906 #include <stdio.h>
6907 #include <sys/types.h>
6908 #ifdef I_MALLOC
6909 #include <malloc.h>
6910 #endif
6911 #ifdef I_STDLIB
6912 #include <stdlib.h>
6913 #endif
6914 #ifdef TRY_MALLOC
6915 void *malloc();
6916 #endif
6917 #ifdef TRY_FREE
6918 void free();
6919 #endif
6920 END
6921 case "$malloctype" in
6922 '')
6923         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6924                 malloctype='void *'
6925         else
6926                 malloctype='char *'
6927         fi
6928         ;;
6929 esac
6930 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6931
6932 case "$freetype" in
6933 '')
6934         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6935                 freetype='void'
6936         else
6937                 freetype='int'
6938         fi
6939         ;;
6940 esac
6941 echo "Your system uses $freetype free(), it would seem." >&4
6942 $rm -f malloc.[co]
6943 $cat <<EOM
6944
6945 After $package is installed, you may wish to install various
6946 add-on modules and utilities.  Typically, these add-ons will
6947 be installed under $prefix with the rest
6948 of this package.  However, you may wish to install such add-ons
6949 elsewhere under a different prefix.
6950
6951 If you do not wish to put everything under a single prefix, that's
6952 ok.  You will be prompted for the individual locations; this siteprefix
6953 is only used to suggest the defaults.
6954
6955 The default should be fine for most people.
6956
6957 EOM
6958 fn=d~+
6959 rp='Installation prefix to use for add-on modules and utilities?'
6960 : XXX Here might be another good place for an installstyle setting.
6961 case "$siteprefix" in
6962 '') dflt=$prefix ;;
6963 *)  dflt=$siteprefix ;;
6964 esac
6965 . ./getfile
6966 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6967 oldsiteprefix=''
6968 case "$siteprefix" in
6969 '') ;;
6970 *)      case "$ans" in
6971         "$prefix") ;;
6972         *) oldsiteprefix="$prefix";;
6973         esac
6974         ;;
6975 esac
6976 siteprefix="$ans"
6977 siteprefixexp="$ansexp"
6978
6979 : determine where site specific libraries go.
6980 : Usual default is /usr/local/lib/perl5/site_perl/$version
6981 : The default "style" setting is made in installstyle.U
6982 : XXX No longer works with Prefixit stuff.
6983 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6984 case "$sitelib" in
6985 '') case "$installstyle" in
6986         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6987         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6988         esac
6989         ;;
6990 *)      dflt="$sitelib"
6991         ;;
6992 esac
6993 $cat <<EOM
6994
6995 The installation process will create a directory for
6996 site-specific extensions and modules.  Most users find it convenient
6997 to place all site-specific files in this directory rather than in the
6998 main distribution directory.
6999
7000 EOM
7001 fn=d~+
7002 rp='Pathname for the site-specific library files?'
7003 . ./getfile
7004 sitelib="$ans"
7005 sitelibexp="$ansexp"
7006 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7007 : Change installation prefix, if necessary.
7008 if $test X"$prefix" != X"$installprefix"; then
7009         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7010 else
7011         installsitelib="$sitelibexp"
7012 fi
7013
7014 : determine where site specific architecture-dependent libraries go.
7015 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7016 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7017 : sitelib may have an optional trailing /share.
7018 case "$sitearch" in
7019 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7020         dflt="$dflt/$archname"
7021         ;;
7022 *)      dflt="$sitearch"
7023         ;;
7024 esac
7025 set sitearch sitearch none
7026 eval $prefixit
7027 $cat <<EOM
7028
7029 The installation process will also create a directory for
7030 architecture-dependent site-specific extensions and modules.
7031
7032 EOM
7033 fn=d~+
7034 rp='Pathname for the site-specific architecture-dependent library files?'
7035 . ./getfile
7036 sitearch="$ans"
7037 sitearchexp="$ansexp"
7038 : Change installation prefix, if necessary.
7039 if $test X"$prefix" != X"$installprefix"; then
7040         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7041 else
7042         installsitearch="$sitearchexp"
7043 fi
7044
7045 $cat <<EOM
7046
7047 The installation process will also create a directory for
7048 vendor-supplied add-ons.  Vendors who supply perl with their system
7049 may find it convenient to place all vendor-supplied files in this
7050 directory rather than in the main distribution directory.  This will
7051 ease upgrades between binary-compatible maintenance versions of perl.
7052
7053 Of course you may also use these directories in whatever way you see
7054 fit.  For example, you might use them to access modules shared over a
7055 company-wide network.
7056
7057 The default answer should be fine for most people.
7058 This causes further questions about vendor add-ons to be skipped
7059 and no vendor-specific directories will be configured for perl.
7060
7061 EOM
7062 rp='Do you want to configure vendor-specific add-on directories?'
7063 case "$usevendorprefix" in
7064 define|true|[yY]*) dflt=y ;;
7065 *)      : User may have set vendorprefix directly on Configure command line.
7066         case "$vendorprefix" in
7067         ''|' ') dflt=n ;;
7068         *)      dflt=y ;;
7069         esac
7070         ;;
7071 esac
7072 . ./myread
7073 case "$ans" in
7074 [yY]*)  fn=d~+
7075         rp='Installation prefix to use for vendor-supplied add-ons?'
7076         case "$vendorprefix" in
7077         '') dflt='' ;;
7078         *)  dflt=$vendorprefix ;;
7079         esac
7080         . ./getfile
7081         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7082         oldvendorprefix=''
7083         case "$vendorprefix" in
7084         '') ;;
7085         *)      case "$ans" in
7086                 "$prefix") ;;
7087                 *) oldvendorprefix="$prefix";;
7088                 esac
7089                 ;;
7090         esac
7091         usevendorprefix="$define"
7092         vendorprefix="$ans"
7093         vendorprefixexp="$ansexp"
7094         ;;
7095 *)      usevendorprefix="$undef"
7096         vendorprefix=''
7097         vendorprefixexp=''
7098         ;;
7099 esac
7100
7101 case "$vendorprefix" in
7102 '')     d_vendorlib="$undef"
7103         vendorlib=''
7104         vendorlibexp=''
7105         ;;
7106 *)      d_vendorlib="$define"
7107         : determine where vendor-supplied modules go.
7108         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7109         case "$vendorlib" in
7110         '')
7111                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7112                 case "$installstyle" in
7113                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7114                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7115                 esac
7116                 ;;
7117         *)      dflt="$vendorlib"
7118                 ;;
7119         esac
7120         fn=d~+
7121         rp='Pathname for the vendor-supplied library files?'
7122         . ./getfile
7123         vendorlib="$ans"
7124         vendorlibexp="$ansexp"
7125         ;;
7126 esac
7127 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7128 : Change installation prefix, if necessary.
7129 if $test X"$prefix" != X"$installprefix"; then
7130         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7131 else
7132         installvendorlib="$vendorlibexp"
7133 fi
7134
7135 case "$vendorprefix" in
7136 '')     d_vendorarch="$undef"
7137         vendorarch=''
7138         vendorarchexp=''
7139         ;;
7140 *)      d_vendorarch="$define"
7141         : determine where vendor-supplied architecture-dependent libraries go.
7142         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7143         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7144         : vendorlib may have an optional trailing /share.
7145         case "$vendorarch" in
7146         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7147                 dflt="$dflt/$archname"
7148                 ;;
7149         *)      dflt="$vendorarch" ;;
7150         esac
7151         fn=d~+
7152         rp='Pathname for vendor-supplied architecture-dependent files?'
7153         . ./getfile
7154         vendorarch="$ans"
7155         vendorarchexp="$ansexp"
7156         ;;
7157 esac
7158 : Change installation prefix, if necessary.
7159 if $test X"$prefix" != X"$installprefix"; then
7160         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7161 else
7162         installvendorarch="$vendorarchexp"
7163 fi
7164
7165 : Final catch-all directories to search
7166 $cat <<EOM
7167
7168 Lastly, you can have perl look in other directories for extensions and
7169 modules in addition to those already specified.
7170 These directories will be searched after 
7171         $sitearch 
7172         $sitelib 
7173 EOM
7174 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7175 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7176 echo ' '
7177 case "$otherlibdirs" in
7178 ''|' ') dflt='none' ;;
7179 *)      dflt="$otherlibdirs" ;;
7180 esac
7181 $cat <<EOM
7182 Enter a colon-separated set of extra paths to include in perl's @INC
7183 search path, or enter 'none' for no extra paths.
7184
7185 EOM
7186
7187 rp='Colon-separated list of additional directories for perl to search?'
7188 . ./myread
7189 case "$ans" in
7190 ' '|''|none)    otherlibdirs=' ' ;;     
7191 *)      otherlibdirs="$ans" ;;
7192 esac
7193 case "$otherlibdirs" in
7194 ' ') val=$undef ;;
7195 *)      val=$define ;;
7196 esac
7197 set d_perl_otherlibdirs
7198 eval $setvar
7199
7200 : Cruising for prototypes
7201 echo " "
7202 echo "Checking out function prototypes..." >&4
7203 $cat >prototype.c <<'EOCP'
7204 int main(int argc, char *argv[]) {
7205         exit(0);}
7206 EOCP
7207 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7208         echo "Your C compiler appears to support function prototypes."
7209         val="$define"
7210 else
7211         echo "Your C compiler doesn't seem to understand function prototypes."
7212         val="$undef"
7213 fi
7214 set prototype
7215 eval $setvar
7216 $rm -f prototype*
7217
7218 case "$prototype" in
7219 "$define") ;;
7220 *)      ansi2knr='ansi2knr'
7221         echo " "
7222         cat <<EOM >&4
7223
7224 $me:  FATAL ERROR:
7225 This version of $package can only be compiled by a compiler that 
7226 understands function prototypes.  Unfortunately, your C compiler 
7227         $cc $ccflags
7228 doesn't seem to understand them.  Sorry about that.
7229
7230 If GNU cc is available for your system, perhaps you could try that instead.  
7231
7232 Eventually, we hope to support building Perl with pre-ANSI compilers.
7233 If you would like to help in that effort, please contact <perlbug@perl.org>.
7234
7235 Aborting Configure now.
7236 EOM
7237         exit 2
7238         ;;
7239 esac
7240
7241 : determine where public executables go
7242 echo " "
7243 set dflt bin bin
7244 eval $prefixit
7245 fn=d~
7246 rp='Pathname where the public executables will reside?'
7247 . ./getfile
7248 if $test "X$ansexp" != "X$binexp"; then
7249         installbin=''
7250 fi
7251 bin="$ans"
7252 binexp="$ansexp"
7253 : Change installation prefix, if necessary.
7254 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7255 if $test X"$prefix" != X"$installprefix"; then
7256         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7257 else
7258         installbin="$binexp"
7259 fi
7260
7261 echo " "
7262 case "$extras" in
7263 '') dflt='n';;
7264 *) dflt='y';;
7265 esac
7266 cat <<EOM
7267 Perl can be built with extra modules or bundles of modules which
7268 will be fetched from the CPAN and installed alongside Perl.
7269
7270 Notice that you will need access to the CPAN; either via the Internet,
7271 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7272 be asked later to configure the CPAN.pm module which will in turn do
7273 the installation of the rest of the extra modules or bundles.)
7274
7275 Notice also that if the modules require any external software such as
7276 libraries and headers (the libz library and the zlib.h header for the
7277 Compress::Zlib module, for example) you MUST have any such software
7278 already installed, this configuration process will NOT install such
7279 things for you.
7280
7281 If this doesn't make any sense to you, just accept the default '$dflt'.
7282 EOM
7283 rp='Install any extra modules (y or n)?'
7284 . ./myread
7285 case "$ans" in
7286 y|Y)
7287         cat <<EOM
7288
7289 Please list any extra modules or bundles to be installed from CPAN,
7290 with spaces between the names.  The names can be in any format the
7291 'install' command of CPAN.pm will understand.  (Answer 'none',
7292 without the quotes, to install no extra modules or bundles.)
7293 EOM
7294         rp='Extras?'
7295         dflt="$extras"
7296         . ./myread
7297         extras="$ans"
7298 esac
7299 case "$extras" in
7300 ''|'none')
7301         val=''
7302         $rm -f ../extras.lst
7303         ;;
7304 *)      echo "(Saving the list of extras for later...)"
7305         echo "$extras" > ../extras.lst
7306         val="'$extras'"
7307         ;;
7308 esac
7309 set extras
7310 eval $setvar
7311 echo " "
7312
7313 : Find perl5.005 or later.
7314 echo "Looking for a previously installed perl5.005 or later... "
7315 case "$perl5" in
7316 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7317                 : Check if this perl is recent and can load a simple module
7318                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7319                         perl5=$tdir/perl
7320                         break;
7321                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7322                         perl5=$tdir/perl5
7323                         break;
7324                 fi
7325         done
7326         ;;
7327 *)      perl5="$perl5"
7328         ;;
7329 esac
7330 case "$perl5" in
7331 '')     echo "None found.  That's ok.";;
7332 *)      echo "Using $perl5." ;;
7333 esac
7334
7335 : Determine list of previous versions to include in @INC
7336 $cat > getverlist <<EOPL
7337 #!$perl5 -w
7338 use File::Basename;
7339 \$api_versionstring = "$api_versionstring";
7340 \$version = "$version";
7341 \$stem = "$sitelib_stem";
7342 \$archname = "$archname";
7343 EOPL
7344         $cat >> getverlist <<'EOPL'
7345 # Can't have leading @ because metaconfig interprets it as a command!
7346 ;@inc_version_list=();
7347 # XXX Redo to do opendir/readdir? 
7348 if (-d $stem) {
7349     chdir($stem);
7350     ;@candidates = glob("5.*");
7351 }
7352 else {
7353     ;@candidates = ();
7354 }
7355
7356 # XXX ToDo:  These comparisons must be reworked when two-digit
7357 # subversions come along, so that 5.7.10 compares as greater than
7358 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7359 # widespread that we can use the built-in version vectors rather
7360 # than reinventing them here.  For 5.6.0, however, we must
7361 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7362 foreach $d (@candidates) {
7363     if ($d lt $version) {
7364         if ($d ge $api_versionstring) {
7365             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7366         }
7367         elsif ($d ge "5.005") {
7368             unshift(@inc_version_list, grep { -d } $d);
7369         }
7370     }
7371     else {
7372         # Skip newer version.  I.e. don't look in
7373         # 5.7.0 if we're installing 5.6.1.
7374     }
7375 }
7376
7377 if (@inc_version_list) {
7378     print join(' ', @inc_version_list);
7379 }
7380 else {
7381     # Blank space to preserve value for next Configure run.
7382     print " ";
7383 }
7384 EOPL
7385 chmod +x getverlist
7386 case "$inc_version_list" in
7387 '')     if test -x "$perl5$exe_ext"; then
7388                 dflt=`$perl5 getverlist`
7389         else
7390                 dflt='none'
7391         fi
7392         ;;
7393 $undef) dflt='none' ;;
7394 *)  eval dflt=\"$inc_version_list\" ;;
7395 esac
7396 case "$dflt" in
7397 ''|' ') dflt=none ;;
7398 esac
7399 case "$dflt" in
7400 5.005) dflt=none ;;
7401 esac
7402 $cat <<EOM
7403
7404 In order to ease the process of upgrading, this version of perl 
7405 can be configured to use modules built and installed with earlier 
7406 versions of perl that were installed under $prefix.  Specify here
7407 the list of earlier versions that this version of perl should check.
7408 If Configure detected no earlier versions of perl installed under
7409 $prefix, then the list will be empty.  Answer 'none' to tell perl
7410 to not search earlier versions.
7411
7412 The default should almost always be sensible, so if you're not sure,
7413 just accept the default.
7414 EOM
7415
7416 rp='List of earlier versions to include in @INC?'
7417 . ./myread
7418 case "$ans" in
7419 [Nn]one|''|' ') inc_version_list=' ' ;;
7420 *) inc_version_list="$ans" ;;
7421 esac
7422 case "$inc_version_list" in
7423 ''|' ') 
7424         inc_version_list_init='0';;
7425 *)      inc_version_list_init=`echo $inc_version_list |
7426                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7427         ;;
7428 esac
7429 $rm -f getverlist
7430
7431 : determine whether to install perl also as /usr/bin/perl
7432
7433 echo " "
7434 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7435         $cat <<EOM
7436 Many scripts expect perl to be installed as /usr/bin/perl.
7437
7438 If you want to, I can install the perl you are about to compile
7439 as /usr/bin/perl (in addition to $bin/perl).
7440 EOM
7441         if test -f /usr/bin/perl; then
7442             $cat <<EOM
7443
7444 However, please note that because you already have a /usr/bin/perl,
7445 overwriting that with a new Perl would very probably cause problems.
7446 Therefore I'm assuming you don't want to do that (unless you insist).
7447
7448 EOM
7449             case "$installusrbinperl" in
7450             "$define"|[yY]*)    dflt='y';;
7451             *)                  dflt='n';;
7452             esac
7453         else
7454             $cat <<EOM
7455
7456 Since you don't have a /usr/bin/perl I'm assuming creating one is okay. 
7457
7458 EOM
7459             case "$installusrbinperl" in
7460             "$undef"|[nN]*)     dflt='n';;
7461             *)                  dflt='y';;
7462             esac
7463         fi
7464         rp="Do you want to install perl as /usr/bin/perl?"
7465         . ./myread
7466         case "$ans" in
7467         [yY]*)  val="$define";;
7468         *)      val="$undef" ;;
7469         esac
7470 else
7471         val="$undef"
7472 fi
7473 set installusrbinperl
7474 eval $setvar
7475
7476 : see if dld is available
7477 set dld.h i_dld
7478 eval $inhdr
7479
7480 : see if dlopen exists
7481 xxx_runnm="$runnm"
7482 runnm=false
7483 set dlopen d_dlopen
7484 eval $inlibc
7485 runnm="$xxx_runnm"
7486
7487 : determine which dynamic loading, if any, to compile in
7488 echo " "
7489 dldir="ext/DynaLoader"
7490 case "$usedl" in
7491 $define|y|true)
7492         dflt='y'
7493         usedl="$define"
7494         ;;
7495 $undef|n|false)
7496         dflt='n'
7497         usedl="$undef"
7498         ;;
7499 *) 
7500         dflt='n'
7501         case "$d_dlopen" in
7502             $define) dflt='y' ;;
7503         esac
7504         case "$i_dld" in
7505             $define) dflt='y' ;;
7506         esac
7507         : Does a dl_xxx.xs file exist for this operating system
7508         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7509         ;;
7510 esac
7511 rp="Do you wish to use dynamic loading?"
7512 . ./myread
7513 usedl="$ans"
7514 case "$ans" in
7515 y*) usedl="$define"
7516         case "$dlsrc" in
7517         '')
7518                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7519                         dflt="$dldir/dl_${osname}.xs"
7520                 elif $test "$d_dlopen" = "$define" ; then
7521                         dflt="$dldir/dl_dlopen.xs"
7522                 elif $test "$i_dld" = "$define" ; then
7523                         dflt="$dldir/dl_dld.xs"
7524                 else
7525                         dflt=''
7526                 fi
7527                 ;;
7528         *)      dflt="$dldir/$dlsrc"
7529                 ;;
7530         esac
7531     echo "The following dynamic loading files are available:"
7532         : Can not go over to $dldir because getfile has path hard-coded in.
7533         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7534         rp="Source file to use for dynamic loading"
7535         fn="fne"
7536         gfpth="$src"
7537         . ./getfile
7538         usedl="$define"
7539         : emulate basename
7540         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7541
7542         $cat << EOM
7543
7544 Some systems may require passing special flags to $cc -c to
7545 compile modules that will be used to create a shared library.
7546 To use no flags, say "none".
7547
7548 EOM
7549     case "$cccdlflags" in
7550     '') case "$gccversion" in
7551                 '') case "$osname" in
7552                         hpux)   dflt='+z' ;;
7553                         next)   dflt='none' ;;
7554                         irix*)  dflt='-KPIC' ;;
7555                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7556                         sunos)  dflt='-pic' ;;
7557                         *)      dflt='none' ;;
7558                     esac
7559                         ;;
7560                 *)  case "$osname" in
7561                         darwin) dflt='none' ;;
7562                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7563                         *)      dflt='-fpic' ;;
7564                     esac ;;
7565             esac ;;
7566         ' ') dflt='none' ;;
7567     *)  dflt="$cccdlflags" ;;
7568     esac
7569     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7570     . ./myread
7571     case "$ans" in
7572     none) cccdlflags=' ' ;;
7573     *) cccdlflags="$ans" ;;
7574     esac
7575
7576     cat << EOM
7577
7578 Some systems use ld to create libraries that can be dynamically loaded,
7579 while other systems (such as those using ELF) use $cc.
7580
7581 EOM
7582         case "$ld" in
7583         '')     $cat >try.c <<'EOM'
7584 /* Test for whether ELF binaries are produced */
7585 #include <fcntl.h>
7586 #include <stdlib.h>
7587 int main() {
7588         char b[4];
7589         int i = open("a.out",O_RDONLY);
7590         if(i == -1) 
7591                 exit(1); /* fail */
7592         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7593                 exit(0); /* succeed (yes, it's ELF) */
7594         else
7595                 exit(1); /* fail */
7596 }
7597 EOM
7598                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7599                         cat <<EOM
7600 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7601 EOM
7602                         dflt="$cc"
7603                 else
7604                         echo "I'll use ld to build dynamic libraries."
7605                         dflt='ld'
7606                 fi
7607                 rm -f try.c a.out
7608                 ;;
7609         *)      dflt="$ld"
7610                 ;;
7611         esac
7612
7613     rp="What command should be used to create dynamic libraries?"
7614     . ./myread
7615         ld="$ans"
7616
7617     cat << EOM
7618
7619 Some systems may require passing special flags to $ld to create a
7620 library that can be dynamically loaded.  If your ld flags include
7621 -L/other/path options to locate libraries outside your loader's normal
7622 search path, you may need to specify those -L options here as well.  To
7623 use no flags, say "none".
7624
7625 EOM
7626     case "$lddlflags" in
7627     '') case "$osname" in
7628                         beos) dflt='-nostart' ;;
7629                         hpux) dflt='-b';
7630                               case "$gccversion" in
7631                               '') dflt="$dflt +vnocompatwarnings" ;;
7632                               esac
7633                               ;;        
7634                         linux|irix*)    dflt='-shared' ;;
7635                         next)  dflt='none' ;;
7636                         solaris) dflt='-G' ;;
7637                         sunos) dflt='-assert nodefinitions' ;;
7638                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7639                 *)     dflt='none' ;;
7640                         esac
7641                         ;;
7642     *) dflt="$lddlflags" ;;
7643     esac
7644
7645         : Try to guess additional flags to pick up local libraries.
7646         : Be careful not to append to a plain 'none'
7647         case "$dflt" in
7648         none) dflt='' ;;
7649         esac
7650         for thisflag in $ldflags; do
7651                 case "$thisflag" in
7652                 -L*|-R*|-Wl,-R*)
7653                         case " $dflt " in
7654                         *" $thisflag "*) ;;
7655                         *) dflt="$dflt $thisflag" ;;
7656                         esac
7657                         ;;
7658                 esac
7659         done
7660
7661         case "$dflt" in
7662         ''|' ') dflt='none' ;;
7663         esac
7664
7665     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7666     . ./myread
7667     case "$ans" in
7668     none) lddlflags=' ' ;;
7669     *) lddlflags="$ans" ;;
7670     esac
7671
7672         cat <<EOM
7673
7674 Some systems may require passing special flags to $cc to indicate that
7675 the resulting executable will use dynamic linking.  To use no flags,
7676 say "none".
7677
7678 EOM
7679     case "$ccdlflags" in
7680     '') case "$osname" in
7681                 hpux)   dflt='-Wl,-E' ;;
7682                 linux)  dflt='-rdynamic' ;;
7683                 next)   dflt='none' ;;
7684                 sunos)  dflt='none' ;;
7685                 *)      dflt='none' ;;
7686             esac ;;
7687     ' ')  dflt='none' ;;
7688     *)  dflt="$ccdlflags" ;;
7689     esac
7690     rp="Any special flags to pass to $cc to use dynamic linking?"
7691     . ./myread
7692     case "$ans" in
7693     none) ccdlflags=' ' ;;
7694     *) ccdlflags="$ans" ;;
7695     esac
7696     ;;
7697 *)  usedl="$undef"
7698         ld='ld'
7699     dlsrc='dl_none.xs'
7700     lddlflags=''
7701     ccdlflags=''
7702     ;;
7703 esac
7704
7705 also=''
7706 case "$usedl" in
7707 $undef)
7708         # No dynamic loading being used, so don't bother even to prompt.
7709         useshrplib='false'
7710         ;;
7711 *)      case "$useshrplib" in
7712         '')     case "$osname" in
7713                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7714                         dflt=y
7715                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7716                         ;;
7717                 next*)
7718                         case "$osvers" in
7719                         4*)     dflt=y
7720                                 also='Building a shared libperl is needed for MAB support.'
7721                                 ;;
7722                         *)      dflt=n
7723                                 ;;
7724                         esac
7725                         ;;
7726                 *)      dflt=n
7727                         ;;
7728                 esac
7729                 ;;
7730         $define|true|[Yy]*)
7731                 dflt=y
7732                 ;;
7733         *)      dflt=n
7734                 ;;
7735         esac
7736         $cat << EOM
7737
7738 The perl executable is normally obtained by linking perlmain.c with
7739 libperl${_a}, any static extensions (usually just DynaLoader), and
7740 any other libraries needed on this system (such as -lm, etc.).  Since
7741 your system supports dynamic loading, it is probably possible to build
7742 a shared libperl.$so.  If you will have more than one executable linked
7743 to libperl.$so, this will significantly reduce the size of each
7744 executable, but it may have a noticeable affect on performance.  The
7745 default is probably sensible for your system.
7746 $also
7747
7748 EOM
7749         rp="Build a shared libperl.$so (y/n)"
7750         . ./myread
7751         case "$ans" in
7752         true|$define|[Yy]*)
7753                 useshrplib='true'  ;;
7754         *)      useshrplib='false' ;;
7755         esac
7756         ;;
7757 esac
7758
7759 case "$useshrplib" in
7760 true)
7761         case "$libperl" in
7762         '')
7763                 # Figure out a good name for libperl.so.  Since it gets stored in
7764                 # a version-specific architecture-dependent library, the version
7765                 # number isn't really that important, except for making cc/ld happy.
7766                 #
7767                 # A name such as libperl.so.3.1
7768                 majmin="libperl.$so.$patchlevel.$subversion"
7769                 # A name such as libperl.so.301
7770                 majonly=`echo $patchlevel $subversion |
7771                         $awk '{printf "%d%02d", $1, $2}'`
7772                 majonly=libperl.$so.$majonly
7773                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7774                 # rely on figuring it out from the naming of libc.
7775                 case "${osname}${osvers}" in
7776                 next4*)
7777                         dflt=libperl.5.$so
7778                         # XXX How handle the --version stuff for MAB?
7779                         ;;
7780                 linux*)  # ld won't link with a bare -lperl otherwise.
7781                         dflt=libperl.$so
7782                         ;;
7783                 cygwin*) # ld links against an importlib
7784                         dflt=libperl$lib_ext
7785                         ;;
7786                 *)      # Try to guess based on whether libc has major.minor.
7787                         case "$libc" in
7788                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7789                         *libc.$so.[0-9]*) dflt=$majonly ;;
7790                         *)      dflt=libperl.$so ;;
7791                         esac
7792                         ;;
7793                 esac
7794                 ;;
7795         *)      dflt=$libperl
7796                 ;;
7797         esac
7798         cat << EOM
7799
7800 I need to select a good name for the shared libperl.  If your system uses
7801 library names with major and minor numbers, then you might want something
7802 like $majmin.  Alternatively, if your system uses a single version
7803 number for shared libraries, then you might want to use $majonly.
7804 Or, your system might be quite happy with a simple libperl.$so.
7805
7806 Since the shared libperl will get installed into a version-specific
7807 architecture-dependent directory, the version number of the shared perl
7808 library probably isn't important, so the default should be o.k.
7809
7810 EOM
7811         rp='What name do you want to give to the shared libperl?'
7812         . ./myread
7813         libperl=$ans
7814         echo "Ok, I'll use $libperl"
7815         ;;
7816 *)
7817         libperl="libperl${_a}"
7818         ;;
7819 esac
7820
7821 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7822 case "$shrpdir" in
7823 '') ;;
7824 *)      $cat >&4 <<EOM
7825 WARNING:  Use of the shrpdir variable for the installation location of
7826 the shared $libperl is not supported.  It was never documented and
7827 will not work in this version.  Let me (perlbug@perl.org)
7828 know of any problems this may cause.
7829
7830 EOM
7831         case "$shrpdir" in
7832         "$archlibexp/CORE")
7833                 $cat >&4 <<EOM
7834 But your current setting of $shrpdir is
7835 the default anyway, so it's harmless.
7836 EOM
7837                 ;;
7838         *)
7839                 $cat >&4 <<EOM
7840 Further, your current attempted setting of $shrpdir
7841 conflicts with the value of $archlibexp/CORE
7842 that installperl will use.
7843 EOM
7844                 ;;
7845         esac
7846         ;;
7847 esac
7848
7849 # How will the perl executable find the installed shared $libperl?
7850 # Add $xxx to ccdlflags.
7851 # If we can't figure out a command-line option, use $shrpenv to
7852 # set env LD_RUN_PATH.  The main perl makefile uses this.
7853 shrpdir=$archlibexp/CORE
7854 xxx=''
7855 tmp_shrpenv=''
7856 if "$useshrplib"; then
7857     case "$osname" in 
7858         aix)
7859                 # We'll set it in Makefile.SH...
7860                 ;;
7861         solaris)
7862                 xxx="-R $shrpdir"
7863                 ;;
7864         freebsd|netbsd)
7865                 xxx="-Wl,-R$shrpdir"
7866                 ;;
7867         bsdos|linux|irix*|dec_osf)
7868                 xxx="-Wl,-rpath,$shrpdir"
7869                 ;;
7870         next)
7871                 # next doesn't like the default...
7872                 ;;
7873         beos)
7874                 # beos doesn't like the default, either.
7875                 ;;
7876         hpux*)
7877                 # hpux doesn't like the default, either.
7878                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7879                 ;;
7880         *)
7881                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7882                 ;;
7883         esac
7884         case "$xxx" in
7885         '') ;;
7886         *)      
7887                 # Only add $xxx if it isn't already in ccdlflags.
7888                 case " $ccdlflags " in
7889                 *" $xxx "*)     ;;
7890                 *)      ccdlflags="$ccdlflags $xxx"
7891                         cat <<EOM >&4
7892
7893 Adding $xxx to the flags
7894 passed to $ld so that the perl executable will find the 
7895 installed shared $libperl.
7896
7897 EOM
7898                         ;;
7899                 esac
7900                 ;;
7901         esac
7902 fi
7903 # Fix ccdlflags in AIX for building external extensions.
7904 # (For building Perl itself bare -bE:perl.exp is needed,
7905 #  Makefile.SH takes care of this.)
7906 case "$osname" in
7907 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7908 esac
7909 # Respect a hint or command-line value.
7910 case "$shrpenv" in
7911 '') shrpenv="$tmp_shrpenv" ;;
7912 esac
7913 case "$ldlibpthname" in
7914 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7915 none)   ldlibpthname='' ;;
7916 esac
7917
7918 : determine where manual pages are on this system
7919 echo " "
7920 case "$sysman" in
7921 '') 
7922         syspath='/usr/share/man/man1 /usr/man/man1'
7923         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7924         syspath="$syspath /usr/man/u_man/man1"
7925         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7926         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7927         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7928         sysman=`./loc . /usr/man/man1 $syspath`
7929         ;;
7930 esac
7931 if $test -d "$sysman"; then
7932         echo "System manual is in $sysman." >&4
7933 else
7934         echo "Could not find manual pages in source form." >&4
7935 fi
7936
7937 : determine where manual pages go
7938 set man1dir man1dir none
7939 eval $prefixit
7940 $cat <<EOM
7941
7942 $spackage has manual pages available in source form.
7943 EOM
7944 case "$nroff" in
7945 nroff)
7946         echo "However, you don't have nroff, so they're probably useless to you."
7947         case "$man1dir" in
7948         '') man1dir="none";;
7949         esac;;
7950 esac
7951 echo "If you don't want the manual sources installed, answer 'none'."
7952 case "$man1dir" in
7953 ' ') dflt=none
7954         ;;
7955 '')
7956         lookpath="$prefixexp/share/man/man1"
7957         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7958         lookpath="$lookpath $prefixexp/man/p_man/man1"
7959         lookpath="$lookpath $prefixexp/man/u_man/man1"
7960         lookpath="$lookpath $prefixexp/man/man.1"
7961         case "$sysman" in
7962         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7963         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7964         esac
7965         set dflt
7966         eval $prefixup
7967         ;;
7968 *)  dflt="$man1dir"
7969         ;;
7970 esac
7971 echo " "
7972 fn=dn+~
7973 rp="Where do the main $spackage manual pages (source) go?"
7974 . ./getfile
7975 if $test "X$man1direxp" != "X$ansexp"; then
7976         installman1dir=''
7977 fi
7978 man1dir="$ans"
7979 man1direxp="$ansexp"
7980 case "$man1dir" in
7981 '')     man1dir=' '
7982         installman1dir='';;
7983 esac
7984
7985 : Change installation prefix, if necessary.
7986 if $test X"$prefix" != X"$installprefix"; then
7987         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7988 else
7989         installman1dir="$man1direxp"
7990 fi
7991
7992 : What suffix to use on installed man pages
7993
7994 case "$man1dir" in
7995 ' ')
7996         man1ext='0'
7997         ;;
7998 *)
7999         rp="What suffix should be used for the main $spackage man pages?"
8000         case "$man1ext" in
8001         '')     case "$man1dir" in
8002                 *1)  dflt=1 ;;
8003                 *1p) dflt=1p ;;
8004                 *1pm) dflt=1pm ;;
8005                 *l) dflt=l;;
8006                 *n) dflt=n;;
8007                 *o) dflt=o;;
8008                 *p) dflt=p;;
8009                 *C) dflt=C;;
8010                 *L) dflt=L;;
8011                 *L1) dflt=L1;;
8012                 *) dflt=1;;
8013                 esac
8014                 ;;
8015         *)      dflt="$man1ext";;
8016         esac
8017         . ./myread
8018         man1ext="$ans"
8019         ;;
8020 esac
8021
8022 : see if we can have long filenames
8023 echo " "
8024 first=123456789abcdef
8025 $rm -f $first
8026 if (echo hi >$first) 2>/dev/null; then
8027         if $test -f 123456789abcde; then
8028                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8029                 val="$undef"
8030         else
8031                 echo 'You can have filenames longer than 14 characters.'>&4
8032                 val="$define"
8033         fi
8034 else
8035         $cat <<'EOM'
8036 You can't have filenames longer than 14 chars.
8037 You can't even think about them!
8038 EOM
8039         val="$undef"
8040 fi 
8041 set d_flexfnam
8042 eval $setvar
8043 $rm -rf 123456789abcde*
8044
8045 : determine where library module manual pages go
8046 set man3dir man3dir none
8047 eval $prefixit
8048 $cat <<EOM
8049
8050 $spackage has manual pages for many of the library modules.
8051 EOM
8052
8053 case "$nroff" in
8054 nroff)
8055         $cat <<'EOM'
8056 However, you don't have nroff, so they're probably useless to you.
8057 EOM
8058         case "$man3dir" in
8059         '') man3dir="none";;
8060         esac;;
8061 esac
8062
8063 case "$d_flexfnam" in
8064 undef)
8065         $cat <<'EOM'
8066 However, your system can't handle the long file names like File::Basename.3. 
8067 EOM
8068         case "$man3dir" in
8069         '') man3dir="none";;
8070         esac;;
8071 esac
8072
8073 echo "If you don't want the manual sources installed, answer 'none'."
8074 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8075 case "$man3dir" in
8076 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8077         if $test -d "$privlib/man/man3"; then
8078                 cat <<EOM >&4
8079
8080 WARNING:  Previous versions of perl installed man3 pages into
8081 $privlib/man/man3.  This version will suggest a 
8082 new default of $dflt.  
8083 EOM
8084                 tdflt=$dflt
8085                 dflt='n'
8086                 rp='Do you wish to preserve the old behavior?(y/n)'
8087                 . ./myread
8088                 case "$ans" in
8089                 y*) dflt="$privlib/man/man3" ;;
8090                 *)  dflt=$tdflt ;;
8091                 esac
8092     fi
8093         ;;
8094 *)      dflt="$man3dir" ;;
8095 esac
8096 case "$dflt" in
8097 ' ') dflt=none ;;
8098 esac
8099 echo " "
8100 fn=dn+~
8101 rp="Where do the $package library man pages (source) go?"
8102 . ./getfile
8103 man3dir="$ans"
8104 man3direxp="$ansexp"
8105 case "$man3dir" in
8106 '')     man3dir=' '
8107         installman3dir='';;
8108 esac
8109
8110 : Change installation prefix, if necessary.
8111 if $test X"$prefix" != X"$installprefix"; then
8112         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8113 else
8114         installman3dir="$man3direxp"
8115 fi
8116
8117 : What suffix to use on installed man pages
8118 case "$man3dir" in
8119 ' ')
8120         man3ext='0'
8121         ;;
8122 *)
8123         rp="What suffix should be used for the $package library man pages?"
8124         case "$man3ext" in
8125         '')     case "$man3dir" in
8126                 *3)  dflt=3 ;;
8127                 *3p) dflt=3p ;;
8128                 *3pm) dflt=3pm ;;
8129                 *l) dflt=l;;
8130                 *n) dflt=n;;
8131                 *o) dflt=o;;
8132                 *p) dflt=p;;
8133                 *C) dflt=C;;
8134                 *L) dflt=L;;
8135                 *L3) dflt=L3;;
8136                 *) dflt=3;;
8137                 esac
8138                 ;;
8139         *)      dflt="$man3ext";;
8140         esac
8141         . ./myread
8142         man3ext="$ans"
8143         ;;
8144 esac
8145
8146 : see if we have to deal with yellow pages, now NIS.
8147 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8148         if $test -f /usr/etc/nibindd; then
8149                 echo " "
8150                 echo "I'm fairly confident you're on a NeXT."
8151                 echo " "
8152                 rp='Do you get the hosts file via NetInfo?'
8153                 dflt=y
8154                 case "$hostcat" in
8155                 nidump*) ;;
8156                 '') ;;
8157                 *) dflt=n;;
8158                 esac
8159                 . ./myread
8160                 case "$ans" in
8161                 y*) hostcat='nidump hosts .';;
8162                 *)      case "$hostcat" in
8163                         nidump*) hostcat='';;
8164                         esac
8165                         ;;
8166                 esac
8167         fi
8168         case "$hostcat" in
8169         nidump*) ;;
8170         *)
8171                 case "$hostcat" in
8172                 *ypcat*) dflt=y;;
8173                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8174                                 dflt=y
8175                         else
8176                                 dflt=n
8177                         fi;;
8178                 *) dflt=n;;
8179                 esac
8180                 echo " "
8181                 rp='Are you getting the hosts file via yellow pages?'
8182                 . ./myread
8183                 case "$ans" in
8184                 y*) hostcat='ypcat hosts';;
8185                 *) hostcat='cat /etc/hosts';;
8186                 esac
8187                 ;;
8188         esac
8189 fi
8190 case "$hostcat" in
8191 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8192 esac
8193 case "$groupcat" in
8194 '') test -f /etc/group && groupcat='cat /etc/group';;
8195 esac
8196 case "$passcat" in
8197 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8198 esac
8199
8200 : now get the host name
8201 echo " "
8202 echo "Figuring out host name..." >&4
8203 case "$myhostname" in
8204 '') cont=true
8205         echo 'Maybe "hostname" will work...'
8206         if tans=`sh -c hostname 2>&1` ; then
8207                 myhostname=$tans
8208                 phostname=hostname
8209                 cont=''
8210         fi
8211         ;;
8212 *) cont='';;
8213 esac
8214 if $test "$cont"; then
8215         if ./xenix; then
8216                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8217                 if tans=`cat /etc/systemid 2>&1` ; then
8218                         myhostname=$tans
8219                         phostname='cat /etc/systemid'
8220                         echo "Whadyaknow.  Xenix always was a bit strange..."
8221                         cont=''
8222                 fi
8223         elif $test -r /etc/systemid; then
8224                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8225         fi
8226 fi
8227 if $test "$cont"; then
8228         echo 'No, maybe "uuname -l" will work...'
8229         if tans=`sh -c 'uuname -l' 2>&1` ; then
8230                 myhostname=$tans
8231                 phostname='uuname -l'
8232         else
8233                 echo 'Strange.  Maybe "uname -n" will work...'
8234                 if tans=`sh -c 'uname -n' 2>&1` ; then
8235                         myhostname=$tans
8236                         phostname='uname -n'
8237                 else
8238                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8239                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8240                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8241                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8242                         else
8243                                 case "$myhostname" in
8244                                 '') echo "Does this machine have an identity crisis or something?"
8245                                         phostname='';;
8246                                 *)
8247                                         echo "Well, you said $myhostname before..."
8248                                         phostname='echo $myhostname';;
8249                                 esac
8250                         fi
8251                 fi
8252         fi
8253 fi
8254 case "$myhostname" in
8255 '') myhostname=noname ;;
8256 esac
8257 : you do not want to know about this
8258 set $myhostname
8259 myhostname=$1
8260
8261 : verify guess
8262 if $test "$myhostname" ; then
8263         dflt=y
8264         rp='Your host name appears to be "'$myhostname'".'" Right?"
8265         . ./myread
8266         case "$ans" in
8267         y*) ;;
8268         *) myhostname='';;
8269         esac
8270 fi
8271
8272 : bad guess or no guess
8273 while $test "X$myhostname" = X ; do
8274         dflt=''
8275         rp="Please type the (one word) name of your host:"
8276         . ./myread
8277         myhostname="$ans"
8278 done
8279
8280 : translate upper to lower if necessary
8281 case "$myhostname" in
8282 *[A-Z]*)
8283         echo "(Normalizing case in your host name)"
8284         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8285         ;;
8286 esac
8287
8288 case "$myhostname" in
8289 *.*)
8290         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8291         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8292         echo "(Trimming domain name from host name--host name is now $myhostname)"
8293         ;;
8294 *) case "$mydomain" in
8295         '')
8296                 {
8297                         test "X$hostcat" = "Xypcat hosts" &&
8298                         ypmatch "$myhostname" hosts 2>/dev/null |\
8299                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8300                         $test -s hosts
8301                 } || {
8302                         test "X$hostcat" != "X" &&
8303                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8304                                         /[       ]$myhostname[  . ]/p" > hosts
8305                 }
8306                 tmp_re="[       . ]"
8307                 if $test -f hosts; then
8308                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8309                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8310                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8311                                 hosts | $sort | $uniq | \
8312                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8313                         case `$echo X$dflt` in
8314                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8315                                 dflt=.
8316                                 ;;
8317                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8318                                 ;;
8319                         esac
8320                 else
8321                         echo "(I cannot locate a hosts database anywhere)"
8322                         dflt=.
8323                 fi
8324                 case "$dflt" in
8325                 .)
8326                         tans=`./loc resolv.conf X /etc /usr/etc`
8327                         if $test -f "$tans"; then
8328                                 echo "(Attempting domain name extraction from $tans)"
8329                                 dflt=.`$sed -n -e 's/   / /g' \
8330                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8331                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8332                                 case "$dflt" in
8333                                 .) dflt=.`$sed -n -e 's/        / /g' \
8334                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8335                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8336                                         ;;
8337                                 esac
8338                         fi
8339                         ;;
8340                 esac
8341                 case "$dflt" in
8342                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8343                         dflt=.`sh -c domainname 2>/dev/null`
8344                         case "$dflt" in
8345                         '') dflt='.';;
8346                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8347                         esac
8348                         ;;
8349                 esac
8350                 case "$dflt$osname" in
8351                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8352                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8353                         ;;
8354                 esac
8355                 case "$dflt" in
8356                 .) echo "(Lost all hope -- silly guess then)"
8357                         dflt='.nonet'
8358                         ;;
8359                 esac
8360                 $rm -f hosts
8361                 ;;
8362         *) dflt="$mydomain";;
8363         esac;;
8364 esac
8365 echo " "
8366 rp="What is your domain name?"
8367 . ./myread
8368 tans="$ans"
8369 case "$ans" in
8370 '') ;;
8371 .*) ;;
8372 *) tans=".$tans";;
8373 esac
8374 mydomain="$tans"
8375
8376 : translate upper to lower if necessary
8377 case "$mydomain" in
8378 *[A-Z]*)
8379         echo "(Normalizing case in your domain name)"
8380         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8381         ;;
8382 esac
8383
8384 : a little sanity check here
8385 case "$phostname" in
8386 '') ;;
8387 *)
8388         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8389         $myhostname$mydomain|$myhostname) ;;
8390         *)
8391                 case "$phostname" in
8392                 sed*)
8393                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8394                         ;;
8395                 *)
8396                         echo "(That doesn't agree with your $phostname command, by the way.)"
8397                         ;;
8398                 esac
8399         ;;
8400         esac
8401         ;;
8402 esac
8403
8404 $cat <<EOM
8405
8406 I need to get your e-mail address in Internet format if possible, i.e.
8407 something like user@host.domain. Please answer accurately since I have
8408 no easy means to double check it. The default value provided below
8409 is most probably close to reality but may not be valid from outside
8410 your organization...
8411
8412 EOM
8413 cont=x
8414 while test "$cont"; do
8415         case "$cf_email" in
8416         '') dflt="$cf_by@$myhostname$mydomain";;
8417         *) dflt="$cf_email";;
8418         esac
8419         rp='What is your e-mail address?'
8420         . ./myread
8421         cf_email="$ans"
8422         case "$cf_email" in
8423         *@*.*) cont='' ;;
8424         *)
8425                 rp='Address does not look like an Internet one.  Use it anyway?'
8426                 case "$fastread" in
8427                 yes) dflt=y ;;
8428                 *) dflt=n ;;
8429                 esac
8430                 . ./myread
8431                 case "$ans" in
8432                 y*) cont='' ;;
8433                 *) echo " " ;;
8434                 esac
8435                 ;;
8436         esac
8437 done
8438
8439 $cat <<EOM
8440
8441 If you or somebody else will be maintaining perl at your site, please
8442 fill in the correct e-mail address here so that they may be contacted
8443 if necessary. Currently, the "perlbug" program included with perl
8444 will send mail to this address in addition to perlbug@perl.org. You may
8445 enter "none" for no administrator.
8446
8447 EOM
8448 case "$perladmin" in
8449 '') dflt="$cf_email";;
8450 *) dflt="$perladmin";;
8451 esac
8452 rp='Perl administrator e-mail address'
8453 . ./myread
8454 perladmin="$ans"
8455
8456 : determine whether to only install version-specific parts.
8457 echo " "
8458 $cat <<EOM
8459 Do you want to install only the version-specific parts of the perl
8460 distribution?  Usually you do *not* want to do this.
8461 EOM
8462 case "$versiononly" in
8463 "$define"|[Yy]*|true) dflt='y' ;;
8464 *) dflt='n';
8465 esac
8466 rp="Do you want to install only the version-specific parts of perl?"
8467 . ./myread
8468 case "$ans" in
8469 [yY]*)  val="$define";;
8470 *)      val="$undef" ;;
8471 esac
8472 set versiononly
8473 eval $setvar
8474
8475 case "$versiononly" in
8476 "$define") inc_version_list=''
8477            inc_version_list_init=0
8478            ;;
8479 esac
8480
8481 : figure out how to guarantee perl startup
8482 case "$startperl" in
8483 '')
8484         case "$sharpbang" in
8485         *!)
8486                 $cat <<EOH
8487
8488 I can use the #! construct to start perl on your system. This will
8489 make startup of perl scripts faster, but may cause problems if you
8490 want to share those scripts and perl is not in a standard place
8491 ($binexp/perl) on all your platforms. The alternative is to force
8492 a shell by starting the script with a single ':' character.
8493
8494 EOH
8495                 case "$versiononly" in
8496                 "$define")      dflt="$binexp/perl$version";;  
8497                 *)              dflt="$binexp/perl";;
8498                 esac
8499                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8500                 . ./myread
8501                 case "$ans" in
8502                 none)   startperl=": # use perl";;
8503                 *)      startperl="#!$ans"
8504                         if $test 30 -lt `echo "$ans" | wc -c`; then
8505                                 $cat >&4 <<EOM
8506
8507 WARNING:  Some systems limit the #! command to 32 characters.
8508 If you experience difficulty running Perl scripts with #!, try
8509 installing Perl in a directory with a shorter pathname.
8510
8511 EOM
8512                         fi ;;
8513                 esac
8514                 ;;
8515         *) startperl=": # use perl"
8516                 ;;
8517         esac
8518         ;;
8519 esac
8520 echo "I'll use $startperl to start perl scripts."
8521
8522 : figure best path for perl in scripts
8523 case "$perlpath" in
8524 '')
8525         case "$versiononly" in
8526         "$define")      perlpath="$binexp/perl$version";;
8527         *)              perlpath="$binexp/perl";;
8528         esac
8529         case "$startperl" in
8530         *!*) ;;
8531         *)
8532                 $cat <<EOH
8533
8534 I will use the "eval 'exec'" idiom to start Perl on your system.
8535 I can use the full path of your Perl binary for this purpose, but
8536 doing so may cause problems if you want to share those scripts and
8537 Perl is not always in a standard place ($binexp/perl).
8538
8539 EOH
8540                 dflt="$binexp/perl"
8541                 rp="What path shall I use in \"eval 'exec'\"?"
8542                 . ./myread
8543                 perlpath="$ans"
8544                 ;;
8545         esac
8546         ;;
8547 esac
8548 case "$startperl" in
8549 *!*)    ;;
8550 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8551 esac
8552
8553 : determine where public executable scripts go
8554 set scriptdir scriptdir
8555 eval $prefixit
8556 case "$scriptdir" in
8557 '')
8558         dflt="$bin"
8559         : guess some guesses
8560         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8561         $test -d /usr/share/bin     && dflt=/usr/share/bin
8562         $test -d /usr/local/script  && dflt=/usr/local/script
8563         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8564         $test -d $prefixexp/script  && dflt=$prefixexp/script
8565         set dflt
8566         eval $prefixup
8567         ;;
8568 *)  dflt="$scriptdir"
8569         ;;
8570 esac
8571 $cat <<EOM
8572  
8573 Some installations have a separate directory just for executable scripts so
8574 that they can mount it across multiple architectures but keep the scripts in
8575 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8576 Or you might just lump your scripts in with all your other executables.
8577  
8578 EOM
8579 fn=d~
8580 rp='Where do you keep publicly executable scripts?'
8581 . ./getfile
8582 if $test "X$ansexp" != "X$scriptdirexp"; then
8583         installscript=''
8584 fi
8585 scriptdir="$ans"
8586 scriptdirexp="$ansexp"
8587 : Change installation prefix, if necessary.
8588 if $test X"$prefix" != X"$installprefix"; then
8589         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8590 else
8591         installscript="$scriptdirexp"
8592 fi
8593
8594 : determine where add-on public executables go
8595 case "$sitebin" in
8596 '')     dflt=$siteprefix/bin ;;
8597 *)      dflt=$sitebin ;;
8598 esac
8599 fn=d~
8600 rp='Pathname where the add-on public executables should be installed?'
8601 . ./getfile
8602 sitebin="$ans"
8603 sitebinexp="$ansexp"
8604 : Change installation prefix, if necessary.
8605 if $test X"$prefix" != X"$installprefix"; then
8606         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8607 else
8608         installsitebin="$sitebinexp"
8609 fi
8610
8611 : define an is-a-typedef? function
8612 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8613 case "$inclist" in
8614 "") inclist="sys/types.h";;
8615 esac;
8616 eval "varval=\$$var";
8617 case "$varval" in
8618 "")
8619         $rm -f temp.c;
8620         for inc in $inclist; do
8621                 echo "#include <$inc>" >>temp.c;
8622         done;
8623         echo "#ifdef $type" >> temp.c;
8624         echo "printf(\"We have $type\");" >> temp.c;
8625         echo "#endif" >> temp.c;
8626         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8627         if $contains $type temp.E >/dev/null 2>&1; then
8628                 eval "$var=\$type";
8629         else
8630                 eval "$var=\$def";
8631         fi;
8632         $rm -f temp.?;;
8633 *) eval "$var=\$varval";;
8634 esac'
8635
8636 : define an is-a-typedef? function that prompts if the type is not available.
8637 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8638 case "$inclist" in
8639 "") inclist="sys/types.h";;
8640 esac;
8641 eval "varval=\$$var";
8642 case "$varval" in
8643 "")
8644         $rm -f temp.c;
8645         for inc in $inclist; do
8646                 echo "#include <$inc>" >>temp.c;
8647         done;
8648         echo "#ifdef $type" >> temp.c;
8649         echo "printf(\"We have $type\");" >> temp.c;
8650         echo "#endif" >> temp.c;
8651         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8652         echo " " ;
8653         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8654         if $contains $type temp.E >/dev/null 2>&1; then
8655                 echo "$type found." >&4;
8656                 eval "$var=\$type";
8657         else
8658                 echo "$type NOT found." >&4;
8659                 dflt="$def";
8660                 . ./myread ;
8661                 eval "$var=\$ans";
8662         fi;
8663         $rm -f temp.?;;
8664 *) eval "$var=\$varval";;
8665 esac'
8666
8667 : see what type lseek is declared as in the kernel
8668 rp="What is the type used for lseek's offset on this system?"
8669 set off_t lseektype long stdio.h sys/types.h
8670 eval $typedef_ask
8671
8672 echo " "
8673 echo "Checking to see how big your file offsets are..." >&4
8674 $cat >try.c <<EOCP
8675 #include <sys/types.h>
8676 #include <stdio.h>
8677 int main()
8678 {
8679     printf("%d\n", (int)sizeof($lseektype));
8680     return(0); 
8681 }
8682 EOCP
8683 set try
8684 if eval $compile_ok; then
8685         lseeksize=`$run ./try`
8686         echo "Your file offsets are $lseeksize bytes long."
8687 else
8688         dflt=$longsize
8689         echo " "
8690         echo "(I can't seem to compile the test program.  Guessing...)"
8691         rp="What is the size of your file offsets (in bytes)?"
8692         . ./myread
8693         lseeksize="$ans"
8694 fi
8695 $rm -f try.c try
8696
8697 : see what type file positions are declared as in the library
8698 rp="What is the type for file position used by fsetpos()?"
8699 set fpos_t fpostype long stdio.h sys/types.h
8700 eval $typedef_ask
8701
8702 echo " "
8703 case "$fpostype" in
8704 *_t) zzz="$fpostype"    ;;
8705 *)   zzz="fpos_t"       ;;
8706 esac
8707 echo "Checking the size of $zzz..." >&4 
8708 cat > try.c <<EOCP
8709 #include <sys/types.h>
8710 #include <stdio.h>
8711 int main() {
8712     printf("%d\n", (int)sizeof($fpostype));
8713     exit(0);
8714 }
8715 EOCP
8716 set try
8717 if eval $compile_ok; then
8718         yyy=`$run ./try`
8719         case "$yyy" in
8720         '')     fpossize=4
8721                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8722                 ;;
8723         *)      fpossize=$yyy
8724                 echo "Your $zzz is $fpossize bytes long."
8725                 ;;
8726         esac
8727 else
8728         dflt="$longsize"
8729         echo " " >&4
8730         echo "(I can't compile the test program.  Guessing...)" >&4
8731         rp="What is the size of your file positions (in bytes)?"
8732         . ./myread
8733         fpossize="$ans"
8734 fi
8735
8736
8737
8738 # Backward compatibility (uselfs is deprecated).
8739 case "$uselfs" in
8740 "$define"|true|[yY]*)
8741         cat <<EOM >&4
8742
8743 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8744 EOM
8745         uselargefiles="$define"
8746         ;;
8747 esac                          
8748
8749 case "$lseeksize:$fpossize" in
8750 8:8) cat <<EOM
8751
8752 You can have files larger than 2 gigabytes.
8753 EOM
8754    val="$define" ;;
8755 *)    case "$uselargefiles" in
8756    "$undef"|false|[nN]*) dflt='n' ;;
8757    *)   dflt='y' ;;
8758    esac
8759    cat <<EOM
8760
8761 Perl can be built to understand large files (files larger than 2 gigabytes)
8762 on some systems.  To do so, Configure can be run with -Duselargefiles.
8763
8764 If this doesn't make any sense to you, just accept the default '$dflt'.
8765 EOM
8766    rp='Try to understand large files, if available?'
8767    . ./myread
8768    case "$ans" in
8769    y|Y)         val="$define" ;;
8770    *)           val="$undef"  ;;
8771    esac
8772    ;;
8773 esac
8774 set uselargefiles
8775 eval $setvar
8776 case "$uselargefiles" in
8777 "$define")
8778 : Look for a hint-file generated 'call-back-unit'.  If the
8779 : user has specified that a large files perl is to be built,
8780 : we may need to set or change some other defaults.
8781         if $test -f uselargefiles.cbu; then
8782                 echo "Your platform has some specific hints for large file builds, using them..."
8783                 . ./uselargefiles.cbu
8784                 echo " "
8785                 echo "Rechecking to see how big your file offsets are..." >&4
8786                 $cat >try.c <<EOCP
8787 #include <sys/types.h>
8788 #include <stdio.h>
8789 int main()
8790 {
8791     printf("%d\n", (int)sizeof($lseektype));
8792     return(0); 
8793 }
8794 EOCP
8795                 set try
8796                 if eval $compile_ok; then
8797                         lseeksize=`$run ./try`
8798                         $echo "Your file offsets are now $lseeksize bytes long."
8799                 else
8800                         dflt="$lseeksize"
8801                         echo " "
8802                         echo "(I can't seem to compile the test program.  Guessing...)"
8803                         rp="What is the size of your file offsets (in bytes)?"
8804                         . ./myread
8805                         lseeksize="$ans"
8806                 fi
8807                 case "$fpostype" in
8808                 *_t) zzz="$fpostype"    ;;
8809                 *)   zzz="fpos_t"       ;;
8810                 esac
8811                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8812                 $cat > try.c <<EOCP
8813 #include <sys/types.h>
8814 #include <stdio.h>
8815 int main() {
8816     printf("%d\n", (int)sizeof($fpostype));
8817     exit(0);
8818 }
8819 EOCP
8820                 set try
8821                 if eval $compile_ok; then
8822                         yyy=`$run ./try`
8823                         dflt="$lseeksize"
8824                         case "$yyy" in
8825                         '')     echo " "
8826                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8827                                 ;;
8828                         *)      fpossize=$yyy
8829                                 echo " $fpossize bytes." >&4
8830                                 ;;
8831                         esac
8832                 else
8833                         dflt="$fpossize"
8834                         echo " "
8835                         echo "(I can't compile the test program.  Guessing...)" >&4
8836                         rp="What is the size of your file positions (in bytes)?"
8837                         . ./myread
8838                         fpossize="$ans"
8839                 fi
8840                 $rm -f try.c try
8841         fi
8842         ;;
8843 esac
8844
8845 case "$vendorprefix" in
8846 '')     d_vendorbin="$undef"
8847         vendorbin=''
8848         vendorbinexp=''
8849         ;;
8850 *)      d_vendorbin="$define"
8851         : determine where vendor-supplied executables go.
8852         case "$vendorbin" in
8853         '') dflt=$vendorprefix/bin ;;
8854         *)      dflt="$vendorbin" ;;
8855         esac
8856         fn=d~+
8857         rp='Pathname for the vendor-supplied executables directory?'
8858         . ./getfile
8859         vendorbin="$ans"
8860         vendorbinexp="$ansexp"
8861         ;;
8862 esac
8863 : Change installation prefix, if necessary.
8864 if $test X"$prefix" != X"$installprefix"; then
8865         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8866 else
8867         installvendorbin="$vendorbinexp"
8868 fi
8869
8870 : see if qgcvt exists
8871 set qgcvt d_qgcvt
8872 eval $inlibc
8873
8874 : Check how to convert floats to strings.
8875
8876 if test "X$d_Gconvert" = X; then
8877
8878 echo " "
8879 echo "Checking for an efficient way to convert floats to strings."
8880 echo " " > try.c
8881 case "$uselongdouble" in
8882 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8883 esac
8884 case "$d_longdbl" in
8885 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8886 esac
8887 case "$d_PRIgldbl" in
8888 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8889 esac
8890 $cat >>try.c <<EOP
8891 #ifdef TRY_gconvert
8892 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8893 char *myname = "gconvert";
8894 #endif
8895 #ifdef TRY_gcvt
8896 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8897 char *myname = "gcvt";
8898 #endif
8899 #ifdef TRY_qgcvt
8900 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8901 char *myname = "qgcvt";
8902 #define DOUBLETYPE long double
8903 #endif
8904 #ifdef TRY_sprintf
8905 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8906 #ifdef HAS_PRIgldbl
8907 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8908 #else
8909 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8910 #endif
8911 #else
8912 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8913 #endif
8914 char *myname = "sprintf";
8915 #endif
8916
8917 #ifndef DOUBLETYPE
8918 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8919 #define DOUBLETYPE long double
8920 #else
8921 #define DOUBLETYPE double
8922 #endif
8923 #endif
8924
8925 #include <stdio.h>
8926
8927 #define I_STDLIB $i_stdlib
8928 #ifdef I_STDLIB
8929 #include <stdlib.h>
8930 #endif
8931
8932 int
8933 checkit(expect, got)
8934 char *expect;
8935 char *got;
8936 {
8937     if (strcmp(expect, got)) {
8938                 printf("%s oddity:  Expected %s, got %s\n",
8939                         myname, expect, got);
8940                 exit(1);
8941         }
8942 }
8943
8944 int main()
8945
8946         char buf[64]; 
8947         buf[63] = '\0';
8948
8949         /* This must be 1st test on (which?) platform */
8950         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8951         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8952         checkit("0.1", buf);
8953
8954         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8955         checkit("0.01", buf);
8956
8957         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8958         checkit("0.001", buf);
8959
8960         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8961         checkit("0.0001", buf);
8962
8963         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8964         if (strlen(buf) > 5)
8965             checkit("9e-005", buf); /* for Microsoft ?? */
8966         else
8967             checkit("9e-05", buf);
8968
8969         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8970         checkit("1", buf);
8971
8972         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8973         checkit("1.1", buf);
8974
8975         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8976         checkit("1.01", buf);
8977
8978         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8979         checkit("1.001", buf);
8980
8981         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8982         checkit("1.0001", buf);
8983
8984         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8985         checkit("1.00001", buf);
8986
8987         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8988         checkit("1.000001", buf);
8989
8990         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8991         checkit("0", buf);
8992
8993         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8994         checkit("-1", buf);
8995
8996         /* Some Linux gcvt's give 1.e+5 here. */
8997         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8998         checkit("100000", buf);
8999         
9000         /* Some Linux gcvt's give -1.e+5 here. */
9001         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9002         checkit("-100000", buf);
9003
9004         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9005         checkit("123.456", buf);
9006
9007         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9008         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9009         /* 34 should be enough to scare even long double
9010          * places into using the e notation. */
9011         if (strlen(buf) > 5)
9012             checkit("1e+034", buf); /* for Microsoft */
9013         else
9014             checkit("1e+34", buf);
9015
9016         /* For Perl, if you add additional tests here, also add them to
9017          * t/base/num.t for benefit of platforms not using Configure or
9018          * overriding d_Gconvert */
9019
9020         exit(0);
9021 }
9022 EOP
9023 : first add preferred functions to our list
9024 xxx_list=""
9025 for xxx_convert in $gconvert_preference; do
9026     case $xxx_convert in
9027     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9028     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9029     esac 
9030 done
9031 : then add any others
9032 for xxx_convert in gconvert gcvt sprintf; do
9033     case "$xxx_list" in
9034     *$xxx_convert*) ;;
9035     *) xxx_list="$xxx_list $xxx_convert" ;;
9036     esac 
9037 done
9038
9039 case "$d_longdbl$uselongdouble" in
9040 "$define$define")
9041     : again, add prefered functions to our list first
9042     xxx_ld_list=""
9043     for xxx_convert in $gconvert_ld_preference; do
9044         case $xxx_convert in
9045         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9046         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9047         esac
9048     done
9049     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9050     for xxx_convert in qgcvt sprintf $xxx_list; do
9051         case "$xxx_ld_list" in
9052         $xxx_convert*|*" $xxx_convert"*) ;;
9053         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9054         esac
9055     done
9056     : if sprintf cannot do long doubles, move it to the end
9057     if test "$d_PRIgldbl" != "$define"; then
9058         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9059     fi
9060     : if no qgcvt, remove it
9061     if test "$d_qgcvt" != "$define"; then
9062         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9063     fi
9064     : use the ld_list
9065     xxx_list="$xxx_ld_list"
9066     ;;
9067 esac
9068
9069 for xxx_convert in $xxx_list; do
9070         echo "Trying $xxx_convert..."
9071         $rm -f try try$_o
9072         set try -DTRY_$xxx_convert
9073         if eval $compile; then
9074                 echo "$xxx_convert() found." >&4
9075                 if $run ./try; then
9076                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9077                         break;
9078                 else
9079                         echo "...But $xxx_convert didn't work as I expected."
9080                         xxx_convert=''
9081                 fi
9082         else
9083                 echo "$xxx_convert NOT found." >&4
9084         fi
9085 done
9086
9087 if test X$xxx_convert = X; then
9088     echo "*** WHOA THERE!!! ***" >&4
9089     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9090     xxx_convert=sprintf
9091 fi
9092
9093 case "$xxx_convert" in
9094 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9095 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9096 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9097 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9098    "$define$define$define")
9099       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9100    "$define$define$undef")
9101       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9102    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9103    esac
9104    ;;  
9105 esac
9106
9107 fi
9108
9109 : see if _fwalk exists
9110 set fwalk d__fwalk
9111 eval $inlibc
9112
9113 : Initialize h_fcntl
9114 h_fcntl=false
9115
9116 : Initialize h_sysfile
9117 h_sysfile=false
9118
9119 : access call always available on UNIX
9120 set access d_access
9121 eval $inlibc
9122
9123 : locate the flags for 'access()'
9124 case "$d_access" in
9125 "$define")
9126         echo " "
9127         $cat >access.c <<'EOCP'
9128 #include <sys/types.h>
9129 #ifdef I_FCNTL
9130 #include <fcntl.h>
9131 #endif
9132 #ifdef I_SYS_FILE
9133 #include <sys/file.h>
9134 #endif
9135 #ifdef I_UNISTD
9136 #include <unistd.h>
9137 #endif
9138 int main() {
9139         exit(R_OK);
9140 }
9141 EOCP
9142         : check sys/file.h first, no particular reason here
9143         if $test `./findhdr sys/file.h` && \
9144                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9145                 h_sysfile=true;
9146                 echo "<sys/file.h> defines the *_OK access constants." >&4
9147         elif $test `./findhdr fcntl.h` && \
9148                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9149                 h_fcntl=true;
9150                 echo "<fcntl.h> defines the *_OK access constants." >&4
9151         elif $test `./findhdr unistd.h` && \
9152                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9153                 echo "<unistd.h> defines the *_OK access constants." >&4
9154         else
9155                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9156         fi
9157         ;;
9158 esac
9159 $rm -f access*
9160
9161 : see if accessx exists
9162 set accessx d_accessx
9163 eval $inlibc
9164
9165 : see if alarm exists
9166 set alarm d_alarm
9167 eval $inlibc
9168
9169 : see if POSIX threads are available
9170 set pthread.h i_pthread
9171 eval $inhdr
9172
9173 : define a fucntion to check prototypes
9174 $cat > protochk <<EOSH
9175 $startsh
9176 cc="$cc"
9177 optimize="$optimize"
9178 ccflags="$ccflags"
9179 prototype="$prototype"
9180 define="$define"
9181 rm=$rm
9182 usethreads=$usethreads
9183 i_pthread=$i_pthread
9184 pthread_h_first=$pthread_h_first
9185 EOSH
9186
9187 $cat >> protochk <<'EOSH'
9188
9189 $rm -f try.c
9190 foo="$1"
9191 shift
9192 while test $# -ge 2; do
9193         case "$1" in
9194                 $define) echo "#include <$2>" >> try.c ;;
9195                 literal) echo "$2" >> try.c ;;
9196         esac
9197     # Extra magic for the benefit of systems that need pthread.h
9198     # to be included early to correctly detect threadsafe functions.
9199     # Such functions must guarantee themselves, though, that the usethreads
9200     # and i_pthread have been defined, before calling protochk.
9201     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9202         echo "#include <pthread.h>" >> try.c
9203         pthread_h_done=yes
9204     fi
9205     shift 2
9206 done
9207 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9208 cat >> try.c <<'EOCP'
9209 #ifdef CAN_PROTOTYPE
9210 #define _(args) args
9211 #else
9212 #define _(args) ()
9213 #endif
9214 EOCP
9215 echo "$foo" >> try.c
9216 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9217 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9218 status=$?
9219 $rm -f try.[co]
9220 exit $status
9221 EOSH
9222 chmod +x protochk
9223 $eunicefix protochk
9224
9225 : see if sys/types.h has to be included
9226 set sys/types.h i_systypes
9227 eval $inhdr
9228
9229 : see if sys/select.h has to be included
9230 set sys/select.h i_sysselct
9231 eval $inhdr
9232
9233 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9234 while $test $# -ge 2; do
9235         case "$1" in
9236         $define) echo "#include <$2>";;
9237         esac ;
9238     shift 2;
9239 done > try.c;
9240 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9241 set try;
9242 if eval $compile; then
9243         val="$define";
9244 else
9245         val="$undef";
9246 fi;
9247 set $varname;
9248 eval $setvar;
9249 $rm -f try.c try.o'
9250
9251 : see if we should include time.h, sys/time.h, or both
9252 echo " "
9253 if test "X$timeincl" = X; then
9254         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9255         $echo $n "I'm now running the test program...$c"
9256         $cat >try.c <<'EOCP'
9257 #include <sys/types.h>
9258 #ifdef I_TIME
9259 #include <time.h>
9260 #endif
9261 #ifdef I_SYSTIME
9262 #ifdef SYSTIMEKERNEL
9263 #define KERNEL
9264 #endif
9265 #include <sys/time.h>
9266 #endif
9267 #ifdef I_SYSSELECT
9268 #include <sys/select.h>
9269 #endif
9270 int main()
9271 {
9272         struct tm foo;
9273 #ifdef S_TIMEVAL
9274         struct timeval bar;
9275 #endif
9276 #ifdef S_TIMEZONE
9277         struct timezone tzp;
9278 #endif
9279         if (foo.tm_sec == foo.tm_sec)
9280                 exit(0);
9281 #ifdef S_TIMEVAL
9282         if (bar.tv_sec == bar.tv_sec)
9283                 exit(0);
9284 #endif
9285         exit(1);
9286 }
9287 EOCP
9288         flags=''
9289         for s_timezone in '-DS_TIMEZONE' ''; do
9290         sysselect=''
9291         for s_timeval in '-DS_TIMEVAL' ''; do
9292         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9293         for i_time in '' '-DI_TIME'; do
9294         for i_systime in '-DI_SYSTIME' ''; do
9295                 case "$flags" in
9296                 '') $echo $n ".$c"
9297                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9298                         if eval $compile; then
9299                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9300                                 shift
9301                                 flags="$*"
9302                                 echo " "
9303                                 $echo $n "Succeeded with $flags$c"
9304                         fi
9305                         ;;
9306                 esac
9307         done
9308         done
9309         done
9310         done
9311         done
9312         timeincl=''
9313         echo " "
9314         case "$flags" in
9315         *SYSTIMEKERNEL*) i_systimek="$define"
9316                 timeincl=`./findhdr sys/time.h`
9317                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9318         *) i_systimek="$undef";;
9319         esac
9320         case "$flags" in
9321         *I_TIME*) i_time="$define"
9322                 timeincl=`./findhdr time.h`" $timeincl"
9323                 echo "We'll include <time.h>." >&4;;
9324         *) i_time="$undef";;
9325         esac
9326         case "$flags" in
9327         *I_SYSTIME*) i_systime="$define"
9328                 timeincl=`./findhdr sys/time.h`" $timeincl"
9329                 echo "We'll include <sys/time.h>." >&4;;
9330         *) i_systime="$undef";;
9331         esac
9332         $rm -f try.c try
9333 fi
9334 : see if struct tm knows about tm_zone
9335 case "$i_systime$i_time" in
9336 *$define*) 
9337         echo " "
9338         echo "Checking to see if your struct tm has tm_zone field..." >&4
9339         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9340         eval $hasfield
9341         ;;
9342 *)      val="$undef"
9343         set d_tm_tm_zone
9344         eval $setvar
9345         ;;
9346 esac
9347 case "$d_tm_tm_zone" in
9348 "$define")      echo "Yes, it does."   ;;
9349 *)              echo "No, it doesn't." ;;
9350 esac
9351 : see if struct tm knows about tm_gmtoff
9352 case "$i_systime$i_time" in
9353 *$define*) 
9354         echo " "
9355         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9356         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9357         eval $hasfield
9358         ;;
9359 *)      val="$undef"
9360         set d_tm_tm_gmtoff
9361         eval $setvar
9362         ;;
9363 esac
9364 case "$d_tm_tm_gmtoff" in
9365 "$define")      echo "Yes, it does."   ;;
9366 *)              echo "No, it doesn't." ;;
9367 esac
9368
9369 : see if asctime_r exists
9370 set asctime_r d_asctime_r
9371 eval $inlibc
9372 case "$d_asctime_r" in
9373 "$define")
9374         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9375         case "$d_asctime_r_proto:$usethreads" in
9376         ":define")      d_asctime_r_proto=define
9377                 set d_asctime_r_proto asctime_r $hdrs
9378                 eval $hasproto ;;
9379         *)      ;;
9380         esac
9381         case "$d_asctime_r_proto" in
9382         define)
9383         case "$asctime_r_proto" in
9384         ''|0) try='char* asctime_r(const struct tm*, char*);'
9385         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9386         esac
9387         case "$asctime_r_proto" in
9388         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9389         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9390         esac
9391         case "$asctime_r_proto" in
9392         ''|0) try='int asctime_r(const struct tm*, char*);'
9393         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9394         esac
9395         case "$asctime_r_proto" in
9396         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9397         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9398         esac
9399         case "$asctime_r_proto" in
9400         ''|0)   d_asctime_r=undef
9401                 asctime_r_proto=0
9402                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9403         * )     case "$asctime_r_proto" in
9404                 REENTRANT_PROTO*) ;;
9405                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9406                 esac
9407                 echo "Prototype: $try" ;;
9408         esac
9409         ;;
9410         *)      case "$usethreads" in
9411                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9412                 esac
9413                 d_asctime_r=undef
9414                 asctime_r_proto=0
9415                 ;;
9416         esac
9417         ;;
9418 *)      asctime_r_proto=0
9419         ;;
9420 esac
9421
9422 : see if atolf exists
9423 set atolf d_atolf
9424 eval $inlibc
9425
9426 : see if atoll exists
9427 set atoll d_atoll
9428 eval $inlibc
9429
9430 : Look for GNU-cc style attribute checking
9431 echo " "
9432 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9433 $cat >attrib.c <<'EOCP'
9434 #include <stdio.h>
9435 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9436 EOCP
9437 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9438         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9439                 echo "Your C compiler doesn't fully support __attribute__."
9440                 val="$undef"
9441         else
9442                 echo "Your C compiler supports __attribute__."
9443                 val="$define"
9444         fi
9445 else
9446         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9447         val="$undef"
9448 fi
9449 set d_attribut
9450 eval $setvar
9451 $rm -f attrib*
9452
9453 : see if bcmp exists
9454 set bcmp d_bcmp
9455 eval $inlibc
9456
9457 : see if bcopy exists
9458 set bcopy d_bcopy
9459 eval $inlibc
9460
9461 : see if this is a unistd.h system
9462 set unistd.h i_unistd
9463 eval $inhdr
9464
9465 : see if getpgrp exists
9466 set getpgrp d_getpgrp
9467 eval $inlibc
9468
9469 case "$d_getpgrp" in
9470 "$define")
9471         echo " "
9472         echo "Checking to see which flavor of getpgrp is in use..."
9473         $cat >try.c <<EOP
9474 #$i_unistd I_UNISTD
9475 #include <sys/types.h>
9476 #ifdef I_UNISTD
9477 #  include <unistd.h>
9478 #endif
9479 int main()
9480 {
9481         if (getuid() == 0) {
9482                 printf("(I see you are running Configure as super-user...)\n");
9483                 setuid(1);
9484         }
9485 #ifdef TRY_BSD_PGRP
9486         if (getpgrp(1) == 0)
9487                 exit(0);
9488 #else
9489         if (getpgrp() > 0)
9490                 exit(0);
9491 #endif
9492         exit(1);
9493 }
9494 EOP
9495         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9496                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9497                 val="$define"
9498         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9499                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9500                 val="$undef"
9501         else
9502                 echo "I can't seem to compile and run the test program."
9503                 if ./usg; then
9504                         xxx="a USG one, i.e. you use getpgrp()."
9505                 else
9506                         # SVR4 systems can appear rather BSD-ish.
9507                         case "$i_unistd" in
9508                         $undef)
9509                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9510                                 val="$define"
9511                                 ;;
9512                         $define)
9513                                 xxx="probably a USG one, i.e. you use getpgrp()."
9514                                 val="$undef"
9515                                 ;;
9516                         esac
9517                 fi
9518                 echo "Assuming your getpgrp is $xxx" >&4
9519         fi
9520         ;;
9521 *) val="$undef";;
9522 esac
9523 set d_bsdgetpgrp
9524 eval $setvar
9525 $rm -f try try.*
9526
9527 : see if setpgrp exists
9528 set setpgrp d_setpgrp
9529 eval $inlibc
9530
9531 case "$d_setpgrp" in
9532 "$define")
9533         echo " "
9534         echo "Checking to see which flavor of setpgrp is in use..."
9535         $cat >try.c <<EOP
9536 #$i_unistd I_UNISTD
9537 #include <sys/types.h>
9538 #ifdef I_UNISTD
9539 #  include <unistd.h>
9540 #endif
9541 int main()
9542 {
9543         if (getuid() == 0) {
9544                 printf("(I see you are running Configure as super-user...)\n");
9545                 setuid(1);
9546         }
9547 #ifdef TRY_BSD_PGRP
9548         if (-1 == setpgrp(1, 1))
9549                 exit(0);
9550 #else
9551         if (setpgrp() != -1)
9552                 exit(0);
9553 #endif
9554         exit(1);
9555 }
9556 EOP
9557         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9558                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9559                 val="$define"
9560         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9561                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9562                 val="$undef"
9563         else
9564                 echo "(I can't seem to compile and run the test program.)"
9565                 if ./usg; then
9566                         xxx="a USG one, i.e. you use setpgrp()."
9567                 else
9568                         # SVR4 systems can appear rather BSD-ish.
9569                         case "$i_unistd" in
9570                         $undef)
9571                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9572                                 val="$define"
9573                                 ;;
9574                         $define)
9575                                 xxx="probably a USG one, i.e. you use setpgrp()."
9576                                 val="$undef"
9577                                 ;;
9578                         esac
9579                 fi
9580                 echo "Assuming your setpgrp is $xxx" >&4
9581         fi
9582         ;;
9583 *) val="$undef";;
9584 esac
9585 set d_bsdsetpgrp
9586 eval $setvar
9587 $rm -f try try.*
9588 : see if bzero exists
9589 set bzero d_bzero
9590 eval $inlibc
9591
9592 : see if signal is declared as pointer to function returning int or void
9593 echo " "
9594 xxx=`./findhdr signal.h`
9595 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9596 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9597         echo "You have int (*signal())() instead of void." >&4
9598         val="$undef"
9599 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9600         echo "You have void (*signal())()." >&4
9601         val="$define"
9602 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9603         echo "You have int (*signal())() instead of void." >&4
9604         val="$undef"
9605 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9606         echo "You have void (*signal())()." >&4
9607         val="$define"
9608 else
9609         case "$d_voidsig" in
9610         '')
9611         echo "I can't determine whether signal handler returns void or int..." >&4
9612                 dflt=void
9613                 rp="What type does your signal handler return?"
9614                 . ./myread
9615                 case "$ans" in
9616                 v*) val="$define";;
9617                 *) val="$undef";;
9618                 esac;;
9619         "$define")
9620                 echo "As you already told me, signal handler returns void." >&4
9621                 val="$define"
9622                 ;;
9623         *)      echo "As you already told me, signal handler returns int." >&4
9624                 val="$undef"
9625                 ;;
9626         esac
9627 fi
9628 set d_voidsig
9629 eval $setvar
9630 case "$d_voidsig" in
9631 "$define") signal_t="void";;
9632 *) signal_t="int";;
9633 esac
9634 $rm -f $$.tmp
9635
9636 : check for ability to cast large floats to 32-bit ints.
9637 echo " "
9638 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9639 if $test "$intsize" -ge 4; then
9640         xxx=int
9641 else
9642         xxx=long
9643 fi
9644 $cat >try.c <<EOCP
9645 #include <stdio.h>
9646 #include <sys/types.h>
9647 #include <signal.h>
9648 $signal_t blech(s) int s; { exit(3); }
9649 int main()
9650 {
9651         $xxx i32;
9652         double f, g;
9653         int result = 0;
9654         char str[16];
9655         signal(SIGFPE, blech);
9656
9657         /* Don't let compiler optimize the test away.  Store the number 
9658            in a writable string for gcc to pass to sscanf under HP/UX.
9659         */
9660         sprintf(str, "2147483647");
9661         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9662         g = 10 * f;
9663         i32  = ($xxx) g;
9664
9665         /* x86 processors will probably give 0x8000 0000, which is a
9666        sign change.  We don't want that.  We want to mimic SPARC
9667            behavior here, which is to preserve the sign and give
9668            back 0x7fff ffff.
9669         */
9670         if (i32 != ($xxx) f)
9671                 result |= 1;
9672         exit(result);
9673 }
9674 EOCP
9675 set try
9676 if eval $compile_ok; then
9677         $run ./try
9678         yyy=$?
9679 else
9680         echo "(I can't seem to compile the test program--assuming it can't)"
9681         yyy=1
9682 fi
9683 case "$yyy" in
9684 0)      val="$define"
9685         echo "Yup, it can."
9686         ;;
9687 *)      val="$undef"
9688         echo "Nope, it can't."
9689         ;;
9690 esac
9691 set d_casti32
9692 eval $setvar
9693 $rm -f try try.*
9694
9695 : check for ability to cast negative floats to unsigned
9696 echo " "
9697 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9698 $cat >try.c <<EOCP
9699 #include <stdio.h>
9700 #include <sys/types.h>
9701 #include <signal.h>
9702 $signal_t blech(s) int s; { exit(7); }
9703 $signal_t blech_in_list(s) int s; { exit(4); }
9704 unsigned long dummy_long(p) unsigned long p; { return p; }
9705 unsigned int dummy_int(p) unsigned int p; { return p; }
9706 unsigned short dummy_short(p) unsigned short p; { return p; }
9707 int main()
9708 {
9709         double f;
9710         unsigned long along;
9711         unsigned int aint;
9712         unsigned short ashort;
9713         int result = 0;
9714         char str[16];
9715         
9716         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9717            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9718            optimized the whole file away
9719         */
9720         /* Store the number in a writable string for gcc to pass to 
9721            sscanf under HP/UX.
9722         */
9723         sprintf(str, "-123");
9724         sscanf(str, "%lf", &f);  /* f = -123.; */
9725
9726         signal(SIGFPE, blech);
9727         along = (unsigned long)f;
9728         aint = (unsigned int)f;
9729         ashort = (unsigned short)f;
9730         if (along != (unsigned long)-123)
9731                 result |= 1;
9732         if (aint != (unsigned int)-123)
9733                 result |= 1;
9734         if (ashort != (unsigned short)-123)
9735                 result |= 1;
9736         sprintf(str, "1073741824.");
9737         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9738         f = f + f;
9739         along = 0;
9740         along = (unsigned long)f;
9741         if (along != 0x80000000)
9742                 result |= 2;
9743         f -= 1.;
9744         along = 0;
9745         along = (unsigned long)f;
9746         if (along != 0x7fffffff)
9747                 result |= 1;
9748         f += 2.;
9749         along = 0;
9750         along = (unsigned long)f;
9751         if (along != 0x80000001)
9752                 result |= 2;
9753         if (result)
9754                 exit(result);
9755         signal(SIGFPE, blech_in_list);
9756         sprintf(str, "123.");
9757         sscanf(str, "%lf", &f);  /* f = 123.; */
9758         along = dummy_long((unsigned long)f);
9759         aint = dummy_int((unsigned int)f);
9760         ashort = dummy_short((unsigned short)f);
9761         if (along != (unsigned long)123)
9762                 result |= 4;
9763         if (aint != (unsigned int)123)
9764                 result |= 4;
9765         if (ashort != (unsigned short)123)
9766                 result |= 4;
9767         exit(result);
9768
9769 }
9770 EOCP
9771 set try
9772 if eval $compile_ok; then
9773         $run ./try
9774         castflags=$?
9775 else
9776         echo "(I can't seem to compile the test program--assuming it can't)"
9777         castflags=7
9778 fi
9779 case "$castflags" in
9780 0)      val="$define"
9781         echo "Yup, it can."
9782         ;;
9783 *)      val="$undef"
9784         echo "Nope, it can't."
9785         ;;
9786 esac
9787 set d_castneg
9788 eval $setvar
9789 $rm -f try.*
9790
9791 : see if vprintf exists
9792 echo " "
9793 if set vprintf val -f d_vprintf; eval $csym; $val; then
9794         echo 'vprintf() found.' >&4
9795         val="$define"
9796         $cat >try.c <<'EOF'
9797 #include <varargs.h>
9798
9799 int main() { xxx("foo"); }
9800
9801 xxx(va_alist)
9802 va_dcl
9803 {
9804         va_list args;
9805         char buf[10];
9806
9807         va_start(args);
9808         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9809 }
9810 EOF
9811         set try
9812         if eval $compile && $run ./try; then
9813                 echo "Your vsprintf() returns (int)." >&4
9814                 val2="$undef"
9815         else
9816                 echo "Your vsprintf() returns (char*)." >&4
9817                 val2="$define"
9818         fi
9819 else
9820         echo 'vprintf() NOT found.' >&4
9821                 val="$undef"
9822                 val2="$undef"
9823 fi
9824 $rm -f try try.*
9825 set d_vprintf
9826 eval $setvar
9827 val=$val2
9828 set d_charvspr
9829 eval $setvar
9830
9831 : see if chown exists
9832 set chown d_chown
9833 eval $inlibc
9834
9835 : see if chroot exists
9836 set chroot d_chroot
9837 eval $inlibc
9838
9839 : see if chsize exists
9840 set chsize d_chsize
9841 eval $inlibc
9842
9843 : see if class exists
9844 set class d_class
9845 eval $inlibc
9846
9847 hasstruct='varname=$1; struct=$2; shift; shift;
9848 while $test $# -ge 2; do
9849         case "$1" in
9850         $define) echo "#include <$2>";;
9851         esac ;
9852     shift 2;
9853 done > try.c;
9854 echo "int main () { struct $struct foo; }" >> try.c;
9855 set try;
9856 if eval $compile; then
9857         val="$define";
9858 else
9859         val="$undef";
9860 fi;
9861 set $varname;
9862 eval $setvar;
9863 $rm -f try.c try.o'
9864
9865 socketlib=''
9866 sockethdr=''
9867 : see whether socket exists
9868 echo " "
9869 $echo $n "Hmm... $c" >&4
9870 if set socket val -f d_socket; eval $csym; $val; then
9871         echo "Looks like you have Berkeley networking support." >&4
9872         d_socket="$define"
9873         if set setsockopt val -f; eval $csym; $val; then
9874                 d_oldsock="$undef"
9875         else
9876                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9877                 d_oldsock="$define"
9878         fi
9879 else
9880         if $contains socklib libc.list >/dev/null 2>&1; then
9881                 echo "Looks like you have Berkeley networking support." >&4
9882                 d_socket="$define"
9883                 : we will have to assume that it supports the 4.2 BSD interface
9884                 d_oldsock="$undef"
9885         else
9886                 echo "You don't have Berkeley networking in libc$_a..." >&4
9887                 if test "X$d_socket" = "X$define"; then
9888                    echo "...but you seem to believe that you have sockets." >&4
9889                 else
9890                         for net in net socket
9891                         do
9892                                 if test -f /usr/lib/lib$net$_a; then
9893                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9894                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9895                                         if $contains socket libc.list >/dev/null 2>&1; then
9896                                                 d_socket="$define"
9897                                                 socketlib="-l$net"
9898                                                 case "$net" in
9899                                                 net)
9900                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9901                                                         sockethdr="-I/usr/netinclude"
9902                                                         ;;
9903                                                 esac
9904                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9905                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9906                                                         d_oldsock="$undef"
9907                                                 else
9908                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9909                                                         d_oldsock="$define"
9910                                                 fi
9911                                                 break
9912                                         fi
9913                                 fi
9914                         done
9915                         if test "X$d_socket" != "X$define"; then
9916                            echo "or anywhere else I see." >&4
9917                            d_socket="$undef"
9918                            d_oldsock="$undef"
9919                         fi
9920                 fi
9921         fi
9922 fi
9923
9924 : see if socketpair exists
9925 set socketpair d_sockpair
9926 eval $inlibc
9927
9928
9929 echo " "
9930 echo "Checking the availability of certain socket constants..." >&4
9931 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9932         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9933         $cat >try.c <<EOF
9934 #include <sys/types.h>
9935 #include <sys/socket.h>
9936 int main() {
9937     int i = $ENUM;
9938 }
9939 EOF
9940         val="$undef"
9941         set try; if eval $compile; then
9942                 val="$define"
9943         fi
9944         set d_${enum}; eval $setvar
9945         $rm -f try.c try
9946 done
9947
9948 : see if this is a sys/uio.h system
9949 set sys/uio.h i_sysuio
9950 eval $inhdr
9951
9952
9953 echo " "
9954 echo "Checking to see if your system supports struct cmsghdr..." >&4
9955 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9956 eval $hasstruct
9957 case "$d_cmsghdr_s" in
9958 "$define")      echo "Yes, it does."   ;;
9959 *)              echo "No, it doesn't." ;;
9960 esac
9961
9962
9963 : check for const keyword
9964 echo " "
9965 echo 'Checking to see if your C compiler knows about "const"...' >&4
9966 $cat >const.c <<'EOCP'
9967 typedef struct spug { int drokk; } spug;
9968 main()
9969 {
9970         const char *foo;
9971         const spug y;
9972 }
9973 EOCP
9974 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9975         val="$define"
9976         echo "Yup, it does."
9977 else
9978         val="$undef"
9979         echo "Nope, it doesn't."
9980 fi
9981 set d_const
9982 eval $setvar
9983
9984 : see if crypt exists
9985 echo " "
9986 set crypt d_crypt
9987 eval $inlibc
9988 case "$d_crypt" in
9989 $define) cryptlib='' ;;
9990 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9991                 echo 'crypt() found.' >&4
9992                 val="$define"
9993                 cryptlib=''
9994         else
9995                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9996                 if $test -z "$cryptlib"; then
9997                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9998                 else
9999                         cryptlib=-lcrypt
10000                 fi
10001                 if $test -z "$cryptlib"; then
10002                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10003                 else
10004                         cryptlib=-lcrypt
10005                 fi
10006                 if $test -z "$cryptlib"; then
10007                         cryptlib=`./loc libcrypt$_a "" $libpth`
10008                 else
10009                         cryptlib=-lcrypt
10010                 fi
10011                 if $test -z "$cryptlib"; then
10012                         echo 'crypt() NOT found.' >&4
10013                         val="$undef"
10014                 else
10015                         val="$define"
10016                 fi
10017         fi
10018         set d_crypt
10019         eval $setvar
10020         ;;
10021 esac
10022
10023 : see if this is a crypt.h system
10024 set crypt.h i_crypt
10025 eval $inhdr
10026
10027 : see if crypt_r exists
10028 set crypt_r d_crypt_r
10029 eval $inlibc
10030 case "$d_crypt_r" in
10031 "$define")
10032         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10033         case "$d_crypt_r_proto:$usethreads" in
10034         ":define")      d_crypt_r_proto=define
10035                 set d_crypt_r_proto crypt_r $hdrs
10036                 eval $hasproto ;;
10037         *)      ;;
10038         esac
10039         case "$d_crypt_r_proto" in
10040         define)
10041         case "$crypt_r_proto" in
10042         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10043         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10044         esac
10045         case "$crypt_r_proto" in
10046         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10047         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10048         esac
10049         case "$crypt_r_proto" in
10050         ''|0)   d_crypt_r=undef
10051                 crypt_r_proto=0
10052                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10053         * )     case "$crypt_r_proto" in
10054                 REENTRANT_PROTO*) ;;
10055                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10056                 esac
10057                 echo "Prototype: $try" ;;
10058         esac
10059         ;;
10060         *)      case "$usethreads" in
10061                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10062                 esac
10063                 d_crypt_r=undef
10064                 crypt_r_proto=0
10065                 ;;
10066         esac
10067         ;;
10068 *)      crypt_r_proto=0
10069         ;;
10070 esac
10071
10072 : get csh whereabouts
10073 case "$csh" in
10074 'csh') val="$undef" ;;
10075 *) val="$define" ;;
10076 esac
10077 set d_csh
10078 eval $setvar
10079 : Respect a hint or command line value for full_csh.
10080 case "$full_csh" in
10081 '') full_csh=$csh ;;
10082 esac
10083
10084 : see if ctermid_r exists
10085 set ctermid_r d_ctermid_r
10086 eval $inlibc
10087 case "$d_ctermid_r" in
10088 "$define")
10089         hdrs="$i_systypes sys/types.h define stdio.h "
10090         case "$d_ctermid_r_proto:$usethreads" in
10091         ":define")      d_ctermid_r_proto=define
10092                 set d_ctermid_r_proto ctermid_r $hdrs
10093                 eval $hasproto ;;
10094         *)      ;;
10095         esac
10096         case "$d_ctermid_r_proto" in
10097         define)
10098         case "$ctermid_r_proto" in
10099         ''|0) try='char* ctermid_r(char*);'
10100         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10101         esac
10102         case "$ctermid_r_proto" in
10103         ''|0)   d_ctermid_r=undef
10104                 ctermid_r_proto=0
10105                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10106         * )     case "$ctermid_r_proto" in
10107                 REENTRANT_PROTO*) ;;
10108                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10109                 esac
10110                 echo "Prototype: $try" ;;
10111         esac
10112         ;;
10113         *)      case "$usethreads" in
10114                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10115                 esac
10116                 d_ctermid_r=undef
10117                 ctermid_r_proto=0
10118                 ;;
10119         esac
10120         ;;
10121 *)      ctermid_r_proto=0
10122         ;;
10123 esac
10124
10125 : see if ctime_r exists
10126 set ctime_r d_ctime_r
10127 eval $inlibc
10128 case "$d_ctime_r" in
10129 "$define")
10130         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10131         case "$d_ctime_r_proto:$usethreads" in
10132         ":define")      d_ctime_r_proto=define
10133                 set d_ctime_r_proto ctime_r $hdrs
10134                 eval $hasproto ;;
10135         *)      ;;
10136         esac
10137         case "$d_ctime_r_proto" in
10138         define)
10139         case "$ctime_r_proto" in
10140         ''|0) try='char* ctime_r(const time_t*, char*);'
10141         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10142         esac
10143         case "$ctime_r_proto" in
10144         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10145         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10146         esac
10147         case "$ctime_r_proto" in
10148         ''|0) try='int ctime_r(const time_t*, char*);'
10149         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10150         esac
10151         case "$ctime_r_proto" in
10152         ''|0) try='int ctime_r(const time_t*, char*, int);'
10153         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10154         esac
10155         case "$ctime_r_proto" in
10156         ''|0)   d_ctime_r=undef
10157                 ctime_r_proto=0
10158                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10159         * )     case "$ctime_r_proto" in
10160                 REENTRANT_PROTO*) ;;
10161                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10162                 esac
10163                 echo "Prototype: $try" ;;
10164         esac
10165         ;;
10166         *)      case "$usethreads" in
10167                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10168                 esac
10169                 d_ctime_r=undef
10170                 ctime_r_proto=0
10171                 ;;
10172         esac
10173         ;;
10174 *)      ctime_r_proto=0
10175         ;;
10176 esac
10177
10178 : see if cuserid exists
10179 set cuserid d_cuserid
10180 eval $inlibc
10181
10182 : see if this is a limits.h system
10183 set limits.h i_limits
10184 eval $inhdr
10185
10186 : see if this is a float.h system
10187 set float.h i_float
10188 eval $inhdr
10189
10190 : See if number of significant digits in a double precision number is known
10191 echo " "
10192 $cat >dbl_dig.c <<EOM
10193 #$i_limits I_LIMITS
10194 #$i_float I_FLOAT
10195 #ifdef I_LIMITS
10196 #include <limits.h>
10197 #endif
10198 #ifdef I_FLOAT
10199 #include <float.h>
10200 #endif
10201 #ifdef DBL_DIG
10202 printf("Contains DBL_DIG");
10203 #endif
10204 EOM
10205 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10206 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10207         echo "DBL_DIG found." >&4
10208         val="$define"
10209 else
10210         echo "DBL_DIG NOT found." >&4
10211         val="$undef"
10212 fi
10213 $rm -f dbl_dig.?
10214 set d_dbl_dig
10215 eval $setvar
10216
10217 : see if dbm.h is available
10218 : see if dbmclose exists
10219 set dbmclose d_dbmclose
10220 eval $inlibc
10221
10222 case "$d_dbmclose" in
10223 $define)
10224         set dbm.h i_dbm
10225         eval $inhdr
10226         case "$i_dbm" in
10227         $define)
10228                 val="$undef"
10229                 set i_rpcsvcdbm
10230                 eval $setvar
10231                 ;;
10232         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10233                 eval $inhdr
10234                 ;;
10235         esac
10236         ;;
10237 *)      echo "We won't be including <dbm.h>"
10238         val="$undef"
10239         set i_dbm
10240         eval $setvar
10241         val="$undef"
10242         set i_rpcsvcdbm
10243         eval $setvar
10244         ;;
10245 esac
10246
10247 : see if prototype for dbminit is available
10248 echo " "
10249 set d_dbminitproto dbminit $i_dbm dbm.h
10250 eval $hasproto
10251
10252 : see if difftime exists
10253 set difftime d_difftime
10254 eval $inlibc
10255
10256 : see if this is a dirent system
10257 echo " "
10258 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10259         val="$define"
10260         echo "<dirent.h> found." >&4
10261 else
10262         val="$undef"
10263         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10264                 echo "<sys/dir.h> found." >&4
10265                 echo " "
10266         else
10267                 xinc=`./findhdr sys/ndir.h`
10268         fi
10269         echo "<dirent.h> NOT found." >&4
10270 fi
10271 set i_dirent
10272 eval $setvar
10273
10274 : Look for type of directory structure.
10275 echo " "
10276 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10277
10278 case "$direntrytype" in
10279 ''|' ')
10280         case "$i_dirent" in
10281         $define) guess1='struct dirent' ;;
10282         *) guess1='struct direct'  ;;
10283         esac
10284         ;;
10285 *)      guess1="$direntrytype"
10286         ;;
10287 esac
10288
10289 case "$guess1" in
10290 'struct dirent') guess2='struct direct' ;;
10291 *) guess2='struct dirent' ;;
10292 esac
10293                 
10294 if $contains "$guess1" try.c >/dev/null 2>&1; then
10295         direntrytype="$guess1"
10296         echo "Your directory entries are $direntrytype." >&4
10297 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10298         direntrytype="$guess2"
10299         echo "Your directory entries seem to be $direntrytype." >&4
10300 else
10301         echo "I don't recognize your system's directory entries." >&4
10302         rp="What type is used for directory entries on this system?"
10303         dflt="$guess1"
10304         . ./myread
10305         direntrytype="$ans"
10306 fi
10307 $rm -f try.c
10308
10309
10310 : see if the directory entry stores field length
10311 echo " "
10312 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10313 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10314         echo "Good, your directory entry keeps length information in d_namlen." >&4
10315         val="$define"
10316 else
10317         echo "Your directory entry does not know about the d_namlen field." >&4
10318         val="$undef"
10319 fi
10320 set d_dirnamlen
10321 eval $setvar
10322 $rm -f try.c
10323
10324 : see if this is an sysdir system
10325 set sys/dir.h i_sysdir
10326 eval $inhdr
10327
10328 : see if this is an sysndir system
10329 set sys/ndir.h i_sysndir
10330 eval $inhdr
10331
10332 : Look for dirfd
10333 echo " "
10334 $cat >dirfd.c <<EOM
10335 #include <stdio.h>
10336 #$i_dirent I_DIRENT             /**/
10337 #$i_sysdir I_SYS_DIR            /**/
10338 #$i_sysndir I_SYS_NDIR          /**/
10339 #$i_systypes I_SYS_TYPES        /**/
10340 #if defined(I_SYS_TYPES)
10341 #include <sys/types.h>
10342 #endif
10343 #if defined(I_DIRENT)
10344 #include <dirent.h>
10345 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10346 #include <sys/dir.h>
10347 #endif
10348 #else
10349 #ifdef I_SYS_NDIR
10350 #include <sys/ndir.h>
10351 #else
10352 #ifdef I_SYS_DIR
10353 #ifdef hp9000s500
10354 #include <ndir.h>       /* may be wrong in the future */
10355 #else
10356 #include <sys/dir.h>
10357 #endif
10358 #endif
10359 #endif
10360 #endif 
10361 int main() {
10362         DIR *dirp = opendir(".");
10363         if (dirfd(dirp) >= 0)
10364                 exit(0);
10365         else
10366                 exit(1);
10367 }
10368 EOM
10369 set dirfd
10370 if eval $compile; then
10371         val="$define"
10372 fi
10373 case "$val" in
10374 $define)        echo "dirfd() found." >&4       ;;
10375 *)              echo "dirfd() NOT found." >&4   ;;
10376 esac
10377 set d_dirfd
10378 eval $setvar
10379 $rm -f dirfd*
10380
10381 : see if dlerror exists
10382 xxx_runnm="$runnm"
10383 runnm=false
10384 set dlerror d_dlerror
10385 eval $inlibc
10386 runnm="$xxx_runnm"
10387
10388 : see if dlfcn is available
10389 set dlfcn.h i_dlfcn
10390 eval $inhdr
10391
10392 case "$usedl" in
10393 $define|y|true)
10394         $cat << EOM
10395
10396 On a few systems, the dynamically loaded modules that perl generates and uses
10397 will need a different extension than shared libs. The default will probably
10398 be appropriate.
10399
10400 EOM
10401         case "$dlext" in
10402         '')     dflt="$so" ;;
10403         *)      dflt="$dlext" ;;
10404         esac
10405         rp='What is the extension of dynamically loaded modules'
10406         . ./myread
10407         dlext="$ans"
10408         ;;
10409 *)
10410         dlext="none"
10411         ;;
10412 esac
10413
10414 : Check if dlsym need a leading underscore
10415 echo " "
10416 val="$undef"
10417
10418 case "$dlsrc" in
10419 dl_dlopen.xs)
10420         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10421         $cat >dyna.c <<'EOM'
10422 fred () { }
10423 EOM
10424
10425 $cat >fred.c<<EOM
10426
10427 #include <stdio.h>
10428 #$i_dlfcn I_DLFCN
10429 #ifdef I_DLFCN
10430 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10431 #else
10432 #include <sys/types.h>
10433 #include <nlist.h>
10434 #include <link.h>
10435 #endif
10436
10437 extern int fred() ;
10438
10439 int main()
10440 {
10441     void * handle ;
10442     void * symbol ;
10443 #ifndef RTLD_LAZY
10444     int mode = 1 ;
10445 #else
10446     int mode = RTLD_LAZY ;
10447 #endif
10448     handle = dlopen("./dyna.$dlext", mode) ;
10449     if (handle == NULL) {
10450         printf ("1\n") ;
10451         fflush (stdout) ;
10452         exit(0);
10453     }
10454     symbol = dlsym(handle, "fred") ;
10455     if (symbol == NULL) {
10456         /* try putting a leading underscore */
10457         symbol = dlsym(handle, "_fred") ;
10458         if (symbol == NULL) {
10459             printf ("2\n") ;
10460             fflush (stdout) ;
10461             exit(0);
10462         }
10463         printf ("3\n") ;
10464     }
10465     else
10466         printf ("4\n") ;
10467     fflush (stdout) ;
10468     exit(0);
10469 }
10470 EOM
10471         : Call the object file tmp-dyna.o in case dlext=o.
10472         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10473                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10474                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10475                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10476                 xxx=`$run ./fred`
10477                 case $xxx in
10478                 1)      echo "Test program failed using dlopen." >&4
10479                         echo "Perhaps you should not use dynamic loading." >&4;;
10480                 2)      echo "Test program failed using dlsym." >&4
10481                         echo "Perhaps you should not use dynamic loading." >&4;;
10482                 3)      echo "dlsym needs a leading underscore" >&4
10483                         val="$define" ;;
10484                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10485                 esac
10486         else
10487                 echo "I can't compile and run the test program." >&4
10488                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10489         fi
10490         ;;
10491 esac
10492                 
10493 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10494
10495 set d_dlsymun
10496 eval $setvar
10497
10498 : see if drand48_r exists
10499 set drand48_r d_drand48_r
10500 eval $inlibc
10501 case "$d_drand48_r" in
10502 "$define")
10503         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10504         case "$d_drand48_r_proto:$usethreads" in
10505         ":define")      d_drand48_r_proto=define
10506                 set d_drand48_r_proto drand48_r $hdrs
10507                 eval $hasproto ;;
10508         *)      ;;
10509         esac
10510         case "$d_drand48_r_proto" in
10511         define)
10512         case "$drand48_r_proto" in
10513         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10514         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10515         esac
10516         case "$drand48_r_proto" in
10517         ''|0)   d_drand48_r=undef
10518                 drand48_r_proto=0
10519                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10520         * )     case "$drand48_r_proto" in
10521                 REENTRANT_PROTO*) ;;
10522                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10523                 esac
10524                 echo "Prototype: $try" ;;
10525         esac
10526         ;;
10527         *)      case "$usethreads" in
10528                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10529                 esac
10530                 d_drand48_r=undef
10531                 drand48_r_proto=0
10532                 ;;
10533         esac
10534         ;;
10535 *)      drand48_r_proto=0
10536         ;;
10537 esac
10538
10539 : see if prototype for drand48 is available
10540 echo " "
10541 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10542 eval $hasproto
10543
10544 : see if dup2 exists
10545 set dup2 d_dup2
10546 eval $inlibc
10547
10548 : see if eaccess exists
10549 set eaccess d_eaccess
10550 eval $inlibc
10551
10552 : see if endgrent exists
10553 set endgrent d_endgrent
10554 eval $inlibc
10555
10556 : see if this is an grp system
10557 set grp.h i_grp
10558 eval $inhdr
10559
10560 case "$i_grp" in
10561 $define)
10562         xxx=`./findhdr grp.h`
10563         $cppstdin $cppflags $cppminus < $xxx >$$.h
10564
10565         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10566                 val="$define"
10567         else
10568                 val="$undef"
10569         fi
10570         set d_grpasswd
10571         eval $setvar
10572
10573         $rm -f $$.h
10574         ;;
10575 *)
10576         val="$undef";
10577         set d_grpasswd; eval $setvar
10578         ;;
10579 esac
10580
10581 : see if endgrent_r exists
10582 set endgrent_r d_endgrent_r
10583 eval $inlibc
10584 case "$d_endgrent_r" in
10585 "$define")
10586         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10587         case "$d_endgrent_r_proto:$usethreads" in
10588         ":define")      d_endgrent_r_proto=define
10589                 set d_endgrent_r_proto endgrent_r $hdrs
10590                 eval $hasproto ;;
10591         *)      ;;
10592         esac
10593         case "$d_endgrent_r_proto" in
10594         define)
10595         case "$endgrent_r_proto" in
10596         ''|0) try='int endgrent_r(FILE**);'
10597         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10598         esac
10599         case "$endgrent_r_proto" in
10600         ''|0) try='void endgrent_r(FILE**);'
10601         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10602         esac
10603         case "$endgrent_r_proto" in
10604         ''|0)   d_endgrent_r=undef
10605                 endgrent_r_proto=0
10606                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10607         * )     case "$endgrent_r_proto" in
10608                 REENTRANT_PROTO*) ;;
10609                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10610                 esac
10611                 echo "Prototype: $try" ;;
10612         esac
10613         ;;
10614         *)      case "$usethreads" in
10615                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10616                 esac
10617                 d_endgrent_r=undef
10618                 endgrent_r_proto=0
10619                 ;;
10620         esac
10621         ;;
10622 *)      endgrent_r_proto=0
10623         ;;
10624 esac
10625
10626 : see if endhostent exists
10627 set endhostent d_endhent
10628 eval $inlibc
10629
10630 : see if this is a netdb.h system
10631 set netdb.h i_netdb
10632 eval $inhdr
10633
10634 : see if endhostent_r exists
10635 set endhostent_r d_endhostent_r
10636 eval $inlibc
10637 case "$d_endhostent_r" in
10638 "$define")
10639         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10640         case "$d_endhostent_r_proto:$usethreads" in
10641         ":define")      d_endhostent_r_proto=define
10642                 set d_endhostent_r_proto endhostent_r $hdrs
10643                 eval $hasproto ;;
10644         *)      ;;
10645         esac
10646         case "$d_endhostent_r_proto" in
10647         define)
10648         case "$endhostent_r_proto" in
10649         ''|0) try='int endhostent_r(struct hostent_data*);'
10650         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10651         esac
10652         case "$endhostent_r_proto" in
10653         ''|0) try='void endhostent_r(struct hostent_data*);'
10654         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10655         esac
10656         case "$endhostent_r_proto" in
10657         ''|0)   d_endhostent_r=undef
10658                 endhostent_r_proto=0
10659                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10660         * )     case "$endhostent_r_proto" in
10661                 REENTRANT_PROTO*) ;;
10662                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10663                 esac
10664                 echo "Prototype: $try" ;;
10665         esac
10666         ;;
10667         *)      case "$usethreads" in
10668                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10669                 esac
10670                 d_endhostent_r=undef
10671                 endhostent_r_proto=0
10672                 ;;
10673         esac
10674         ;;
10675 *)      endhostent_r_proto=0
10676         ;;
10677 esac
10678
10679 : see if endnetent exists
10680 set endnetent d_endnent
10681 eval $inlibc
10682
10683 : see if endnetent_r exists
10684 set endnetent_r d_endnetent_r
10685 eval $inlibc
10686 case "$d_endnetent_r" in
10687 "$define")
10688         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10689         case "$d_endnetent_r_proto:$usethreads" in
10690         ":define")      d_endnetent_r_proto=define
10691                 set d_endnetent_r_proto endnetent_r $hdrs
10692                 eval $hasproto ;;
10693         *)      ;;
10694         esac
10695         case "$d_endnetent_r_proto" in
10696         define)
10697         case "$endnetent_r_proto" in
10698         ''|0) try='int endnetent_r(struct netent_data*);'
10699         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10700         esac
10701         case "$endnetent_r_proto" in
10702         ''|0) try='void endnetent_r(struct netent_data*);'
10703         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10704         esac
10705         case "$endnetent_r_proto" in
10706         ''|0)   d_endnetent_r=undef
10707                 endnetent_r_proto=0
10708                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10709         * )     case "$endnetent_r_proto" in
10710                 REENTRANT_PROTO*) ;;
10711                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10712                 esac
10713                 echo "Prototype: $try" ;;
10714         esac
10715         ;;
10716         *)      case "$usethreads" in
10717                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10718                 esac
10719                 d_endnetent_r=undef
10720                 endnetent_r_proto=0
10721                 ;;
10722         esac
10723         ;;
10724 *)      endnetent_r_proto=0
10725         ;;
10726 esac
10727
10728 : see if endprotoent exists
10729 set endprotoent d_endpent
10730 eval $inlibc
10731
10732 : see if endprotoent_r exists
10733 set endprotoent_r d_endprotoent_r
10734 eval $inlibc
10735 case "$d_endprotoent_r" in
10736 "$define")
10737         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10738         case "$d_endprotoent_r_proto:$usethreads" in
10739         ":define")      d_endprotoent_r_proto=define
10740                 set d_endprotoent_r_proto endprotoent_r $hdrs
10741                 eval $hasproto ;;
10742         *)      ;;
10743         esac
10744         case "$d_endprotoent_r_proto" in
10745         define)
10746         case "$endprotoent_r_proto" in
10747         ''|0) try='int endprotoent_r(struct protoent_data*);'
10748         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10749         esac
10750         case "$endprotoent_r_proto" in
10751         ''|0) try='void endprotoent_r(struct protoent_data*);'
10752         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10753         esac
10754         case "$endprotoent_r_proto" in
10755         ''|0)   d_endprotoent_r=undef
10756                 endprotoent_r_proto=0
10757                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10758         * )     case "$endprotoent_r_proto" in
10759                 REENTRANT_PROTO*) ;;
10760                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10761                 esac
10762                 echo "Prototype: $try" ;;
10763         esac
10764         ;;
10765         *)      case "$usethreads" in
10766                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10767                 esac
10768                 d_endprotoent_r=undef
10769                 endprotoent_r_proto=0
10770                 ;;
10771         esac
10772         ;;
10773 *)      endprotoent_r_proto=0
10774         ;;
10775 esac
10776
10777 : see if endpwent exists
10778 set endpwent d_endpwent
10779 eval $inlibc
10780
10781 : see if this is a pwd.h system
10782 set pwd.h i_pwd
10783 eval $inhdr
10784
10785 case "$i_pwd" in
10786 $define)
10787         xxx=`./findhdr pwd.h`
10788         $cppstdin $cppflags $cppminus < $xxx >$$.h
10789
10790         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10791                 val="$define"
10792         else
10793                 val="$undef"
10794         fi
10795         set d_pwquota
10796         eval $setvar
10797
10798         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10799                 val="$define"
10800         else
10801                 val="$undef"
10802         fi
10803         set d_pwage
10804         eval $setvar
10805
10806         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10807                 val="$define"
10808         else
10809                 val="$undef"
10810         fi
10811         set d_pwchange
10812         eval $setvar
10813
10814         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10815                 val="$define"
10816         else
10817                 val="$undef"
10818         fi
10819         set d_pwclass
10820         eval $setvar
10821
10822         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10823                 val="$define"
10824         else
10825                 val="$undef"
10826         fi
10827         set d_pwexpire
10828         eval $setvar
10829
10830         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10831                 val="$define"
10832         else
10833                 val="$undef"
10834         fi
10835         set d_pwcomment
10836         eval $setvar
10837
10838         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10839                 val="$define"
10840         else
10841                 val="$undef"
10842         fi
10843         set d_pwgecos
10844         eval $setvar
10845
10846         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10847                 val="$define"
10848         else
10849                 val="$undef"
10850         fi
10851         set d_pwpasswd
10852         eval $setvar
10853
10854         $rm -f $$.h
10855         ;;
10856 *)
10857         val="$undef"; 
10858         set d_pwquota; eval $setvar
10859         set d_pwage; eval $setvar
10860         set d_pwchange; eval $setvar
10861         set d_pwclass; eval $setvar
10862         set d_pwexpire; eval $setvar
10863         set d_pwcomment; eval $setvar
10864         set d_pwgecos; eval $setvar
10865         set d_pwpasswd; eval $setvar
10866         ;;
10867 esac
10868
10869 : see if endpwent_r exists
10870 set endpwent_r d_endpwent_r
10871 eval $inlibc
10872 case "$d_endpwent_r" in
10873 "$define")
10874         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10875         case "$d_endpwent_r_proto:$usethreads" in
10876         ":define")      d_endpwent_r_proto=define
10877                 set d_endpwent_r_proto endpwent_r $hdrs
10878                 eval $hasproto ;;
10879         *)      ;;
10880         esac
10881         case "$d_endpwent_r_proto" in
10882         define)
10883         case "$endpwent_r_proto" in
10884         ''|0) try='int endpwent_r(FILE**);'
10885         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10886         esac
10887         case "$endpwent_r_proto" in
10888         ''|0) try='void endpwent_r(FILE**);'
10889         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10890         esac
10891         case "$endpwent_r_proto" in
10892         ''|0)   d_endpwent_r=undef
10893                 endpwent_r_proto=0
10894                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10895         * )     case "$endpwent_r_proto" in
10896                 REENTRANT_PROTO*) ;;
10897                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10898                 esac
10899                 echo "Prototype: $try" ;;
10900         esac
10901         ;;
10902         *)      case "$usethreads" in
10903                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10904                 esac
10905                 d_endpwent_r=undef
10906                 endpwent_r_proto=0
10907                 ;;
10908         esac
10909         ;;
10910 *)      endpwent_r_proto=0
10911         ;;
10912 esac
10913
10914 : see if endservent exists
10915 set endservent d_endsent
10916 eval $inlibc
10917
10918 : see if endservent_r exists
10919 set endservent_r d_endservent_r
10920 eval $inlibc
10921 case "$d_endservent_r" in
10922 "$define")
10923         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10924         case "$d_endservent_r_proto:$usethreads" in
10925         ":define")      d_endservent_r_proto=define
10926                 set d_endservent_r_proto endservent_r $hdrs
10927                 eval $hasproto ;;
10928         *)      ;;
10929         esac
10930         case "$d_endservent_r_proto" in
10931         define)
10932         case "$endservent_r_proto" in
10933         ''|0) try='int endservent_r(struct servent_data*);'
10934         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10935         esac
10936         case "$endservent_r_proto" in
10937         ''|0) try='void endservent_r(struct servent_data*);'
10938         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10939         esac
10940         case "$endservent_r_proto" in
10941         ''|0)   d_endservent_r=undef
10942                 endservent_r_proto=0
10943                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10944         * )     case "$endservent_r_proto" in
10945                 REENTRANT_PROTO*) ;;
10946                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10947                 esac
10948                 echo "Prototype: $try" ;;
10949         esac
10950         ;;
10951         *)      case "$usethreads" in
10952                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10953                 esac
10954                 d_endservent_r=undef
10955                 endservent_r_proto=0
10956                 ;;
10957         esac
10958         ;;
10959 *)      endservent_r_proto=0
10960         ;;
10961 esac
10962
10963 : Locate the flags for 'open()'
10964 echo " "
10965 $cat >try.c <<'EOCP'
10966 #include <sys/types.h>
10967 #ifdef I_FCNTL
10968 #include <fcntl.h>
10969 #endif
10970 #ifdef I_SYS_FILE
10971 #include <sys/file.h>
10972 #endif
10973 int main() {
10974         if(O_RDONLY);
10975 #ifdef O_TRUNC
10976         exit(0);
10977 #else
10978         exit(1);
10979 #endif
10980 }
10981 EOCP
10982 : check sys/file.h first to get FREAD on Sun
10983 if $test `./findhdr sys/file.h` && \
10984                 set try -DI_SYS_FILE && eval $compile; then
10985         h_sysfile=true;
10986         echo "<sys/file.h> defines the O_* constants..." >&4
10987         if $run ./try; then
10988                 echo "and you have the 3 argument form of open()." >&4
10989                 val="$define"
10990         else
10991                 echo "but not the 3 argument form of open().  Oh, well." >&4
10992                 val="$undef"
10993         fi
10994 elif $test `./findhdr fcntl.h` && \
10995                 set try -DI_FCNTL && eval $compile; then
10996         h_fcntl=true;
10997         echo "<fcntl.h> defines the O_* constants..." >&4
10998         if $run ./try; then
10999                 echo "and you have the 3 argument form of open()." >&4
11000                 val="$define"
11001         else
11002                 echo "but not the 3 argument form of open().  Oh, well." >&4
11003                 val="$undef"
11004         fi
11005 else
11006         val="$undef"
11007         echo "I can't find the O_* constant definitions!  You got problems." >&4
11008 fi
11009 set d_open3
11010 eval $setvar
11011 $rm -f try try.*
11012
11013 : see which of string.h or strings.h is needed
11014 echo " "
11015 strings=`./findhdr string.h`
11016 if $test "$strings" && $test -r "$strings"; then
11017         echo "Using <string.h> instead of <strings.h>." >&4
11018         val="$define"
11019 else
11020         val="$undef"
11021         strings=`./findhdr strings.h`
11022         if $test "$strings" && $test -r "$strings"; then
11023                 echo "Using <strings.h> instead of <string.h>." >&4
11024         else
11025                 echo "No string header found -- You'll surely have problems." >&4
11026         fi
11027 fi
11028 set i_string
11029 eval $setvar
11030 case "$i_string" in
11031 "$undef") strings=`./findhdr strings.h`;;
11032 *)        strings=`./findhdr string.h`;;
11033 esac
11034
11035 : see if this is a sys/file.h system
11036 val=''
11037 set sys/file.h val
11038 eval $inhdr
11039
11040 : do we need to include sys/file.h ?
11041 case "$val" in
11042 "$define")
11043         echo " "
11044         if $h_sysfile; then
11045                 val="$define"
11046                 echo "We'll be including <sys/file.h>." >&4
11047         else
11048                 val="$undef"
11049                 echo "We won't be including <sys/file.h>." >&4
11050         fi
11051         ;;
11052 *)
11053         h_sysfile=false
11054         ;;
11055 esac
11056 set i_sysfile
11057 eval $setvar
11058
11059 : see if fcntl.h is there
11060 val=''
11061 set fcntl.h val
11062 eval $inhdr
11063
11064 : see if we can include fcntl.h
11065 case "$val" in
11066 "$define")
11067         echo " "
11068         if $h_fcntl; then
11069                 val="$define"
11070                 echo "We'll be including <fcntl.h>." >&4
11071         else
11072                 val="$undef"
11073                 if $h_sysfile; then
11074         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11075                 else
11076                         echo "We won't be including <fcntl.h>." >&4
11077                 fi
11078         fi
11079         ;;
11080 *)
11081         h_fcntl=false
11082         val="$undef"
11083         ;;
11084 esac
11085 set i_fcntl
11086 eval $setvar
11087
11088 : check for non-blocking I/O stuff
11089 case "$h_sysfile" in
11090 true) echo "#include <sys/file.h>" > head.c;;
11091 *)
11092        case "$h_fcntl" in
11093        true) echo "#include <fcntl.h>" > head.c;;
11094        *) echo "#include <sys/fcntl.h>" > head.c;;
11095        esac
11096        ;;
11097 esac
11098 echo " "
11099 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11100 case "$o_nonblock" in
11101 '')
11102         $cat head.c > try.c
11103         $cat >>try.c <<EOCP
11104 #include <stdio.h>
11105 #include <stdlib.h>
11106 #$i_fcntl I_FCNTL
11107 #ifdef I_FCNTL
11108 #include <fcntl.h>
11109 #endif
11110 int main() {
11111 #ifdef O_NONBLOCK
11112         printf("O_NONBLOCK\n");
11113         exit(0);
11114 #endif
11115 #ifdef O_NDELAY
11116         printf("O_NDELAY\n");
11117         exit(0);
11118 #endif
11119 #ifdef FNDELAY
11120         printf("FNDELAY\n");
11121         exit(0);
11122 #endif
11123         exit(0);
11124 }
11125 EOCP
11126         set try
11127         if eval $compile_ok; then
11128                 o_nonblock=`$run ./try`
11129                 case "$o_nonblock" in
11130                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11131                 *) echo "Seems like we can use $o_nonblock.";;
11132                 esac
11133         else
11134                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11135         fi
11136         ;;
11137 *) echo "Using $hint value $o_nonblock.";;
11138 esac
11139 $rm -f try try.* .out core
11140
11141 echo " "
11142 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11143 case "$eagain" in
11144 '')
11145         $cat head.c > try.c
11146         $cat >>try.c <<EOCP
11147 #include <errno.h>
11148 #include <sys/types.h>
11149 #include <signal.h>
11150 #include <stdio.h> 
11151 #include <stdlib.h> 
11152 #$i_fcntl I_FCNTL
11153 #ifdef I_FCNTL
11154 #include <fcntl.h>
11155 #endif
11156 #define MY_O_NONBLOCK $o_nonblock
11157 #ifndef errno  /* XXX need better Configure test */
11158 extern int errno;
11159 #endif
11160 #$i_unistd I_UNISTD
11161 #ifdef I_UNISTD
11162 #include <unistd.h>
11163 #endif
11164 #$i_string I_STRING
11165 #ifdef I_STRING
11166 #include <string.h>
11167 #else
11168 #include <strings.h>
11169 #endif
11170 $signal_t blech(x) int x; { exit(3); }
11171 EOCP
11172         $cat >> try.c <<'EOCP'
11173 int main()
11174 {
11175         int pd[2];
11176         int pu[2];
11177         char buf[1];
11178         char string[100];
11179
11180         pipe(pd);       /* Down: child -> parent */
11181         pipe(pu);       /* Up: parent -> child */
11182         if (0 != fork()) {
11183                 int ret;
11184                 close(pd[1]);   /* Parent reads from pd[0] */
11185                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11186 #ifdef F_SETFL
11187                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11188                         exit(1);
11189 #else
11190                 exit(4);
11191 #endif
11192                 signal(SIGALRM, blech);
11193                 alarm(5);
11194                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11195                         exit(2);
11196                 sprintf(string, "%d\n", ret);
11197                 write(2, string, strlen(string));
11198                 alarm(0);
11199 #ifdef EAGAIN
11200                 if (errno == EAGAIN) {
11201                         printf("EAGAIN\n");
11202                         goto ok;
11203                 }
11204 #endif
11205 #ifdef EWOULDBLOCK
11206                 if (errno == EWOULDBLOCK)
11207                         printf("EWOULDBLOCK\n");
11208 #endif
11209         ok:
11210                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11211                 sleep(2);                               /* Give it time to close our pipe */
11212                 alarm(5);
11213                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11214                 alarm(0);
11215                 sprintf(string, "%d\n", ret);
11216                 write(4, string, strlen(string));
11217                 exit(0);
11218         }
11219
11220         close(pd[0]);                   /* We write to pd[1] */
11221         close(pu[1]);                   /* We read from pu[0] */
11222         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11223         close(pd[1]);                   /* Pipe pd is now fully closed! */
11224         exit(0);                                /* Bye bye, thank you for playing! */
11225 }
11226 EOCP
11227         set try
11228         if eval $compile_ok; then
11229                 echo "$startsh" >mtry
11230                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11231                 chmod +x mtry
11232                 ./mtry >/dev/null 2>&1
11233                 case $? in
11234                 0) eagain=`$cat try.out`;;
11235                 1) echo "Could not perform non-blocking setting!";;
11236                 2) echo "I did a successful read() for something that was not there!";;
11237                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11238                 4) echo "Could not find F_SETFL!";;
11239                 *) echo "Something terribly wrong happened during testing.";;
11240                 esac
11241                 rd_nodata=`$cat try.ret`
11242                 echo "A read() system call with no data present returns $rd_nodata."
11243                 case "$rd_nodata" in
11244                 0|-1) ;;
11245                 *)
11246                         echo "(That's peculiar, fixing that to be -1.)"
11247                         rd_nodata=-1
11248                         ;;
11249                 esac
11250                 case "$eagain" in
11251                 '')
11252                         echo "Forcing errno EAGAIN on read() with no data available."
11253                         eagain=EAGAIN
11254                         ;;
11255                 *)
11256                         echo "Your read() sets errno to $eagain when no data is available."
11257                         ;;
11258                 esac
11259                 status=`$cat try.err`
11260                 case "$status" in
11261                 0) echo "And it correctly returns 0 to signal EOF.";;
11262                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11263                 *) echo "However, your read() returns '$status' on EOF??";;
11264                 esac
11265                 val="$define"
11266                 if test "$status" = "$rd_nodata"; then
11267                         echo "WARNING: you can't distinguish between EOF and no data!"
11268                         val="$undef"
11269                 fi
11270         else
11271                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11272                 eagain=EAGAIN
11273         fi
11274         set d_eofnblk
11275         eval $setvar
11276         ;;
11277 *)
11278         echo "Using $hint value $eagain."
11279         echo "Your read() returns $rd_nodata when no data is present."
11280         case "$d_eofnblk" in
11281         "$define") echo "And you can see EOF because read() returns 0.";;
11282         "$undef") echo "But you can't see EOF status from read() returned value.";;
11283         *)
11284                 echo "(Assuming you can't see EOF status from read anyway.)"
11285                 d_eofnblk=$undef
11286                 ;;
11287         esac
11288         ;;
11289 esac
11290 $rm -f try try.* .out core head.c mtry
11291
11292 : see if fchdir exists
11293 set fchdir d_fchdir
11294 eval $inlibc
11295
11296 : see if fchmod exists
11297 set fchmod d_fchmod
11298 eval $inlibc
11299
11300 : see if fchown exists
11301 set fchown d_fchown
11302 eval $inlibc
11303
11304 : see if this is an fcntl system
11305 set fcntl d_fcntl
11306 eval $inlibc
11307
11308 echo " "
11309 : See if fcntl-based locking works.
11310 $cat >try.c <<EOCP
11311 #include <stdlib.h>
11312 #include <unistd.h>
11313 #include <fcntl.h>
11314 #include <signal.h>
11315 $signal_t blech(x) int x; { exit(3); }
11316 int main() {
11317 #if defined(F_SETLK) && defined(F_SETLKW)
11318      struct flock flock;
11319      int retval, fd;
11320      fd = open("try.c", O_RDONLY);
11321      flock.l_type = F_RDLCK;
11322      flock.l_whence = SEEK_SET;
11323      flock.l_start = flock.l_len = 0;
11324      signal(SIGALRM, blech);
11325      alarm(10);
11326      retval = fcntl(fd, F_SETLK, &flock);
11327      close(fd);
11328      (retval < 0 ? exit(2) : exit(0));
11329 #else
11330      exit(2);
11331 #endif
11332 }
11333 EOCP
11334 echo "Checking if fcntl-based file locking works... "
11335 case "$d_fcntl" in
11336 "$define")
11337         set try
11338         if eval $compile_ok; then
11339                 if $run ./try; then
11340                         echo "Yes, it seems to work."
11341                         val="$define"
11342                 else
11343                         echo "Nope, it didn't work."
11344                         val="$undef"
11345                         case "$?" in
11346                         3) $cat >&4 <<EOM
11347 ***
11348 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11349 *** This is (almost) impossible.
11350 *** If your NFS lock daemons are not feeling well, something like
11351 *** this may happen, please investigate.  Cannot continue, aborting.
11352 ***
11353 EOM
11354                                 exit 1
11355                                 ;;
11356                         esac
11357                 fi
11358         else
11359                 echo "I'm unable to compile the test program, so I'll assume not."
11360                 val="$undef"
11361         fi
11362         ;;
11363 *) val="$undef";
11364         echo "Nope, since you don't even have fcntl()."
11365         ;;
11366 esac
11367 set d_fcntl_can_lock
11368 eval $setvar
11369 $rm -f try*
11370
11371
11372 : check for fd_set items
11373 $cat <<EOM
11374
11375 Checking to see how well your C compiler handles fd_set and friends ...
11376 EOM
11377 $cat >try.c <<EOCP
11378 #$i_systime I_SYS_TIME
11379 #$i_sysselct I_SYS_SELECT
11380 #$d_socket HAS_SOCKET
11381 #include <sys/types.h>
11382 #ifdef HAS_SOCKET
11383 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11384 #endif
11385 #ifdef I_SYS_TIME
11386 #include <sys/time.h>
11387 #endif
11388 #ifdef I_SYS_SELECT
11389 #include <sys/select.h>
11390 #endif
11391 int main() {
11392         fd_set fds;
11393
11394 #ifdef TRYBITS
11395         if(fds.fds_bits);
11396 #endif
11397
11398 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11399         exit(0);
11400 #else
11401         exit(1);
11402 #endif
11403 }
11404 EOCP
11405 set try -DTRYBITS
11406 if eval $compile; then
11407         d_fds_bits="$define"
11408         d_fd_set="$define"
11409         echo "Well, your system knows about the normal fd_set typedef..." >&4
11410         if $run ./try; then
11411                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11412                 d_fd_macros="$define"
11413         else
11414                 $cat >&4 <<'EOM'
11415 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11416 EOM
11417                 d_fd_macros="$undef"
11418         fi
11419 else
11420         $cat <<'EOM'
11421 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11422 EOM
11423         set try
11424         if eval $compile; then
11425                 d_fds_bits="$undef"
11426                 d_fd_set="$define"
11427                 echo "Well, your system has some sort of fd_set available..." >&4
11428                 if $run ./try; then
11429                         echo "and you have the normal fd_set macros." >&4
11430                         d_fd_macros="$define"
11431                 else
11432                         $cat <<'EOM'
11433 but not the normal fd_set macros!  Gross!  More work for me...
11434 EOM
11435                         d_fd_macros="$undef"
11436                 fi
11437         else
11438         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11439                 d_fd_set="$undef"
11440                 d_fds_bits="$undef"
11441                 d_fd_macros="$undef"
11442         fi
11443 fi
11444 $rm -f try try.*
11445
11446 : see if fgetpos exists
11447 set fgetpos d_fgetpos
11448 eval $inlibc
11449
11450 : see if finite exists
11451 set finite d_finite
11452 eval $inlibc
11453
11454 : see if finitel exists
11455 set finitel d_finitel
11456 eval $inlibc
11457
11458 : see if flock exists
11459 set flock d_flock
11460 eval $inlibc
11461
11462 : see if prototype for flock is available
11463 echo " "
11464 set d_flockproto flock $i_sysfile sys/file.h
11465 eval $hasproto
11466
11467 : see if fork exists
11468 set fork d_fork
11469 eval $inlibc
11470
11471 : see if fp_class exists
11472 set fp_class d_fp_class
11473 eval $inlibc
11474
11475 : see if pathconf exists
11476 set pathconf d_pathconf
11477 eval $inlibc
11478
11479 : see if fpathconf exists
11480 set fpathconf d_fpathconf
11481 eval $inlibc
11482
11483 : see if fpclass exists
11484 set fpclass d_fpclass
11485 eval $inlibc
11486
11487 : see if fpclassify exists
11488 set fpclassify d_fpclassify
11489 eval $inlibc
11490
11491 : see if fpclassl exists
11492 set fpclassl d_fpclassl
11493 eval $inlibc
11494
11495
11496 : check for fpos64_t
11497 echo " "
11498 echo "Checking to see if you have fpos64_t..." >&4
11499 $cat >try.c <<EOCP
11500 #include <stdio.h>
11501 int main() { fpos64_t x = 7; }
11502 EOCP
11503 set try
11504 if eval $compile; then
11505         val="$define"
11506         echo "You have fpos64_t."
11507 else
11508         val="$undef"
11509         echo "You do not have fpos64_t."
11510         case "$fpossize" in
11511         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11512         esac
11513 fi
11514 $rm -f try.* try
11515 set d_fpos64_t
11516 eval $setvar
11517
11518 : see if frexpl exists
11519 set frexpl d_frexpl
11520 eval $inlibc
11521
11522 : see if this is a sys/param system
11523 set sys/param.h i_sysparam
11524 eval $inhdr
11525
11526 : see if this is a sys/mount.h system
11527 set sys/mount.h i_sysmount
11528 eval $inhdr
11529
11530
11531 echo " "
11532 echo "Checking to see if your system supports struct fs_data..." >&4
11533 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11534 eval $hasstruct
11535 case "$d_fs_data_s" in
11536 "$define")      echo "Yes, it does."   ;;
11537 *)              echo "No, it doesn't." ;;
11538 esac
11539
11540 : see if fseeko exists
11541 set fseeko d_fseeko
11542 eval $inlibc
11543 case "$longsize" in
11544 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11545 esac
11546
11547 : see if fsetpos exists
11548 set fsetpos d_fsetpos
11549 eval $inlibc
11550
11551
11552 : see if fstatfs exists
11553 set fstatfs d_fstatfs
11554 eval $inlibc
11555
11556
11557 : see if statvfs exists
11558 set statvfs d_statvfs
11559 eval $inlibc
11560
11561 : see if fstatvfs exists
11562 set fstatvfs d_fstatvfs
11563 eval $inlibc
11564
11565
11566 : see if fsync exists
11567 set fsync d_fsync
11568 eval $inlibc
11569
11570 : see if ftello exists
11571 set ftello d_ftello
11572 eval $inlibc
11573 case "$longsize" in
11574 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11575 esac
11576
11577 : see if getcwd exists
11578 set getcwd d_getcwd
11579 eval $inlibc
11580
11581 : see if getespwnam exists
11582 set getespwnam d_getespwnam
11583 eval $inlibc
11584
11585
11586 : see if getfsstat exists
11587 set getfsstat d_getfsstat
11588 eval $inlibc
11589
11590 : see if getgrent exists
11591 set getgrent d_getgrent
11592 eval $inlibc
11593
11594 : see if getgrent_r exists
11595 set getgrent_r d_getgrent_r
11596 eval $inlibc
11597 case "$d_getgrent_r" in
11598 "$define")
11599         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11600         case "$d_getgrent_r_proto:$usethreads" in
11601         ":define")      d_getgrent_r_proto=define
11602                 set d_getgrent_r_proto getgrent_r $hdrs
11603                 eval $hasproto ;;
11604         *)      ;;
11605         esac
11606         case "$d_getgrent_r_proto" in
11607         define)
11608         case "$getgrent_r_proto" in
11609         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11610         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11611         esac
11612         case "$getgrent_r_proto" in
11613         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11614         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11615         esac
11616         case "$getgrent_r_proto" in
11617         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11618         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11619         esac
11620         case "$getgrent_r_proto" in
11621         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11622         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11623         esac
11624         case "$getgrent_r_proto" in
11625         ''|0) try='int getgrent_r(struct group*, char*, int);'
11626         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11627         esac
11628         case "$getgrent_r_proto" in
11629         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11630         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11631         esac
11632         case "$getgrent_r_proto" in
11633         ''|0)   d_getgrent_r=undef
11634                 getgrent_r_proto=0
11635                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11636         * )     case "$getgrent_r_proto" in
11637                 REENTRANT_PROTO*) ;;
11638                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11639                 esac
11640                 echo "Prototype: $try" ;;
11641         esac
11642         ;;
11643         *)      case "$usethreads" in
11644                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11645                 esac
11646                 d_getgrent_r=undef
11647                 getgrent_r_proto=0
11648                 ;;
11649         esac
11650         ;;
11651 *)      getgrent_r_proto=0
11652         ;;
11653 esac
11654
11655 : see if getgrgid_r exists
11656 set getgrgid_r d_getgrgid_r
11657 eval $inlibc
11658 case "$d_getgrgid_r" in
11659 "$define")
11660         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11661         case "$d_getgrgid_r_proto:$usethreads" in
11662         ":define")      d_getgrgid_r_proto=define
11663                 set d_getgrgid_r_proto getgrgid_r $hdrs
11664                 eval $hasproto ;;
11665         *)      ;;
11666         esac
11667         case "$d_getgrgid_r_proto" in
11668         define)
11669         case "$getgrgid_r_proto" in
11670         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11671         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11672         esac
11673         case "$getgrgid_r_proto" in
11674         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11675         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11676         esac
11677         case "$getgrgid_r_proto" in
11678         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11679         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11680         esac
11681         case "$getgrgid_r_proto" in
11682         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11683         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11684         esac
11685         case "$getgrgid_r_proto" in
11686         ''|0)   d_getgrgid_r=undef
11687                 getgrgid_r_proto=0
11688                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11689         * )     case "$getgrgid_r_proto" in
11690                 REENTRANT_PROTO*) ;;
11691                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11692                 esac
11693                 echo "Prototype: $try" ;;
11694         esac
11695         ;;
11696         *)      case "$usethreads" in
11697                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11698                 esac
11699                 d_getgrgid_r=undef
11700                 getgrgid_r_proto=0
11701                 ;;
11702         esac
11703         ;;
11704 *)      getgrgid_r_proto=0
11705         ;;
11706 esac
11707
11708 : see if getgrnam_r exists
11709 set getgrnam_r d_getgrnam_r
11710 eval $inlibc
11711 case "$d_getgrnam_r" in
11712 "$define")
11713         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11714         case "$d_getgrnam_r_proto:$usethreads" in
11715         ":define")      d_getgrnam_r_proto=define
11716                 set d_getgrnam_r_proto getgrnam_r $hdrs
11717                 eval $hasproto ;;
11718         *)      ;;
11719         esac
11720         case "$d_getgrnam_r_proto" in
11721         define)
11722         case "$getgrnam_r_proto" in
11723         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11724         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11725         esac
11726         case "$getgrnam_r_proto" in
11727         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11728         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11729         esac
11730         case "$getgrnam_r_proto" in
11731         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11732         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11733         esac
11734         case "$getgrnam_r_proto" in
11735         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11736         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11737         esac
11738         case "$getgrnam_r_proto" in
11739         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11740         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11741         esac
11742         case "$getgrnam_r_proto" in
11743         ''|0)   d_getgrnam_r=undef
11744                 getgrnam_r_proto=0
11745                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11746         * )     case "$getgrnam_r_proto" in
11747                 REENTRANT_PROTO*) ;;
11748                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11749                 esac
11750                 echo "Prototype: $try" ;;
11751         esac
11752         ;;
11753         *)      case "$usethreads" in
11754                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11755                 esac
11756                 d_getgrnam_r=undef
11757                 getgrnam_r_proto=0
11758                 ;;
11759         esac
11760         ;;
11761 *)      getgrnam_r_proto=0
11762         ;;
11763 esac
11764
11765 : see if gethostbyaddr exists
11766 set gethostbyaddr d_gethbyaddr
11767 eval $inlibc
11768
11769 : see if gethostbyname exists
11770 set gethostbyname d_gethbyname
11771 eval $inlibc
11772
11773 : see if gethostent exists
11774 set gethostent d_gethent
11775 eval $inlibc
11776
11777 : see how we will look up host name
11778 echo " "
11779 call=''
11780 if set gethostname val -f d_gethname; eval $csym; $val; then
11781         echo 'gethostname() found.' >&4
11782         d_gethname="$define"
11783         call=gethostname
11784 fi
11785 if set uname val -f d_uname; eval $csym; $val; then
11786         if ./xenix; then
11787                 $cat <<'EOM'
11788 uname() was found, but you're running xenix, and older versions of xenix
11789 have a broken uname(). If you don't really know whether your xenix is old
11790 enough to have a broken system call, use the default answer.
11791
11792 EOM
11793                 dflt=y
11794                 case "$d_uname" in
11795                 "$define") dflt=n;;
11796                 esac
11797                 rp='Is your uname() broken?'
11798                 . ./myread
11799                 case "$ans" in
11800                 n*) d_uname="$define"; call=uname;;
11801                 esac
11802         else
11803                 echo 'uname() found.' >&4
11804                 d_uname="$define"
11805                 case "$call" in
11806                 '') call=uname ;;
11807                 esac
11808         fi
11809 fi
11810 case "$d_gethname" in
11811 '') d_gethname="$undef";;
11812 esac
11813 case "$d_uname" in
11814 '') d_uname="$undef";;
11815 esac
11816 case "$d_uname$d_gethname" in
11817 *define*)
11818         dflt=n
11819         cat <<EOM
11820  
11821 Every now and then someone has a $call() that lies about the hostname
11822 but can't be fixed for political or economic reasons.  If you wish, I can
11823 pretend $call() isn't there and maybe compute hostname at run-time
11824 thanks to the '$phostname' command.
11825
11826 EOM
11827         rp="Shall I ignore $call() from now on?"
11828         . ./myread
11829         case "$ans" in
11830         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11831         esac;;
11832 esac
11833 case "$phostname" in
11834 '') aphostname='';;
11835 *) case "$aphostname" in
11836         /*) ;;
11837         *) set X $phostname
11838                 shift
11839                 file=$1
11840                 shift
11841                 file=`./loc $file $file $pth`
11842                 aphostname=`echo $file $*`
11843                 ;;
11844         esac
11845         ;;
11846 esac
11847 case "$d_uname$d_gethname" in
11848 *define*) ;;
11849 *)
11850         case "$phostname" in
11851         '')
11852                 echo "There will be no way for $package to get your hostname." >&4;;
11853         *)
11854         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11855                 ;;
11856         esac;;
11857 esac
11858 case "$d_phostname" in
11859 '') d_phostname="$undef";;
11860 esac
11861
11862 : see if gethostbyaddr_r exists
11863 set gethostbyaddr_r d_gethostbyaddr_r
11864 eval $inlibc
11865 case "$d_gethostbyaddr_r" in
11866 "$define")
11867         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
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 "$d_gethostbyname_r_proto:$usethreads" in
11946         ":define")      d_gethostbyname_r_proto=define
11947                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11948                 eval $hasproto ;;
11949         *)      ;;
11950         esac
11951         case "$d_gethostbyname_r_proto" in
11952         define)
11953         case "$gethostbyname_r_proto" in
11954         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11955         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11956         esac
11957         case "$gethostbyname_r_proto" in
11958         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11959         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11960         esac
11961         case "$gethostbyname_r_proto" in
11962         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11963         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11964         esac
11965         case "$gethostbyname_r_proto" in
11966         ''|0)   d_gethostbyname_r=undef
11967                 gethostbyname_r_proto=0
11968                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11969         * )     case "$gethostbyname_r_proto" in
11970                 REENTRANT_PROTO*) ;;
11971                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11972                 esac
11973                 echo "Prototype: $try" ;;
11974         esac
11975         ;;
11976         *)      case "$usethreads" in
11977                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11978                 esac
11979                 d_gethostbyname_r=undef
11980                 gethostbyname_r_proto=0
11981                 ;;
11982         esac
11983         ;;
11984 *)      gethostbyname_r_proto=0
11985         ;;
11986 esac
11987
11988 : see if gethostent_r exists
11989 set gethostent_r d_gethostent_r
11990 eval $inlibc
11991 case "$d_gethostent_r" in
11992 "$define")
11993         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11994         case "$d_gethostent_r_proto:$usethreads" in
11995         ":define")      d_gethostent_r_proto=define
11996                 set d_gethostent_r_proto gethostent_r $hdrs
11997                 eval $hasproto ;;
11998         *)      ;;
11999         esac
12000         case "$d_gethostent_r_proto" in
12001         define)
12002         case "$gethostent_r_proto" in
12003         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12004         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12005         esac
12006         case "$gethostent_r_proto" in
12007         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12008         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12009         esac
12010         case "$gethostent_r_proto" in
12011         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12012         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12013         esac
12014         case "$gethostent_r_proto" in
12015         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12016         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12017         esac
12018         case "$gethostent_r_proto" in
12019         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12020         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12021         esac
12022         case "$gethostent_r_proto" in
12023         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12024         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12025         esac
12026         case "$gethostent_r_proto" in
12027         ''|0)   d_gethostent_r=undef
12028                 gethostent_r_proto=0
12029                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12030         * )     case "$gethostent_r_proto" in
12031                 REENTRANT_PROTO*) ;;
12032                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12033                 esac
12034                 echo "Prototype: $try" ;;
12035         esac
12036         ;;
12037         *)      case "$usethreads" in
12038                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12039                 esac
12040                 d_gethostent_r=undef
12041                 gethostent_r_proto=0
12042                 ;;
12043         esac
12044         ;;
12045 *)      gethostent_r_proto=0
12046         ;;
12047 esac
12048
12049 : see if prototypes for various gethostxxx netdb.h functions are available
12050 echo " "
12051 set d_gethostprotos gethostent $i_netdb netdb.h
12052 eval $hasproto
12053
12054 : see if getitimer exists
12055 set getitimer d_getitimer
12056 eval $inlibc
12057
12058 : see if getlogin exists
12059 set getlogin d_getlogin
12060 eval $inlibc
12061
12062 : see if getlogin_r exists
12063 set getlogin_r d_getlogin_r
12064 eval $inlibc
12065 case "$d_getlogin_r" in
12066 "$define")
12067         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12068         case "$d_getlogin_r_proto:$usethreads" in
12069         ":define")      d_getlogin_r_proto=define
12070                 set d_getlogin_r_proto getlogin_r $hdrs
12071                 eval $hasproto ;;
12072         *)      ;;
12073         esac
12074         case "$d_getlogin_r_proto" in
12075         define)
12076         case "$getlogin_r_proto" in
12077         ''|0) try='int getlogin_r(char*, size_t);'
12078         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12079         esac
12080         case "$getlogin_r_proto" in
12081         ''|0) try='int getlogin_r(char*, int);'
12082         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12083         esac
12084         case "$getlogin_r_proto" in
12085         ''|0) try='char* getlogin_r(char*, size_t);'
12086         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12087         esac
12088         case "$getlogin_r_proto" in
12089         ''|0) try='char* getlogin_r(char*, int);'
12090         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12091         esac
12092         case "$getlogin_r_proto" in
12093         ''|0)   d_getlogin_r=undef
12094                 getlogin_r_proto=0
12095                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12096         * )     case "$getlogin_r_proto" in
12097                 REENTRANT_PROTO*) ;;
12098                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12099                 esac
12100                 echo "Prototype: $try" ;;
12101         esac
12102         ;;
12103         *)      case "$usethreads" in
12104                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12105                 esac
12106                 d_getlogin_r=undef
12107                 getlogin_r_proto=0
12108                 ;;
12109         esac
12110         ;;
12111 *)      getlogin_r_proto=0
12112         ;;
12113 esac
12114
12115 : see if getmnt exists
12116 set getmnt d_getmnt
12117 eval $inlibc
12118
12119 : see if getmntent exists
12120 set getmntent d_getmntent
12121 eval $inlibc
12122
12123 : see if getnetbyaddr exists
12124 set getnetbyaddr d_getnbyaddr
12125 eval $inlibc
12126
12127 : see if getnetbyname exists
12128 set getnetbyname d_getnbyname
12129 eval $inlibc
12130
12131 : see if getnetent exists
12132 set getnetent d_getnent
12133 eval $inlibc
12134
12135 : see if getnetbyaddr_r exists
12136 set getnetbyaddr_r d_getnetbyaddr_r
12137 eval $inlibc
12138 case "$d_getnetbyaddr_r" in
12139 "$define")
12140         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12141         case "$d_getnetbyaddr_r_proto:$usethreads" in
12142         ":define")      d_getnetbyaddr_r_proto=define
12143                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12144                 eval $hasproto ;;
12145         *)      ;;
12146         esac
12147         case "$d_getnetbyaddr_r_proto" in
12148         define)
12149         case "$getnetbyaddr_r_proto" in
12150         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12151         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12152         esac
12153         case "$getnetbyaddr_r_proto" in
12154         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12155         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12156         esac
12157         case "$getnetbyaddr_r_proto" in
12158         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12159         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12160         esac
12161         case "$getnetbyaddr_r_proto" in
12162         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12163         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12164         esac
12165         case "$getnetbyaddr_r_proto" in
12166         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12167         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12168         esac
12169         case "$getnetbyaddr_r_proto" in
12170         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12171         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12172         esac
12173         case "$getnetbyaddr_r_proto" in
12174         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12175         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12176         esac
12177         case "$getnetbyaddr_r_proto" in
12178         ''|0)   d_getnetbyaddr_r=undef
12179                 getnetbyaddr_r_proto=0
12180                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12181         * )     case "$getnetbyaddr_r_proto" in
12182                 REENTRANT_PROTO*) ;;
12183                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12184                 esac
12185                 echo "Prototype: $try" ;;
12186         esac
12187         ;;
12188         *)      case "$usethreads" in
12189                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12190                 esac
12191                 d_getnetbyaddr_r=undef
12192                 getnetbyaddr_r_proto=0
12193                 ;;
12194         esac
12195         ;;
12196 *)      getnetbyaddr_r_proto=0
12197         ;;
12198 esac
12199
12200 : see if getnetbyname_r exists
12201 set getnetbyname_r d_getnetbyname_r
12202 eval $inlibc
12203 case "$d_getnetbyname_r" in
12204 "$define")
12205         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12206         case "$d_getnetbyname_r_proto:$usethreads" in
12207         ":define")      d_getnetbyname_r_proto=define
12208                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12209                 eval $hasproto ;;
12210         *)      ;;
12211         esac
12212         case "$d_getnetbyname_r_proto" in
12213         define)
12214         case "$getnetbyname_r_proto" in
12215         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12216         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12217         esac
12218         case "$getnetbyname_r_proto" in
12219         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12220         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12221         esac
12222         case "$getnetbyname_r_proto" in
12223         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12224         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12225         esac
12226         case "$getnetbyname_r_proto" in
12227         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12228         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12229         esac
12230         case "$getnetbyname_r_proto" in
12231         ''|0)   d_getnetbyname_r=undef
12232                 getnetbyname_r_proto=0
12233                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12234         * )     case "$getnetbyname_r_proto" in
12235                 REENTRANT_PROTO*) ;;
12236                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12237                 esac
12238                 echo "Prototype: $try" ;;
12239         esac
12240         ;;
12241         *)      case "$usethreads" in
12242                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12243                 esac
12244                 d_getnetbyname_r=undef
12245                 getnetbyname_r_proto=0
12246                 ;;
12247         esac
12248         ;;
12249 *)      getnetbyname_r_proto=0
12250         ;;
12251 esac
12252
12253 : see if getnetent_r exists
12254 set getnetent_r d_getnetent_r
12255 eval $inlibc
12256 case "$d_getnetent_r" in
12257 "$define")
12258         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12259         case "$d_getnetent_r_proto:$usethreads" in
12260         ":define")      d_getnetent_r_proto=define
12261                 set d_getnetent_r_proto getnetent_r $hdrs
12262                 eval $hasproto ;;
12263         *)      ;;
12264         esac
12265         case "$d_getnetent_r_proto" in
12266         define)
12267         case "$getnetent_r_proto" in
12268         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12269         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12270         esac
12271         case "$getnetent_r_proto" in
12272         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12273         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12274         esac
12275         case "$getnetent_r_proto" in
12276         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12277         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12278         esac
12279         case "$getnetent_r_proto" in
12280         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12281         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12282         esac
12283         case "$getnetent_r_proto" in
12284         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12285         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12286         esac
12287         case "$getnetent_r_proto" in
12288         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12289         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12290         esac
12291         case "$getnetent_r_proto" in
12292         ''|0)   d_getnetent_r=undef
12293                 getnetent_r_proto=0
12294                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12295         * )     case "$getnetent_r_proto" in
12296                 REENTRANT_PROTO*) ;;
12297                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12298                 esac
12299                 echo "Prototype: $try" ;;
12300         esac
12301         ;;
12302         *)      case "$usethreads" in
12303                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12304                 esac
12305                 d_getnetent_r=undef
12306                 getnetent_r_proto=0
12307                 ;;
12308         esac
12309         ;;
12310 *)      getnetent_r_proto=0
12311         ;;
12312 esac
12313
12314 : see if prototypes for various getnetxxx netdb.h functions are available
12315 echo " "
12316 set d_getnetprotos getnetent $i_netdb netdb.h
12317 eval $hasproto
12318
12319 : see if getpagesize exists
12320 set getpagesize d_getpagsz
12321 eval $inlibc
12322
12323
12324 : see if getprotobyname exists
12325 set getprotobyname d_getpbyname
12326 eval $inlibc
12327
12328 : see if getprotobynumber exists
12329 set getprotobynumber d_getpbynumber
12330 eval $inlibc
12331
12332 : see if getprotoent exists
12333 set getprotoent d_getpent
12334 eval $inlibc
12335
12336 : see if getpgid exists
12337 set getpgid d_getpgid
12338 eval $inlibc
12339
12340 : see if getpgrp2 exists
12341 set getpgrp2 d_getpgrp2
12342 eval $inlibc
12343
12344 : see if getppid exists
12345 set getppid d_getppid
12346 eval $inlibc
12347
12348 : see if getpriority exists
12349 set getpriority d_getprior
12350 eval $inlibc
12351
12352 : see if getprotobyname_r exists
12353 set getprotobyname_r d_getprotobyname_r
12354 eval $inlibc
12355 case "$d_getprotobyname_r" in
12356 "$define")
12357         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12358         case "$d_getprotobyname_r_proto:$usethreads" in
12359         ":define")      d_getprotobyname_r_proto=define
12360                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12361                 eval $hasproto ;;
12362         *)      ;;
12363         esac
12364         case "$d_getprotobyname_r_proto" in
12365         define)
12366         case "$getprotobyname_r_proto" in
12367         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12368         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12369         esac
12370         case "$getprotobyname_r_proto" in
12371         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12372         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12373         esac
12374         case "$getprotobyname_r_proto" in
12375         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12376         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12377         esac
12378         case "$getprotobyname_r_proto" in
12379         ''|0)   d_getprotobyname_r=undef
12380                 getprotobyname_r_proto=0
12381                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12382         * )     case "$getprotobyname_r_proto" in
12383                 REENTRANT_PROTO*) ;;
12384                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12385                 esac
12386                 echo "Prototype: $try" ;;
12387         esac
12388         ;;
12389         *)      case "$usethreads" in
12390                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12391                 esac
12392                 d_getprotobyname_r=undef
12393                 getprotobyname_r_proto=0
12394                 ;;
12395         esac
12396         ;;
12397 *)      getprotobyname_r_proto=0
12398         ;;
12399 esac
12400
12401 : see if getprotobynumber_r exists
12402 set getprotobynumber_r d_getprotobynumber_r
12403 eval $inlibc
12404 case "$d_getprotobynumber_r" in
12405 "$define")
12406         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12407         case "$d_getprotobynumber_r_proto:$usethreads" in
12408         ":define")      d_getprotobynumber_r_proto=define
12409                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12410                 eval $hasproto ;;
12411         *)      ;;
12412         esac
12413         case "$d_getprotobynumber_r_proto" in
12414         define)
12415         case "$getprotobynumber_r_proto" in
12416         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12417         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12418         esac
12419         case "$getprotobynumber_r_proto" in
12420         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12421         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12422         esac
12423         case "$getprotobynumber_r_proto" in
12424         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12425         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12426         esac
12427         case "$getprotobynumber_r_proto" in
12428         ''|0)   d_getprotobynumber_r=undef
12429                 getprotobynumber_r_proto=0
12430                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12431         * )     case "$getprotobynumber_r_proto" in
12432                 REENTRANT_PROTO*) ;;
12433                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12434                 esac
12435                 echo "Prototype: $try" ;;
12436         esac
12437         ;;
12438         *)      case "$usethreads" in
12439                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12440                 esac
12441                 d_getprotobynumber_r=undef
12442                 getprotobynumber_r_proto=0
12443                 ;;
12444         esac
12445         ;;
12446 *)      getprotobynumber_r_proto=0
12447         ;;
12448 esac
12449
12450 : see if getprotoent_r exists
12451 set getprotoent_r d_getprotoent_r
12452 eval $inlibc
12453 case "$d_getprotoent_r" in
12454 "$define")
12455         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12456         case "$d_getprotoent_r_proto:$usethreads" in
12457         ":define")      d_getprotoent_r_proto=define
12458                 set d_getprotoent_r_proto getprotoent_r $hdrs
12459                 eval $hasproto ;;
12460         *)      ;;
12461         esac
12462         case "$d_getprotoent_r_proto" in
12463         define)
12464         case "$getprotoent_r_proto" in
12465         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12466         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12467         esac
12468         case "$getprotoent_r_proto" in
12469         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12470         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12471         esac
12472         case "$getprotoent_r_proto" in
12473         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12474         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12475         esac
12476         case "$getprotoent_r_proto" in
12477         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12478         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12479         esac
12480         case "$getprotoent_r_proto" in
12481         ''|0)   d_getprotoent_r=undef
12482                 getprotoent_r_proto=0
12483                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12484         * )     case "$getprotoent_r_proto" in
12485                 REENTRANT_PROTO*) ;;
12486                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12487                 esac
12488                 echo "Prototype: $try" ;;
12489         esac
12490         ;;
12491         *)      case "$usethreads" in
12492                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12493                 esac
12494                 d_getprotoent_r=undef
12495                 getprotoent_r_proto=0
12496                 ;;
12497         esac
12498         ;;
12499 *)      getprotoent_r_proto=0
12500         ;;
12501 esac
12502
12503 : see if prototypes for various getprotoxxx netdb.h functions are available
12504 echo " "
12505 set d_getprotoprotos getprotoent $i_netdb netdb.h
12506 eval $hasproto
12507
12508 : see if getprpwnam exists
12509 set getprpwnam d_getprpwnam
12510 eval $inlibc
12511
12512 : see if getpwent exists
12513 set getpwent d_getpwent
12514 eval $inlibc
12515
12516 : see if getpwent_r exists
12517 set getpwent_r d_getpwent_r
12518 eval $inlibc
12519 case "$d_getpwent_r" in
12520 "$define")
12521         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12522         case "$d_getpwent_r_proto:$usethreads" in
12523         ":define")      d_getpwent_r_proto=define
12524                 set d_getpwent_r_proto getpwent_r $hdrs
12525                 eval $hasproto ;;
12526         *)      ;;
12527         esac
12528         case "$d_getpwent_r_proto" in
12529         define)
12530         case "$getpwent_r_proto" in
12531         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12532         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12533         esac
12534         case "$getpwent_r_proto" in
12535         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12536         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12537         esac
12538         case "$getpwent_r_proto" in
12539         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12540         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12541         esac
12542         case "$getpwent_r_proto" in
12543         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12544         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12545         esac
12546         case "$getpwent_r_proto" in
12547         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12548         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12549         esac
12550         case "$getpwent_r_proto" in
12551         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12552         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12553         esac
12554         case "$getpwent_r_proto" in
12555         ''|0)   d_getpwent_r=undef
12556                 getpwent_r_proto=0
12557                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12558         * )     case "$getpwent_r_proto" in
12559                 REENTRANT_PROTO*) ;;
12560                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12561                 esac
12562                 echo "Prototype: $try" ;;
12563         esac
12564         ;;
12565         *)      case "$usethreads" in
12566                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12567                 esac
12568                 d_getpwent_r=undef
12569                 getpwent_r_proto=0
12570                 ;;
12571         esac
12572         ;;
12573 *)      getpwent_r_proto=0
12574         ;;
12575 esac
12576
12577 : see if getpwnam_r exists
12578 set getpwnam_r d_getpwnam_r
12579 eval $inlibc
12580 case "$d_getpwnam_r" in
12581 "$define")
12582         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12583         case "$d_getpwnam_r_proto:$usethreads" in
12584         ":define")      d_getpwnam_r_proto=define
12585                 set d_getpwnam_r_proto getpwnam_r $hdrs
12586                 eval $hasproto ;;
12587         *)      ;;
12588         esac
12589         case "$d_getpwnam_r_proto" in
12590         define)
12591         case "$getpwnam_r_proto" in
12592         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12593         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12594         esac
12595         case "$getpwnam_r_proto" in
12596         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12597         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12598         esac
12599         case "$getpwnam_r_proto" in
12600         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12601         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12602         esac
12603         case "$getpwnam_r_proto" in
12604         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12605         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12606         esac
12607         case "$getpwnam_r_proto" in
12608         ''|0)   d_getpwnam_r=undef
12609                 getpwnam_r_proto=0
12610                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12611         * )     case "$getpwnam_r_proto" in
12612                 REENTRANT_PROTO*) ;;
12613                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12614                 esac
12615                 echo "Prototype: $try" ;;
12616         esac
12617         ;;
12618         *)      case "$usethreads" in
12619                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12620                 esac
12621                 d_getpwnam_r=undef
12622                 getpwnam_r_proto=0
12623                 ;;
12624         esac
12625         ;;
12626 *)      getpwnam_r_proto=0
12627         ;;
12628 esac
12629
12630 : see if getpwuid_r exists
12631 set getpwuid_r d_getpwuid_r
12632 eval $inlibc
12633 case "$d_getpwuid_r" in
12634 "$define")
12635         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12636         case "$d_getpwuid_r_proto:$usethreads" in
12637         ":define")      d_getpwuid_r_proto=define
12638                 set d_getpwuid_r_proto getpwuid_r $hdrs
12639                 eval $hasproto ;;
12640         *)      ;;
12641         esac
12642         case "$d_getpwuid_r_proto" in
12643         define)
12644         case "$getpwuid_r_proto" in
12645         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12646         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12647         esac
12648         case "$getpwuid_r_proto" in
12649         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12650         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12651         esac
12652         case "$getpwuid_r_proto" in
12653         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12654         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12655         esac
12656         case "$getpwuid_r_proto" in
12657         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12658         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12659         esac
12660         case "$getpwuid_r_proto" in
12661         ''|0)   d_getpwuid_r=undef
12662                 getpwuid_r_proto=0
12663                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12664         * )     case "$getpwuid_r_proto" in
12665                 REENTRANT_PROTO*) ;;
12666                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12667                 esac
12668                 echo "Prototype: $try" ;;
12669         esac
12670         ;;
12671         *)      case "$usethreads" in
12672                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12673                 esac
12674                 d_getpwuid_r=undef
12675                 getpwuid_r_proto=0
12676                 ;;
12677         esac
12678         ;;
12679 *)      getpwuid_r_proto=0
12680         ;;
12681 esac
12682
12683
12684 : see if getservbyname exists
12685 set getservbyname d_getsbyname
12686 eval $inlibc
12687
12688 : see if getservbyport exists
12689 set getservbyport d_getsbyport
12690 eval $inlibc
12691
12692 : see if getservent exists
12693 set getservent d_getsent
12694 eval $inlibc
12695
12696 : see if getservbyname_r exists
12697 set getservbyname_r d_getservbyname_r
12698 eval $inlibc
12699 case "$d_getservbyname_r" in
12700 "$define")
12701         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12702         case "$d_getservbyname_r_proto:$usethreads" in
12703         ":define")      d_getservbyname_r_proto=define
12704                 set d_getservbyname_r_proto getservbyname_r $hdrs
12705                 eval $hasproto ;;
12706         *)      ;;
12707         esac
12708         case "$d_getservbyname_r_proto" in
12709         define)
12710         case "$getservbyname_r_proto" in
12711         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12712         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12713         esac
12714         case "$getservbyname_r_proto" in
12715         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12716         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12717         esac
12718         case "$getservbyname_r_proto" in
12719         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12720         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12721         esac
12722         case "$getservbyname_r_proto" in
12723         ''|0)   d_getservbyname_r=undef
12724                 getservbyname_r_proto=0
12725                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12726         * )     case "$getservbyname_r_proto" in
12727                 REENTRANT_PROTO*) ;;
12728                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12729                 esac
12730                 echo "Prototype: $try" ;;
12731         esac
12732         ;;
12733         *)      case "$usethreads" in
12734                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12735                 esac
12736                 d_getservbyname_r=undef
12737                 getservbyname_r_proto=0
12738                 ;;
12739         esac
12740         ;;
12741 *)      getservbyname_r_proto=0
12742         ;;
12743 esac
12744
12745 : see if getservbyport_r exists
12746 set getservbyport_r d_getservbyport_r
12747 eval $inlibc
12748 case "$d_getservbyport_r" in
12749 "$define")
12750         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12751         case "$d_getservbyport_r_proto:$usethreads" in
12752         ":define")      d_getservbyport_r_proto=define
12753                 set d_getservbyport_r_proto getservbyport_r $hdrs
12754                 eval $hasproto ;;
12755         *)      ;;
12756         esac
12757         case "$d_getservbyport_r_proto" in
12758         define)
12759         case "$getservbyport_r_proto" in
12760         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12761         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12762         esac
12763         case "$getservbyport_r_proto" in
12764         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12765         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12766         esac
12767         case "$getservbyport_r_proto" in
12768         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12769         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12770         esac
12771         case "$getservbyport_r_proto" in
12772         ''|0)   d_getservbyport_r=undef
12773                 getservbyport_r_proto=0
12774                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12775         * )     case "$getservbyport_r_proto" in
12776                 REENTRANT_PROTO*) ;;
12777                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12778                 esac
12779                 echo "Prototype: $try" ;;
12780         esac
12781         ;;
12782         *)      case "$usethreads" in
12783                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12784                 esac
12785                 d_getservbyport_r=undef
12786                 getservbyport_r_proto=0
12787                 ;;
12788         esac
12789         ;;
12790 *)      getservbyport_r_proto=0
12791         ;;
12792 esac
12793
12794 : see if getservent_r exists
12795 set getservent_r d_getservent_r
12796 eval $inlibc
12797 case "$d_getservent_r" in
12798 "$define")
12799         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12800         case "$d_getservent_r_proto:$usethreads" in
12801         ":define")      d_getservent_r_proto=define
12802                 set d_getservent_r_proto getservent_r $hdrs
12803                 eval $hasproto ;;
12804         *)      ;;
12805         esac
12806         case "$d_getservent_r_proto" in
12807         define)
12808         case "$getservent_r_proto" in
12809         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12810         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12811         esac
12812         case "$getservent_r_proto" in
12813         ''|0) try='int getservent_r(struct servent*, char*, int);'
12814         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12815         esac
12816         case "$getservent_r_proto" in
12817         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12818         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12819         esac
12820         case "$getservent_r_proto" in
12821         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12822         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12823         esac
12824         case "$getservent_r_proto" in
12825         ''|0)   d_getservent_r=undef
12826                 getservent_r_proto=0
12827                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12828         * )     case "$getservent_r_proto" in
12829                 REENTRANT_PROTO*) ;;
12830                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12831                 esac
12832                 echo "Prototype: $try" ;;
12833         esac
12834         ;;
12835         *)      case "$usethreads" in
12836                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12837                 esac
12838                 d_getservent_r=undef
12839                 getservent_r_proto=0
12840                 ;;
12841         esac
12842         ;;
12843 *)      getservent_r_proto=0
12844         ;;
12845 esac
12846
12847 : see if prototypes for various getservxxx netdb.h functions are available
12848 echo " "
12849 set d_getservprotos getservent $i_netdb netdb.h
12850 eval $hasproto
12851
12852 : see if getspnam exists
12853 set getspnam d_getspnam
12854 eval $inlibc
12855
12856 : see if this is a shadow.h system
12857 set shadow.h i_shadow
12858 eval $inhdr
12859
12860 : see if getspnam_r exists
12861 set getspnam_r d_getspnam_r
12862 eval $inlibc
12863 case "$d_getspnam_r" in
12864 "$define")
12865         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12866         case "$d_getspnam_r_proto:$usethreads" in
12867         ":define")      d_getspnam_r_proto=define
12868                 set d_getspnam_r_proto getspnam_r $hdrs
12869                 eval $hasproto ;;
12870         *)      ;;
12871         esac
12872         case "$d_getspnam_r_proto" in
12873         define)
12874         case "$getspnam_r_proto" in
12875         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12876         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12877         esac
12878         case "$getspnam_r_proto" in
12879         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12880         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12881         esac
12882         case "$getspnam_r_proto" in
12883         ''|0)   d_getspnam_r=undef
12884                 getspnam_r_proto=0
12885                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12886         * )     case "$getspnam_r_proto" in
12887                 REENTRANT_PROTO*) ;;
12888                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12889                 esac
12890                 echo "Prototype: $try" ;;
12891         esac
12892         ;;
12893         *)      case "$usethreads" in
12894                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12895                 esac
12896                 d_getspnam_r=undef
12897                 getspnam_r_proto=0
12898                 ;;
12899         esac
12900         ;;
12901 *)      getspnam_r_proto=0
12902         ;;
12903 esac
12904
12905 : see if gettimeofday or ftime exists
12906 set gettimeofday d_gettimeod
12907 eval $inlibc
12908 case "$d_gettimeod" in
12909 "$undef")
12910         set ftime d_ftime 
12911         eval $inlibc
12912         ;;
12913 *)
12914         val="$undef"; set d_ftime; eval $setvar
12915         ;;
12916 esac
12917 case "$d_gettimeod$d_ftime" in
12918 "$undef$undef")
12919         echo " "
12920         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12921         ;;
12922 esac
12923
12924 : see if gmtime_r exists
12925 set gmtime_r d_gmtime_r
12926 eval $inlibc
12927 case "$d_gmtime_r" in
12928 "$define")
12929         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12930         case "$d_gmtime_r_proto:$usethreads" in
12931         ":define")      d_gmtime_r_proto=define
12932                 set d_gmtime_r_proto gmtime_r $hdrs
12933                 eval $hasproto ;;
12934         *)      ;;
12935         esac
12936         case "$d_gmtime_r_proto" in
12937         define)
12938         case "$gmtime_r_proto" in
12939         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12940         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12941         esac
12942         case "$gmtime_r_proto" in
12943         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12944         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12945         esac
12946         case "$gmtime_r_proto" in
12947         ''|0)   d_gmtime_r=undef
12948                 gmtime_r_proto=0
12949                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12950         * )     case "$gmtime_r_proto" in
12951                 REENTRANT_PROTO*) ;;
12952                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12953                 esac
12954                 echo "Prototype: $try" ;;
12955         esac
12956         ;;
12957         *)      case "$usethreads" in
12958                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12959                 esac
12960                 d_gmtime_r=undef
12961                 gmtime_r_proto=0
12962                 ;;
12963         esac
12964         ;;
12965 *)      gmtime_r_proto=0
12966         ;;
12967 esac
12968
12969 : see if hasmntopt exists
12970 set hasmntopt d_hasmntopt
12971 eval $inlibc
12972
12973 : see if this is a netinet/in.h or sys/in.h system
12974 set netinet/in.h i_niin sys/in.h i_sysin
12975 eval $inhdr
12976
12977 : see if arpa/inet.h has to be included
12978 set arpa/inet.h i_arpainet
12979 eval $inhdr
12980
12981 : see if htonl --and friends-- exists
12982 val=''
12983 set htonl val
12984 eval $inlibc
12985
12986 : Maybe they are macros.
12987 case "$val" in
12988 $undef)
12989         $cat >htonl.c <<EOM
12990 #include <stdio.h>
12991 #include <sys/types.h>
12992 #$i_niin I_NETINET_IN
12993 #$i_sysin I_SYS_IN
12994 #$i_arpainet I_ARPA_INET
12995 #ifdef I_NETINET_IN
12996 #include <netinet/in.h>
12997 #endif
12998 #ifdef I_SYS_IN
12999 #include <sys/in.h>
13000 #endif
13001 #ifdef I_ARPA_INET
13002 #include <arpa/inet.h>
13003 #endif
13004 #ifdef htonl
13005 printf("Defined as a macro.");
13006 #endif
13007 EOM
13008         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13009         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13010                 val="$define"
13011                 echo "But it seems to be defined as a macro." >&4
13012         fi
13013         $rm -f htonl.?
13014         ;;
13015 esac
13016 set d_htonl
13017 eval $setvar
13018
13019 : index or strchr
13020 echo " "
13021 if set index val -f; eval $csym; $val; then
13022         if set strchr val -f d_strchr; eval $csym; $val; then
13023                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13024                         val="$define"
13025                         vali="$undef"
13026                         echo "strchr() found." >&4
13027                 else
13028                         val="$undef"
13029                         vali="$define"
13030                         echo "index() found." >&4
13031                 fi
13032         else
13033                 val="$undef"
13034                 vali="$define"
13035                 echo "index() found." >&4
13036         fi
13037 else
13038         if set strchr val -f d_strchr; eval $csym; $val; then
13039                 val="$define"
13040                 vali="$undef"
13041                 echo "strchr() found." >&4
13042         else
13043                 echo "No index() or strchr() found!" >&4
13044                 val="$undef"
13045                 vali="$undef"
13046         fi
13047 fi
13048 set d_strchr; eval $setvar
13049 val="$vali"
13050 set d_index; eval $setvar
13051
13052 : check whether inet_aton exists
13053 set inet_aton d_inetaton
13054 eval $inlibc
13055
13056 : Look for isascii
13057 echo " "
13058 $cat >isascii.c <<'EOCP'
13059 #include <stdio.h>
13060 #include <ctype.h>
13061 int main() {
13062         int c = 'A';
13063         if (isascii(c))
13064                 exit(0);
13065         else
13066                 exit(1);
13067 }
13068 EOCP
13069 set isascii
13070 if eval $compile; then
13071         echo "isascii() found." >&4
13072         val="$define"
13073 else
13074         echo "isascii() NOT found." >&4
13075         val="$undef"
13076 fi
13077 set d_isascii
13078 eval $setvar
13079 $rm -f isascii*
13080
13081 : see if isfinite exists
13082 set isfinite d_isfinite
13083 eval $inlibc
13084
13085 : see if isinf exists
13086 set isinf d_isinf
13087 eval $inlibc
13088
13089 : see if isnan exists
13090 set isnan d_isnan
13091 eval $inlibc
13092
13093 : see if isnanl exists
13094 set isnanl d_isnanl
13095 eval $inlibc
13096
13097 : see if killpg exists
13098 set killpg d_killpg
13099 eval $inlibc
13100
13101 : see if lchown exists
13102 echo " "
13103 $cat > try.c <<'EOCP'
13104 /* System header to define __stub macros and hopefully few prototypes,
13105     which can conflict with char lchown(); below.  */
13106 #include <assert.h>
13107 /* Override any gcc2 internal prototype to avoid an error.  */
13108 /* We use char because int might match the return type of a gcc2
13109    builtin and then its argument prototype would still apply.  */
13110 char lchown();
13111 int main() {
13112     /*  The GNU C library defines this for functions which it implements
13113         to always fail with ENOSYS.  Some functions are actually named
13114         something starting with __ and the normal name is an alias.  */
13115 #if defined (__stub_lchown) || defined (__stub___lchown)
13116 choke me
13117 #else
13118 lchown();
13119 #endif
13120 ; return 0; }
13121 EOCP
13122 set try
13123 if eval $compile; then
13124     $echo "lchown() found." >&4
13125     val="$define"
13126 else
13127     $echo "lchown() NOT found." >&4
13128     val="$undef"
13129 fi
13130 set d_lchown
13131 eval $setvar
13132
13133 : See if number of significant digits in a double precision number is known
13134 echo " "
13135 $cat >ldbl_dig.c <<EOM
13136 #$i_limits I_LIMITS
13137 #$i_float I_FLOAT
13138 #ifdef I_LIMITS
13139 #include <limits.h>
13140 #endif
13141 #ifdef I_FLOAT
13142 #include <float.h>
13143 #endif
13144 #ifdef LDBL_DIG
13145 printf("Contains LDBL_DIG");
13146 #endif
13147 EOM
13148 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13149 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13150         echo "LDBL_DIG found." >&4
13151         val="$define"
13152 else
13153         echo "LDBL_DIG NOT found." >&4
13154         val="$undef"
13155 fi
13156 $rm -f ldbl_dig.?
13157 set d_ldbl_dig
13158 eval $setvar
13159
13160 : see if link exists
13161 set link d_link
13162 eval $inlibc
13163
13164 : see if localtime_r exists
13165 set localtime_r d_localtime_r
13166 eval $inlibc
13167 case "$d_localtime_r" in
13168 "$define")
13169         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13170         case "$d_localtime_r_proto:$usethreads" in
13171         ":define")      d_localtime_r_proto=define
13172                 set d_localtime_r_proto localtime_r $hdrs
13173                 eval $hasproto ;;
13174         *)      ;;
13175         esac
13176         case "$d_localtime_r_proto" in
13177         define)
13178         case "$localtime_r_proto" in
13179         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13180         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13181         esac
13182         case "$localtime_r_proto" in
13183         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13184         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13185         esac
13186         case "$localtime_r_proto" in
13187         ''|0)   d_localtime_r=undef
13188                 localtime_r_proto=0
13189                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13190         * )     case "$localtime_r_proto" in
13191                 REENTRANT_PROTO*) ;;
13192                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13193                 esac
13194                 echo "Prototype: $try" ;;
13195         esac
13196         ;;
13197         *)      case "$usethreads" in
13198                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13199                 esac
13200                 d_localtime_r=undef
13201                 localtime_r_proto=0
13202                 ;;
13203         esac
13204         ;;
13205 *)      localtime_r_proto=0
13206         ;;
13207 esac
13208
13209 : see if localeconv exists
13210 set localeconv d_locconv
13211 eval $inlibc
13212
13213 : see if lockf exists
13214 set lockf d_lockf
13215 eval $inlibc
13216
13217 : see if prototype for lseek is available
13218 echo " "
13219 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13220 eval $hasproto
13221
13222 : see if lstat exists
13223 set lstat d_lstat
13224 eval $inlibc
13225
13226 : see if madvise exists
13227 set madvise d_madvise
13228 eval $inlibc
13229
13230 : see if mblen exists
13231 set mblen d_mblen
13232 eval $inlibc
13233
13234 : see if mbstowcs exists
13235 set mbstowcs d_mbstowcs
13236 eval $inlibc
13237
13238 : see if mbtowc exists
13239 set mbtowc d_mbtowc
13240 eval $inlibc
13241
13242 : see if memchr exists
13243 set memchr d_memchr
13244 eval $inlibc
13245
13246 : see if memcmp exists
13247 set memcmp d_memcmp
13248 eval $inlibc
13249
13250 : see if memcpy exists
13251 set memcpy d_memcpy
13252 eval $inlibc
13253
13254 : see if memmove exists
13255 set memmove d_memmove
13256 eval $inlibc
13257
13258 : see if memset exists
13259 set memset d_memset
13260 eval $inlibc
13261
13262 : see if mkdir exists
13263 set mkdir d_mkdir
13264 eval $inlibc
13265
13266 : see if mkdtemp exists
13267 set mkdtemp d_mkdtemp
13268 eval $inlibc
13269
13270 : see if mkfifo exists
13271 set mkfifo d_mkfifo
13272 eval $inlibc
13273
13274 : see if mkstemp exists
13275 set mkstemp d_mkstemp
13276 eval $inlibc
13277
13278 : see if mkstemps exists
13279 set mkstemps d_mkstemps
13280 eval $inlibc
13281
13282 : see if mktime exists
13283 set mktime d_mktime
13284 eval $inlibc
13285
13286 : see if this is a sys/mman.h system
13287 set sys/mman.h i_sysmman
13288 eval $inhdr
13289
13290 : see if mmap exists
13291 set mmap d_mmap
13292 eval $inlibc
13293 : see what shmat returns
13294 : default to something harmless
13295 mmaptype='void *'
13296 case "$i_sysmman$d_mmap" in
13297 "$define$define")
13298         $cat >mmap.c <<'END'
13299 #include <sys/mman.h>
13300 void *mmap();
13301 END
13302         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13303                 mmaptype='void *'
13304         else
13305                 mmaptype='caddr_t'
13306         fi
13307         echo "and it returns ($mmaptype)." >&4
13308         ;;
13309 esac
13310
13311
13312
13313 : see if mprotect exists
13314 set mprotect d_mprotect
13315 eval $inlibc
13316
13317 : see if msgctl exists
13318 set msgctl d_msgctl
13319 eval $inlibc
13320
13321 : see if msgget exists
13322 set msgget d_msgget
13323 eval $inlibc
13324
13325 : see if msgsnd exists
13326 set msgsnd d_msgsnd
13327 eval $inlibc
13328
13329 : see if msgrcv exists
13330 set msgrcv d_msgrcv
13331 eval $inlibc
13332
13333 : see how much of the 'msg*(2)' library is present.
13334 h_msg=true
13335 echo " "
13336 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13337 *"$undef"*) h_msg=false;;
13338 esac
13339 case "$osname" in
13340 freebsd)
13341     case "`ipcs 2>&1`" in
13342     "SVID messages"*"not configured"*)
13343         echo "Your $osname does not have the msg*(2) configured." >&4
13344         h_msg=false
13345         val="$undef"
13346         set msgctl d_msgctl
13347         eval $setvar
13348         set msgget d_msgget
13349         eval $setvar
13350         set msgsnd d_msgsnd
13351         eval $setvar
13352         set msgrcv d_msgrcv
13353         eval $setvar
13354         ;;
13355     esac
13356     ;;
13357 esac
13358 : we could also check for sys/ipc.h ...
13359 if $h_msg && $test `./findhdr sys/msg.h`; then
13360         echo "You have the full msg*(2) library." >&4
13361         val="$define"
13362 else
13363         echo "You don't have the full msg*(2) library." >&4
13364         val="$undef"
13365 fi
13366 set d_msg
13367 eval $setvar
13368
13369
13370 echo " "
13371 echo "Checking to see if your system supports struct msghdr..." >&4
13372 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13373 eval $hasstruct
13374 case "$d_msghdr_s" in
13375 "$define")      echo "Yes, it does."   ;;
13376 *)              echo "No, it doesn't." ;;
13377 esac
13378
13379
13380 : see if msync exists
13381 set msync d_msync
13382 eval $inlibc
13383
13384 : see if munmap exists
13385 set munmap d_munmap
13386 eval $inlibc
13387
13388 : see if nice exists
13389 set nice d_nice
13390 eval $inlibc
13391
13392 : see if this is a langinfo.h system
13393 set langinfo.h i_langinfo
13394 eval $inhdr
13395
13396 : see if nl_langinfo exists
13397 set nl_langinfo d_nl_langinfo
13398 eval $inlibc
13399
13400 : check for length of character
13401 echo " "
13402 case "$charsize" in
13403 '')
13404         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13405         $cat >try.c <<'EOCP'
13406 #include <stdio.h>
13407 int main()
13408 {
13409     printf("%d\n", (int)sizeof(char));
13410     exit(0);
13411 }
13412 EOCP
13413         set try
13414         if eval $compile_ok; then
13415                 dflt=`$run ./try`
13416         else
13417                 dflt='1'
13418                 echo "(I can't seem to compile the test program.  Guessing...)"
13419         fi
13420         ;;
13421 *)
13422         dflt="$charsize"
13423         ;;
13424 esac
13425 rp="What is the size of a character (in bytes)?"
13426 . ./myread
13427 charsize="$ans"
13428 $rm -f try.c try
13429
13430 : check for volatile keyword
13431 echo " "
13432 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13433 $cat >try.c <<'EOCP'
13434 main()
13435 {
13436         typedef struct _goo_struct goo_struct;
13437         goo_struct * volatile goo = ((goo_struct *)0);
13438         struct _goo_struct {
13439                 long long_int;
13440                 int reg_int;
13441                 char char_var;
13442         };
13443         typedef unsigned short foo_t;
13444         char *volatile foo;
13445         volatile int bar;
13446         volatile foo_t blech;
13447         foo = foo;
13448 }
13449 EOCP
13450 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13451         val="$define"
13452         echo "Yup, it does."
13453 else
13454         val="$undef"
13455         echo "Nope, it doesn't."
13456 fi
13457 set d_volatile
13458 eval $setvar
13459 $rm -f try.*
13460
13461
13462 echo " "
13463 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13464
13465 case "$use64bitint:$d_quad:$quadtype" in
13466 define:define:?*)
13467         ivtype="$quadtype"
13468         uvtype="$uquadtype"
13469         ivsize=8
13470         uvsize=8
13471         ;;
13472 *)      ivtype="long"
13473         uvtype="unsigned long"
13474         ivsize=$longsize
13475         uvsize=$longsize
13476         ;;
13477 esac
13478
13479 case "$uselongdouble:$d_longdbl" in
13480 define:define)
13481         nvtype="long double"
13482         nvsize=$longdblsize
13483         ;;
13484 *)      nvtype=double
13485         nvsize=$doublesize
13486         ;;
13487 esac
13488
13489 $echo "(IV will be "$ivtype", $ivsize bytes)"
13490 $echo "(UV will be "$uvtype", $uvsize bytes)"
13491 $echo "(NV will be "$nvtype", $nvsize bytes)"
13492
13493 $cat >try.c <<EOCP
13494 #$i_inttypes I_INTTYPES
13495 #ifdef I_INTTYPES
13496 #include <inttypes.h>
13497 #endif
13498 #include <stdio.h>
13499 int main() {
13500 #ifdef INT8
13501    int8_t i =  INT8_MAX;
13502   uint8_t u = UINT8_MAX;
13503   printf("int8_t\n");
13504 #endif
13505 #ifdef INT16
13506    int16_t i =  INT16_MAX;
13507   uint16_t i = UINT16_MAX;
13508   printf("int16_t\n");
13509 #endif
13510 #ifdef INT32
13511    int32_t i =  INT32_MAX;
13512   uint32_t u = UINT32_MAX;
13513   printf("int32_t\n");
13514 #endif
13515 }
13516 EOCP
13517
13518 case "$i8type" in
13519 '')     case "$charsize" in
13520         1)      i8type=char
13521                 u8type="unsigned char"
13522                 i8size=$charsize
13523                 u8size=$charsize
13524                 ;;
13525         esac
13526         ;;
13527 esac
13528 case "$i8type" in
13529 '')     set try -DINT8
13530         if eval $compile; then
13531                 case "`$run ./try`" in
13532                 int8_t) i8type=int8_t
13533                         u8type=uint8_t
13534                         i8size=1
13535                         u8size=1
13536                         ;;
13537                 esac
13538         fi
13539         ;;
13540 esac
13541 case "$i8type" in
13542 '')     if $test $charsize -ge 1; then
13543                 i8type=char
13544                 u8type="unsigned char"
13545                 i8size=$charsize
13546                 u8size=$charsize
13547         fi
13548         ;;
13549 esac
13550
13551 case "$i16type" in
13552 '')     case "$shortsize" in
13553         2)      i16type=short
13554                 u16type="unsigned short"
13555                 i16size=$shortsize
13556                 u16size=$shortsize
13557                 ;;
13558         esac
13559         ;;
13560 esac
13561 case "$i16type" in
13562 '')     set try -DINT16
13563         if eval $compile; then
13564                 case "`$run ./try`" in
13565                 int16_t)
13566                         i16type=int16_t
13567                         u16type=uint16_t
13568                         i16size=2
13569                         u16size=2
13570                         ;;
13571                 esac
13572         fi
13573         ;;
13574 esac
13575 case "$i16type" in
13576 '')     if $test $shortsize -ge 2; then
13577                 i16type=short
13578                 u16type="unsigned short"
13579                 i16size=$shortsize
13580                 u16size=$shortsize
13581         fi
13582         ;;
13583 esac
13584
13585 case "$i32type" in
13586 '')     case "$longsize" in
13587         4)      i32type=long
13588                 u32type="unsigned long"
13589                 i32size=$longsize
13590                 u32size=$longsize
13591                 ;;
13592         *)      case "$intsize" in
13593                 4)      i32type=int
13594                         u32type="unsigned int"
13595                         i32size=$intsize
13596                         u32size=$intsize
13597                         ;;
13598                 esac
13599                 ;;
13600         esac
13601         ;;
13602 esac
13603 case "$i32type" in
13604 '')     set try -DINT32
13605         if eval $compile; then
13606                 case "`$run ./try`" in
13607                 int32_t)
13608                         i32type=int32_t
13609                         u32type=uint32_t
13610                         i32size=4
13611                         u32size=4
13612                         ;;
13613                 esac
13614         fi
13615         ;;
13616 esac
13617 case "$i32type" in
13618 '')     if $test $intsize -ge 4; then
13619                 i32type=int
13620                 u32type="unsigned int"
13621                 i32size=$intsize
13622                 u32size=$intsize
13623         fi
13624         ;;
13625 esac
13626
13627 case "$i64type" in
13628 '')     case "$d_quad:$quadtype" in
13629         define:?*)
13630                 i64type="$quadtype"
13631                 u64type="$uquadtype"
13632                 i64size=8
13633                 u64size=8
13634                 ;;
13635         esac
13636         ;;
13637 esac
13638
13639 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13640 : volatile so that the compiler has to store it out to memory.
13641 if test X"$d_volatile" = X"$define"; then
13642         volatile=volatile
13643 fi
13644 $cat <<EOP >try.c
13645 #include <stdio.h>
13646 #include <sys/types.h>
13647 #include <signal.h>
13648 #ifdef SIGFPE
13649 $volatile int bletched = 0;
13650 $signal_t blech(s) int s; { bletched = 1; }
13651 #endif
13652 int main() {
13653     $uvtype u = 0;
13654     $nvtype d;
13655     int     n = 8 * $uvsize;
13656     int     i;
13657 #ifdef SIGFPE
13658     signal(SIGFPE, blech);
13659 #endif
13660
13661     for (i = 0; i < n; i++) {
13662       u = u << 1 | ($uvtype)1;
13663       d = ($nvtype)u;
13664       if (($uvtype)d != u)
13665         break;
13666       if (d <= 0)
13667         break;
13668       d = ($nvtype)(u - 1);
13669       if (($uvtype)d != (u - 1))
13670         break;
13671 #ifdef SIGFPE
13672       if (bletched) {
13673         break;
13674 #endif
13675       } 
13676     }
13677     printf("%d\n", ((i == n) ? -n : i));
13678     exit(0);
13679 }
13680 EOP
13681 set try
13682
13683 d_nv_preserves_uv="$undef"
13684 if eval $compile; then
13685         nv_preserves_uv_bits="`$run ./try`"
13686 fi
13687 case "$nv_preserves_uv_bits" in
13688 \-[1-9]*)       
13689         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13690         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13691         d_nv_preserves_uv="$define"
13692         ;;
13693 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13694         d_nv_preserves_uv="$undef" ;;
13695 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13696         nv_preserves_uv_bits="$undef" ;;
13697 esac
13698
13699 $rm -f try.* try
13700
13701
13702 : check for off64_t
13703 echo " "
13704 echo "Checking to see if you have off64_t..." >&4
13705 $cat >try.c <<EOCP
13706 #include <sys/types.h>
13707 #include <unistd.h>
13708 int main() { off64_t x = 7; }
13709 EOCP
13710 set try
13711 if eval $compile; then
13712         val="$define"
13713         echo "You have off64_t."
13714 else
13715         val="$undef"
13716         echo "You do not have off64_t."
13717         case "$lseeksize" in
13718         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13719         esac
13720 fi
13721 $rm -f try.* try
13722 set d_off64_t
13723 eval $setvar
13724
13725 : how to create joinable pthreads
13726 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13727         echo " "
13728         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13729         $cat >try.c <<'EOCP'
13730 #include <pthread.h>
13731 int main() {
13732     int detachstate = JOINABLE;
13733 }
13734 EOCP
13735         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13736         if eval $compile; then
13737                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13738                 val="$undef" # Yes, undef.
13739                 set d_old_pthread_create_joinable
13740                 eval $setvar
13741                 val=""
13742                 set old_pthread_create_joinable
13743                 eval $setvar
13744         else
13745                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13746                 if eval $compile; then
13747                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13748                         val="$define"
13749                         set d_old_pthread_create_joinable
13750                         eval $setvar
13751                         val=PTHREAD_CREATE_UNDETACHED
13752                         set old_pthread_create_joinable
13753                         eval $setvar
13754                 else            
13755                         set try -DJOINABLE=__UNDETACHED
13756                         if eval $compile; then
13757                                 echo "You seem to use __UNDETACHED." >&4
13758                                 val="$define"
13759                                 set d_old_pthread_create_joinable
13760                                 eval $setvar
13761                                 val=__UNDETACHED
13762                                 set old_pthread_create_joinable
13763                                 eval $setvar
13764                         else
13765                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13766                                 val="$define"
13767                                 set d_old_pthread_create_joinable
13768                                 eval $setvar
13769                                 val=0
13770                                 set old_pthread_create_joinable
13771                                 eval $setvar
13772                         fi
13773                 fi
13774         fi
13775         $rm -f try try.*
13776 else
13777     d_old_pthread_create_joinable="$undef"
13778     old_pthread_create_joinable=""
13779 fi
13780
13781 : see if pause exists
13782 set pause d_pause
13783 eval $inlibc
13784
13785 : see if pipe exists
13786 set pipe d_pipe
13787 eval $inlibc
13788
13789 : see if poll exists
13790 set poll d_poll
13791 eval $inlibc
13792
13793 : see if readlink exists
13794 set readlink d_readlink
13795 eval $inlibc
13796
13797 echo " "
13798 procselfexe=''
13799 val="$undef"
13800 case "$d_readlink" in
13801 "$define")
13802         if $issymlink /proc/self/exe ; then
13803                 $ls -l /proc/self/exe > reflect
13804                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13805                         echo "You have Linux-like /proc/self/exe."
13806                         procselfexe='"/proc/self/exe"'
13807                         val="$define"
13808                 fi
13809         fi
13810         if $issymlink /proc/curproc/file ; then
13811                 $ls -l /proc/curproc/file > reflect
13812                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13813                         echo "You have BSD-like /proc/curproc/file."
13814                         procselfexe='"/proc/curproc/file"'
13815                         val="$define"
13816                 fi
13817         fi
13818         ;;
13819 esac
13820 $rm -f reflect
13821 set d_procselfexe
13822 eval $setvar
13823
13824 : see whether the pthread_atfork exists
13825 $cat >try.c <<EOP
13826 #include <pthread.h>
13827 #include <stdio.h>
13828 int main() {
13829 #ifdef  PTHREAD_ATFORK
13830         pthread_atfork(NULL,NULL,NULL);
13831 #endif
13832 }
13833 EOP
13834
13835 : see if pthread_atfork exists
13836 set try -DPTHREAD_ATFORK
13837 if eval $compile; then
13838     val="$define"
13839 else
13840     val="$undef"
13841 fi
13842 case "$usethreads" in
13843 $define)
13844         case "$val" in
13845         $define) echo 'pthread_atfork found.' >&4        ;;
13846         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13847         esac
13848 esac
13849 set d_pthread_atfork
13850 eval $setvar
13851
13852
13853 : see whether the various POSIXish _yields exist
13854 $cat >try.c <<EOP
13855 #include <pthread.h>
13856 #include <stdio.h>
13857 int main() {
13858 #ifdef SCHED_YIELD
13859         sched_yield();
13860 #else
13861 #ifdef PTHREAD_YIELD
13862         pthread_yield();
13863 #else
13864 #ifdef PTHREAD_YIELD_NULL
13865         pthread_yield(NULL);
13866 #endif
13867 #endif
13868 #endif
13869 }
13870 EOP
13871 : see if sched_yield exists
13872 set try -DSCHED_YIELD
13873 if eval $compile; then
13874     val="$define"
13875     sched_yield='sched_yield()'
13876 else
13877     val="$undef"
13878 fi
13879 case "$usethreads" in
13880 $define)
13881         case "$val" in
13882         $define) echo 'sched_yield() found.' >&4        ;;
13883         *)       echo 'sched_yield() NOT found.' >&4    ;;
13884         esac
13885 esac
13886 set d_sched_yield
13887 eval $setvar
13888
13889 : see if pthread_yield exists
13890 set try -DPTHREAD_YIELD
13891 if eval $compile; then
13892     val="$define"
13893     case "$sched_yield" in
13894     '') sched_yield='pthread_yield()' ;;
13895     esac
13896 else
13897     set try -DPTHREAD_YIELD_NULL
13898     if eval $compile; then
13899         val="$define"
13900         case "$sched_yield" in
13901         '') sched_yield='pthread_yield(NULL)' ;;
13902         esac
13903     else
13904         val="$undef"
13905     fi
13906 fi
13907 case "$usethreads" in
13908 $define)
13909         case "$val" in
13910         $define) echo 'pthread_yield() found.' >&4      ;;
13911         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13912         esac
13913         ;;
13914 esac
13915 set d_pthread_yield
13916 eval $setvar
13917
13918 case "$sched_yield" in
13919 '') sched_yield=undef ;;
13920 esac
13921
13922 $rm -f try try.*
13923
13924 : see if random_r exists
13925 set random_r d_random_r
13926 eval $inlibc
13927 case "$d_random_r" in
13928 "$define")
13929         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13930         case "$d_random_r_proto:$usethreads" in
13931         ":define")      d_random_r_proto=define
13932                 set d_random_r_proto random_r $hdrs
13933                 eval $hasproto ;;
13934         *)      ;;
13935         esac
13936         case "$d_random_r_proto" in
13937         define)
13938         case "$random_r_proto" in
13939         ''|0) try='int random_r(int*, struct random_data*);'
13940         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13941         esac
13942         case "$random_r_proto" in
13943         ''|0)   d_random_r=undef
13944                 random_r_proto=0
13945                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13946         * )     case "$random_r_proto" in
13947                 REENTRANT_PROTO*) ;;
13948                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13949                 esac
13950                 echo "Prototype: $try" ;;
13951         esac
13952         ;;
13953         *)      case "$usethreads" in
13954                 define) echo "random_r has no prototype, not using it." >&4 ;;
13955                 esac
13956                 d_random_r=undef
13957                 random_r_proto=0
13958                 ;;
13959         esac
13960         ;;
13961 *)      random_r_proto=0
13962         ;;
13963 esac
13964
13965 : see if readdir and friends exist
13966 set readdir d_readdir
13967 eval $inlibc
13968 set seekdir d_seekdir
13969 eval $inlibc
13970 set telldir d_telldir
13971 eval $inlibc
13972 set rewinddir d_rewinddir
13973 eval $inlibc
13974
13975 : see if readdir64_r exists
13976 set readdir64_r d_readdir64_r
13977 eval $inlibc
13978 case "$d_readdir64_r" in
13979 "$define")
13980         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13981         case "$d_readdir64_r_proto:$usethreads" in
13982         ":define")      d_readdir64_r_proto=define
13983                 set d_readdir64_r_proto readdir64_r $hdrs
13984                 eval $hasproto ;;
13985         *)      ;;
13986         esac
13987         case "$d_readdir64_r_proto" in
13988         define)
13989         case "$readdir64_r_proto" in
13990         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13991         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13992         esac
13993         case "$readdir64_r_proto" in
13994         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13995         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13996         esac
13997         case "$readdir64_r_proto" in
13998         ''|0)   d_readdir64_r=undef
13999                 readdir64_r_proto=0
14000                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14001         * )     case "$readdir64_r_proto" in
14002                 REENTRANT_PROTO*) ;;
14003                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14004                 esac
14005                 echo "Prototype: $try" ;;
14006         esac
14007         ;;
14008         *)      case "$usethreads" in
14009                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14010                 esac
14011                 d_readdir64_r=undef
14012                 readdir64_r_proto=0
14013                 ;;
14014         esac
14015         ;;
14016 *)      readdir64_r_proto=0
14017         ;;
14018 esac
14019
14020 : see if readdir_r exists
14021 set readdir_r d_readdir_r
14022 eval $inlibc
14023 case "$d_readdir_r" in
14024 "$define")
14025         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14026         case "$d_readdir_r_proto:$usethreads" in
14027         ":define")      d_readdir_r_proto=define
14028                 set d_readdir_r_proto readdir_r $hdrs
14029                 eval $hasproto ;;
14030         *)      ;;
14031         esac
14032         case "$d_readdir_r_proto" in
14033         define)
14034         case "$readdir_r_proto" in
14035         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14036         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14037         esac
14038         case "$readdir_r_proto" in
14039         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14040         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14041         esac
14042         case "$readdir_r_proto" in
14043         ''|0)   d_readdir_r=undef
14044                 readdir_r_proto=0
14045                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14046         * )     case "$readdir_r_proto" in
14047                 REENTRANT_PROTO*) ;;
14048                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14049                 esac
14050                 echo "Prototype: $try" ;;
14051         esac
14052         ;;
14053         *)      case "$usethreads" in
14054                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14055                 esac
14056                 d_readdir_r=undef
14057                 readdir_r_proto=0
14058                 ;;
14059         esac
14060         ;;
14061 *)      readdir_r_proto=0
14062         ;;
14063 esac
14064
14065 : see if readv exists
14066 set readv d_readv
14067 eval $inlibc
14068
14069 : see if recvmsg exists
14070 set recvmsg d_recvmsg
14071 eval $inlibc
14072
14073 : see if rename exists
14074 set rename d_rename
14075 eval $inlibc
14076
14077 : see if rmdir exists
14078 set rmdir d_rmdir
14079 eval $inlibc
14080
14081 : see if memory.h is available.
14082 val=''
14083 set memory.h val
14084 eval $inhdr
14085
14086 : See if it conflicts with string.h
14087 case "$val" in
14088 $define)
14089         case "$strings" in
14090         '') ;;
14091         *)
14092                 $cppstdin $cppflags $cppminus < $strings > mem.h
14093                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14094                         echo " "
14095                         echo "We won't be including <memory.h>."
14096                         val="$undef"
14097                 fi
14098                 $rm -f mem.h
14099                 ;;
14100         esac
14101 esac
14102 set i_memory
14103 eval $setvar
14104
14105 : can bcopy handle overlapping blocks?
14106 echo " "
14107 val="$undef"
14108 case "$d_memmove" in
14109 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14110 *)      case "$d_bcopy" in
14111         "$define")
14112                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14113                 $cat >try.c <<EOCP
14114 #$i_memory I_MEMORY
14115 #$i_stdlib I_STDLIB
14116 #$i_string I_STRING
14117 #$i_unistd I_UNISTD
14118 EOCP
14119         $cat >>try.c <<'EOCP'
14120 #include <stdio.h>
14121 #ifdef I_MEMORY
14122 #  include <memory.h>
14123 #endif
14124 #ifdef I_STDLIB
14125 #  include <stdlib.h>
14126 #endif
14127 #ifdef I_STRING
14128 #  include <string.h>
14129 #else
14130 #  include <strings.h>
14131 #endif
14132 #ifdef I_UNISTD
14133 #  include <unistd.h>  /* Needed for NetBSD */
14134 #endif
14135 int main()
14136 {
14137 char buf[128], abc[128];
14138 char *b;
14139 int len;
14140 int off;
14141 int align;
14142
14143 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14144    try to store the string in read-only memory. */
14145 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14146
14147 for (align = 7; align >= 0; align--) {
14148         for (len = 36; len; len--) {
14149                 b = buf+align;
14150                 bcopy(abc, b, len);
14151                 for (off = 1; off <= len; off++) {
14152                         bcopy(b, b+off, len);
14153                         bcopy(b+off, b, len);
14154                         if (bcmp(b, abc, len))
14155                                 exit(1);
14156                 }
14157         }
14158 }
14159 exit(0);
14160 }
14161 EOCP
14162                 set try
14163                 if eval $compile_ok; then
14164                         if ./try 2>/dev/null; then
14165                                 echo "Yes, it can."
14166                                 val="$define"
14167                         else
14168                                 echo "It can't, sorry."
14169                         fi
14170                 else
14171                         echo "(I can't compile the test program, so we'll assume not...)"
14172                 fi
14173                 ;;
14174         esac
14175         $rm -f try.* try core
14176         ;;
14177 esac
14178 set d_safebcpy
14179 eval $setvar
14180
14181 : can memcpy handle overlapping blocks?
14182 echo " "
14183 val="$undef"
14184 case "$d_memmove" in
14185 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14186 *)      case "$d_memcpy" in
14187         "$define")
14188                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14189                 $cat >try.c <<EOCP
14190 #$i_memory I_MEMORY
14191 #$i_stdlib I_STDLIB
14192 #$i_string I_STRING
14193 #$i_unistd I_UNISTD
14194 EOCP
14195         $cat >>try.c <<'EOCP'
14196 #include <stdio.h>
14197 #ifdef I_MEMORY
14198 #  include <memory.h>
14199 #endif
14200 #ifdef I_STDLIB
14201 #  include <stdlib.h>
14202 #endif
14203 #ifdef I_STRING
14204 #  include <string.h>
14205 #else
14206 #  include <strings.h>
14207 #endif
14208 #ifdef I_UNISTD
14209 #  include <unistd.h>  /* Needed for NetBSD */
14210 #endif
14211 int main()
14212 {
14213 char buf[128], abc[128];
14214 char *b;
14215 int len;
14216 int off;
14217 int align;
14218
14219 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14220    try to store the string in read-only memory. */
14221 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14222
14223 for (align = 7; align >= 0; align--) {
14224         for (len = 36; len; len--) {
14225                 b = buf+align;
14226                 memcpy(b, abc, len);
14227                 for (off = 1; off <= len; off++) {
14228                         memcpy(b+off, b, len);
14229                         memcpy(b, b+off, len);
14230                         if (memcmp(b, abc, len))
14231                                 exit(1);
14232                 }
14233         }
14234 }
14235 exit(0);
14236 }
14237 EOCP
14238                 set try
14239                 if eval $compile_ok; then
14240                         if ./try 2>/dev/null; then
14241                                 echo "Yes, it can."
14242                                 val="$define"
14243                         else
14244                                 echo "It can't, sorry."
14245                         fi
14246                 else
14247                         echo "(I can't compile the test program, so we'll assume not...)"
14248                 fi
14249                 ;;
14250         esac
14251         $rm -f try.* try core
14252         ;;
14253 esac
14254 set d_safemcpy
14255 eval $setvar
14256
14257 : can memcmp be trusted to compare relative magnitude?
14258 val="$undef"
14259 case "$d_memcmp" in
14260 "$define")
14261         echo " "
14262         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14263         $cat >try.c <<EOCP
14264 #$i_memory I_MEMORY
14265 #$i_stdlib I_STDLIB
14266 #$i_string I_STRING
14267 #$i_unistd I_UNISTD
14268 EOCP
14269         $cat >>try.c <<'EOCP'
14270 #include <stdio.h>
14271 #ifdef I_MEMORY
14272 #  include <memory.h>
14273 #endif
14274 #ifdef I_STDLIB
14275 #  include <stdlib.h>
14276 #endif
14277 #ifdef I_STRING
14278 #  include <string.h>
14279 #else
14280 #  include <strings.h>
14281 #endif
14282 #ifdef I_UNISTD
14283 #  include <unistd.h>  /* Needed for NetBSD */
14284 #endif
14285 int main()
14286 {
14287 char a = -1;
14288 char b = 0;
14289 if ((a < b) && memcmp(&a, &b, 1) < 0)
14290         exit(1);
14291 exit(0);
14292 }
14293 EOCP
14294         set try
14295         if eval $compile_ok; then
14296                 if $run ./try 2>/dev/null; then
14297                         echo "Yes, it can."
14298                         val="$define"
14299                 else
14300                         echo "No, it can't (it uses signed chars)."
14301                 fi
14302         else
14303                 echo "(I can't compile the test program, so we'll assume not...)"
14304         fi
14305         ;;
14306 esac
14307 $rm -f try.* try core
14308 set d_sanemcmp
14309 eval $setvar
14310
14311 : see if prototype for sbrk is available
14312 echo " "
14313 set d_sbrkproto sbrk $i_unistd unistd.h
14314 eval $hasproto
14315
14316 : see if select exists
14317 set select d_select
14318 eval $inlibc
14319
14320 : see if semctl exists
14321 set semctl d_semctl
14322 eval $inlibc
14323
14324 : see if semget exists
14325 set semget d_semget
14326 eval $inlibc
14327
14328 : see if semop exists
14329 set semop d_semop
14330 eval $inlibc
14331
14332 : see how much of the 'sem*(2)' library is present.
14333 h_sem=true
14334 echo " "
14335 case "$d_semctl$d_semget$d_semop" in
14336 *"$undef"*) h_sem=false;;
14337 esac
14338 case "$osname" in
14339 freebsd)
14340     case "`ipcs 2>&1`" in
14341     "SVID messages"*"not configured"*)
14342         echo "Your $osname does not have the sem*(2) configured." >&4
14343         h_sem=false
14344         val="$undef"
14345         set semctl d_semctl
14346         eval $setvar
14347         set semget d_semget
14348         eval $setvar
14349         set semop d_semop
14350         eval $setvar
14351         ;;
14352     esac
14353     ;;
14354 esac
14355 : we could also check for sys/ipc.h ...
14356 if $h_sem && $test `./findhdr sys/sem.h`; then
14357         echo "You have the full sem*(2) library." >&4
14358         val="$define"
14359 else
14360         echo "You don't have the full sem*(2) library." >&4
14361         val="$undef"
14362 fi
14363 set d_sem
14364 eval $setvar
14365
14366 : see whether sys/sem.h defines union semun
14367 echo " "
14368 $cat > try.c <<'END'
14369 #include <sys/types.h>
14370 #include <sys/ipc.h>
14371 #include <sys/sem.h>
14372 int main () { union semun semun; semun.buf = 0; }
14373 END
14374 set try
14375 if eval $compile; then
14376     echo "You have union semun in <sys/sem.h>." >&4
14377     val="$define"
14378 else
14379     echo "You do not have union semun in <sys/sem.h>." >&4
14380     val="$undef"
14381 fi
14382 $rm -f try try.c try.h
14383 set d_union_semun
14384 eval $setvar
14385
14386 : see how to do semctl IPC_STAT
14387 case "$d_sem" in
14388 $define)
14389     : see whether semctl IPC_STAT can use union semun
14390     echo " "
14391     $cat > try.h <<END
14392 #ifndef S_IRUSR
14393 #   ifdef S_IREAD
14394 #       define S_IRUSR S_IREAD
14395 #       define S_IWUSR S_IWRITE
14396 #       define S_IXUSR S_IEXEC
14397 #   else
14398 #       define S_IRUSR 0400
14399 #       define S_IWUSR 0200
14400 #       define S_IXUSR 0100
14401 #   endif
14402 #   define S_IRGRP (S_IRUSR>>3)
14403 #   define S_IWGRP (S_IWUSR>>3)
14404 #   define S_IXGRP (S_IXUSR>>3)
14405 #   define S_IROTH (S_IRUSR>>6)
14406 #   define S_IWOTH (S_IWUSR>>6)
14407 #   define S_IXOTH (S_IXUSR>>6)
14408 #endif
14409 #ifndef S_IRWXU
14410 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14411 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14412 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14413 #endif
14414 END
14415
14416     $cat > try.c <<END
14417 #include <sys/types.h>
14418 #include <sys/ipc.h>
14419 #include <sys/sem.h>
14420 #include <sys/stat.h>
14421 #include <stdio.h>
14422 #include <errno.h>
14423 #include "try.h"
14424 #ifndef errno
14425 extern int errno;
14426 #endif
14427 #$d_union_semun HAS_UNION_SEMUN
14428 int main() {
14429     union semun
14430 #ifndef HAS_UNION_SEMUN
14431     {
14432         int val;
14433         struct semid_ds *buf;
14434         unsigned short *array;
14435     }
14436 #endif
14437     arg;
14438     int sem, st;
14439
14440 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14441     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14442     if (sem > -1) {
14443         struct semid_ds argbuf;
14444         arg.buf = &argbuf;
14445 #       ifdef IPC_STAT
14446         st = semctl(sem, 0, IPC_STAT, arg);
14447         if (st == 0)
14448             printf("semun\n");
14449         else
14450 #       endif /* IPC_STAT */
14451             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14452 #       ifdef IPC_RMID
14453         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14454 #       endif /* IPC_RMID */
14455             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14456     } else
14457 #endif /* IPC_PRIVATE && ... */
14458         printf("semget failed: errno = %d\n", errno);
14459   return 0;
14460 }
14461 END
14462     val="$undef"
14463     set try
14464     if eval $compile; then
14465         xxx=`$run ./try`
14466         case "$xxx" in
14467         semun) val="$define" ;;
14468         esac
14469     fi
14470     $rm -f try try.c
14471     set d_semctl_semun
14472     eval $setvar
14473     case "$d_semctl_semun" in
14474     $define)
14475         echo "You can use union semun for semctl IPC_STAT." >&4
14476         also='also'
14477         ;;
14478     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14479         also=''
14480         ;;
14481     esac
14482
14483     : see whether semctl IPC_STAT can use struct semid_ds pointer
14484     $cat > try.c <<'END'
14485 #include <sys/types.h>
14486 #include <sys/ipc.h>
14487 #include <sys/sem.h>
14488 #include <sys/stat.h>
14489 #include "try.h"
14490 #include <stdio.h>
14491 #include <errno.h>
14492 #ifndef errno
14493 extern int errno;
14494 #endif
14495 int main() {
14496     struct semid_ds arg;
14497     int sem, st;
14498
14499 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14500     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14501     if (sem > -1) {
14502 #       ifdef IPC_STAT
14503         st = semctl(sem, 0, IPC_STAT, &arg);
14504         if (st == 0)
14505             printf("semid_ds\n");
14506         else
14507 #       endif /* IPC_STAT */
14508             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14509 #       ifdef IPC_RMID
14510         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14511 #       endif /* IPC_RMID */
14512             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14513     } else
14514 #endif /* IPC_PRIVATE && ... */
14515         printf("semget failed: errno = %d\n", errno);
14516
14517     return 0;
14518 }
14519 END
14520     val="$undef"
14521     set try
14522     if eval $compile; then
14523         xxx=`$run ./try`
14524         case "$xxx" in
14525         semid_ds) val="$define" ;;
14526         esac
14527     fi
14528     $rm -f try try.c
14529     set d_semctl_semid_ds
14530     eval $setvar
14531     case "$d_semctl_semid_ds" in
14532     $define)
14533         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14534         ;;
14535     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14536         ;;
14537     esac
14538     $rm -f try.h
14539     ;;
14540 *)  val="$undef"
14541
14542     # We do not have the full sem*(2) library, so assume we can not
14543     # use either.
14544
14545     set d_semctl_semun
14546     eval $setvar
14547
14548     set d_semctl_semid_ds
14549     eval $setvar
14550     ;;
14551 esac
14552
14553 : see if sendmsg exists
14554 set sendmsg d_sendmsg
14555 eval $inlibc
14556
14557 : see if setegid exists
14558 set setegid d_setegid
14559 eval $inlibc
14560
14561 : see if seteuid exists
14562 set seteuid d_seteuid
14563 eval $inlibc
14564
14565 : see if setgrent exists
14566 set setgrent d_setgrent
14567 eval $inlibc
14568
14569 : see if setgrent_r exists
14570 set setgrent_r d_setgrent_r
14571 eval $inlibc
14572 case "$d_setgrent_r" in
14573 "$define")
14574         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14575         case "$d_setgrent_r_proto:$usethreads" in
14576         ":define")      d_setgrent_r_proto=define
14577                 set d_setgrent_r_proto setgrent_r $hdrs
14578                 eval $hasproto ;;
14579         *)      ;;
14580         esac
14581         case "$d_setgrent_r_proto" in
14582         define)
14583         case "$setgrent_r_proto" in
14584         ''|0) try='int setgrent_r(FILE**);'
14585         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14586         esac
14587         case "$setgrent_r_proto" in
14588         ''|0) try='void setgrent_r(FILE**);'
14589         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14590         esac
14591         case "$setgrent_r_proto" in
14592         ''|0)   d_setgrent_r=undef
14593                 setgrent_r_proto=0
14594                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14595         * )     case "$setgrent_r_proto" in
14596                 REENTRANT_PROTO*) ;;
14597                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14598                 esac
14599                 echo "Prototype: $try" ;;
14600         esac
14601         ;;
14602         *)      case "$usethreads" in
14603                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14604                 esac
14605                 d_setgrent_r=undef
14606                 setgrent_r_proto=0
14607                 ;;
14608         esac
14609         ;;
14610 *)      setgrent_r_proto=0
14611         ;;
14612 esac
14613
14614 : see if sethostent exists
14615 set sethostent d_sethent
14616 eval $inlibc
14617
14618 : see if sethostent_r exists
14619 set sethostent_r d_sethostent_r
14620 eval $inlibc
14621 case "$d_sethostent_r" in
14622 "$define")
14623         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14624         case "$d_sethostent_r_proto:$usethreads" in
14625         ":define")      d_sethostent_r_proto=define
14626                 set d_sethostent_r_proto sethostent_r $hdrs
14627                 eval $hasproto ;;
14628         *)      ;;
14629         esac
14630         case "$d_sethostent_r_proto" in
14631         define)
14632         case "$sethostent_r_proto" in
14633         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14634         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14635         esac
14636         case "$sethostent_r_proto" in
14637         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14638         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14639         esac
14640         case "$sethostent_r_proto" in
14641         ''|0)   d_sethostent_r=undef
14642                 sethostent_r_proto=0
14643                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14644         * )     case "$sethostent_r_proto" in
14645                 REENTRANT_PROTO*) ;;
14646                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14647                 esac
14648                 echo "Prototype: $try" ;;
14649         esac
14650         ;;
14651         *)      case "$usethreads" in
14652                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14653                 esac
14654                 d_sethostent_r=undef
14655                 sethostent_r_proto=0
14656                 ;;
14657         esac
14658         ;;
14659 *)      sethostent_r_proto=0
14660         ;;
14661 esac
14662
14663 : see if setitimer exists
14664 set setitimer d_setitimer
14665 eval $inlibc
14666
14667 : see if setlinebuf exists
14668 set setlinebuf d_setlinebuf
14669 eval $inlibc
14670
14671 : see if setlocale exists
14672 set setlocale d_setlocale
14673 eval $inlibc
14674
14675 : see if locale.h is available
14676 set locale.h i_locale
14677 eval $inhdr
14678
14679 : see if setlocale_r exists
14680 set setlocale_r d_setlocale_r
14681 eval $inlibc
14682 case "$d_setlocale_r" in
14683 "$define")
14684         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14685         case "$d_setlocale_r_proto:$usethreads" in
14686         ":define")      d_setlocale_r_proto=define
14687                 set d_setlocale_r_proto setlocale_r $hdrs
14688                 eval $hasproto ;;
14689         *)      ;;
14690         esac
14691         case "$d_setlocale_r_proto" in
14692         define)
14693         case "$setlocale_r_proto" in
14694         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14695         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14696         esac
14697         case "$setlocale_r_proto" in
14698         ''|0)   d_setlocale_r=undef
14699                 setlocale_r_proto=0
14700                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14701         * )     case "$setlocale_r_proto" in
14702                 REENTRANT_PROTO*) ;;
14703                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14704                 esac
14705                 echo "Prototype: $try" ;;
14706         esac
14707         ;;
14708         *)      case "$usethreads" in
14709                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14710                 esac
14711                 d_setlocale_r=undef
14712                 setlocale_r_proto=0
14713                 ;;
14714         esac
14715         ;;
14716 *)      setlocale_r_proto=0
14717         ;;
14718 esac
14719
14720 : see if setnetent exists
14721 set setnetent d_setnent
14722 eval $inlibc
14723
14724 : see if setnetent_r exists
14725 set setnetent_r d_setnetent_r
14726 eval $inlibc
14727 case "$d_setnetent_r" in
14728 "$define")
14729         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14730         case "$d_setnetent_r_proto:$usethreads" in
14731         ":define")      d_setnetent_r_proto=define
14732                 set d_setnetent_r_proto setnetent_r $hdrs
14733                 eval $hasproto ;;
14734         *)      ;;
14735         esac
14736         case "$d_setnetent_r_proto" in
14737         define)
14738         case "$setnetent_r_proto" in
14739         ''|0) try='int setnetent_r(int, struct netent_data*);'
14740         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14741         esac
14742         case "$setnetent_r_proto" in
14743         ''|0) try='void setnetent_r(int, struct netent_data*);'
14744         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14745         esac
14746         case "$setnetent_r_proto" in
14747         ''|0)   d_setnetent_r=undef
14748                 setnetent_r_proto=0
14749                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14750         * )     case "$setnetent_r_proto" in
14751                 REENTRANT_PROTO*) ;;
14752                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14753                 esac
14754                 echo "Prototype: $try" ;;
14755         esac
14756         ;;
14757         *)      case "$usethreads" in
14758                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14759                 esac
14760                 d_setnetent_r=undef
14761                 setnetent_r_proto=0
14762                 ;;
14763         esac
14764         ;;
14765 *)      setnetent_r_proto=0
14766         ;;
14767 esac
14768
14769 : see if setprotoent exists
14770 set setprotoent d_setpent
14771 eval $inlibc
14772
14773 : see if setpgid exists
14774 set setpgid d_setpgid
14775 eval $inlibc
14776
14777 : see if setpgrp2 exists
14778 set setpgrp2 d_setpgrp2
14779 eval $inlibc
14780
14781 : see if setpriority exists
14782 set setpriority d_setprior
14783 eval $inlibc
14784
14785 : see if setproctitle exists
14786 set setproctitle d_setproctitle
14787 eval $inlibc
14788
14789 : see if setprotoent_r exists
14790 set setprotoent_r d_setprotoent_r
14791 eval $inlibc
14792 case "$d_setprotoent_r" in
14793 "$define")
14794         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14795         case "$d_setprotoent_r_proto:$usethreads" in
14796         ":define")      d_setprotoent_r_proto=define
14797                 set d_setprotoent_r_proto setprotoent_r $hdrs
14798                 eval $hasproto ;;
14799         *)      ;;
14800         esac
14801         case "$d_setprotoent_r_proto" in
14802         define)
14803         case "$setprotoent_r_proto" in
14804         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14805         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14806         esac
14807         case "$setprotoent_r_proto" in
14808         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14809         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14810         esac
14811         case "$setprotoent_r_proto" in
14812         ''|0)   d_setprotoent_r=undef
14813                 setprotoent_r_proto=0
14814                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14815         * )     case "$setprotoent_r_proto" in
14816                 REENTRANT_PROTO*) ;;
14817                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14818                 esac
14819                 echo "Prototype: $try" ;;
14820         esac
14821         ;;
14822         *)      case "$usethreads" in
14823                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14824                 esac
14825                 d_setprotoent_r=undef
14826                 setprotoent_r_proto=0
14827                 ;;
14828         esac
14829         ;;
14830 *)      setprotoent_r_proto=0
14831         ;;
14832 esac
14833
14834 : see if setpwent exists
14835 set setpwent d_setpwent
14836 eval $inlibc
14837
14838 : see if setpwent_r exists
14839 set setpwent_r d_setpwent_r
14840 eval $inlibc
14841 case "$d_setpwent_r" in
14842 "$define")
14843         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14844         case "$d_setpwent_r_proto:$usethreads" in
14845         ":define")      d_setpwent_r_proto=define
14846                 set d_setpwent_r_proto setpwent_r $hdrs
14847                 eval $hasproto ;;
14848         *)      ;;
14849         esac
14850         case "$d_setpwent_r_proto" in
14851         define)
14852         case "$setpwent_r_proto" in
14853         ''|0) try='int setpwent_r(FILE**);'
14854         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14855         esac
14856         case "$setpwent_r_proto" in
14857         ''|0) try='void setpwent_r(FILE**);'
14858         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14859         esac
14860         case "$setpwent_r_proto" in
14861         ''|0)   d_setpwent_r=undef
14862                 setpwent_r_proto=0
14863                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14864         * )     case "$setpwent_r_proto" in
14865                 REENTRANT_PROTO*) ;;
14866                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14867                 esac
14868                 echo "Prototype: $try" ;;
14869         esac
14870         ;;
14871         *)      case "$usethreads" in
14872                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14873                 esac
14874                 d_setpwent_r=undef
14875                 setpwent_r_proto=0
14876                 ;;
14877         esac
14878         ;;
14879 *)      setpwent_r_proto=0
14880         ;;
14881 esac
14882
14883 : see if setregid exists
14884 set setregid d_setregid
14885 eval $inlibc
14886 set setresgid d_setresgid
14887 eval $inlibc
14888
14889 : see if setreuid exists
14890 set setreuid d_setreuid
14891 eval $inlibc
14892 set setresuid d_setresuid
14893 eval $inlibc
14894
14895 : see if setrgid exists
14896 set setrgid d_setrgid
14897 eval $inlibc
14898
14899 : see if setruid exists
14900 set setruid d_setruid
14901 eval $inlibc
14902
14903 : see if setservent exists
14904 set setservent d_setsent
14905 eval $inlibc
14906
14907 : see if setservent_r exists
14908 set setservent_r d_setservent_r
14909 eval $inlibc
14910 case "$d_setservent_r" in
14911 "$define")
14912         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14913         case "$d_setservent_r_proto:$usethreads" in
14914         ":define")      d_setservent_r_proto=define
14915                 set d_setservent_r_proto setservent_r $hdrs
14916                 eval $hasproto ;;
14917         *)      ;;
14918         esac
14919         case "$d_setservent_r_proto" in
14920         define)
14921         case "$setservent_r_proto" in
14922         ''|0) try='int setservent_r(int, struct servent_data*);'
14923         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14924         esac
14925         case "$setservent_r_proto" in
14926         ''|0) try='void setservent_r(int, struct servent_data*);'
14927         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14928         esac
14929         case "$setservent_r_proto" in
14930         ''|0)   d_setservent_r=undef
14931                 setservent_r_proto=0
14932                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14933         * )     case "$setservent_r_proto" in
14934                 REENTRANT_PROTO*) ;;
14935                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14936                 esac
14937                 echo "Prototype: $try" ;;
14938         esac
14939         ;;
14940         *)      case "$usethreads" in
14941                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14942                 esac
14943                 d_setservent_r=undef
14944                 setservent_r_proto=0
14945                 ;;
14946         esac
14947         ;;
14948 *)      setservent_r_proto=0
14949         ;;
14950 esac
14951
14952 : see if setsid exists
14953 set setsid d_setsid
14954 eval $inlibc
14955
14956 : see if setvbuf exists
14957 set setvbuf d_setvbuf
14958 eval $inlibc
14959
14960 : see if sfio.h is available
14961 set sfio.h i_sfio
14962 eval $inhdr
14963
14964
14965 : see if sfio library is available
14966 case "$i_sfio" in
14967 $define)
14968         val=''
14969         set sfreserve val
14970         eval $inlibc
14971         ;;
14972 *)
14973         val="$undef"
14974         ;;
14975 esac
14976 : Ok, but do we want to use it.
14977 case "$val" in
14978 $define)
14979         case "$usesfio" in
14980         true|$define|[yY]*) dflt='y';;
14981         *) dflt='n';;
14982         esac
14983         echo "$package can use the sfio library, but it is experimental."
14984         case "$useperlio" in
14985         "$undef")
14986             echo "For sfio also the PerlIO abstraction layer is needed."
14987             echo "Earlier you said you wouldn't want that."
14988             ;;
14989         esac
14990         rp="You seem to have sfio available, do you want to try using it?"
14991         . ./myread
14992         case "$ans" in
14993         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14994                 useperlio="$define"
14995                 val="$define"
14996                 ;;
14997         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14998                 val="$undef"
14999                 ;;
15000         esac
15001         ;;
15002 *)      case "$usesfio" in
15003         true|$define|[yY]*)
15004                 echo "Sorry, cannot find sfio on this machine." >&4
15005                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15006                 val="$undef"
15007                 ;;
15008         esac
15009         ;;
15010 esac
15011 set d_sfio
15012 eval $setvar
15013 case "$d_sfio" in
15014 $define) usesfio='true';;
15015 *) usesfio='false';;
15016 esac
15017 case "$d_sfio" in
15018 $define) ;;
15019 *)      : Remove sfio from list of libraries to use
15020         case "$libs" in
15021         *-lsfio*)
15022                 echo "Removing unneeded -lsfio from library list" >&4
15023                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15024                 shift
15025                 libs="$*"
15026                 echo "libs = $libs" >&4
15027                 ;;
15028         esac
15029 ;;
15030 esac
15031
15032
15033 : see if shmctl exists
15034 set shmctl d_shmctl
15035 eval $inlibc
15036
15037 : see if shmget exists
15038 set shmget d_shmget
15039 eval $inlibc
15040
15041 : see if shmat exists
15042 set shmat d_shmat
15043 eval $inlibc
15044 : see what shmat returns
15045 case "$d_shmat" in
15046 "$define")
15047         $cat >shmat.c <<'END'
15048 #include <sys/shm.h>
15049 void *shmat();
15050 END
15051         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15052                 shmattype='void *'
15053         else
15054                 shmattype='char *'
15055         fi
15056         echo "and it returns ($shmattype)." >&4
15057         : see if a prototype for shmat is available
15058         xxx=`./findhdr sys/shm.h`
15059         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15060         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15061                 val="$define"
15062         else
15063                 val="$undef"
15064         fi
15065         $rm -f shmat.[co]
15066         ;;
15067 *)
15068         val="$undef"
15069         ;;
15070 esac
15071 set d_shmatprototype
15072 eval $setvar
15073
15074 : see if shmdt exists
15075 set shmdt d_shmdt
15076 eval $inlibc
15077
15078 : see how much of the 'shm*(2)' library is present.
15079 h_shm=true
15080 echo " "
15081 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15082 *"$undef"*) h_shm=false;;
15083 esac
15084 case "$osname" in
15085 freebsd)
15086     case "`ipcs 2>&1`" in
15087     "SVID shared memory"*"not configured"*)
15088         echo "Your $osname does not have the shm*(2) configured." >&4
15089         h_shm=false
15090         val="$undef"
15091         set shmctl d_shmctl
15092         evat $setvar
15093         set shmget d_shmget
15094         evat $setvar
15095         set shmat d_shmat
15096         evat $setvar
15097         set shmdt d_shmdt
15098         evat $setvar
15099         ;;
15100     esac
15101     ;;
15102 esac
15103 : we could also check for sys/ipc.h ...
15104 if $h_shm && $test `./findhdr sys/shm.h`; then
15105         echo "You have the full shm*(2) library." >&4
15106         val="$define"
15107 else
15108         echo "You don't have the full shm*(2) library." >&4
15109         val="$undef"
15110 fi
15111 set d_shm
15112 eval $setvar
15113
15114 echo " "
15115 : see if we have sigaction
15116 if set sigaction val -f d_sigaction; eval $csym; $val; then
15117         echo 'sigaction() found.' >&4
15118         $cat > try.c <<'EOP'
15119 #include <stdio.h>
15120 #include <sys/types.h>
15121 #include <signal.h>
15122 int main()
15123 {
15124     struct sigaction act, oact;
15125     act.sa_flags = 0;
15126     oact.sa_handler = 0;
15127     /* so that act and oact are used */
15128     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15129 }
15130 EOP
15131         set try
15132         if eval $compile_ok; then
15133                 val="$define"
15134         else
15135                 echo "But you don't seem to have a useable struct sigaction." >&4
15136                 val="$undef"
15137         fi
15138 else
15139         echo 'sigaction NOT found.' >&4
15140         val="$undef"
15141 fi
15142 set d_sigaction; eval $setvar
15143 $rm -f try try$_o try.c
15144
15145 : see if sigprocmask exists
15146 set sigprocmask d_sigprocmask
15147 eval $inlibc
15148
15149 : see if sigsetjmp exists
15150 echo " "
15151 case "$d_sigsetjmp" in
15152 '')
15153         $cat >try.c <<'EOP'
15154 #include <setjmp.h>
15155 sigjmp_buf env;
15156 int set = 1;
15157 int main()
15158 {
15159         if (sigsetjmp(env,1))
15160                 exit(set);
15161         set = 0;
15162         siglongjmp(env, 1);
15163         exit(1);
15164 }
15165 EOP
15166         set try
15167         if eval $compile; then
15168                 if $run ./try >/dev/null 2>&1; then
15169                         echo "POSIX sigsetjmp found." >&4
15170                         val="$define"
15171                 else
15172                         $cat >&4 <<EOM
15173 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15174 I'll ignore them.
15175 EOM
15176                         val="$undef"
15177                 fi
15178         else
15179                 echo "sigsetjmp not found." >&4
15180                 val="$undef"
15181         fi
15182         ;;
15183 *) val="$d_sigsetjmp"
15184         case "$d_sigsetjmp" in
15185         $define) echo "POSIX sigsetjmp found." >&4;;
15186         $undef) echo "sigsetjmp not found." >&4;;
15187         esac
15188         ;;
15189 esac
15190 set d_sigsetjmp
15191 eval $setvar
15192 $rm -f try.c try
15193
15194 : see if sockatmark exists
15195 set sockatmark d_sockatmark
15196 eval $inlibc
15197
15198 : see if prototype for sockatmark is available
15199 echo " "
15200 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15201 eval $hasproto
15202
15203 : see if socks5_init exists
15204 set socks5_init d_socks5_init
15205 eval $inlibc
15206
15207 : see if srand48_r exists
15208 set srand48_r d_srand48_r
15209 eval $inlibc
15210 case "$d_srand48_r" in
15211 "$define")
15212         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15213         case "$d_srand48_r_proto:$usethreads" in
15214         ":define")      d_srand48_r_proto=define
15215                 set d_srand48_r_proto srand48_r $hdrs
15216                 eval $hasproto ;;
15217         *)      ;;
15218         esac
15219         case "$d_srand48_r_proto" in
15220         define)
15221         case "$srand48_r_proto" in
15222         ''|0) try='int srand48_r(long, struct drand48_data*);'
15223         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15224         esac
15225         case "$srand48_r_proto" in
15226         ''|0)   d_srand48_r=undef
15227                 srand48_r_proto=0
15228                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15229         * )     case "$srand48_r_proto" in
15230                 REENTRANT_PROTO*) ;;
15231                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15232                 esac
15233                 echo "Prototype: $try" ;;
15234         esac
15235         ;;
15236         *)      case "$usethreads" in
15237                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15238                 esac
15239                 d_srand48_r=undef
15240                 srand48_r_proto=0
15241                 ;;
15242         esac
15243         ;;
15244 *)      srand48_r_proto=0
15245         ;;
15246 esac
15247
15248 : see if srandom_r exists
15249 set srandom_r d_srandom_r
15250 eval $inlibc
15251 case "$d_srandom_r" in
15252 "$define")
15253         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15254         case "$d_srandom_r_proto:$usethreads" in
15255         ":define")      d_srandom_r_proto=define
15256                 set d_srandom_r_proto srandom_r $hdrs
15257                 eval $hasproto ;;
15258         *)      ;;
15259         esac
15260         case "$d_srandom_r_proto" in
15261         define)
15262         case "$srandom_r_proto" in
15263         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15264         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15265         esac
15266         case "$srandom_r_proto" in
15267         ''|0)   d_srandom_r=undef
15268                 srandom_r_proto=0
15269                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15270         * )     case "$srandom_r_proto" in
15271                 REENTRANT_PROTO*) ;;
15272                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15273                 esac
15274                 echo "Prototype: $try" ;;
15275         esac
15276         ;;
15277         *)      case "$usethreads" in
15278                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15279                 esac
15280                 d_srandom_r=undef
15281                 srandom_r_proto=0
15282                 ;;
15283         esac
15284         ;;
15285 *)      srandom_r_proto=0
15286         ;;
15287 esac
15288
15289 : see if prototype for setresgid is available
15290 echo " "
15291 set d_sresgproto setresgid $i_unistd unistd.h
15292 eval $hasproto
15293
15294 : see if prototype for setresuid is available
15295 echo " "
15296 set d_sresuproto setresuid $i_unistd unistd.h
15297 eval $hasproto
15298
15299 : see if sys/stat.h is available
15300 set sys/stat.h i_sysstat
15301 eval $inhdr
15302
15303
15304 : see if stat knows about block sizes
15305 echo " "
15306 echo "Checking to see if your struct stat has st_blocks field..." >&4
15307 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15308 eval $hasfield
15309
15310
15311 : see if this is a sys/vfs.h system
15312 set sys/vfs.h i_sysvfs
15313 eval $inhdr
15314
15315
15316 : see if this is a sys/statfs.h system
15317 set sys/statfs.h i_sysstatfs
15318 eval $inhdr
15319
15320
15321 echo " "
15322 echo "Checking to see if your system supports struct statfs..." >&4
15323 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
15324 eval $hasstruct
15325 case "$d_statfs_s" in
15326 "$define")      echo "Yes, it does."   ;;
15327 *)              echo "No, it doesn't." ;;
15328 esac
15329
15330
15331
15332 : see if struct statfs knows about f_flags
15333 case "$d_statfs_s" in
15334 define) 
15335         echo " "
15336         echo "Checking to see if your struct statfs has f_flags field..." >&4
15337         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
15338         eval $hasfield
15339         ;;
15340 *)      val="$undef"
15341         set d_statfs_f_flags
15342         eval $setvar
15343         ;;
15344 esac
15345 case "$d_statfs_f_flags" in
15346 "$define")      echo "Yes, it does."   ;;
15347 *)              echo "No, it doesn't." ;;
15348 esac
15349
15350 : see if _ptr and _cnt from stdio act std
15351 echo " "
15352
15353 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15354         echo "(Looks like you have stdio.h from BSD.)"
15355         case "$stdio_ptr" in
15356         '') stdio_ptr='((fp)->_p)'
15357                 ptr_lval=$define
15358                 ;;
15359         *)      ptr_lval=$d_stdio_ptr_lval;;
15360         esac
15361         case "$stdio_cnt" in
15362         '') stdio_cnt='((fp)->_r)'
15363                 cnt_lval=$define
15364                 ;;
15365         *)      cnt_lval=$d_stdio_cnt_lval;;
15366         esac
15367         case "$stdio_base" in
15368         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15369         esac
15370         case "$stdio_bufsiz" in
15371         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15372         esac
15373 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15374         echo "(Looks like you have stdio.h from Linux.)"
15375         case "$stdio_ptr" in
15376         '') stdio_ptr='((fp)->_IO_read_ptr)'
15377                 ptr_lval=$define
15378                 ;;
15379         *)      ptr_lval=$d_stdio_ptr_lval;;
15380         esac
15381         case "$stdio_cnt" in
15382         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15383                 cnt_lval=$undef
15384                 ;;
15385         *)      cnt_lval=$d_stdio_cnt_lval;;
15386         esac
15387         case "$stdio_base" in
15388         '') stdio_base='((fp)->_IO_read_base)';;
15389         esac
15390         case "$stdio_bufsiz" in
15391         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15392         esac
15393 else
15394         case "$stdio_ptr" in
15395         '') stdio_ptr='((fp)->_ptr)'
15396                 ptr_lval=$define
15397                 ;;
15398         *)      ptr_lval=$d_stdio_ptr_lval;;
15399         esac
15400         case "$stdio_cnt" in
15401         '') stdio_cnt='((fp)->_cnt)'
15402                 cnt_lval=$define
15403                 ;;
15404         *)      cnt_lval=$d_stdio_cnt_lval;;
15405         esac
15406         case "$stdio_base" in
15407         '') stdio_base='((fp)->_base)';;
15408         esac
15409         case "$stdio_bufsiz" in
15410         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15411         esac
15412 fi
15413
15414 : test whether _ptr and _cnt really work
15415 echo "Checking how std your stdio is..." >&4
15416 $cat >try.c <<EOP
15417 #include <stdio.h>
15418 #define FILE_ptr(fp)    $stdio_ptr
15419 #define FILE_cnt(fp)    $stdio_cnt
15420 int main() {
15421         FILE *fp = fopen("try.c", "r");
15422         char c = getc(fp);
15423         if (
15424                 18 <= FILE_cnt(fp) &&
15425                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15426         )
15427                 exit(0);
15428         exit(1);
15429 }
15430 EOP
15431 val="$undef"
15432 set try
15433 if eval $compile && $to try.c; then
15434         if $run ./try; then
15435                 echo "Your stdio acts pretty std."
15436                 val="$define"
15437         else
15438                 echo "Your stdio isn't very std."
15439         fi
15440 else
15441         echo "Your stdio doesn't appear very std."
15442 fi
15443 $rm -f try.c try
15444
15445 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15446 # direct buffer manipulation no longer works.  The Configure tests
15447 # should be changed to correctly detect this, but until then,
15448 # the following check should at least let perl compile and run.
15449 # (This quick fix should be updated before 5.8.1.)
15450 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15451 # A. Dougherty, June 3, 2002.
15452 case "$d_gnulibc" in
15453 $define)
15454         case "$gnulibc_version" in
15455         2.[01]*)  ;;
15456         2.2) ;;
15457         2.2.[0-9]) ;;
15458         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15459                 val="$undef"
15460                 ;;
15461         esac
15462         ;;
15463 esac
15464 set d_stdstdio
15465 eval $setvar
15466
15467 : Can _ptr be used as an lvalue?
15468 case "$d_stdstdio$ptr_lval" in
15469 $define$define) val=$define ;;
15470 *) val=$undef ;;
15471 esac
15472 set d_stdio_ptr_lval
15473 eval $setvar
15474
15475 : Can _cnt be used as an lvalue?
15476 case "$d_stdstdio$cnt_lval" in
15477 $define$define) val=$define ;;
15478 *) val=$undef ;;
15479 esac
15480 set d_stdio_cnt_lval
15481 eval $setvar
15482
15483
15484 : test whether setting _ptr sets _cnt as a side effect
15485 d_stdio_ptr_lval_sets_cnt="$undef"
15486 d_stdio_ptr_lval_nochange_cnt="$undef"
15487 case "$d_stdio_ptr_lval$d_stdstdio" in
15488 $define$define)
15489         echo "Checking to see what happens if we set the stdio ptr..." >&4
15490 $cat >try.c <<EOP
15491 #include <stdio.h>
15492 /* Can we scream? */
15493 /* Eat dust sed :-) */
15494 /* In the buffer space, no one can hear you scream. */
15495 #define FILE_ptr(fp)    $stdio_ptr
15496 #define FILE_cnt(fp)    $stdio_cnt
15497 #include <sys/types.h>
15498 int main() {
15499         FILE *fp = fopen("try.c", "r");
15500         int c;
15501         char *ptr;
15502         size_t cnt;
15503         if (!fp) {
15504             puts("Fail even to read");
15505             exit(1);
15506         }
15507         c = getc(fp); /* Read away the first # */
15508         if (c == EOF) {
15509             puts("Fail even to read");
15510             exit(1);
15511         }
15512         if (!(
15513                 18 <= FILE_cnt(fp) &&
15514                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15515         )) {
15516                 puts("Fail even to read");
15517                 exit (1);
15518         }
15519         ptr = (char*) FILE_ptr(fp);
15520         cnt = (size_t)FILE_cnt(fp);
15521
15522         FILE_ptr(fp) += 42;
15523
15524         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15525                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15526                 exit (1);
15527         }
15528         if (FILE_cnt(fp) <= 20) {
15529                 printf ("Fail (<20 chars to test)");
15530                 exit (1);
15531         }
15532         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15533                 puts("Fail compare");
15534                 exit (1);
15535         }
15536         if (cnt == FILE_cnt(fp)) {
15537                 puts("Pass_unchanged");
15538                 exit (0);
15539         }       
15540         if (FILE_cnt(fp) == (cnt - 42)) {
15541                 puts("Pass_changed");
15542                 exit (0);
15543         }
15544         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15545         return 1;
15546
15547 }
15548 EOP
15549         set try
15550         if eval $compile && $to try.c; then
15551                 case `$run ./try` in
15552                 Pass_changed)
15553                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15554                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15555                 Pass_unchanged)
15556                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15557                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15558                 Fail*)
15559                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15560                 *)
15561                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15562         esac
15563         else
15564                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15565         fi
15566         $rm -f try.c try
15567         ;;
15568 esac
15569
15570 : see if _base is also standard
15571 val="$undef"
15572 case "$d_stdstdio" in
15573 $define)
15574         $cat >try.c <<EOP
15575 #include <stdio.h>
15576 #define FILE_base(fp)   $stdio_base
15577 #define FILE_bufsiz(fp) $stdio_bufsiz
15578 int main() {
15579         FILE *fp = fopen("try.c", "r");
15580         char c = getc(fp);
15581         if (
15582                 19 <= FILE_bufsiz(fp) &&
15583                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15584         )
15585                 exit(0);
15586         exit(1);
15587 }
15588 EOP
15589         set try
15590         if eval $compile && $to try.c; then
15591                 if $run ./try; then
15592                         echo "And its _base field acts std."
15593                         val="$define"
15594                 else
15595                         echo "But its _base field isn't std."
15596                 fi
15597         else
15598                 echo "However, it seems to be lacking the _base field."
15599         fi
15600         $rm -f try.c try
15601         ;;
15602 esac
15603 set d_stdiobase
15604 eval $setvar
15605
15606 $cat >&4 <<EOM
15607 Checking how to access stdio streams by file descriptor number...
15608 EOM
15609 case "$stdio_stream_array" in
15610 '')     $cat >try.c <<EOCP
15611 #include <stdio.h>
15612 int main() {
15613   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15614     printf("yes\n");
15615 }
15616 EOCP
15617         for s in _iob __iob __sF
15618         do
15619                 set try -DSTDIO_STREAM_ARRAY=$s
15620                 if eval $compile; then
15621                         case "`$run ./try`" in
15622                         yes)    stdio_stream_array=$s; break ;;
15623                         esac
15624                 fi
15625         done
15626         $rm -f try.* try$exe_ext
15627 esac
15628 case "$stdio_stream_array" in
15629 '')     $cat >&4 <<EOM
15630 I can't figure out how to access stdio streams by file descriptor number.
15631 EOM
15632         d_stdio_stream_array="$undef"
15633         ;;
15634 *)      $cat >&4 <<EOM
15635 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15636 EOM
15637         d_stdio_stream_array="$define"
15638         ;;
15639 esac
15640
15641 : see if strcoll exists
15642 set strcoll d_strcoll
15643 eval $inlibc
15644
15645 : check for structure copying
15646 echo " "
15647 echo "Checking to see if your C compiler can copy structs..." >&4
15648 $cat >try.c <<'EOCP'
15649 main()
15650 {
15651         struct blurfl {
15652                 int dyick;
15653         } foo, bar;
15654
15655         foo = bar;
15656 }
15657 EOCP
15658 if $cc -c try.c >/dev/null 2>&1 ; then
15659         val="$define"
15660         echo "Yup, it can."
15661 else
15662         val="$undef"
15663         echo "Nope, it can't."
15664 fi
15665 set d_strctcpy
15666 eval $setvar
15667 $rm -f try.*
15668
15669 : see if strerror and/or sys_errlist[] exist
15670 echo " "
15671 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15672     if set strerror val -f d_strerror; eval $csym; $val; then
15673                 echo 'strerror() found.' >&4
15674                 d_strerror="$define"
15675                 d_strerrm='strerror(e)'
15676                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15677                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15678                         d_syserrlst="$define"
15679                 else
15680                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15681                         d_syserrlst="$undef"
15682                 fi
15683     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15684                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15685                 echo 'strerror() found in string header.' >&4
15686                 d_strerror="$define"
15687                 d_strerrm='strerror(e)'
15688                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15689                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15690                                 d_syserrlst="$define"
15691                 else
15692                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15693                         d_syserrlst="$undef"
15694                 fi
15695     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15696                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15697                 d_strerror="$undef"
15698                 d_syserrlst="$define"
15699                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15700     else
15701                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15702                 d_strerror="$undef"
15703                 d_syserrlst="$undef"
15704                 d_strerrm='"unknown"'
15705     fi
15706 fi
15707
15708 : see if strerror_r exists
15709 set strerror_r d_strerror_r
15710 eval $inlibc
15711 case "$d_strerror_r" in
15712 "$define")
15713         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15714         case "$d_strerror_r_proto:$usethreads" in
15715         ":define")      d_strerror_r_proto=define
15716                 set d_strerror_r_proto strerror_r $hdrs
15717                 eval $hasproto ;;
15718         *)      ;;
15719         esac
15720         case "$d_strerror_r_proto" in
15721         define)
15722         case "$strerror_r_proto" in
15723         ''|0) try='int strerror_r(int, char*, size_t);'
15724         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15725         esac
15726         case "$strerror_r_proto" in
15727         ''|0) try='int strerror_r(int, char*, int);'
15728         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15729         esac
15730         case "$strerror_r_proto" in
15731         ''|0) try='char* strerror_r(int, char*, size_t);'
15732         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15733         esac
15734         case "$strerror_r_proto" in
15735         ''|0)   d_strerror_r=undef
15736                 strerror_r_proto=0
15737                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15738         * )     case "$strerror_r_proto" in
15739                 REENTRANT_PROTO*) ;;
15740                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15741                 esac
15742                 echo "Prototype: $try" ;;
15743         esac
15744         ;;
15745         *)      case "$usethreads" in
15746                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15747                 esac
15748                 d_strerror_r=undef
15749                 strerror_r_proto=0
15750                 ;;
15751         esac
15752         ;;
15753 *)      strerror_r_proto=0
15754         ;;
15755 esac
15756
15757 : see if strftime exists
15758 set strftime d_strftime
15759 eval $inlibc
15760
15761 : see if strtod exists
15762 set strtod d_strtod
15763 eval $inlibc
15764
15765 : see if strtol exists
15766 set strtol d_strtol
15767 eval $inlibc
15768
15769 : see if strtold exists
15770 set strtold d_strtold
15771 eval $inlibc
15772
15773 : see if strtoll exists
15774 set strtoll d_strtoll
15775 eval $inlibc
15776
15777 case "$d_longlong-$d_strtoll" in
15778 "$define-$define")
15779         $cat <<EOM
15780 Checking whether your strtoll() works okay...
15781 EOM
15782         $cat >try.c <<'EOCP'
15783 #include <errno.h>
15784 #ifdef __hpux
15785 #define strtoll __strtoll
15786 #endif
15787 #ifdef __EMX__
15788 #define strtoll _strtoll
15789 #endif
15790 #include <stdio.h>
15791 extern long long int strtoll(char *s, char **, int); 
15792 static int bad = 0;
15793 int check(char *s, long long ell, int een) {
15794         long long gll;
15795         errno = 0;
15796         gll = strtoll(s, 0, 10);
15797         if (!((gll == ell) && (errno == een)))
15798                 bad++;
15799 }
15800 int main() {
15801         check(" 1",                                      1LL, 0);
15802         check(" 0",                                      0LL, 0);
15803         check("-1",                                     -1LL, 0);
15804         check("-9223372036854775808", -9223372036854775808LL, 0);
15805         check("-9223372036854775808", -9223372036854775808LL, 0);
15806         check(" 9223372036854775807",  9223372036854775807LL, 0);
15807         check("-9223372036854775808", -9223372036854775808LL, 0);
15808         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15809         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15810         if (!bad)
15811                 printf("ok\n");
15812 }
15813 EOCP
15814         set try
15815         if eval $compile; then
15816                 yyy=`$run ./try`
15817                 case "$yyy" in
15818                 ok) echo "Your strtoll() seems to be working okay." ;;
15819                 *) cat <<EOM >&4
15820 Your strtoll() doesn't seem to be working okay.
15821 EOM
15822                    d_strtoll="$undef"
15823                    ;;
15824                 esac
15825         else
15826                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15827                 d_strtoll="$undef"
15828         fi
15829         ;;
15830 esac
15831
15832 : see if strtoq exists
15833 set strtoq d_strtoq
15834 eval $inlibc
15835
15836 : see if strtoul exists
15837 set strtoul d_strtoul
15838 eval $inlibc
15839
15840 case "$d_strtoul" in
15841 "$define")
15842         $cat <<EOM
15843 Checking whether your strtoul() works okay...
15844 EOM
15845         $cat >try.c <<'EOCP'
15846 #include <errno.h>
15847 #include <stdio.h>
15848 extern unsigned long int strtoul(char *s, char **, int); 
15849 static int bad = 0;
15850 void check(char *s, unsigned long eul, int een) {
15851         unsigned long gul;
15852         errno = 0;
15853         gul = strtoul(s, 0, 10);
15854         if (!((gul == eul) && (errno == een)))
15855                 bad++;
15856 }
15857 int main() {
15858         check(" 1", 1L, 0);
15859         check(" 0", 0L, 0);
15860 EOCP
15861         case "$longsize" in
15862         8)
15863             $cat >>try.c <<'EOCP'
15864         check("18446744073709551615", 18446744073709551615UL, 0);
15865         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15866 #if 0 /* strtoul() for /^-/ strings is undefined. */
15867         check("-1", 18446744073709551615UL, 0);
15868         check("-18446744073709551614", 2, 0);
15869         check("-18446744073709551615", 1, 0);
15870         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15871         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15872 #endif
15873 EOCP
15874                 ;;
15875         4)
15876                     $cat >>try.c <<'EOCP'
15877         check("4294967295", 4294967295UL, 0);
15878         check("4294967296", 4294967295UL, ERANGE);
15879 #if 0 /* strtoul() for /^-/ strings is undefined. */
15880         check("-1", 4294967295UL, 0);
15881         check("-4294967294", 2, 0);
15882         check("-4294967295", 1, 0);
15883         check("-4294967296", 4294967295UL, ERANGE);
15884         check("-4294967297", 4294967295UL, ERANGE);
15885 #endif
15886 EOCP
15887                 ;;
15888         *)
15889 : Should we write these tests to be more portable by sprintf-ing
15890 : ~0 and then manipulating that char string as input for strtol?
15891                 ;;
15892         esac
15893         $cat >>try.c <<'EOCP'
15894         if (!bad)
15895                 printf("ok\n");
15896         return 0;
15897 }
15898 EOCP
15899         set try
15900         if eval $compile; then
15901                 case "`$run ./try`" in
15902                 ok) echo "Your strtoul() seems to be working okay." ;;
15903                 *) cat <<EOM >&4
15904 Your strtoul() doesn't seem to be working okay.
15905 EOM
15906                    d_strtoul="$undef"
15907                    ;;
15908                 esac
15909         fi
15910         ;;
15911 esac
15912
15913 : see if strtoull exists
15914 set strtoull d_strtoull
15915 eval $inlibc
15916
15917 case "$d_longlong-$d_strtoull" in
15918 "$define-$define")
15919         $cat <<EOM
15920 Checking whether your strtoull() works okay...
15921 EOM
15922         $cat >try.c <<'EOCP'
15923 #include <errno.h>
15924 #ifdef __hpux
15925 #define strtoull __strtoull
15926 #endif
15927 #include <stdio.h>
15928 extern unsigned long long int strtoull(char *s, char **, int); 
15929 static int bad = 0;
15930 int check(char *s, long long eull, int een) {
15931         long long gull;
15932         errno = 0;
15933         gull = strtoull(s, 0, 10);
15934         if (!((gull == eull) && (errno == een)))
15935                 bad++;
15936 }
15937 int main() {
15938         check(" 1",                                        1LL, 0);
15939         check(" 0",                                        0LL, 0);
15940         check("18446744073709551615",  18446744073709551615ULL, 0);
15941         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15942 #if 0 /* strtoull() for /^-/ strings is undefined. */
15943         check("-1",                    18446744073709551615ULL, 0);
15944         check("-18446744073709551614",                     2LL, 0);
15945         check("-18446744073709551615",                     1LL, 0);
15946         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15947         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15948 #endif
15949         if (!bad)
15950                 printf("ok\n");
15951 }
15952 EOCP
15953         set try
15954         if eval $compile; then
15955                 case "`$run ./try`" in
15956                 ok) echo "Your strtoull() seems to be working okay." ;;
15957                 *) cat <<EOM >&4
15958 Your strtoull() doesn't seem to be working okay.
15959 EOM
15960                    d_strtoull="$undef"
15961                    ;;
15962                 esac
15963         fi
15964         ;;
15965 esac
15966
15967 : see if strtouq exists
15968 set strtouq d_strtouq
15969 eval $inlibc
15970
15971 case "$d_strtouq" in
15972 "$define")
15973         $cat <<EOM
15974 Checking whether your strtouq() works okay...
15975 EOM
15976         $cat >try.c <<'EOCP'
15977 #include <errno.h>
15978 #include <stdio.h>
15979 extern unsigned long long int strtouq(char *s, char **, int); 
15980 static int bad = 0;
15981 void check(char *s, unsigned long long eull, int een) {
15982         unsigned long long gull;
15983         errno = 0;
15984         gull = strtouq(s, 0, 10);
15985         if (!((gull == eull) && (errno == een)))
15986                 bad++;
15987 }
15988 int main() {
15989         check(" 1",                                        1LL, 0);
15990         check(" 0",                                        0LL, 0);
15991         check("18446744073709551615",  18446744073709551615ULL, 0);
15992         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15993 #if 0 /* strtouq() for /^-/ strings is undefined. */
15994         check("-1",                    18446744073709551615ULL, 0);
15995         check("-18446744073709551614",                     2LL, 0);
15996         check("-18446744073709551615",                     1LL, 0);
15997         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15998         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15999 #endif
16000         if (!bad)
16001                 printf("ok\n");
16002         return 0;
16003 }
16004 EOCP
16005         set try
16006         if eval $compile; then
16007                 case "`$run ./try`" in
16008                 ok) echo "Your strtouq() seems to be working okay." ;;
16009                 *) cat <<EOM >&4
16010 Your strtouq() doesn't seem to be working okay.
16011 EOM
16012                    d_strtouq="$undef"
16013                    ;;
16014                 esac
16015         fi
16016         ;;
16017 esac
16018
16019 : see if strxfrm exists
16020 set strxfrm d_strxfrm
16021 eval $inlibc
16022
16023 : see if symlink exists
16024 set symlink d_symlink
16025 eval $inlibc
16026
16027 : see if syscall exists
16028 set syscall d_syscall
16029 eval $inlibc
16030
16031 : see if prototype for syscall is available
16032 echo " "
16033 set d_syscallproto syscall $i_unistd unistd.h
16034 eval $hasproto
16035
16036 : see if sysconf exists
16037 set sysconf d_sysconf
16038 eval $inlibc
16039
16040 : see if system exists
16041 set system d_system
16042 eval $inlibc
16043
16044 : see if tcgetpgrp exists
16045 set tcgetpgrp d_tcgetpgrp
16046 eval $inlibc
16047
16048 : see if tcsetpgrp exists
16049 set tcsetpgrp d_tcsetpgrp
16050 eval $inlibc
16051
16052 : see if prototype for telldir is available
16053 echo " "
16054 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16055 eval $hasproto
16056
16057 : see if time exists
16058 echo " "
16059 if test "X$d_time" = X -o X"$timetype" = X; then
16060     if set time val -f d_time; eval $csym; $val; then
16061                 echo 'time() found.' >&4
16062                 val="$define"
16063                 rp="What is the type returned by time() on this system?"
16064                 set time_t timetype long stdio.h sys/types.h
16065                 eval $typedef_ask
16066     else
16067                 echo 'time() not found, hope that will do.' >&4
16068                 val="$undef"
16069                 timetype='int';
16070     fi
16071     set d_time
16072     eval $setvar
16073 fi
16074
16075 : see if this is a sys/times.h system
16076 set sys/times.h i_systimes
16077 eval $inhdr
16078
16079 : see if times exists
16080 echo " "
16081 if set times val -f d_times; eval $csym; $val; then
16082         echo 'times() found.' >&4
16083         d_times="$define"
16084         inc=''
16085         case "$i_systimes" in
16086         "$define") inc='sys/times.h';;
16087         esac
16088         rp="What is the type returned by times() on this system?"
16089         set clock_t clocktype long stdio.h sys/types.h $inc
16090         eval $typedef_ask
16091 else
16092         echo 'times() NOT found, hope that will do.' >&4
16093         d_times="$undef"
16094         clocktype='int'
16095 fi
16096
16097 : see if tmpnam_r exists
16098 set tmpnam_r d_tmpnam_r
16099 eval $inlibc
16100 case "$d_tmpnam_r" in
16101 "$define")
16102         hdrs="$i_systypes sys/types.h define stdio.h "
16103         case "$d_tmpnam_r_proto:$usethreads" in
16104         ":define")      d_tmpnam_r_proto=define
16105                 set d_tmpnam_r_proto tmpnam_r $hdrs
16106                 eval $hasproto ;;
16107         *)      ;;
16108         esac
16109         case "$d_tmpnam_r_proto" in
16110         define)
16111         case "$tmpnam_r_proto" in
16112         ''|0) try='char* tmpnam_r(char*);'
16113         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16114         esac
16115         case "$tmpnam_r_proto" in
16116         ''|0)   d_tmpnam_r=undef
16117                 tmpnam_r_proto=0
16118                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16119         * )     case "$tmpnam_r_proto" in
16120                 REENTRANT_PROTO*) ;;
16121                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16122                 esac
16123                 echo "Prototype: $try" ;;
16124         esac
16125         ;;
16126         *)      case "$usethreads" in
16127                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16128                 esac
16129                 d_tmpnam_r=undef
16130                 tmpnam_r_proto=0
16131                 ;;
16132         esac
16133         ;;
16134 *)      tmpnam_r_proto=0
16135         ;;
16136 esac
16137
16138 : see if truncate exists
16139 set truncate d_truncate
16140 eval $inlibc
16141
16142 : see if ttyname_r exists
16143 set ttyname_r d_ttyname_r
16144 eval $inlibc
16145 case "$d_ttyname_r" in
16146 "$define")
16147         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16148         case "$d_ttyname_r_proto:$usethreads" in
16149         ":define")      d_ttyname_r_proto=define
16150                 set d_ttyname_r_proto ttyname_r $hdrs
16151                 eval $hasproto ;;
16152         *)      ;;
16153         esac
16154         case "$d_ttyname_r_proto" in
16155         define)
16156         case "$ttyname_r_proto" in
16157         ''|0) try='int ttyname_r(int, char*, size_t);'
16158         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16159         esac
16160         case "$ttyname_r_proto" in
16161         ''|0) try='int ttyname_r(int, char*, int);'
16162         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16163         esac
16164         case "$ttyname_r_proto" in
16165         ''|0) try='char* ttyname_r(int, char*, int);'
16166         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16167         esac
16168         case "$ttyname_r_proto" in
16169         ''|0)   d_ttyname_r=undef
16170                 ttyname_r_proto=0
16171                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16172         * )     case "$ttyname_r_proto" in
16173                 REENTRANT_PROTO*) ;;
16174                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16175                 esac
16176                 echo "Prototype: $try" ;;
16177         esac
16178         ;;
16179         *)      case "$usethreads" in
16180                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16181                 esac
16182                 d_ttyname_r=undef
16183                 ttyname_r_proto=0
16184                 ;;
16185         esac
16186         ;;
16187 *)      ttyname_r_proto=0
16188         ;;
16189 esac
16190
16191 : see if tzname[] exists
16192 echo " "
16193 if set tzname val -a d_tzname; eval $csym; $val; then
16194         val="$define"
16195         echo 'tzname[] found.' >&4
16196 else
16197         val="$undef"
16198         echo 'tzname[] NOT found.' >&4
16199 fi
16200 set d_tzname
16201 eval $setvar
16202
16203 case "$osname" in
16204 next|rhapsody|darwin) multiarch="$define" ;;
16205 esac
16206 case "$multiarch" in
16207 ''|[nN]*) multiarch="$undef" ;;
16208 esac
16209
16210 : check for ordering of bytes in a UV
16211 echo " "
16212 case "$usecrosscompile$multiarch" in
16213 *$define*)
16214         $cat <<EOM
16215 You seem to be either cross-compiling or doing a multiarchitecture build,
16216 skipping the byteorder check.
16217
16218 EOM
16219         byteorder='ffff'
16220         ;;
16221 *)
16222         case "$byteorder" in
16223         '')
16224                 $cat <<'EOM'
16225 In the following, larger digits indicate more significance.  A big-endian
16226 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16227 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16228 machines may have weird orders like 3412.  A Cray will report 87654321,
16229 an Alpha will report 12345678. If the test program works the default is
16230 probably right.
16231 I'm now running the test program...
16232 EOM
16233                 $cat >try.c <<EOCP
16234 #include <stdio.h>
16235 #include <sys/types.h>
16236 typedef $uvtype UV;
16237 int main()
16238 {
16239         int i;
16240         union {
16241                 UV l;
16242                 char c[$uvsize];
16243         } u;
16244
16245         if ($uvsize > 4)
16246                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16247         else
16248                 u.l = (UV)0x04030201;
16249         for (i = 0; i < $uvsize; i++)
16250                 printf("%c", u.c[i]+'0');
16251         printf("\n");
16252         exit(0);
16253 }
16254 EOCP
16255                 xxx_prompt=y
16256                 set try
16257                 if eval $compile && ./try > /dev/null; then
16258                         dflt=`$run ./try`
16259                         case "$dflt" in
16260                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16261                                 echo "(The test program ran ok.)"
16262                                 echo "byteorder=$dflt"
16263                                 xxx_prompt=n
16264                         ;;
16265                         ????|????????) echo "(The test program ran ok.)" ;;
16266                         *) echo "(The test program didn't run right for some reason.)" ;;
16267                         esac
16268                 else
16269                         dflt='4321'
16270                         cat <<'EOM'
16271 (I can't seem to compile the test program.  Guessing big-endian...)
16272 EOM
16273                 fi
16274                 case "$xxx_prompt" in
16275                 y)
16276                         rp="What is the order of bytes in $uvtype?"
16277                         . ./myread
16278                         byteorder="$ans"
16279                         ;;
16280                 *)      byteorder=$dflt
16281                         ;;
16282                 esac
16283                 ;;
16284         esac
16285         $rm -f try.c try
16286         ;;
16287 esac
16288
16289
16290 $cat <<EOM
16291
16292 Checking to see whether you can access character data unalignedly...
16293 EOM
16294 case "$d_u32align" in
16295 '')   $cat >try.c <<EOCP
16296 #include <stdio.h>
16297 #define U32 $u32type
16298 #define BYTEORDER 0x$byteorder
16299 #define U8 $u8type
16300 #include <signal.h>
16301 #ifdef SIGBUS
16302 $signal_t bletch(s) int s; { exit(4); }
16303 #endif
16304 int main() {
16305 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16306     U8 buf[8];
16307     U32 *up;
16308     int i;
16309
16310     if (sizeof(U32) != 4) {
16311         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16312         exit(1);
16313     }
16314
16315     fflush(stdout);
16316
16317 #ifdef SIGBUS
16318     signal(SIGBUS, bletch);
16319 #endif
16320
16321     buf[0] = 0;
16322     buf[1] = 0;
16323     buf[2] = 0;
16324     buf[3] = 1;
16325     buf[5] = 0;
16326     buf[6] = 0;
16327     buf[7] = 0;
16328     buf[8] = 1;
16329
16330     for (i = 0; i < 4; i++) {
16331         up = (U32*)(buf + i);
16332         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16333                (*up == 1 << (8*(3-i)))  /* little-endian */
16334               )
16335            )
16336         {
16337             printf("read failed (%x)\n", *up);
16338             exit(2);
16339         }
16340     }
16341
16342     /* write test */
16343     for (i = 0; i < 4; i++) {
16344         up = (U32*)(buf + i);
16345         *up = 0xBeef;
16346         if (*up != 0xBeef) {
16347             printf("write failed (%x)\n", *up);
16348             exit(3);
16349         }
16350     }
16351
16352     exit(0);
16353 #else
16354     printf("1\n");
16355     exit(1);
16356 #endif
16357     return 0;
16358 }
16359 EOCP
16360 set try
16361 if eval $compile_ok; then
16362         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16363         $run ./try 2>&1 >/dev/null
16364         case "$?" in
16365         0)      cat >&4 <<EOM
16366 You can access character data pretty unalignedly.
16367 EOM
16368                 d_u32align="$undef"
16369                 ;;
16370         *)      cat >&4 <<EOM
16371 It seems that you must access character data in an aligned manner.
16372 EOM
16373                 d_u32align="$define"
16374                 ;;
16375         esac
16376 else
16377         rp='Can you access character data at unaligned addresses?'
16378         dflt='n'
16379         . ./myread
16380         case "$ans" in
16381         [yY]*)  d_u32align="$undef"  ;;
16382         *)      d_u32align="$define" ;;
16383         esac
16384 fi
16385 $rm -f core core.try.* try.core
16386 ;;
16387 esac
16388
16389 : see if ualarm exists
16390 set ualarm d_ualarm
16391 eval $inlibc
16392
16393 : see if umask exists
16394 set umask d_umask
16395 eval $inlibc
16396
16397 : see if unordered exists
16398 set unordered d_unordered
16399 eval $inlibc
16400
16401 : see if usleep exists
16402 set usleep d_usleep
16403 eval $inlibc
16404
16405 : see if prototype for usleep is available
16406 echo " "
16407 set d_usleepproto usleep $i_unistd unistd.h
16408 eval $hasproto
16409
16410 : see if ustat exists
16411 set ustat d_ustat
16412 eval $inlibc
16413
16414 : backward compatibility for d_hvfork
16415 if test X$d_hvfork != X; then
16416         d_vfork="$d_hvfork"
16417         d_hvfork=''
16418 fi
16419 : see if there is a vfork
16420 val=''
16421 set vfork val
16422 eval $inlibc
16423
16424 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16425 : perl on Solaris 2.x, and probably elsewhere.
16426 case "$val" in
16427 $define)
16428         echo " "
16429         case "$usevfork" in
16430         false) dflt='n';;
16431         *) dflt='y';;
16432         esac
16433         cat <<'EOM'
16434  
16435 Perl can only use a vfork() that doesn't suffer from strict
16436 restrictions on calling functions or modifying global data in
16437 the child.  For example, glibc-2.1 contains such a vfork()
16438 that is unsuitable.  If your system provides a proper fork()
16439 call, chances are that you do NOT want perl to use vfork().
16440
16441 EOM
16442         rp="Do you still want to use vfork()?"
16443         . ./myread
16444         case "$ans" in
16445         y|Y) ;;
16446         *)
16447                 echo "Ok, we won't use vfork()."
16448                 val="$undef"
16449                 ;;
16450         esac
16451         ;;
16452 esac
16453 set d_vfork
16454 eval $setvar
16455 case "$d_vfork" in
16456 $define) usevfork='true';;
16457 *) usevfork='false';;
16458 esac
16459
16460 : see if closedir exists
16461 set closedir d_closedir
16462 eval $inlibc
16463
16464 case "$d_closedir" in
16465 "$define")
16466         echo " "
16467         echo "Checking whether closedir() returns a status..." >&4
16468         cat > try.c <<EOM
16469 #$i_dirent I_DIRENT             /**/
16470 #$i_sysdir I_SYS_DIR            /**/
16471 #$i_sysndir I_SYS_NDIR          /**/
16472 #$i_systypes I_SYS_TYPES        /**/
16473
16474 #if defined(I_SYS_TYPES)
16475 #include <sys/types.h>
16476 #endif
16477 #if defined(I_DIRENT)
16478 #include <dirent.h>
16479 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16480 #include <sys/dir.h>
16481 #endif
16482 #else
16483 #ifdef I_SYS_NDIR
16484 #include <sys/ndir.h>
16485 #else
16486 #ifdef I_SYS_DIR
16487 #ifdef hp9000s500
16488 #include <ndir.h>       /* may be wrong in the future */
16489 #else
16490 #include <sys/dir.h>
16491 #endif
16492 #endif
16493 #endif
16494 #endif 
16495 int main() { return closedir(opendir(".")); }
16496 EOM
16497         set try
16498         if eval $compile_ok; then
16499                 if $run ./try > /dev/null 2>&1 ; then
16500                         echo "Yes, it does."
16501                         val="$undef"
16502                 else
16503                         echo "No, it doesn't."
16504                         val="$define"
16505                 fi
16506         else
16507                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16508                 val="$define"
16509         fi
16510         ;;
16511 *)
16512         val="$undef";
16513         ;;
16514 esac
16515 set d_void_closedir
16516 eval $setvar
16517 $rm -f try try.*
16518 : see if there is a wait4
16519 set wait4 d_wait4
16520 eval $inlibc
16521
16522 : see if waitpid exists
16523 set waitpid d_waitpid
16524 eval $inlibc
16525
16526 : see if wcstombs exists
16527 set wcstombs d_wcstombs
16528 eval $inlibc
16529
16530 : see if wctomb exists
16531 set wctomb d_wctomb
16532 eval $inlibc
16533
16534 : see if writev exists
16535 set writev d_writev
16536 eval $inlibc
16537
16538 : preserve RCS keywords in files with variable substitution, grrr
16539 Date='$Date'
16540 Id='$Id'
16541 Log='$Log'
16542 RCSfile='$RCSfile'
16543 Revision='$Revision'
16544
16545 : check for alignment requirements
16546 echo " "
16547 case "$usecrosscompile$multiarch" in
16548 *$define*)
16549         $cat <<EOM
16550 You seem to be either cross-compiling or doing a multiarchitecture build,
16551 skipping the memory alignment check.
16552
16553 EOM
16554         case "$alignbytes" in
16555         '') alignbytes=8 ;;
16556         esac
16557         ;;
16558 *)
16559         case "$alignbytes" in
16560         '') echo "Checking alignment constraints..." >&4
16561                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16562                         $cat >try.c <<'EOCP'
16563 typedef long double NV;
16564 EOCP
16565                 else
16566                         $cat >try.c <<'EOCP'
16567 typedef double NV;
16568 EOCP
16569                 fi
16570                 $cat >>try.c <<'EOCP'
16571 #include <stdio.h>
16572 struct foobar {
16573         char foo;
16574         NV bar;
16575 } try_algn;
16576 int main()
16577 {
16578     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16579     return(0);
16580 }
16581 EOCP
16582                 set try
16583                 if eval $compile_ok; then
16584                         dflt=`$run ./try`
16585                 else
16586                         dflt='8'
16587                         echo "(I can't seem to compile the test program...)"
16588                 fi
16589                 ;;
16590         *) dflt="$alignbytes"
16591                 ;;
16592         esac
16593         rp="Doubles must be aligned on a how-many-byte boundary?"
16594         . ./myread
16595         alignbytes="$ans"
16596         $rm -f try.c try
16597         ;;
16598 esac
16599
16600
16601 : set the base revision
16602 baserev=5.0
16603
16604 : how do we catenate cpp tokens here?
16605 echo " "
16606 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16607 $cat >cpp_stuff.c <<'EOCP'
16608 #define RCAT(a,b)a/**/b
16609 #define ACAT(a,b)a ## b
16610 RCAT(Rei,ser)
16611 ACAT(Cir,cus)
16612 EOCP
16613 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16614 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16615         echo "Oh!  Smells like ANSI's been here." >&4
16616         echo "We can catify or stringify, separately or together!"
16617         cpp_stuff=42
16618 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16619         echo "Ah, yes!  The good old days!" >&4
16620         echo "However, in the good old days we don't know how to stringify and"
16621         echo "catify at the same time."
16622         cpp_stuff=1
16623 else
16624         $cat >&4 <<EOM
16625 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16626 to have to edit the values of CAT[2-5] in config.h...
16627 EOM
16628         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16629 fi
16630 $rm -f cpp_stuff.*
16631
16632 : see if this is a db.h system
16633 set db.h i_db
16634 eval $inhdr
16635
16636 case "$i_db" in
16637 $define)
16638         : Check db version.
16639         echo " "
16640         echo "Checking Berkeley DB version ..." >&4
16641         $cat >try.c <<EOCP
16642 #$d_const HASCONST
16643 #ifndef HASCONST
16644 #define const
16645 #endif
16646 #include <sys/types.h>
16647 #include <stdio.h>
16648 #include <db.h>
16649 int main(int argc, char *argv[])
16650 {
16651 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16652     int Major, Minor, Patch ;
16653     unsigned long Version ;
16654     (void)db_version(&Major, &Minor, &Patch) ;
16655     if (argc == 2) {
16656         printf("%d %d %d %d %d %d\n",
16657                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16658                Major, Minor, Patch);
16659         exit(0);
16660     }
16661     printf("You have Berkeley DB Version 2 or greater.\n");
16662
16663     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16664                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16665     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16666                 Major, Minor, Patch) ;
16667
16668     /* check that db.h & libdb are compatible */
16669     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16670         printf("db.h and libdb are incompatible.\n") ;
16671         exit(3);        
16672     }
16673
16674     printf("db.h and libdb are compatible.\n") ;
16675
16676     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16677                 + DB_VERSION_PATCH ;
16678
16679     /* needs to be >= 2.3.4 */
16680     if (Version < 2003004) {
16681     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16682         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16683         exit(2);        
16684     }
16685
16686     exit(0);
16687 #else
16688 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16689     if (argc == 2) {
16690         printf("1 0 0\n");
16691         exit(0);
16692     }
16693     printf("You have Berkeley DB Version 1.\n");
16694     exit(0);    /* DB version < 2: the coast is clear. */
16695 #else
16696     exit(1);    /* <db.h> not Berkeley DB? */
16697 #endif
16698 #endif
16699 }
16700 EOCP
16701         set try
16702         if eval $compile_ok && $run ./try; then
16703                 echo 'Looks OK.' >&4
16704                 set `$run ./try 1`
16705                 db_version_major=$1
16706                 db_version_minor=$2
16707                 db_version_patch=$3
16708         else
16709                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16710                 i_db=$undef
16711                 case " $libs " in
16712                 *"-ldb "*)
16713                         : Remove db from list of libraries to use
16714                         echo "Removing unusable -ldb from library list" >&4
16715                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16716                         shift
16717                         libs="$*"
16718                         echo "libs = $libs" >&4
16719                         ;;
16720                 esac
16721         fi
16722         $rm -f try.*
16723         ;;
16724 esac
16725
16726 case "$i_db" in
16727 define)
16728         : Check the return type needed for hash 
16729         echo " "
16730         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16731         $cat >try.c <<EOCP
16732 #$d_const HASCONST
16733 #ifndef HASCONST
16734 #define const
16735 #endif
16736 #include <sys/types.h>
16737 #include <db.h>
16738
16739 #ifndef DB_VERSION_MAJOR
16740 u_int32_t hash_cb (ptr, size)
16741 const void *ptr;
16742 size_t size;
16743 {
16744 }
16745 HASHINFO info;
16746 int main()
16747 {
16748         info.hash = hash_cb;
16749 }
16750 #endif
16751 EOCP
16752         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16753                 if $contains warning try.out >>/dev/null 2>&1 ; then
16754                         db_hashtype='int'
16755                 else
16756                         db_hashtype='u_int32_t'
16757                 fi
16758         else
16759                 : XXX Maybe we should just give up here.
16760                 db_hashtype=u_int32_t
16761                 $cat try.out >&4
16762                 echo "Help:  I can't seem to compile the db test program." >&4
16763                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16764         fi
16765         $rm -f try.*
16766         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16767         ;;
16768 *)      db_hashtype=u_int32_t
16769         ;;
16770 esac
16771 case "$i_db" in
16772 define)
16773         : Check the return type needed for prefix 
16774         echo " "
16775         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16776         cat >try.c <<EOCP
16777 #$d_const HASCONST
16778 #ifndef HASCONST
16779 #define const
16780 #endif
16781 #include <sys/types.h>
16782 #include <db.h>
16783
16784 #ifndef DB_VERSION_MAJOR
16785 size_t prefix_cb (key1, key2)
16786 const DBT *key1;
16787 const DBT *key2;
16788 {
16789 }
16790 BTREEINFO info;
16791 int main()
16792 {
16793         info.prefix = prefix_cb;
16794 }
16795 #endif
16796 EOCP
16797         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16798                 if $contains warning try.out >>/dev/null 2>&1 ; then
16799                         db_prefixtype='int'
16800                 else
16801                         db_prefixtype='size_t'
16802                 fi
16803         else
16804                 db_prefixtype='size_t'
16805                 : XXX Maybe we should just give up here.
16806                 $cat try.out >&4
16807                 echo "Help:  I can't seem to compile the db test program." >&4
16808                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16809         fi
16810         $rm -f try.*
16811         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16812         ;;
16813 *)      db_prefixtype='size_t'
16814         ;;
16815 esac
16816
16817
16818 : How can we generate normalized random numbers ?
16819 echo " "
16820 echo "Looking for a random number function..." >&4
16821 case "$randfunc" in
16822 '')
16823         if set drand48 val -f; eval $csym; $val; then
16824                 dflt="drand48"
16825                 echo "Good, found drand48()." >&4
16826         elif set random val -f; eval $csym; $val; then
16827                 dflt="random"
16828                 echo "OK, found random()." >&4
16829         else
16830                 dflt="rand"
16831                 echo "Yick, looks like I have to use rand()." >&4
16832         fi
16833         echo " "
16834         ;;
16835 *)
16836         dflt="$randfunc"
16837         ;;
16838 esac
16839 cont=true
16840
16841 case "$ccflags" in
16842 *-Dmy_rand=*|*-Dmy_srand=*)
16843         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16844         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16845         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16846         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16847         ;;
16848 esac
16849
16850 while $test "$cont"; do
16851         rp="Use which function to generate random numbers?"
16852         . ./myread
16853         if $test "$ans" = "$dflt"; then
16854                 : null
16855         else
16856                 randbits=''
16857         fi
16858         randfunc="$ans"
16859         if set $ans val -f; eval $csym; $val; then
16860                 cont=''
16861         else
16862                 dflt=y
16863                 rp="I cannot find function $ans. Use that name anyway?"
16864                 . ./myread
16865                 dflt=rand
16866                 case "$ans" in
16867                         [yY]*) cont='';;
16868                 esac
16869         fi
16870         case "$cont" in
16871         '')
16872                 case "$randfunc" in
16873                 drand48)
16874                         drand01="drand48()"
16875                         seedfunc="srand48"
16876                         randbits=48
16877                         randseedtype=long
16878                         ;;
16879                 rand|random)
16880                         case "$randbits" in
16881                         '')
16882 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16883                                 $cat >try.c <<EOCP
16884 #$i_unistd I_UNISTD
16885 #$i_stdlib I_STDLIB
16886 #include <stdio.h>
16887 #ifdef I_UNISTD
16888 #  include <unistd.h>
16889 #endif
16890 #ifdef I_STDLIB
16891 #  include <stdlib.h>
16892 #endif
16893 int main()
16894 {
16895         register int i;
16896         register unsigned long tmp;
16897         register unsigned long max = 0L;
16898
16899         for (i = 1000; i; i--) {
16900                 tmp = (unsigned long) $randfunc();
16901                 if (tmp > max) max = tmp;
16902         }
16903         for (i = 0; max; i++)
16904                 max /= 2;
16905         printf("%d\n",i);
16906 }
16907 EOCP
16908                                 set try
16909                                 if eval $compile_ok; then
16910                                         dflt=`try`
16911                                 else
16912                                         dflt='?'
16913                                         echo "(I can't seem to compile the test program...)"
16914                                 fi
16915                                 ;;
16916                         *)
16917                                 dflt="$randbits"
16918                                 ;;
16919                         esac
16920                         rp="How many bits does your $randfunc() function produce?"
16921                         . ./myread
16922                         randbits="$ans"
16923                         $rm -f try.c try
16924                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16925                         seedfunc="s$randfunc"
16926                         randseedtype=unsigned
16927                         ;;
16928                 *)
16929                         dflt="31"
16930                         rp="How many bits does your $randfunc() function produce?"
16931                         . ./myread
16932                         randbits="$ans"
16933                         seedfunc="s$randfunc"
16934                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16935                         if set $seedfunc val -f; eval $csym; $val; then
16936                                 echo "(Using $seedfunc() to seed random generator)"
16937                         else
16938                                 echo "(Warning: no $seedfunc() to seed random generator)"
16939                                 seedfunc=rand
16940                         fi
16941                         randseedtype=unsigned
16942                         ;;
16943                 esac
16944                 ;;
16945         esac
16946 done
16947
16948 echo " "
16949 echo "Determining whether or not we are on an EBCDIC system..." >&4
16950 $cat >try.c <<'EOM'
16951 int main()
16952 {
16953   if ('M'==0xd4) return 0;
16954   return 1;
16955 }
16956 EOM
16957
16958 val=$undef
16959 set try
16960 if eval $compile_ok; then
16961         if $run ./try; then
16962                 echo "You seem to speak EBCDIC." >&4
16963                 val="$define"
16964         else
16965                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16966         fi
16967 else
16968         echo "I'm unable to compile the test program." >&4
16969         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16970 fi
16971 $rm -f try try.*
16972 set ebcdic
16973 eval $setvar
16974
16975 echo " "
16976 $cat >&4 <<EOM
16977 Checking how to flush all pending stdio output...
16978 EOM
16979 # I only know how to find the first 32 possibly open files on SunOS.
16980 # See also hints/sunos_4_1.sh and util.c  --AD
16981 case "$osname" in
16982 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16983 esac
16984 $cat >>try.c <<EOCP
16985 #include <stdio.h>
16986 #$i_unistd I_UNISTD
16987 #ifdef I_UNISTD
16988 # include <unistd.h>
16989 #endif
16990 #$d_sysconf HAS_SYSCONF
16991 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16992 #ifdef HAS_STDIO_STREAM_ARRAY
16993 # define STDIO_STREAM_ARRAY $stdio_stream_array
16994 #endif
16995 int main() {
16996   FILE* p;
16997   unlink("try.out");
16998   p = fopen("try.out", "w");
16999 #ifdef TRY_FPUTC
17000   fputc('x', p);
17001 #else
17002 # ifdef TRY_FPRINTF
17003   fprintf(p, "x");
17004 # endif
17005 #endif
17006 #ifdef TRY_FFLUSH_NULL
17007   fflush(NULL);
17008 #endif
17009 #ifdef TRY_FFLUSH_ALL
17010   {
17011     long open_max = -1;
17012 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17013     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17014 # else
17015 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17016     open_max = sysconf(_SC_OPEN_MAX);
17017 #  else
17018 #   ifdef FOPEN_MAX
17019     open_max = FOPEN_MAX;
17020 #   else
17021 #    ifdef OPEN_MAX
17022     open_max = OPEN_MAX;
17023 #    else
17024 #     ifdef _NFILE
17025     open_max = _NFILE;
17026 #     endif
17027 #    endif
17028 #   endif
17029 #  endif
17030 # endif 
17031 # ifdef HAS_STDIO_STREAM_ARRAY
17032     if (open_max > 0) {
17033       long i;
17034       for (i = 0; i < open_max; i++)
17035             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17036                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17037                 STDIO_STREAM_ARRAY[i]._flag)
17038                 fflush(&STDIO_STREAM_ARRAY[i]);
17039     }   
17040   }
17041 # endif
17042 #endif
17043   _exit(42);
17044 }
17045 EOCP
17046 : first we have to find out how _not_ to flush
17047 $to try.c
17048 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17049     output=''
17050     set try -DTRY_FPUTC
17051     if eval $compile; then
17052             $run ./try 2>/dev/null
17053             code="$?"
17054             $from try.out
17055             if $test ! -s try.out -a "X$code" = X42; then
17056                 output=-DTRY_FPUTC
17057             fi
17058     fi
17059     case "$output" in
17060     '')
17061             set try -DTRY_FPRINTF
17062             if eval $compile; then
17063                     $run ./try 2>/dev/null
17064                     code="$?"
17065                     $from try.out
17066                     if $test ! -s try.out -a "X$code" = X42; then
17067                         output=-DTRY_FPRINTF
17068                     fi
17069             fi
17070         ;;
17071     esac
17072 fi
17073 : check for fflush NULL behaviour
17074 case "$fflushNULL" in
17075 '')     set try -DTRY_FFLUSH_NULL $output
17076         if eval $compile; then
17077                 $run ./try 2>/dev/null
17078                 code="$?"
17079                 $from try.out
17080                 if $test -s try.out -a "X$code" = X42; then
17081                         fflushNULL="`$cat try.out`"
17082                 else
17083                         if $test "X$code" != X42; then
17084                                 $cat >&4 <<EOM
17085 (If this test failed, don't worry, we'll try another method shortly.)
17086 EOM
17087                         fi
17088                 fi
17089         fi
17090         $rm -f core try.core core.try.*
17091         case "$fflushNULL" in
17092         x)      $cat >&4 <<EOM
17093 Your fflush(NULL) works okay for output streams.
17094 Let's see if it clobbers input pipes...
17095 EOM
17096 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17097 # bug that improperly flushes the input end of pipes.  So we avoid the
17098 # autoflush on fork/system/exec support for now. :-(
17099 $cat >tryp.c <<EOCP
17100 #include <stdio.h>
17101 int
17102 main(int argc, char **argv)
17103 {
17104     char buf[1024];
17105     int i;
17106     char *bp = buf;
17107     while (1) {
17108         while ((i = getc(stdin)) != -1
17109                && (*bp++ = i) != '\n'
17110                && bp < &buf[1024])
17111         /* DO NOTHING */ ;
17112         *bp = '\0';
17113         fprintf(stdout, "%s", buf);
17114         fflush(NULL);
17115         if (i == -1)
17116             return 0;
17117         bp = buf;
17118     }
17119 }
17120 EOCP
17121                 fflushNULL="$define"
17122                 set tryp
17123                 if eval $compile; then
17124                     $rm -f tryp.out
17125                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17126                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17127                        $cat >&4 <<EOM
17128 fflush(NULL) seems to behave okay with input streams.
17129 EOM
17130                         fflushNULL="$define"
17131                     else
17132                         $cat >&4 <<EOM
17133 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17134 EOM
17135                         fflushNULL="$undef"
17136                     fi
17137                 fi
17138                 $rm -f core tryp.c tryp.core core.tryp.*
17139                 ;;
17140         '')     $cat >&4 <<EOM
17141 Your fflush(NULL) isn't working (contrary to ANSI C).
17142 EOM
17143                 fflushNULL="$undef"
17144                 ;;
17145         *)      $cat >&4 <<EOM
17146 Cannot figure out whether your fflush(NULL) works or not.
17147 I'm assuming it doesn't (contrary to ANSI C).
17148 EOM
17149                 fflushNULL="$undef"
17150                 ;;
17151         esac
17152         ;;
17153 $define|true|[yY]*)
17154         fflushNULL="$define"
17155         ;;
17156 *)
17157         fflushNULL="$undef"
17158         ;;
17159 esac
17160 : check explicit looping only if NULL did not work, and if the pipe
17161 : bug does not show up on an explicit flush too
17162 case "$fflushNULL" in
17163 "$undef")
17164         $cat >tryp.c <<EOCP
17165 #include <stdio.h>
17166 int
17167 main(int argc, char **argv)
17168 {
17169     char buf[1024];
17170     int i;
17171     char *bp = buf;
17172     while (1) {
17173         while ((i = getc(stdin)) != -1
17174                && (*bp++ = i) != '\n'
17175                && bp < &buf[1024])
17176         /* DO NOTHING */ ;
17177         *bp = '\0';
17178         fprintf(stdout, "%s", buf);
17179         fflush(stdin);
17180         if (i == -1)
17181             return 0;
17182         bp = buf;
17183     }
17184 }
17185 EOCP
17186         set tryp
17187         if eval $compile; then
17188             $rm -f tryp.out
17189             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17190             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17191                $cat >&4 <<EOM
17192 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17193 EOM
17194                 : now check for fflushall behaviour
17195                 case "$fflushall" in
17196                 '')     set try -DTRY_FFLUSH_ALL $output
17197                         if eval $compile; then
17198                                 $cat >&4 <<EOM
17199 (Now testing the other method--but note that this also may fail.)
17200 EOM
17201                                 $run ./try 2>/dev/null
17202                                 code=$?
17203                                 $from try.out
17204                                 if $test -s try.out -a "X$code" = X42; then
17205                                         fflushall="`$cat try.out`"
17206                                 fi
17207                         fi
17208                         $rm -f core try.core core.try.*
17209                         case "$fflushall" in
17210                         x)      $cat >&4 <<EOM
17211 Whew. Flushing explicitly all the stdio streams works.
17212 EOM
17213                                 fflushall="$define"
17214                                 ;;
17215                         '')     $cat >&4 <<EOM
17216 Sigh. Flushing explicitly all the stdio streams doesn't work.
17217 EOM
17218                                 fflushall="$undef"
17219                                 ;;
17220                         *)      $cat >&4 <<EOM
17221 Cannot figure out whether flushing stdio streams explicitly works or not.
17222 I'm assuming it doesn't.
17223 EOM
17224                                 fflushall="$undef"
17225                                 ;;
17226                         esac
17227                         ;;
17228                 "$define"|true|[yY]*)
17229                         fflushall="$define"
17230                         ;;
17231                 *)
17232                         fflushall="$undef"
17233                         ;;
17234                 esac
17235             else
17236                 $cat >&4 <<EOM
17237 All is futile.  Even fflush(stdin) clobbers input pipes!
17238 EOM
17239                 fflushall="$undef"
17240             fi
17241         else
17242             fflushall="$undef"
17243         fi
17244         $rm -f core tryp.c tryp.core core.tryp.*
17245         ;;
17246 *)      fflushall="$undef"
17247         ;;
17248 esac
17249
17250 case "$fflushNULL$fflushall" in
17251 undefundef)
17252         $cat <<EOM
17253 OK, I give up.  I cannot figure out how to flush pending stdio output.
17254 We won't be flushing handles at all before fork/exec/popen.
17255 EOM
17256         ;;
17257 esac
17258 $rm -f try.* try$exe_ext
17259
17260 : Store the full pathname to the ar program for use in the C program
17261 : Respect a hint or command line value for full_ar.
17262 case "$full_ar" in
17263 '') full_ar=$ar ;;
17264 esac
17265
17266 : Store the full pathname to the sed program for use in the C program
17267 full_sed=$sed
17268
17269 : see what type gids are declared as in the kernel
17270 echo " "
17271 echo "Looking for the type for group ids returned by getgid()."
17272 set gid_t gidtype xxx stdio.h sys/types.h
17273 eval $typedef
17274 case "$gidtype" in
17275 xxx)
17276         xxx=`./findhdr sys/user.h`
17277         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17278         case $1 in
17279         unsigned) dflt="$1 $2" ;;
17280         *) dflt="$1" ;;
17281         esac
17282         ;;
17283 *) dflt="$gidtype";;
17284 esac
17285 case "$gidtype" in
17286 gid_t) echo "gid_t found." ;;
17287 *)      rp="What is the type for group ids returned by getgid()?"
17288         . ./myread
17289         gidtype="$ans"
17290         ;;
17291 esac
17292
17293 echo " "
17294 case "$gidtype" in
17295 *_t) zzz="$gidtype"     ;;
17296 *)   zzz="gid"          ;;
17297 esac
17298 echo "Checking the size of $zzz..." >&4 
17299 cat > try.c <<EOCP
17300 #include <sys/types.h>
17301 #include <stdio.h>
17302 int main() {
17303     printf("%d\n", (int)sizeof($gidtype));
17304     exit(0);
17305 }
17306 EOCP
17307 set try
17308 if eval $compile_ok; then
17309         yyy=`$run ./try`
17310         case "$yyy" in
17311         '')     gidsize=4
17312                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17313                 ;;
17314         *)      gidsize=$yyy
17315                 echo "Your $zzz is $gidsize bytes long."
17316                 ;;
17317         esac
17318 else
17319         gidsize=4
17320         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17321 fi
17322
17323
17324 echo " "
17325 case "$gidtype" in
17326 *_t) zzz="$gidtype"     ;;
17327 *)   zzz="gid"          ;;
17328 esac
17329 echo "Checking the sign of $zzz..." >&4 
17330 cat > try.c <<EOCP
17331 #include <sys/types.h>
17332 #include <stdio.h>
17333 int main() {
17334         $gidtype foo = -1;
17335         if (foo < 0)
17336                 printf("-1\n");
17337         else
17338                 printf("1\n");
17339 }
17340 EOCP
17341 set try
17342 if eval $compile; then
17343         yyy=`$run ./try`
17344         case "$yyy" in
17345         '')     gidsign=1
17346                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17347                 ;;
17348         *)      gidsign=$yyy
17349                 case "$gidsign" in
17350                  1) echo "Your $zzz is unsigned." ;;
17351                 -1) echo "Your $zzz is signed."   ;;
17352                 esac
17353                 ;;
17354         esac
17355 else
17356         gidsign=1
17357         echo "(I can't compile the test program--guessing unsigned.)" >&4
17358 fi
17359
17360
17361 echo " "
17362
17363 if $test X"$quadtype" != X; then
17364
17365 echo "Checking how to print 64-bit integers..." >&4
17366
17367 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17368         $cat >try.c <<'EOCP'
17369 #include <sys/types.h>
17370 #include <stdio.h>
17371 int main() {
17372   int q = 12345678901;
17373   printf("%ld\n", q);
17374 }
17375 EOCP
17376         set try
17377         if eval $compile; then
17378                 yyy=`$run ./try`
17379                 case "$yyy" in
17380                 12345678901)
17381                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17382                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17383                         echo "We will use %d."
17384                         ;;
17385                 esac
17386         fi
17387 fi
17388
17389 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17390         $cat >try.c <<'EOCP'
17391 #include <sys/types.h>
17392 #include <stdio.h>
17393 int main() {
17394   long q = 12345678901;
17395   printf("%ld\n", q);
17396 }
17397 EOCP
17398         set try
17399         if eval $compile; then
17400                 yyy=`$run ./try`
17401                 case "$yyy" in
17402                 12345678901)
17403                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17404                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17405                         echo "We will use %ld."
17406                         ;;
17407                 esac
17408         fi
17409 fi
17410
17411 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17412         $cat >try.c <<'EOCP'
17413 #include <sys/types.h>
17414 #include <inttypes.h>
17415 #include <stdio.h>
17416 int main() {
17417   int64_t q = 12345678901;
17418   printf("%" PRId64 "\n", q);
17419 }
17420 EOCP
17421         set try
17422         if eval $compile; then
17423                 yyy=`$run ./try`
17424                 case "$yyy" in
17425                 12345678901)
17426                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17427                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17428                         echo "We will use the C9X style."
17429                         ;;
17430                 esac
17431         fi
17432 fi
17433
17434 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17435         $cat >try.c <<EOCP
17436 #include <sys/types.h>
17437 #include <stdio.h>
17438 int main() {
17439   $quadtype q = 12345678901;
17440   printf("%Ld\n", q);
17441 }
17442 EOCP
17443         set try
17444         if eval $compile; then
17445                 yyy=`$run ./try`
17446                 case "$yyy" in
17447                 12345678901)
17448                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17449                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17450                         echo "We will use %Ld."
17451                         ;;
17452                 esac
17453         fi
17454 fi
17455
17456 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17457         $cat >try.c <<'EOCP'
17458 #include <sys/types.h>
17459 #include <stdio.h>
17460 int main() {
17461   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17462   printf("%lld\n", q);
17463 }
17464 EOCP
17465         set try
17466         if eval $compile; then
17467                 yyy=`$run ./try`
17468                 case "$yyy" in
17469                 12345678901)
17470                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17471                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17472                         echo "We will use the %lld style."
17473                         ;;
17474                 esac
17475         fi
17476 fi
17477
17478 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17479         $cat >try.c <<EOCP
17480 #include <sys/types.h>
17481 #include <stdio.h>
17482 int main() {
17483   $quadtype q = 12345678901;
17484   printf("%qd\n", q);
17485 }
17486 EOCP
17487         set try
17488         if eval $compile; then
17489                 yyy=`$run ./try`
17490                 case "$yyy" in
17491                 12345678901)
17492                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17493                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17494                         echo "We will use %qd."
17495                         ;;
17496                 esac
17497         fi
17498 fi
17499
17500 if $test X"$sPRId64" = X; then
17501         echo "Cannot figure out how to print 64-bit integers." >&4
17502 fi
17503
17504 $rm -f try try.*
17505
17506 fi
17507
17508 case "$sPRId64" in
17509 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17510         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17511         ;;
17512 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17513         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17514         ;;
17515 esac
17516
17517
17518 echo " "
17519 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17520
17521 if $test X"$ivsize" = X8; then
17522         ivdformat="$sPRId64"
17523         uvuformat="$sPRIu64"
17524         uvoformat="$sPRIo64"
17525         uvxformat="$sPRIx64"
17526         uvXUformat="$sPRIXU64"
17527 else
17528         if $test X"$ivsize" = X"$longsize"; then
17529                 ivdformat='"ld"'
17530                 uvuformat='"lu"'
17531                 uvoformat='"lo"'
17532                 uvxformat='"lx"'
17533                 uvXUformat='"lX"'
17534         else
17535                 if $test X"$ivsize" = X"$intsize"; then
17536                         ivdformat='"d"'
17537                         uvuformat='"u"'
17538                         uvoformat='"o"'
17539                         uvxformat='"x"'
17540                         uvXUformat='"X"'
17541                 else
17542                         : far out
17543                         if $test X"$ivsize" = X"$shortsize"; then
17544                                 ivdformat='"hd"'
17545                                 uvuformat='"hu"'
17546                                 uvoformat='"ho"'
17547                                 uvxformat='"hx"'
17548                                 uvXUformat='"hX"'
17549                         fi
17550                 fi
17551         fi
17552 fi
17553
17554 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17555         nveformat="$sPRIeldbl"
17556         nvfformat="$sPRIfldbl"
17557         nvgformat="$sPRIgldbl"
17558         nvEUformat="$sPRIEUldbl"
17559         nvFUformat="$sPRIFUldbl"
17560         nvGUformat="$sPRIGUldbl"
17561 else
17562         nveformat='"e"'
17563         nvfformat='"f"'
17564         nvgformat='"g"'
17565         nvEUformat='"E"'
17566         nvFUformat='"F"'
17567         nvGUformat='"G"'
17568 fi
17569
17570 case "$ivdformat" in
17571 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17572     exit 1
17573     ;;
17574 esac
17575
17576
17577 echo " "
17578 $echo "Checking the format string to be used for gids..." >&4
17579
17580 case "$gidsign" in
17581 -1)     if $test X"$gidsize" = X"$ivsize"; then
17582                 gidformat="$ivdformat"
17583         else
17584                 if $test X"$gidsize" = X"$longsize"; then
17585                         gidformat='"ld"'
17586                 else
17587                         if $test X"$gidsize" = X"$intsize"; then
17588                                 gidformat='"d"'
17589                         else
17590                                 if $test X"$gidsize" = X"$shortsize"; then
17591                                         gidformat='"hd"'
17592                                 fi
17593                         fi
17594                 fi
17595         fi
17596         ;;
17597 *)      if $test X"$gidsize" = X"$uvsize"; then
17598                 gidformat="$uvuformat"
17599         else
17600                 if $test X"$gidsize" = X"$longsize"; then
17601                         gidformat='"lu"'
17602                 else
17603                         if $test X"$gidsize" = X"$intsize"; then
17604                                 gidformat='"u"'
17605                         else
17606                                 if $test X"$gidsize" = X"$shortsize"; then
17607                                         gidformat='"hu"'
17608                                 fi
17609                         fi
17610                 fi
17611         fi
17612         ;;
17613 esac
17614
17615 : see if getgroups exists
17616 set getgroups d_getgrps
17617 eval $inlibc
17618
17619 : see if setgroups exists
17620 set setgroups d_setgrps
17621 eval $inlibc
17622
17623
17624 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17625 echo " "
17626 case "$d_getgrps$d_setgrps" in
17627 *define*)
17628         case "$groupstype" in
17629         '') dflt="$gidtype" ;;
17630         *)  dflt="$groupstype" ;;
17631         esac
17632         $cat <<EOM
17633 What type of pointer is the second argument to getgroups() and setgroups()?
17634 Usually this is the same as group ids, $gidtype, but not always.
17635
17636 EOM
17637         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17638         . ./myread
17639         groupstype="$ans"
17640         ;;
17641 *)  groupstype="$gidtype";;
17642 esac
17643
17644 echo " "
17645 echo "Checking if your $make program sets \$(MAKE)..." >&4
17646 case "$make_set_make" in
17647 '')
17648         $sed 's/^X //' > testmake.mak << 'EOF'
17649 Xall:
17650 X       @echo 'maketemp="$(MAKE)"'
17651 EOF
17652         case "`$make -f testmake.mak 2>/dev/null`" in
17653         *maketemp=*) make_set_make='#' ;;
17654         *)      make_set_make="MAKE=$make" ;;
17655         esac
17656         $rm -f testmake.mak
17657         ;;
17658 esac
17659 case "$make_set_make" in
17660 '#') echo "Yup, it does.";;
17661 *) echo "Nope, it doesn't.";;
17662 esac
17663
17664 : see what type is used for mode_t
17665 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17666 set mode_t modetype int stdio.h sys/types.h
17667 eval $typedef_ask
17668
17669 : see if stdarg is available
17670 echo " "
17671 if $test `./findhdr stdarg.h`; then
17672         echo "<stdarg.h> found." >&4
17673         valstd="$define"
17674 else
17675         echo "<stdarg.h> NOT found." >&4
17676         valstd="$undef"
17677 fi
17678
17679 : see if varags is available
17680 echo " "
17681 if $test `./findhdr varargs.h`; then
17682         echo "<varargs.h> found." >&4
17683 else
17684         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17685 fi
17686
17687 : set up the varargs testing programs
17688 $cat > varargs.c <<EOP
17689 #ifdef I_STDARG
17690 #include <stdarg.h>
17691 #endif
17692 #ifdef I_VARARGS
17693 #include <varargs.h>
17694 #endif
17695
17696 #ifdef I_STDARG
17697 int f(char *p, ...)
17698 #else
17699 int f(va_alist)
17700 va_dcl
17701 #endif
17702 {
17703         va_list ap;
17704 #ifndef I_STDARG
17705         char *p;
17706 #endif
17707 #ifdef I_STDARG
17708         va_start(ap,p);
17709 #else
17710         va_start(ap);
17711         p = va_arg(ap, char *);
17712 #endif
17713         va_end(ap);
17714 }
17715 EOP
17716 $cat > varargs <<EOP
17717 $startsh
17718 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17719         echo "true"
17720 else
17721         echo "false"
17722 fi
17723 $rm -f varargs$_o
17724 EOP
17725 chmod +x varargs
17726
17727 : now check which varargs header should be included
17728 echo " "
17729 i_varhdr=''
17730 case "$valstd" in
17731 "$define")
17732         if `./varargs I_STDARG`; then
17733                 val='stdarg.h'
17734         elif `./varargs I_VARARGS`; then
17735                 val='varargs.h'
17736         fi
17737         ;;
17738 *)
17739         if `./varargs I_VARARGS`; then
17740                 val='varargs.h'
17741         fi
17742         ;;
17743 esac
17744 case "$val" in
17745 '')
17746 echo "I could not find the definition for va_dcl... You have problems..." >&4
17747         val="$undef"; set i_stdarg; eval $setvar
17748         val="$undef"; set i_varargs; eval $setvar
17749         ;;
17750 *) 
17751         set i_varhdr
17752         eval $setvar
17753         case "$i_varhdr" in
17754         stdarg.h)
17755                 val="$define"; set i_stdarg; eval $setvar
17756                 val="$undef"; set i_varargs; eval $setvar
17757                 ;;
17758         varargs.h)
17759                 val="$undef"; set i_stdarg; eval $setvar
17760                 val="$define"; set i_varargs; eval $setvar
17761                 ;;
17762         esac
17763         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17764 esac
17765 $rm -f varargs*
17766
17767 : see if we need va_copy
17768 echo " "
17769 case "$i_stdarg" in
17770 "$define")
17771         $cat >try.c <<EOCP
17772 #include <stdarg.h>
17773 #include <stdio.h>
17774 #$i_stdlib I_STDLIB
17775 #ifdef I_STDLIB
17776 #include <stdlib.h>
17777 #endif
17778 #include <signal.h>
17779
17780 int
17781 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17782 {
17783   return vfprintf(f, fmt, *valp);
17784 }
17785  
17786 int    
17787 myvfprintf(FILE *f, const  char *fmt, va_list val)
17788 {
17789   return ivfprintf(f, fmt, &val);
17790 }
17791       
17792 int
17793 myprintf(char *fmt, ...) 
17794 {
17795   va_list val;
17796   va_start(val, fmt);
17797   return myvfprintf(stdout, fmt, val); 
17798 }         
17799
17800 int
17801 main(int ac, char **av)
17802 {
17803   signal(SIGSEGV, exit);
17804
17805   myprintf("%s%cs all right, then\n", "that", '\'');                            
17806   exit(0);      
17807 }
17808 EOCP
17809         set try
17810         if eval $compile && $run ./try 2>&1 >/dev/null; then
17811                 case "`$run ./try`" in
17812                 "that's all right, then")
17813                         okay=yes
17814                         ;;
17815                 esac
17816         fi
17817         case "$okay" in
17818         yes)    echo "It seems that you don't need va_copy()." >&4
17819                 need_va_copy="$undef"
17820                 ;;
17821         *)      echo "It seems that va_copy() or similar will be needed." >&4
17822                 need_va_copy="$define"
17823                 ;;
17824         esac
17825         $rm -f try.* core core.* *.core *.core.*
17826         ;;
17827 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17828         ;;
17829 esac
17830
17831 : see what type is used for size_t
17832 rp="What is the type used for the length parameter for string functions?"
17833 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17834 eval $typedef_ask
17835
17836 : check for type of arguments to gethostbyaddr. 
17837 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17838         case "$d_gethbyaddr" in
17839         $define)
17840                 $cat <<EOM
17841
17842 Checking to see what type of arguments are accepted by gethostbyaddr().
17843 EOM
17844                 hdrs="$define sys/types.h
17845                         $d_socket sys/socket.h 
17846                         $i_niin netinet/in.h 
17847                         $i_netdb netdb.h
17848                         $i_unistd unistd.h"
17849                 : The first arg can 'char *' or 'void *'
17850                 : The second arg is some of integral type
17851                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17852                         for yyy in size_t long int; do
17853                                 case "$netdb_host_type" in
17854                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17855                                         if ./protochk "$try" $hdrs; then
17856                                                 echo "Your system accepts $xxx for the first arg."
17857                                                 echo "...and $yyy for the second arg."
17858                                                 netdb_host_type="$xxx"
17859                                                 netdb_hlen_type="$yyy"
17860                                         fi
17861                                         ;;
17862                                 esac
17863                         done
17864                 done
17865                 : In case none of those worked, prompt the user.
17866                 case "$netdb_host_type" in
17867                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17868                         dflt='char *'
17869                         . ./myread
17870                         netdb_host_type=$ans
17871                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17872                         dflt="$sizetype"
17873                         . ./myread
17874                         netdb_hlen_type=$ans
17875                         ;;
17876                 esac
17877                 ;;
17878         *)      : no gethostbyaddr, so pick harmless defaults
17879                 netdb_host_type='char *'
17880                 netdb_hlen_type="$sizetype"
17881                 ;;
17882         esac
17883         # Remove the "const" if needed. -- but then we'll have a 
17884         # prototype clash!
17885         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17886 fi
17887
17888 : check for type of argument to gethostbyname. 
17889 if test "X$netdb_name_type" = X ; then
17890         case "$d_gethbyname" in
17891         $define)
17892                 $cat <<EOM
17893
17894 Checking to see what type of argument is accepted by gethostbyname().
17895 EOM
17896                 hdrs="$define sys/types.h
17897                         $d_socket sys/socket.h 
17898                         $i_niin netinet/in.h 
17899                         $i_netdb netdb.h
17900                         $i_unistd unistd.h"
17901                 for xxx in "const char *" "char *"; do
17902                         case "$netdb_name_type" in
17903                         '')     try="extern struct hostent *gethostbyname($xxx);"
17904                                 if ./protochk "$try" $hdrs; then
17905                                         echo "Your system accepts $xxx."
17906                                         netdb_name_type="$xxx"
17907                                 fi
17908                                 ;;
17909                         esac
17910                 done
17911                 : In case none of those worked, prompt the user.
17912                 case "$netdb_name_type" in
17913                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17914                         dflt='char *'
17915                         . ./myread
17916                         netdb_name_type=$ans
17917                         ;;
17918                 esac
17919                 ;;
17920         *)      : no gethostbyname, so pick harmless default
17921                 netdb_name_type='char *'
17922                 ;;
17923         esac
17924 fi
17925
17926 : check for type of 1st argument to getnetbyaddr. 
17927 if test "X$netdb_net_type" = X ; then
17928         case "$d_getnbyaddr" in
17929         $define)
17930                 $cat <<EOM
17931
17932 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17933 EOM
17934                 hdrs="$define sys/types.h
17935                         $d_socket sys/socket.h 
17936                         $i_niin netinet/in.h 
17937                         $i_netdb netdb.h
17938                         $i_unistd unistd.h"
17939                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17940                         case "$netdb_net_type" in
17941                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17942                                 if ./protochk "$try" $hdrs; then
17943                                         echo "Your system accepts $xxx."
17944                                         netdb_net_type="$xxx"
17945                                 fi
17946                                 ;;
17947                         esac
17948                 done
17949                 : In case none of those worked, prompt the user.
17950                 case "$netdb_net_type" in
17951                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17952                         dflt='long'
17953                         . ./myread
17954                         netdb_net_type=$ans
17955                         ;;
17956                 esac
17957                 ;;
17958         *)      : no getnetbyaddr, so pick harmless default
17959                 netdb_net_type='long'
17960                 ;;
17961         esac
17962 fi
17963 : locate the preferred pager for this system
17964 fn=f/
17965 case "$pager" in
17966 '')
17967         dflt=''
17968         case "$pg" in
17969         /*) dflt=$pg;;
17970         [a-zA-Z]:/*) dflt=$pg;;
17971         esac
17972         case "$more" in
17973         /*) dflt=$more;;
17974         [a-zA-Z]:/*) dflt=$more;;
17975         esac
17976         case "$less" in
17977         /*) dflt=$less;;
17978         [a-zA-Z]:/*) dflt=$less;;
17979         esac
17980         case "$dflt" in
17981         '') dflt=/usr/ucb/more;;
17982         esac
17983         ;;
17984 *)      dflt="$pager"
17985         : Instruct ./getfile to trust the hinted or previous pager value,
17986         : even if it does not begin with a slash.  For example, on os2,
17987         : pager might be cmd /c more.  See comments in UU/getfile.
17988         fn="f/($pager)"
17989         ;;
17990 esac
17991 echo " "
17992 rp='What pager is used on your system?'
17993 . ./getfile
17994 pager="$ans"
17995
17996 : see what type pids are declared as in the kernel
17997 rp="What is the type of process ids on this system?"
17998 set pid_t pidtype int stdio.h sys/types.h
17999 eval $typedef_ask
18000
18001 : Find earliest binary compatible site_perl subdirectory perl can use.
18002 xs_apiversion=$version # The current site_perl version.
18003 : Find earliest pure perl site_perl subdirectory perl can use.
18004 : The versioned directories started at 5.005.
18005 pm_apiversion='5.005'
18006
18007 : see if ar generates random libraries by itself
18008 echo " "
18009 echo "Checking how to generate random libraries on your machine..." >&4
18010 echo 'int bar1() { return bar2(); }' > bar1.c
18011 echo 'int bar2() { return 2; }' > bar2.c
18012 $cat > foo.c <<'EOP'
18013 int main() { printf("%d\n", bar1()); exit(0); }
18014 EOP
18015 $cc $ccflags -c bar1.c >/dev/null 2>&1
18016 $cc $ccflags -c bar2.c >/dev/null 2>&1
18017 $cc $ccflags -c foo.c >/dev/null 2>&1
18018 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18019 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18020         $run ./foobar >/dev/null 2>&1; then
18021         echo "$ar appears to generate random libraries itself."
18022         orderlib=false
18023         ranlib=":"
18024 elif $ar ts bar$_a >/dev/null 2>&1 &&
18025         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18026         $run ./foobar >/dev/null 2>&1; then
18027                 echo "a table of contents needs to be added with '$ar ts'."
18028                 orderlib=false
18029                 ranlib="$ar ts"
18030 else
18031         case "$ranlib" in
18032         :) ranlib='';;
18033         '')
18034                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18035                 $test -f $ranlib || ranlib=''
18036                 ;;
18037         esac
18038         if $test -n "$ranlib"; then
18039                 echo "your system has '$ranlib'; we'll use that."
18040                 orderlib=false
18041         else
18042                 echo "your system doesn't seem to support random libraries"
18043                 echo "so we'll use lorder and tsort to order the libraries."
18044                 orderlib=true
18045                 ranlib=":"
18046         fi
18047 fi
18048 $rm -f foo* bar* 
18049
18050 : check for type of arguments to select. 
18051 case "$selecttype" in
18052 '') case "$d_select" in
18053         $define)
18054                 echo " "
18055                 $cat <<EOM
18056 Checking to see what type of arguments are accepted by select().
18057 EOM
18058                 hdrs="$define sys/types.h
18059                         $i_systime sys/time.h 
18060                         $i_sysselct sys/select.h
18061                         $d_socket sys/socket.h"
18062                 : The first arg can be int, unsigned, or size_t
18063                 : The last arg may or may not be 'const'
18064                 val=''
18065                 : void pointer has been seen but using that
18066                 : breaks the selectminbits test
18067                 for xxx in 'fd_set *' 'int *'; do
18068                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18069                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18070                                         case "$val" in
18071                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18072                                                 if ./protochk "$try" $hdrs; then
18073                                                         echo "Your system accepts $xxx."
18074                                                         val="$xxx"
18075                                                 fi
18076                                                 ;;
18077                                         esac
18078                                 done
18079                         done
18080                 done
18081                 case "$val" in
18082                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18083                         case "$d_fd_set" in
18084                                 $define) dflt="fd_set *" ;;
18085                                 *)              dflt="int *" ;;
18086                         esac
18087                         . ./myread
18088                         val=$ans
18089                         ;;
18090                 esac
18091                 selecttype="$val"
18092                 ;;
18093         *)      : no select, so pick a harmless default
18094                 selecttype='int *'
18095                 ;;
18096         esac
18097         ;;
18098 esac
18099
18100 : check for the select 'width'
18101 case "$selectminbits" in
18102 '') case "$d_select" in
18103         $define)
18104                 $cat <<EOM
18105
18106 Checking to see on how many bits at a time your select() operates...
18107 EOM
18108                 $cat >try.c <<EOCP
18109 #include <sys/types.h>
18110 #$i_time I_TIME
18111 #$i_systime I_SYS_TIME
18112 #$i_systimek I_SYS_TIME_KERNEL
18113 #ifdef I_TIME
18114 #   include <time.h>
18115 #endif
18116 #ifdef I_SYS_TIME
18117 #   ifdef I_SYS_TIME_KERNEL
18118 #       define KERNEL
18119 #   endif
18120 #   include <sys/time.h>
18121 #   ifdef I_SYS_TIME_KERNEL
18122 #       undef KERNEL
18123 #   endif
18124 #endif
18125 #$i_sysselct I_SYS_SELECT
18126 #ifdef I_SYS_SELECT
18127 #include <sys/select.h>
18128 #endif
18129 #$d_socket HAS_SOCKET
18130 #ifdef HAS_SOCKET
18131 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18132 #endif
18133 #include <stdio.h>
18134 $selecttype b;
18135 #define S sizeof(*(b))
18136 #define MINBITS 64
18137 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18138 #define NBITS  (NBYTES * 8)
18139 int main() {
18140     char s[NBYTES];
18141     struct timeval t;
18142     int i;
18143     FILE* fp;
18144     int fd;
18145
18146     fclose(stdin);
18147     fp = fopen("try.c", "r");
18148     if (fp == 0)
18149       exit(1);
18150     fd = fileno(fp);
18151     if (fd < 0)
18152       exit(2);
18153     b = ($selecttype)s;
18154     for (i = 0; i < NBITS; i++)
18155         FD_SET(i, b);
18156     t.tv_sec  = 0;
18157     t.tv_usec = 0;
18158     select(fd + 1, b, 0, 0, &t);
18159     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18160     printf("%d\n", i + 1);
18161     return 0;
18162 }
18163 EOCP
18164                 set try
18165                 if eval $compile_ok; then
18166                         selectminbits=`$run ./try`
18167                         case "$selectminbits" in
18168                         '')     cat >&4 <<EOM
18169 Cannot figure out on how many bits at a time your select() operates.
18170 I'll play safe and guess it is 32 bits.
18171 EOM
18172                                 selectminbits=32
18173                                 bits="32 bits"
18174                                 ;;
18175                         1)      bits="1 bit" ;;
18176                         *)      bits="$selectminbits bits" ;;
18177                         esac
18178                         echo "Your select() operates on $bits at a time." >&4
18179                 else
18180                         rp='What is the minimum number of bits your select() operates on?'
18181                         case "$byteorder" in
18182                         1234|12345678)  dflt=32 ;;
18183                         *)              dflt=1  ;;
18184                         esac
18185                         . ./myread
18186                         val=$ans
18187                         selectminbits="$val"
18188                 fi
18189                 $rm -f try.* try
18190                 ;;
18191         *)      : no select, so pick a harmless default
18192                 selectminbits='32'
18193                 ;;
18194         esac
18195         ;;
18196 esac
18197
18198 : Trace out the files included by signal.h, then look for SIGxxx names.
18199 : Remove SIGARRAYSIZE used by HPUX.
18200 : Remove SIGSTKSIZE used by Linux.
18201 : Remove SIGSTKSZ used by Posix.
18202 : Remove SIGTYP void lines used by OS2.
18203 : Some cpps, like os390, dont give the file name anywhere
18204 if [ "X$fieldn" = X ]; then
18205         : Just make some guesses.  We check them later.
18206         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18207 else
18208         xxx=`echo '#include <signal.h>' |
18209         $cppstdin $cppminus $cppflags 2>/dev/null |
18210         $grep '^[       ]*#.*include' | 
18211         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18212 fi
18213 : Check this list of files to be sure we have parsed the cpp output ok.
18214 : This will also avoid potentially non-existent files, such 
18215 : as ../foo/bar.h
18216 xxxfiles=''
18217 for xx in $xxx /dev/null ; do
18218         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18219 done
18220 : If we have found no files, at least try signal.h
18221 case "$xxxfiles" in
18222 '')     xxxfiles=`./findhdr signal.h` ;;
18223 esac
18224 xxx=`awk '
18225 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18226         print substr($2, 4, 20)
18227 }
18228 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18229         print substr($3, 4, 20)
18230 }' $xxxfiles`
18231 : Append some common names just in case the awk scan failed.
18232 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18233 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18234 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18235 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18236 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18237
18238 : generate a few handy files for later
18239 $cat > signal.c <<'EOCP'
18240 #include <sys/types.h>
18241 #include <signal.h>
18242 #include <stdio.h>
18243 int main() {
18244
18245 /* Strange style to avoid deeply-nested #if/#else/#endif */
18246 #ifndef NSIG
18247 #  ifdef _NSIG
18248 #    define NSIG (_NSIG)
18249 #  endif
18250 #endif
18251
18252 #ifndef NSIG
18253 #  ifdef SIGMAX
18254 #    define NSIG (SIGMAX+1)
18255 #  endif
18256 #endif
18257
18258 #ifndef NSIG
18259 #  ifdef SIG_MAX
18260 #    define NSIG (SIG_MAX+1)
18261 #  endif
18262 #endif
18263
18264 #ifndef NSIG
18265 #  ifdef MAXSIG
18266 #    define NSIG (MAXSIG+1)
18267 #  endif
18268 #endif
18269
18270 #ifndef NSIG
18271 #  ifdef MAX_SIG
18272 #    define NSIG (MAX_SIG+1)
18273 #  endif
18274 #endif
18275
18276 #ifndef NSIG
18277 #  ifdef SIGARRAYSIZE
18278 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18279 #  endif
18280 #endif
18281
18282 #ifndef NSIG
18283 #  ifdef _sys_nsig
18284 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18285 #  endif
18286 #endif
18287
18288 /* Default to some arbitrary number that's big enough to get most
18289    of the common signals.
18290 */
18291 #ifndef NSIG
18292 #    define NSIG 50
18293 #endif
18294
18295 printf("NSIG %d\n", NSIG);
18296
18297 #ifndef JUST_NSIG
18298
18299 EOCP
18300
18301 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18302 {
18303         printf "#ifdef SIG"; printf $1; printf "\n"
18304         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18305         printf $1; printf ");\n"
18306         printf "#endif\n"
18307 }
18308 END {
18309         printf "#endif /* JUST_NSIG */\n";
18310         printf "exit(0);\n}\n";
18311 }
18312 ' >>signal.c
18313 $cat >signal.awk <<'EOP'
18314 BEGIN { ndups = 0 }
18315 $1 ~ /^NSIG$/ { nsig = $2 }
18316 ($1 !~ /^NSIG$/) && (NF == 2) {
18317     if ($2 > maxsig) { maxsig = $2 }
18318     if (sig_name[$2]) {
18319         dup_name[ndups] = $1
18320         dup_num[ndups] = $2
18321         ndups++ 
18322     }
18323     else {
18324         sig_name[$2] = $1
18325         sig_num[$2] = $2
18326     }
18327 }
18328 END { 
18329     if (nsig == 0) {
18330         nsig = maxsig + 1
18331     }
18332     printf("NSIG %d\n", nsig);
18333     for (n = 1; n < nsig; n++) {
18334         if (sig_name[n]) {
18335             printf("%s %d\n", sig_name[n], sig_num[n])
18336         }
18337         else {
18338             printf("NUM%d %d\n", n, n) 
18339         }
18340     }
18341     for (n = 0; n < ndups; n++) {
18342         printf("%s %d\n", dup_name[n], dup_num[n])
18343     }
18344 }
18345 EOP
18346 $cat >signal_cmd <<EOS
18347 $startsh
18348 if $test -s signal.lst; then
18349     echo "Using your existing signal.lst file"
18350         exit 0
18351 fi
18352 xxx="$xxx"
18353 EOS
18354 $cat >>signal_cmd <<'EOS'
18355
18356 set signal
18357 if eval $compile_ok; then
18358         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18359 else
18360         echo "(I can't seem be able to compile the whole test program)" >&4
18361         echo "(I'll try it in little pieces.)" >&4
18362         set signal -DJUST_NSIG
18363         if eval $compile_ok; then
18364                 $run ./signal$_exe > signal.nsg
18365                 $cat signal.nsg
18366         else
18367                 echo "I can't seem to figure out how many signals you have." >&4
18368                 echo "Guessing 50." >&4
18369                 echo 'NSIG 50' > signal.nsg
18370         fi
18371         : Now look at all the signal names, one at a time.
18372         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18373                 $cat > signal.c <<EOCP
18374 #include <sys/types.h>
18375 #include <signal.h>
18376 #include <stdio.h>
18377 int main() {
18378 printf("$xx %d\n", SIG${xx});
18379 return 0;
18380 }
18381 EOCP
18382                 set signal
18383                 if eval $compile; then
18384                         echo "SIG${xx} found."
18385                         $run ./signal$_exe  >> signal.ls1
18386                 else
18387                         echo "SIG${xx} NOT found."
18388                 fi
18389         done
18390         if $test -s signal.ls1; then
18391                 $cat signal.nsg signal.ls1 |
18392                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18393         fi
18394
18395 fi
18396 if $test -s signal.lst; then
18397         :
18398 else
18399         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18400         echo 'kill -l' >signal
18401         set X `csh -f <signal`
18402         $rm -f signal
18403         shift
18404         case $# in
18405         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18406         esac
18407         echo $@ | $tr ' ' $trnl | \
18408             $awk '{ printf "%s %d\n", $1, ++s; }
18409                   END { printf "NSIG %d\n", ++s }' >signal.lst
18410 fi
18411 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18412 EOS
18413 chmod a+x signal_cmd
18414 $eunicefix signal_cmd
18415
18416 : generate list of signal names
18417 echo " "
18418 case "$sig_name_init" in
18419 '') doinit=yes ;;
18420 *)  case "$sig_num_init" in
18421     ''|*,*) doinit=yes ;;
18422     esac ;;
18423 esac
18424 case "$doinit" in
18425 yes)
18426         echo "Generating a list of signal names and numbers..." >&4
18427         . ./signal_cmd
18428         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18429         sig_name=`$awk 'BEGIN { printf "ZERO " }
18430                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18431         sig_num=`$awk  'BEGIN { printf "0 " }
18432                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18433         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18434                              !/^NSIG/   { printf "\"%s\", ", $1 }
18435                              END        { printf "0\n" }' signal.lst`
18436         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18437                              !/^NSIG/   { printf "%d, ", $2}
18438                              END        { printf "0\n"}' signal.lst`
18439         ;;
18440 esac
18441 echo "The following $sig_count signals are available:"
18442 echo " "
18443 echo $sig_name | $awk \
18444 'BEGIN { linelen = 0 }
18445 {
18446         for (i = 1; i <= NF; i++) {
18447                 name = "SIG" $i " "
18448                 linelen = linelen + length(name)
18449                 if (linelen > 70) {
18450                         printf "\n"
18451                         linelen = length(name)
18452                 }
18453                 printf "%s", name
18454         }
18455         printf "\n"
18456 }'
18457 sig_size=`echo $sig_name | awk '{print NF}'`
18458 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18459
18460 echo " "
18461 case "$sizetype" in
18462 *_t) zzz="$sizetype"    ;;
18463 *)   zzz="filesize"     ;;
18464 esac
18465 echo "Checking the size of $zzz..." >&4 
18466 cat > try.c <<EOCP
18467 #include <sys/types.h>
18468 #include <stdio.h>
18469 int main() {
18470     printf("%d\n", (int)sizeof($sizetype));
18471     exit(0);
18472 }
18473 EOCP
18474 set try
18475 if eval $compile_ok; then
18476         yyy=`$run ./try`
18477         case "$yyy" in
18478         '')     sizesize=4
18479                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18480                 ;;
18481         *)      sizesize=$yyy
18482                 echo "Your $zzz size is $sizesize bytes."
18483                 ;;
18484         esac
18485 else
18486         sizesize=4
18487         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18488 fi
18489
18490
18491 : check for socklen_t
18492 echo " "
18493 echo "Checking to see if you have socklen_t..." >&4
18494 $cat >try.c <<EOCP
18495 #include <sys/types.h>
18496 #$d_socket HAS_SOCKET
18497 #ifdef HAS_SOCKET
18498 #include <sys/socket.h>
18499 #endif
18500 int main() { socklen_t x = 16; }
18501 EOCP
18502 set try
18503 if eval $compile; then
18504         val="$define"
18505         echo "You have socklen_t."
18506 else
18507         val="$undef"
18508         echo "You do not have socklen_t."
18509         case "$sizetype" in
18510         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18511         esac
18512 fi
18513 $rm -f try try.*
18514 set d_socklen_t
18515 eval $setvar
18516
18517 : see if this is a socks.h system
18518 set socks.h i_socks
18519 eval $inhdr
18520
18521 : check for type of the size argument to socket calls
18522 case "$d_socket" in
18523 "$define")
18524         $cat <<EOM
18525
18526 Checking to see what type is the last argument of accept().
18527 EOM
18528         yyy=''
18529         case "$d_socklen_t" in
18530         "$define") yyy="$yyy socklen_t"
18531         esac
18532         yyy="$yyy $sizetype int long unsigned"
18533         for xxx in $yyy; do
18534                 case "$socksizetype" in
18535                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18536                         case "$usesocks" in
18537                         "$define")
18538                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18539                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18540                                         socksizetype="$xxx"
18541                                 fi
18542                                 ;;
18543                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18544                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18545                                         socksizetype="$xxx"
18546                                 fi
18547                                 ;;
18548                         esac
18549                         ;;
18550                 esac
18551         done
18552 : In case none of those worked, prompt the user.
18553         case "$socksizetype" in
18554         '')     rp='What is the type for socket address structure sizes?'
18555                 dflt='int'
18556                 . ./myread
18557                 socksizetype=$ans
18558                 ;;
18559         esac
18560         ;;
18561 *)      : no sockets, so pick relatively harmless default
18562         socksizetype='int'
18563         ;;
18564 esac
18565
18566 : see what type is used for signed size_t
18567 set ssize_t ssizetype int stdio.h sys/types.h
18568 eval $typedef
18569 dflt="$ssizetype"
18570 $cat > try.c <<EOM
18571 #include <stdio.h>
18572 #include <sys/types.h>
18573 #define Size_t $sizetype
18574 #define SSize_t $dflt
18575 int main()
18576 {
18577         if (sizeof(Size_t) == sizeof(SSize_t))
18578                 printf("$dflt\n");
18579         else if (sizeof(Size_t) == sizeof(int))
18580                 printf("int\n");
18581         else 
18582                 printf("long\n");
18583         exit(0);
18584 }
18585 EOM
18586 echo " "
18587 set try
18588 if eval $compile_ok && $run ./try > /dev/null; then
18589         ssizetype=`$run ./try`
18590         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18591 else
18592         $cat >&4 <<EOM
18593 Help! I can't compile and run the ssize_t test program: please enlighten me!
18594 (This is probably a misconfiguration in your system or libraries, and
18595 you really ought to fix it.  Still, I'll try anyway.)
18596
18597 I need a type that is the same size as $sizetype, but is guaranteed to
18598 be signed.  Common values are ssize_t, int and long.
18599
18600 EOM
18601         rp="What signed type is the same size as $sizetype?"
18602         . ./myread
18603         ssizetype="$ans"
18604 fi
18605 $rm -f try try.*
18606
18607 : see what type of char stdio uses.
18608 echo " "
18609 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18610 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18611         echo "Your stdio uses unsigned chars." >&4
18612         stdchar="unsigned char"
18613 else
18614         echo "Your stdio uses signed chars." >&4
18615         stdchar="char"
18616 fi
18617 $rm -f stdioh
18618
18619
18620
18621 : see what type uids are declared as in the kernel
18622 echo " "
18623 echo "Looking for the type for user ids returned by getuid()."
18624 set uid_t uidtype xxx stdio.h sys/types.h
18625 eval $typedef
18626 case "$uidtype" in
18627 xxx)
18628         xxx=`./findhdr sys/user.h`
18629         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18630         case $1 in
18631         unsigned) dflt="$1 $2" ;;
18632         *) dflt="$1" ;;
18633         esac
18634         ;;
18635 *) dflt="$uidtype";;
18636 esac
18637 case "$uidtype" in
18638 uid_t)  echo "uid_t found." ;;
18639 *)      rp="What is the type for user ids returned by getuid()?"
18640         . ./myread
18641         uidtype="$ans"
18642         ;;
18643 esac
18644
18645 echo " "
18646 case "$uidtype" in
18647 *_t) zzz="$uidtype"     ;;
18648 *)   zzz="uid"          ;;
18649 esac
18650 echo "Checking the size of $zzz..." >&4 
18651 cat > try.c <<EOCP
18652 #include <sys/types.h>
18653 #include <stdio.h>
18654 int main() {
18655     printf("%d\n", (int)sizeof($uidtype));
18656     exit(0);
18657 }
18658 EOCP
18659 set try
18660 if eval $compile_ok; then
18661         yyy=`$run ./try`
18662         case "$yyy" in
18663         '')     uidsize=4
18664                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18665                 ;;
18666         *)      uidsize=$yyy
18667                 echo "Your $zzz is $uidsize bytes long."
18668                 ;;
18669         esac
18670 else
18671         uidsize=4
18672         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18673 fi
18674
18675 echo " "
18676 case "$uidtype" in
18677 *_t) zzz="$uidtype"     ;;
18678 *)   zzz="uid"          ;;
18679 esac
18680 echo "Checking the sign of $zzz..." >&4
18681 cat > try.c <<EOCP
18682 #include <sys/types.h>
18683 #include <stdio.h>
18684 int main() {
18685         $uidtype foo = -1;
18686         if (foo < 0)
18687                 printf("-1\n");
18688         else
18689                 printf("1\n");
18690 }
18691 EOCP
18692 set try
18693 if eval $compile; then
18694         yyy=`$run ./try`
18695         case "$yyy" in
18696         '')     uidsign=1
18697                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18698                 ;;
18699         *)      uidsign=$yyy
18700                 case "$uidsign" in
18701                  1) echo "Your $zzz is unsigned." ;;
18702                 -1) echo "Your $zzz is signed."   ;;
18703                 esac
18704                 ;;
18705         esac
18706 else
18707         uidsign=1
18708         echo "(I can't compile the test program--guessing unsigned.)" >&4
18709 fi
18710
18711
18712
18713 echo " "
18714 $echo "Checking the format string to be used for uids..." >&4
18715
18716 case "$uidsign" in
18717 -1)     if $test X"$uidsize" = X"$ivsize"; then
18718                 uidformat="$ivdformat"
18719         else
18720                 if $test X"$uidsize" = X"$longsize"; then
18721                         uidformat='"ld"'
18722                 else
18723                         if $test X"$uidsize" = X"$intsize"; then
18724                                 uidformat='"d"'
18725                         else
18726                                 if $test X"$uidsize" = X"$shortsize"; then
18727                                         uidformat='"hd"'
18728                                 fi
18729                         fi
18730                 fi
18731         fi
18732         ;;
18733 *)      if $test X"$uidsize" = X"$uvsize"; then
18734                 uidformat="$uvuformat"
18735         else
18736                 if $test X"$uidsize" = X"$longsize"; then
18737                         uidformat='"lu"'
18738                 else
18739                         if $test X"$uidsize" = X"$intsize"; then
18740                                 uidformat='"u"'
18741                         else
18742                                 if $test X"$uidsize" = X"$shortsize"; then
18743                                         uidformat='"hu"'
18744                                 fi
18745                         fi
18746                 fi
18747         fi
18748         ;;
18749 esac
18750
18751 : determine compiler compiler
18752 case "$yacc" in
18753 '')
18754         dflt=yacc;;
18755 *)
18756         dflt="$yacc";;
18757 esac
18758 echo " "
18759 comp='yacc'
18760 if $test -f "$byacc$_exe"; then
18761         dflt="$byacc"
18762         comp="byacc or $comp"
18763 fi
18764 if $test -f "$bison$_exe"; then
18765         comp="$comp or bison -y"
18766 fi
18767 rp="Which compiler compiler ($comp) shall I use?"
18768 . ./myread
18769 yacc="$ans"
18770 case "$yacc" in
18771 *bis*)
18772         case "$yacc" in
18773         *-y*) ;;
18774         *)
18775                 yacc="$yacc -y"
18776                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18777                 ;;
18778         esac
18779         ;;
18780 esac
18781
18782 : see if this is a fp.h system
18783 set fp.h i_fp
18784 eval $inhdr
18785
18786 : see if this is a fp_class.h system
18787 set fp_class.h i_fp_class
18788 eval $inhdr
18789
18790 : see if this is a ieeefp.h system
18791 case "$i_ieeefp" in
18792 '' ) set ieeefp.h i_ieeefp
18793      eval $inhdr
18794      ;;
18795 esac
18796
18797 : see if this is a libutil.h system
18798 set libutil.h i_libutil
18799 eval $inhdr
18800
18801 : see if mach cthreads are available
18802 if test "X$usethreads" = "X$define"; then
18803         set mach/cthreads.h i_machcthr
18804         eval $inhdr
18805 else
18806         i_machcthr="$undef"
18807 fi
18808
18809
18810
18811 : see if this is a math.h system
18812 set math.h i_math
18813 eval $inhdr
18814
18815 : see if this is a mntent.h system
18816 set mntent.h i_mntent
18817 eval $inhdr
18818
18819 : see if ndbm.h is available
18820 set ndbm.h t_ndbm
18821 eval $inhdr
18822
18823 case "$t_ndbm" in
18824 $undef)
18825     # Some Linux distributions such as RedHat 7.1 put the
18826     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18827     if $test -f /usr/include/gdbm/ndbm.h; then
18828         echo '<gdbm/ndbm.h> found.'
18829         ccflags="$ccflags -I/usr/include/gdbm"
18830         cppflags="$cppflags -I/usr/include/gdbm"
18831         t_ndbm=$define
18832     fi
18833     ;;
18834 esac
18835
18836 case "$t_ndbm" in
18837 $define)
18838         : see if dbm_open exists
18839         set dbm_open d_dbm_open
18840         eval $inlibc
18841         case "$d_dbm_open" in
18842         $undef)
18843                 t_ndbm="$undef"
18844                 echo "We won't be including <ndbm.h>"
18845                 ;;
18846         esac
18847         ;;
18848 esac
18849 val="$t_ndbm"
18850 set i_ndbm
18851 eval $setvar
18852
18853 : see if net/errno.h is available
18854 val=''
18855 set net/errno.h val
18856 eval $inhdr
18857
18858 : Unfortunately, it causes problems on some systems.  Arrgh.
18859 case "$val" in
18860 $define)
18861         cat > try.c <<'EOM'
18862 #include <stdio.h>
18863 #include <errno.h>
18864 #include <net/errno.h>
18865 int func()
18866 {
18867         return ENOTSOCK;
18868 }
18869 EOM
18870         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18871                 echo "We'll be including <net/errno.h>." >&4
18872         else
18873                 echo "We won't be including <net/errno.h>." >&4
18874                 val="$undef"
18875         fi
18876         $rm -f try.* try
18877         ;;
18878 esac
18879 set i_neterrno
18880 eval $setvar
18881
18882 : see if netinet/tcp.h is available
18883 set netinet/tcp.h i_netinettcp
18884 eval $inhdr
18885
18886 : see if this is a poll.h system
18887 set poll.h i_poll
18888 eval $inhdr
18889
18890 : see if this is a prot.h system
18891 set prot.h i_prot
18892 eval $inhdr
18893
18894 echo " "
18895 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18896 $cat <<'EOSH' > Cppsym.know
18897 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18898 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18899 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18900 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18901 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18902 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18903 bull c cadmus clipper CMU COFF COMPILER_VERSION
18904 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18905 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18906 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18907 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18908 GLIBC GLIBC_MINOR
18909 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18910 H3050R H3050RX hbullx20 hcx host_mips
18911 hp200 hp300 hp700 HP700 hp800 hp9000
18912 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18913 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18914 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18915 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18916 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18917 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18918 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18919 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18920 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18921 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18922 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18923 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18924 MATH_HAS_NO_SIDE_EFFECTS
18925 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18926 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18927 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18928 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18929 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18930 NetBSD news1500 news1700 news1800 news1900 news3700
18931 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18932 ns32016 ns32332 ns32k nsc32000
18933 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18934 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18935 pc532 pdp11 PGC PIC plexus PORTAR posix
18936 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18937 POSIX_C_SOURCE POSIX_SOURCE POWER
18938 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18939 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18940 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18941 sony sony_news sonyrisc sparc sparclite spectrum
18942 stardent stdc STDC_EXT stratos sun sun3 sun386
18943 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18944 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18945 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18946 sysV68 sysV88 Tek4132 Tek4300 titan
18947 TM3200 TM5400 TM5600
18948 tower tower32 tower32_200 tower32_600 tower32_700
18949 tower32_800 tower32_850 tss
18950 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18951 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18952 unix UNIX95 UNIX99 unixpc unos
18953 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18954 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18955 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18956 USGr4 USGr4_2
18957 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18958 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18959 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18960 z8000
18961 EOSH
18962 # Maybe put other stuff here too.
18963 cat <<EOSH >>Cppsym.know
18964 $osname
18965 EOSH
18966 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18967 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18968 $cat Cppsym.know > Cppsym.c
18969 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18970 $rm -f Cppsym.a Cppsym.b Cppsym.c
18971 cat <<EOSH > Cppsym
18972 $startsh
18973 if $test \$# -gt 0; then
18974     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18975     if $test -s Cppsym.got; then
18976         $rm -f Cppsym.got
18977         exit 0
18978     fi
18979     $rm -f Cppsym.got
18980     exit 1
18981 else
18982     $tr " " "$trnl" | ./Cppsym.try
18983     exit 0
18984 fi
18985 EOSH
18986 chmod +x Cppsym
18987 $eunicefix Cppsym
18988 cat <<EOSH > Cppsym.try
18989 $startsh
18990 cat <<'EOCP' > try.c
18991 #include <stdio.h>
18992 int main() {
18993 EOCP
18994 $awk \\
18995 EOSH
18996 cat <<'EOSH' >> Cppsym.try
18997 'length($1) > 0 {
18998     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
18999     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
19000     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
19001     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
19002 }'       >> try.c
19003 echo 'return 0;}' >> try.c
19004 EOSH
19005 cat <<EOSH >> Cppsym.try
19006 ccflags="$ccflags"
19007 case "$osname-$gccversion" in
19008 irix-) ccflags="\$ccflags -woff 1178" ;;
19009 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19010 esac
19011 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19012 EOSH
19013 chmod +x Cppsym.try
19014 $eunicefix Cppsym.try
19015 ./Cppsym < Cppsym.know > Cppsym.true
19016 : now check the C compiler for additional symbols
19017 postprocess_cc_v=''
19018 case "$osname" in
19019 aix) postprocess_cc_v="|$tr , ' '" ;;
19020 esac
19021 $cat >ccsym <<EOS
19022 $startsh
19023 $cat >tmp.c <<EOF
19024 extern int foo;
19025 EOF
19026 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19027 do
19028         case "\$i" in
19029         -D*) echo "\$i" | $sed 's/^-D//';;
19030         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19031         esac
19032 done
19033 $rm -f try.c
19034 EOS
19035 postprocess_cc_v=''
19036 chmod +x ccsym
19037 $eunicefix ccsym
19038 ./ccsym > ccsym1.raw
19039 if $test -s ccsym1.raw; then
19040        $sort ccsym1.raw | $uniq >ccsym.raw
19041 else
19042        mv ccsym1.raw ccsym.raw
19043 fi
19044
19045 $awk '/\=/ { print $0; next }
19046         { print $0"=1" }' ccsym.raw >ccsym.list
19047 $awk '/\=/ { print $0; next }
19048         { print $0"=1" }' Cppsym.true >ccsym.true
19049 $comm -13 ccsym.true ccsym.list >ccsym.own
19050 $comm -12 ccsym.true ccsym.list >ccsym.com
19051 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19052 also=''
19053 if $test -z ccsym.raw; then
19054         echo "Your C compiler doesn't seem to define any symbols!" >&4
19055         echo " "
19056         echo "However, your C preprocessor defines the following symbols:"
19057         $cat Cppsym.true
19058         ccsymbols=''
19059         cppsymbols=`$cat Cppsym.true`
19060         cppsymbols=`echo $cppsymbols`
19061         cppccsymbols="$cppsymbols"
19062 else
19063         if $test -s ccsym.com; then
19064                 echo "Your C compiler and pre-processor define these symbols:"
19065                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19066                 also='also '
19067                 symbols='ones'
19068                 cppccsymbols=`$cat ccsym.com`
19069                 cppccsymbols=`echo $cppccsymbols`
19070                 $test "$silent" || sleep 1
19071         fi
19072         if $test -s ccsym.cpp; then
19073                 $test "$also" && echo " "
19074                 echo "Your C pre-processor ${also}defines the following symbols:"
19075                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19076                 also='further '
19077                 cppsymbols=`$cat ccsym.cpp`
19078                 cppsymbols=`echo $cppsymbols`
19079                 $test "$silent" || sleep 1
19080         fi
19081         if $test -s ccsym.own; then
19082                 $test "$also" && echo " "
19083                 echo "Your C compiler ${also}defines the following cpp symbols:"
19084                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19085                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19086                 ccsymbols=`$cat ccsym.own`
19087                 ccsymbols=`echo $ccsymbols`
19088                 $test "$silent" || sleep 1
19089         fi
19090 fi
19091
19092 : see if this is a termio system
19093 val="$undef"
19094 val2="$undef"
19095 val3="$undef"
19096 if $test `./findhdr termios.h`; then
19097         set tcsetattr i_termios
19098         eval $inlibc
19099         val3="$i_termios"
19100 fi
19101 echo " "
19102 case "$val3" in
19103 "$define") echo "You have POSIX termios.h... good!" >&4;;
19104 *) if ./Cppsym pyr; then
19105                 case "`/bin/universe`" in
19106                 ucb) if $test `./findhdr sgtty.h`; then
19107                                 val2="$define"
19108                                 echo "<sgtty.h> found." >&4
19109                         else
19110                                 echo "System is pyramid with BSD universe."
19111                                 echo "<sgtty.h> not found--you could have problems." >&4
19112                         fi;;
19113                 *) if $test `./findhdr termio.h`; then
19114                                 val="$define"
19115                                 echo "<termio.h> found." >&4
19116                         else
19117                                 echo "System is pyramid with USG universe."
19118                                 echo "<termio.h> not found--you could have problems." >&4
19119                         fi;;
19120                 esac
19121         elif ./usg; then
19122                 if $test `./findhdr termio.h`; then
19123                         echo "<termio.h> found." >&4
19124                         val="$define"
19125                 elif $test `./findhdr sgtty.h`; then
19126                         echo "<sgtty.h> found." >&4
19127                         val2="$define"
19128                 else
19129 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19130                 fi
19131         else
19132                 if $test `./findhdr sgtty.h`; then
19133                         echo "<sgtty.h> found." >&4
19134                         val2="$define"
19135                 elif $test `./findhdr termio.h`; then
19136                         echo "<termio.h> found." >&4
19137                         val="$define"
19138                 else
19139 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19140                 fi
19141         fi;;
19142 esac
19143 set i_termio; eval $setvar
19144 val=$val2; set i_sgtty; eval $setvar
19145 val=$val3; set i_termios; eval $setvar
19146
19147 : see if stddef is available
19148 set stddef.h i_stddef
19149 eval $inhdr
19150
19151 : see if this is a sunmath.h system
19152 set sunmath.h i_sunmath
19153 eval $inhdr
19154
19155 : see if sys/access.h is available
19156 set sys/access.h i_sysaccess
19157 eval $inhdr
19158
19159 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19160 set sys/filio.h i_sysfilio
19161 eval $inhdr
19162 echo " "
19163 if $test `./findhdr sys/ioctl.h`; then
19164         val="$define"
19165         echo '<sys/ioctl.h> found.' >&4
19166 else
19167         val="$undef"
19168         if $test $i_sysfilio = "$define"; then
19169             echo '<sys/ioctl.h> NOT found.' >&4
19170         else
19171                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19172                 $test $i_termio = "$define" && xxx="termio.h"
19173                 $test $i_termios = "$define" && xxx="termios.h"
19174 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19175         fi
19176 fi
19177 set i_sysioctl
19178 eval $setvar
19179
19180 : see if socket ioctl defs are in sys/sockio.h
19181 echo " "
19182 xxx=`./findhdr sys/sockio.h`
19183 if $test "$xxx"; then
19184         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19185                 val="$define"
19186                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19187         else
19188                 val="$undef"
19189                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19190         fi
19191 else
19192         val="$undef"
19193         $cat <<EOM
19194 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19195 EOM
19196 fi
19197 set i_syssockio
19198 eval $setvar
19199
19200
19201 : see if this is a syslog.h system
19202 set syslog.h i_syslog
19203 eval $inhdr
19204
19205
19206 : see if this is a sys/mode.h system
19207 set sys/mode.h i_sysmode
19208 eval $inhdr
19209
19210 : see if sys/resource.h has to be included
19211 set sys/resource.h i_sysresrc
19212 eval $inhdr
19213
19214 : see if sys/security.h is available
19215 set sys/security.h i_syssecrt
19216 eval $inhdr
19217
19218 : see if this is a sys/statvfs.h system
19219 set sys/statvfs.h i_sysstatvfs
19220 eval $inhdr
19221
19222 : see if this is a sys/un.h system
19223 set sys/un.h i_sysun
19224 eval $inhdr
19225
19226
19227 : see if this is a sys/utsname.h system
19228 set sys/utsname.h i_sysutsname
19229 eval $inhdr
19230
19231 : see if this is a syswait system
19232 set sys/wait.h i_syswait
19233 eval $inhdr
19234
19235 : see if this is a ustat.h system
19236 set ustat.h i_ustat
19237 eval $inhdr
19238
19239 : see if this is an utime system
19240 set utime.h i_utime
19241 eval $inhdr
19242
19243 : see if this is a values.h system
19244 set values.h i_values
19245 eval $inhdr
19246
19247 : see if this is a vfork system
19248 case "$d_vfork" in
19249 "$define")
19250         set vfork.h i_vfork
19251         eval $inhdr
19252         ;;
19253 *)
19254         i_vfork="$undef"
19255         ;;
19256 esac
19257
19258 : see if gdbm.h is available
19259 set gdbm.h t_gdbm
19260 eval $inhdr
19261 case "$t_gdbm" in
19262 $define)
19263         : see if gdbm_open exists
19264         set gdbm_open d_gdbm_open
19265         eval $inlibc
19266         case "$d_gdbm_open" in
19267         $undef)
19268                 t_gdbm="$undef"
19269                 echo "We won't be including <gdbm.h>"
19270                 ;;
19271         esac
19272         ;;
19273 esac
19274 val="$t_gdbm"
19275 set i_gdbm
19276 eval $setvar
19277
19278 echo " "
19279 echo "Looking for extensions..." >&4
19280 : If we are using the old config.sh, known_extensions may contain
19281 : old or inaccurate or duplicate values.
19282 known_extensions=''
19283 nonxs_extensions=''
19284 : We do not use find because it might not be available.
19285 : We do not just use MANIFEST because the user may have dropped
19286 : some additional extensions into the source tree and expect them
19287 : to be built.
19288
19289 : Function to recursively find available extensions, ignoring DynaLoader
19290 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19291 find_extensions='
19292     for xxx in *; do
19293        case "$xxx" in
19294            DynaLoader|dynaload) ;;
19295            *)
19296            if $test -f $xxx/$xxx.xs; then
19297                known_extensions="$known_extensions $1$xxx";
19298            elif $test -f $xxx/Makefile.PL; then
19299                nonxs_extensions="$nonxs_extensions $1$xxx";
19300            else
19301                if $test -d $xxx -a $# -lt 10; then
19302                    set $1$xxx/ $*;
19303                    cd "$xxx";
19304                    eval $find_extensions;
19305                    cd ..;
19306                    shift;
19307                fi;
19308            fi
19309            ;;
19310        esac;
19311     done'
19312 tdir=`pwd`
19313 cd "$rsrc/ext"
19314 set X
19315 shift
19316 eval $find_extensions
19317 # Special case:  Add in threads/shared since it is not picked up by the
19318 # recursive find above (and adding in general recursive finding breaks
19319 # SDBM_File/sdbm).  A.D.  10/25/2001.
19320 known_extensions="$known_extensions threads/shared"
19321 set X $nonxs_extensions
19322 shift
19323 nonxs_extensions="$*"
19324 set X $known_extensions
19325 shift
19326 known_extensions="$*"
19327 cd "$tdir"
19328
19329 : Now see which are supported on this system.
19330 avail_ext=''
19331 for xxx in $known_extensions ; do
19332         case "$xxx" in
19333         DB_File|db_file)
19334                 case "$i_db" in
19335                 $define) avail_ext="$avail_ext $xxx" ;;
19336                 esac
19337                 ;;
19338         GDBM_File|gdbm_fil)
19339                 case "$i_gdbm" in 
19340                 $define) avail_ext="$avail_ext $xxx" ;;
19341                 esac
19342                 ;;
19343         I18N/Langinfo|i18n_lan)
19344                 case "$i_langinfo$d_nl_langinfo" in 
19345                 $define$define) avail_ext="$avail_ext $xxx" ;;
19346                 esac
19347                 ;;
19348         NDBM_File|ndbm_fil)
19349                 case "$i_ndbm" in
19350                 $define)
19351                     case "$osname-$use64bitint" in
19352                     hpux-define)
19353                         case "$libs" in
19354                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19355                         esac
19356                         ;;
19357                     *) avail_ext="$avail_ext $xxx" ;;
19358                     esac
19359                     ;;
19360                 esac
19361                 ;;
19362         ODBM_File|odbm_fil) 
19363                 case "${i_dbm}${i_rpcsvcdbm}" in
19364                 *"${define}"*)
19365                     case "$osname-$use64bitint" in
19366                     hpux-define)
19367                         case "$libs" in
19368                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19369                         esac
19370                         ;;
19371                     *) avail_ext="$avail_ext $xxx" ;;
19372                     esac
19373                     ;;
19374                 esac
19375                 ;;
19376         POSIX|posix)
19377                 case "$useposix" in
19378                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19379                 esac
19380                 ;;
19381         Opcode|opcode)
19382                 case "$useopcode" in
19383                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19384                 esac
19385                 ;;
19386         Socket|socket)
19387                 case "$d_socket" in 
19388                 true|$define|y)
19389                     case "$osname" in
19390                     beos) ;; # not unless BONE
19391                     *) avail_ext="$avail_ext $xxx" ;;
19392                     esac
19393                     ;;
19394                 esac
19395                 ;;
19396         Sys/Syslog|sys/syslog)
19397                 : XXX syslog requires socket
19398                 case "$d_socket" in 
19399                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19400                 esac
19401                 ;;
19402         Thread|thread)
19403                 case "$usethreads" in
19404                 true|$define|y)
19405                         case "$useithreads" in
19406                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19407                         esac
19408                 esac
19409                 ;;
19410         XS/APItest|xs/apitest)
19411                 # This is just for testing.  Skip it unless we have dynamic loading.
19412
19413                 case "$usedl" in
19414                 $define) avail_ext="$avail_ext $xxx" ;;
19415                 esac
19416                 ;;
19417         XS/Typemap|xs/typemap)
19418                 # This is just for testing.  Skip it unless we have dynamic loading.
19419                 case "$usedl" in
19420                 $define) avail_ext="$avail_ext $xxx" ;;
19421                 esac
19422                 ;;
19423         threads|threads/shared)
19424                 # threads and threads::shared are special cases.
19425                 # To stop people from asking "Perl 5.8.0 was supposed
19426                 # to have this new fancy threads implementation but my
19427                 # perl doesn't have it" and from people trying to
19428                 # (re)install the threads module using CPAN.pm and
19429                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19430                 # the threads.pm and threads/shared.pm will always be
19431                 # there, croaking informatively ("you need to rebuild
19432                 # all of Perl with threads, sorry") when threads haven't
19433                 # been compiled in.
19434                 # --jhi
19435                 avail_ext="$avail_ext $xxx"
19436                 ;;
19437         IPC/SysV|ipc/sysv)
19438                 : XXX Do we need a useipcsysv variable here
19439                 case "${d_msg}${d_sem}${d_shm}" in 
19440                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19441                 esac
19442                 ;;
19443         *)      avail_ext="$avail_ext $xxx"
19444                 ;;
19445         esac
19446 done
19447
19448 set X $avail_ext
19449 shift
19450 avail_ext="$*"
19451
19452 : Now see which nonxs extensions are supported on this system.
19453 : For now assume all are.
19454 nonxs_ext=''
19455 for xxx in $nonxs_extensions ; do
19456         case "$xxx" in
19457         *)      nonxs_ext="$nonxs_ext $xxx"
19458                 ;;
19459         esac
19460 done
19461
19462 set X $nonxs_ext
19463 shift
19464 nonxs_ext="$*"
19465
19466 case $usedl in
19467 $define)
19468         $cat <<EOM
19469 A number of extensions are supplied with $package.  You may choose to
19470 compile these extensions for dynamic loading (the default), compile
19471 them into the $package executable (static loading), or not include
19472 them at all.  Answer "none" to include no extensions.
19473 Note that DynaLoader is always built and need not be mentioned here.
19474
19475 EOM
19476         case "$dynamic_ext" in
19477         '')
19478                 : Exclude those listed in static_ext
19479                 dflt=''
19480                 for xxx in $avail_ext; do
19481                         case " $static_ext " in
19482                         *" $xxx "*) ;;
19483                         *) dflt="$dflt $xxx" ;;
19484                         esac
19485                 done
19486                 set X $dflt
19487                 shift
19488                 dflt="$*"
19489                 ;;
19490         *)      dflt="$dynamic_ext"
19491                 # Perhaps we are reusing an old out-of-date config.sh.
19492                 case "$hint" in
19493                 previous)
19494                         if test X"$dynamic_ext" != X"$avail_ext"; then
19495                                 $cat <<EOM
19496 NOTICE:  Your previous config.sh list may be incorrect. 
19497 The extensions now available to you are 
19498         ${avail_ext}
19499 but the default list from your previous config.sh is
19500         ${dynamic_ext} 
19501
19502 EOM
19503                         fi
19504                         ;;
19505                 esac
19506                 ;;
19507         esac
19508         case "$dflt" in
19509         '')     dflt=none;;
19510         esac
19511         rp="What extensions do you wish to load dynamically?"
19512         . ./myread
19513         case "$ans" in
19514         none) dynamic_ext=' ' ;;
19515         *) dynamic_ext="$ans" ;;
19516         esac
19517
19518         case "$static_ext" in
19519         '')
19520                 : Exclude those already listed in dynamic linking
19521                 dflt=''
19522                 for xxx in $avail_ext; do
19523                         case " $dynamic_ext " in
19524                         *" $xxx "*) ;;
19525                         *) dflt="$dflt $xxx" ;;
19526                         esac
19527                 done
19528                 set X $dflt
19529                 shift
19530                 dflt="$*"
19531                 ;;
19532         *)  dflt="$static_ext" 
19533                 ;;
19534         esac
19535
19536         case "$dflt" in
19537         '')     dflt=none;;
19538         esac
19539         rp="What extensions do you wish to load statically?"
19540         . ./myread
19541         case "$ans" in
19542         none) static_ext=' ' ;;
19543         *) static_ext="$ans" ;;
19544         esac
19545         ;;
19546 *)
19547         $cat <<EOM
19548 A number of extensions are supplied with $package.  Answer "none" 
19549 to include no extensions. 
19550 Note that DynaLoader is always built and need not be mentioned here.
19551
19552 EOM
19553         case "$static_ext" in
19554         '') dflt="$avail_ext" ;;
19555         *)      dflt="$static_ext"
19556                 # Perhaps we are reusing an old out-of-date config.sh.
19557                 case "$hint" in
19558                 previous)
19559                         if test X"$static_ext" != X"$avail_ext"; then
19560                                 $cat <<EOM
19561 NOTICE:  Your previous config.sh list may be incorrect. 
19562 The extensions now available to you are 
19563         ${avail_ext}
19564 but the default list from your previous config.sh is
19565         ${static_ext} 
19566
19567 EOM
19568                         fi
19569                         ;;
19570                 esac
19571                 ;;
19572         esac
19573         : Exclude those that are not xs extensions
19574         case "$dflt" in
19575         '')     dflt=none;;
19576         esac
19577         rp="What extensions do you wish to include?"
19578         . ./myread
19579         case "$ans" in
19580         none) static_ext=' ' ;;
19581         *) static_ext="$ans" ;;
19582         esac
19583         ;;
19584 esac
19585 #        
19586 # Encode is a special case.  If we are building Encode as a static
19587 # extension, we need to explicitly list its subextensions as well.
19588 # For other nested extensions, this is handled automatically by
19589 # the appropriate Makefile.PL.
19590 case " $static_ext " in
19591         *" Encode "*) # Add the subextensions of Encode
19592         cd "$rsrc/ext"
19593         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19594                 static_ext="$static_ext Encode/$xxx"
19595         done
19596         cd "$tdir"
19597         ;;
19598 esac
19599
19600 set X $dynamic_ext $static_ext $nonxs_ext
19601 shift
19602 extensions="$*"
19603
19604 : Remove libraries needed only for extensions
19605 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19606 : The exception is SunOS 4.x, which needs them.
19607 case "${osname}X${osvers}" in
19608 sunos*X4*)
19609     perllibs="$libs"
19610     ;;
19611 *) case "$usedl" in
19612     $define|true|[yY]*)
19613             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19614             shift
19615             perllibs="$*"
19616             ;;
19617     *)  perllibs="$libs"
19618             ;;
19619     esac
19620     ;;
19621 esac
19622
19623 : Remove build directory name from cppstdin so it can be used from
19624 : either the present location or the final installed location.
19625 echo " "
19626 : Get out of the UU directory to get correct path name.
19627 cd ..
19628 case "$cppstdin" in
19629 `pwd`/cppstdin)
19630         echo "Stripping down cppstdin path name"
19631         cppstdin=cppstdin
19632         ;;
19633 esac
19634 cd UU
19635
19636 : end of configuration questions
19637 echo " "
19638 echo "End of configuration questions."
19639 echo " "
19640
19641 : back to where it started
19642 if test -d ../UU; then
19643         cd ..
19644 fi
19645
19646 : configuration may be patched via a 'config.arch' file
19647 if $test -f config.arch; then
19648         echo "I see a config.arch file, loading it."
19649         . ./config.arch
19650 fi
19651
19652 : configuration may be patched via a 'config.over' file
19653 if $test -f config.over; then
19654         echo " "
19655         dflt=y
19656         rp='I see a config.over file.  Do you wish to load it?'
19657         . UU/myread
19658         case "$ans" in
19659         n*) echo "OK, I'll ignore it.";;
19660         *)      . ./config.over
19661                 echo "Configuration override changes have been loaded."
19662                 ;;
19663         esac
19664 fi
19665
19666 : in case they want portability, strip down executable paths
19667 case "$d_portable" in
19668 "$define")
19669         echo " "
19670         echo "Stripping down executable paths..." >&4
19671         for file in $loclist $trylist; do
19672                 eval temp=\$$file
19673                 eval $file=`basename $temp`
19674         done
19675         ;;
19676 esac
19677
19678 : create config.sh file
19679 echo " "
19680 echo "Creating config.sh..." >&4
19681 $spitshell <<EOT >config.sh
19682 $startsh
19683 #
19684 # This file was produced by running the Configure script. It holds all the
19685 # definitions figured out by Configure. Should you modify one of these values,
19686 # do not forget to propagate your changes by running "Configure -der". You may
19687 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19688 #
19689
19690 # Package name      : $package
19691 # Source directory  : $src
19692 # Configuration time: $cf_time
19693 # Configured by     : $cf_by
19694 # Target system     : $myuname
19695
19696 Author='$Author'
19697 Date='$Date'
19698 Header='$Header'
19699 Id='$Id'
19700 Locker='$Locker'
19701 Log='$Log'
19702 Mcc='$Mcc'
19703 RCSfile='$RCSfile'
19704 Revision='$Revision'
19705 Source='$Source'
19706 State='$State'
19707 _a='$_a'
19708 _exe='$_exe'
19709 _o='$_o'
19710 afs='$afs'
19711 afsroot='$afsroot'
19712 alignbytes='$alignbytes'
19713 ansi2knr='$ansi2knr'
19714 aphostname='$aphostname'
19715 api_revision='$api_revision'
19716 api_subversion='$api_subversion'
19717 api_version='$api_version'
19718 api_versionstring='$api_versionstring'
19719 ar='$ar'
19720 archlib='$archlib'
19721 archlibexp='$archlibexp'
19722 archname64='$archname64'
19723 archname='$archname'
19724 archobjs='$archobjs'
19725 asctime_r_proto='$asctime_r_proto'
19726 awk='$awk'
19727 baserev='$baserev'
19728 bash='$bash'
19729 bin='$bin'
19730 binexp='$binexp'
19731 bison='$bison'
19732 byacc='$byacc'
19733 byteorder='$byteorder'
19734 c='$c'
19735 castflags='$castflags'
19736 cat='$cat'
19737 cc='$cc'
19738 cccdlflags='$cccdlflags'
19739 ccdlflags='$ccdlflags'
19740 ccflags='$ccflags'
19741 ccflags_uselargefiles='$ccflags_uselargefiles'
19742 ccname='$ccname'
19743 ccsymbols='$ccsymbols'
19744 ccversion='$ccversion'
19745 cf_by='$cf_by'
19746 cf_email='$cf_email'
19747 cf_time='$cf_time'
19748 charsize='$charsize'
19749 chgrp='$chgrp'
19750 chmod='$chmod'
19751 chown='$chown'
19752 clocktype='$clocktype'
19753 comm='$comm'
19754 compress='$compress'
19755 contains='$contains'
19756 cp='$cp'
19757 cpio='$cpio'
19758 cpp='$cpp'
19759 cpp_stuff='$cpp_stuff'
19760 cppccsymbols='$cppccsymbols'
19761 cppflags='$cppflags'
19762 cpplast='$cpplast'
19763 cppminus='$cppminus'
19764 cpprun='$cpprun'
19765 cppstdin='$cppstdin'
19766 cppsymbols='$cppsymbols'
19767 crypt_r_proto='$crypt_r_proto'
19768 cryptlib='$cryptlib'
19769 csh='$csh'
19770 ctermid_r_proto='$ctermid_r_proto'
19771 ctime_r_proto='$ctime_r_proto'
19772 d_Gconvert='$d_Gconvert'
19773 d_PRIEUldbl='$d_PRIEUldbl'
19774 d_PRIFUldbl='$d_PRIFUldbl'
19775 d_PRIGUldbl='$d_PRIGUldbl'
19776 d_PRIXU64='$d_PRIXU64'
19777 d_PRId64='$d_PRId64'
19778 d_PRIeldbl='$d_PRIeldbl'
19779 d_PRIfldbl='$d_PRIfldbl'
19780 d_PRIgldbl='$d_PRIgldbl'
19781 d_PRIi64='$d_PRIi64'
19782 d_PRIo64='$d_PRIo64'
19783 d_PRIu64='$d_PRIu64'
19784 d_PRIx64='$d_PRIx64'
19785 d_SCNfldbl='$d_SCNfldbl'
19786 d__fwalk='$d__fwalk'
19787 d_access='$d_access'
19788 d_accessx='$d_accessx'
19789 d_alarm='$d_alarm'
19790 d_archlib='$d_archlib'
19791 d_asctime_r='$d_asctime_r'
19792 d_atolf='$d_atolf'
19793 d_atoll='$d_atoll'
19794 d_attribut='$d_attribut'
19795 d_bcmp='$d_bcmp'
19796 d_bcopy='$d_bcopy'
19797 d_bsd='$d_bsd'
19798 d_bsdgetpgrp='$d_bsdgetpgrp'
19799 d_bsdsetpgrp='$d_bsdsetpgrp'
19800 d_bzero='$d_bzero'
19801 d_casti32='$d_casti32'
19802 d_castneg='$d_castneg'
19803 d_charvspr='$d_charvspr'
19804 d_chown='$d_chown'
19805 d_chroot='$d_chroot'
19806 d_chsize='$d_chsize'
19807 d_class='$d_class'
19808 d_closedir='$d_closedir'
19809 d_cmsghdr_s='$d_cmsghdr_s'
19810 d_const='$d_const'
19811 d_crypt='$d_crypt'
19812 d_crypt_r='$d_crypt_r'
19813 d_csh='$d_csh'
19814 d_ctermid_r='$d_ctermid_r'
19815 d_ctime_r='$d_ctime_r'
19816 d_cuserid='$d_cuserid'
19817 d_dbl_dig='$d_dbl_dig'
19818 d_dbminitproto='$d_dbminitproto'
19819 d_difftime='$d_difftime'
19820 d_dirfd='$d_dirfd'
19821 d_dirnamlen='$d_dirnamlen'
19822 d_dlerror='$d_dlerror'
19823 d_dlopen='$d_dlopen'
19824 d_dlsymun='$d_dlsymun'
19825 d_dosuid='$d_dosuid'
19826 d_drand48_r='$d_drand48_r'
19827 d_drand48proto='$d_drand48proto'
19828 d_dup2='$d_dup2'
19829 d_eaccess='$d_eaccess'
19830 d_endgrent='$d_endgrent'
19831 d_endgrent_r='$d_endgrent_r'
19832 d_endhent='$d_endhent'
19833 d_endhostent_r='$d_endhostent_r'
19834 d_endnent='$d_endnent'
19835 d_endnetent_r='$d_endnetent_r'
19836 d_endpent='$d_endpent'
19837 d_endprotoent_r='$d_endprotoent_r'
19838 d_endpwent='$d_endpwent'
19839 d_endpwent_r='$d_endpwent_r'
19840 d_endsent='$d_endsent'
19841 d_endservent_r='$d_endservent_r'
19842 d_eofnblk='$d_eofnblk'
19843 d_eunice='$d_eunice'
19844 d_fchdir='$d_fchdir'
19845 d_fchmod='$d_fchmod'
19846 d_fchown='$d_fchown'
19847 d_fcntl='$d_fcntl'
19848 d_fcntl_can_lock='$d_fcntl_can_lock'
19849 d_fd_macros='$d_fd_macros'
19850 d_fd_set='$d_fd_set'
19851 d_fds_bits='$d_fds_bits'
19852 d_fgetpos='$d_fgetpos'
19853 d_finite='$d_finite'
19854 d_finitel='$d_finitel'
19855 d_flexfnam='$d_flexfnam'
19856 d_flock='$d_flock'
19857 d_flockproto='$d_flockproto'
19858 d_fork='$d_fork'
19859 d_fp_class='$d_fp_class'
19860 d_fpathconf='$d_fpathconf'
19861 d_fpclass='$d_fpclass'
19862 d_fpclassify='$d_fpclassify'
19863 d_fpclassl='$d_fpclassl'
19864 d_fpos64_t='$d_fpos64_t'
19865 d_frexpl='$d_frexpl'
19866 d_fs_data_s='$d_fs_data_s'
19867 d_fseeko='$d_fseeko'
19868 d_fsetpos='$d_fsetpos'
19869 d_fstatfs='$d_fstatfs'
19870 d_fstatvfs='$d_fstatvfs'
19871 d_fsync='$d_fsync'
19872 d_ftello='$d_ftello'
19873 d_ftime='$d_ftime'
19874 d_getcwd='$d_getcwd'
19875 d_getespwnam='$d_getespwnam'
19876 d_getfsstat='$d_getfsstat'
19877 d_getgrent='$d_getgrent'
19878 d_getgrent_r='$d_getgrent_r'
19879 d_getgrgid_r='$d_getgrgid_r'
19880 d_getgrnam_r='$d_getgrnam_r'
19881 d_getgrps='$d_getgrps'
19882 d_gethbyaddr='$d_gethbyaddr'
19883 d_gethbyname='$d_gethbyname'
19884 d_gethent='$d_gethent'
19885 d_gethname='$d_gethname'
19886 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19887 d_gethostbyname_r='$d_gethostbyname_r'
19888 d_gethostent_r='$d_gethostent_r'
19889 d_gethostprotos='$d_gethostprotos'
19890 d_getitimer='$d_getitimer'
19891 d_getlogin='$d_getlogin'
19892 d_getlogin_r='$d_getlogin_r'
19893 d_getmnt='$d_getmnt'
19894 d_getmntent='$d_getmntent'
19895 d_getnbyaddr='$d_getnbyaddr'
19896 d_getnbyname='$d_getnbyname'
19897 d_getnent='$d_getnent'
19898 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19899 d_getnetbyname_r='$d_getnetbyname_r'
19900 d_getnetent_r='$d_getnetent_r'
19901 d_getnetprotos='$d_getnetprotos'
19902 d_getpagsz='$d_getpagsz'
19903 d_getpbyname='$d_getpbyname'
19904 d_getpbynumber='$d_getpbynumber'
19905 d_getpent='$d_getpent'
19906 d_getpgid='$d_getpgid'
19907 d_getpgrp2='$d_getpgrp2'
19908 d_getpgrp='$d_getpgrp'
19909 d_getppid='$d_getppid'
19910 d_getprior='$d_getprior'
19911 d_getprotobyname_r='$d_getprotobyname_r'
19912 d_getprotobynumber_r='$d_getprotobynumber_r'
19913 d_getprotoent_r='$d_getprotoent_r'
19914 d_getprotoprotos='$d_getprotoprotos'
19915 d_getprpwnam='$d_getprpwnam'
19916 d_getpwent='$d_getpwent'
19917 d_getpwent_r='$d_getpwent_r'
19918 d_getpwnam_r='$d_getpwnam_r'
19919 d_getpwuid_r='$d_getpwuid_r'
19920 d_getsbyname='$d_getsbyname'
19921 d_getsbyport='$d_getsbyport'
19922 d_getsent='$d_getsent'
19923 d_getservbyname_r='$d_getservbyname_r'
19924 d_getservbyport_r='$d_getservbyport_r'
19925 d_getservent_r='$d_getservent_r'
19926 d_getservprotos='$d_getservprotos'
19927 d_getspnam='$d_getspnam'
19928 d_getspnam_r='$d_getspnam_r'
19929 d_gettimeod='$d_gettimeod'
19930 d_gmtime_r='$d_gmtime_r'
19931 d_gnulibc='$d_gnulibc'
19932 d_grpasswd='$d_grpasswd'
19933 d_hasmntopt='$d_hasmntopt'
19934 d_htonl='$d_htonl'
19935 d_index='$d_index'
19936 d_inetaton='$d_inetaton'
19937 d_int64_t='$d_int64_t'
19938 d_isascii='$d_isascii'
19939 d_isfinite='$d_isfinite'
19940 d_isinf='$d_isinf'
19941 d_isnan='$d_isnan'
19942 d_isnanl='$d_isnanl'
19943 d_killpg='$d_killpg'
19944 d_lchown='$d_lchown'
19945 d_ldbl_dig='$d_ldbl_dig'
19946 d_link='$d_link'
19947 d_localtime_r='$d_localtime_r'
19948 d_locconv='$d_locconv'
19949 d_lockf='$d_lockf'
19950 d_longdbl='$d_longdbl'
19951 d_longlong='$d_longlong'
19952 d_lseekproto='$d_lseekproto'
19953 d_lstat='$d_lstat'
19954 d_madvise='$d_madvise'
19955 d_mblen='$d_mblen'
19956 d_mbstowcs='$d_mbstowcs'
19957 d_mbtowc='$d_mbtowc'
19958 d_memchr='$d_memchr'
19959 d_memcmp='$d_memcmp'
19960 d_memcpy='$d_memcpy'
19961 d_memmove='$d_memmove'
19962 d_memset='$d_memset'
19963 d_mkdir='$d_mkdir'
19964 d_mkdtemp='$d_mkdtemp'
19965 d_mkfifo='$d_mkfifo'
19966 d_mkstemp='$d_mkstemp'
19967 d_mkstemps='$d_mkstemps'
19968 d_mktime='$d_mktime'
19969 d_mmap='$d_mmap'
19970 d_modfl='$d_modfl'
19971 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19972 d_modflproto='$d_modflproto'
19973 d_mprotect='$d_mprotect'
19974 d_msg='$d_msg'
19975 d_msg_ctrunc='$d_msg_ctrunc'
19976 d_msg_dontroute='$d_msg_dontroute'
19977 d_msg_oob='$d_msg_oob'
19978 d_msg_peek='$d_msg_peek'
19979 d_msg_proxy='$d_msg_proxy'
19980 d_msgctl='$d_msgctl'
19981 d_msgget='$d_msgget'
19982 d_msghdr_s='$d_msghdr_s'
19983 d_msgrcv='$d_msgrcv'
19984 d_msgsnd='$d_msgsnd'
19985 d_msync='$d_msync'
19986 d_munmap='$d_munmap'
19987 d_mymalloc='$d_mymalloc'
19988 d_nice='$d_nice'
19989 d_nl_langinfo='$d_nl_langinfo'
19990 d_nv_preserves_uv='$d_nv_preserves_uv'
19991 d_off64_t='$d_off64_t'
19992 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19993 d_oldpthreads='$d_oldpthreads'
19994 d_oldsock='$d_oldsock'
19995 d_open3='$d_open3'
19996 d_pathconf='$d_pathconf'
19997 d_pause='$d_pause'
19998 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19999 d_phostname='$d_phostname'
20000 d_pipe='$d_pipe'
20001 d_poll='$d_poll'
20002 d_portable='$d_portable'
20003 d_procselfexe='$d_procselfexe'
20004 d_pthread_atfork='$d_pthread_atfork'
20005 d_pthread_yield='$d_pthread_yield'
20006 d_pwage='$d_pwage'
20007 d_pwchange='$d_pwchange'
20008 d_pwclass='$d_pwclass'
20009 d_pwcomment='$d_pwcomment'
20010 d_pwexpire='$d_pwexpire'
20011 d_pwgecos='$d_pwgecos'
20012 d_pwpasswd='$d_pwpasswd'
20013 d_pwquota='$d_pwquota'
20014 d_qgcvt='$d_qgcvt'
20015 d_quad='$d_quad'
20016 d_random_r='$d_random_r'
20017 d_readdir64_r='$d_readdir64_r'
20018 d_readdir='$d_readdir'
20019 d_readdir_r='$d_readdir_r'
20020 d_readlink='$d_readlink'
20021 d_readv='$d_readv'
20022 d_recvmsg='$d_recvmsg'
20023 d_rename='$d_rename'
20024 d_rewinddir='$d_rewinddir'
20025 d_rmdir='$d_rmdir'
20026 d_safebcpy='$d_safebcpy'
20027 d_safemcpy='$d_safemcpy'
20028 d_sanemcmp='$d_sanemcmp'
20029 d_sbrkproto='$d_sbrkproto'
20030 d_sched_yield='$d_sched_yield'
20031 d_scm_rights='$d_scm_rights'
20032 d_seekdir='$d_seekdir'
20033 d_select='$d_select'
20034 d_sem='$d_sem'
20035 d_semctl='$d_semctl'
20036 d_semctl_semid_ds='$d_semctl_semid_ds'
20037 d_semctl_semun='$d_semctl_semun'
20038 d_semget='$d_semget'
20039 d_semop='$d_semop'
20040 d_sendmsg='$d_sendmsg'
20041 d_setegid='$d_setegid'
20042 d_seteuid='$d_seteuid'
20043 d_setgrent='$d_setgrent'
20044 d_setgrent_r='$d_setgrent_r'
20045 d_setgrps='$d_setgrps'
20046 d_sethent='$d_sethent'
20047 d_sethostent_r='$d_sethostent_r'
20048 d_setitimer='$d_setitimer'
20049 d_setlinebuf='$d_setlinebuf'
20050 d_setlocale='$d_setlocale'
20051 d_setlocale_r='$d_setlocale_r'
20052 d_setnent='$d_setnent'
20053 d_setnetent_r='$d_setnetent_r'
20054 d_setpent='$d_setpent'
20055 d_setpgid='$d_setpgid'
20056 d_setpgrp2='$d_setpgrp2'
20057 d_setpgrp='$d_setpgrp'
20058 d_setprior='$d_setprior'
20059 d_setproctitle='$d_setproctitle'
20060 d_setprotoent_r='$d_setprotoent_r'
20061 d_setpwent='$d_setpwent'
20062 d_setpwent_r='$d_setpwent_r'
20063 d_setregid='$d_setregid'
20064 d_setresgid='$d_setresgid'
20065 d_setresuid='$d_setresuid'
20066 d_setreuid='$d_setreuid'
20067 d_setrgid='$d_setrgid'
20068 d_setruid='$d_setruid'
20069 d_setsent='$d_setsent'
20070 d_setservent_r='$d_setservent_r'
20071 d_setsid='$d_setsid'
20072 d_setvbuf='$d_setvbuf'
20073 d_sfio='$d_sfio'
20074 d_shm='$d_shm'
20075 d_shmat='$d_shmat'
20076 d_shmatprototype='$d_shmatprototype'
20077 d_shmctl='$d_shmctl'
20078 d_shmdt='$d_shmdt'
20079 d_shmget='$d_shmget'
20080 d_sigaction='$d_sigaction'
20081 d_sigprocmask='$d_sigprocmask'
20082 d_sigsetjmp='$d_sigsetjmp'
20083 d_sockatmark='$d_sockatmark'
20084 d_sockatmarkproto='$d_sockatmarkproto'
20085 d_socket='$d_socket'
20086 d_socklen_t='$d_socklen_t'
20087 d_sockpair='$d_sockpair'
20088 d_socks5_init='$d_socks5_init'
20089 d_sqrtl='$d_sqrtl'
20090 d_srand48_r='$d_srand48_r'
20091 d_srandom_r='$d_srandom_r'
20092 d_sresgproto='$d_sresgproto'
20093 d_sresuproto='$d_sresuproto'
20094 d_statblks='$d_statblks'
20095 d_statfs_f_flags='$d_statfs_f_flags'
20096 d_statfs_s='$d_statfs_s'
20097 d_statvfs='$d_statvfs'
20098 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20099 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20100 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20101 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20102 d_stdio_stream_array='$d_stdio_stream_array'
20103 d_stdiobase='$d_stdiobase'
20104 d_stdstdio='$d_stdstdio'
20105 d_strchr='$d_strchr'
20106 d_strcoll='$d_strcoll'
20107 d_strctcpy='$d_strctcpy'
20108 d_strerrm='$d_strerrm'
20109 d_strerror='$d_strerror'
20110 d_strerror_r='$d_strerror_r'
20111 d_strftime='$d_strftime'
20112 d_strtod='$d_strtod'
20113 d_strtol='$d_strtol'
20114 d_strtold='$d_strtold'
20115 d_strtoll='$d_strtoll'
20116 d_strtoq='$d_strtoq'
20117 d_strtoul='$d_strtoul'
20118 d_strtoull='$d_strtoull'
20119 d_strtouq='$d_strtouq'
20120 d_strxfrm='$d_strxfrm'
20121 d_suidsafe='$d_suidsafe'
20122 d_symlink='$d_symlink'
20123 d_syscall='$d_syscall'
20124 d_syscallproto='$d_syscallproto'
20125 d_sysconf='$d_sysconf'
20126 d_sysernlst='$d_sysernlst'
20127 d_syserrlst='$d_syserrlst'
20128 d_system='$d_system'
20129 d_tcgetpgrp='$d_tcgetpgrp'
20130 d_tcsetpgrp='$d_tcsetpgrp'
20131 d_telldir='$d_telldir'
20132 d_telldirproto='$d_telldirproto'
20133 d_time='$d_time'
20134 d_times='$d_times'
20135 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20136 d_tm_tm_zone='$d_tm_tm_zone'
20137 d_tmpnam_r='$d_tmpnam_r'
20138 d_truncate='$d_truncate'
20139 d_ttyname_r='$d_ttyname_r'
20140 d_tzname='$d_tzname'
20141 d_u32align='$d_u32align'
20142 d_ualarm='$d_ualarm'
20143 d_umask='$d_umask'
20144 d_uname='$d_uname'
20145 d_union_semun='$d_union_semun'
20146 d_unordered='$d_unordered'
20147 d_usleep='$d_usleep'
20148 d_usleepproto='$d_usleepproto'
20149 d_ustat='$d_ustat'
20150 d_vendorarch='$d_vendorarch'
20151 d_vendorbin='$d_vendorbin'
20152 d_vendorlib='$d_vendorlib'
20153 d_vfork='$d_vfork'
20154 d_void_closedir='$d_void_closedir'
20155 d_voidsig='$d_voidsig'
20156 d_voidtty='$d_voidtty'
20157 d_volatile='$d_volatile'
20158 d_vprintf='$d_vprintf'
20159 d_wait4='$d_wait4'
20160 d_waitpid='$d_waitpid'
20161 d_wcstombs='$d_wcstombs'
20162 d_wctomb='$d_wctomb'
20163 d_writev='$d_writev'
20164 d_xenix='$d_xenix'
20165 date='$date'
20166 db_hashtype='$db_hashtype'
20167 db_prefixtype='$db_prefixtype'
20168 db_version_major='$db_version_major'
20169 db_version_minor='$db_version_minor'
20170 db_version_patch='$db_version_patch'
20171 defvoidused='$defvoidused'
20172 direntrytype='$direntrytype'
20173 dlext='$dlext'
20174 dlsrc='$dlsrc'
20175 doublesize='$doublesize'
20176 drand01='$drand01'
20177 drand48_r_proto='$drand48_r_proto'
20178 dynamic_ext='$dynamic_ext'
20179 eagain='$eagain'
20180 ebcdic='$ebcdic'
20181 echo='$echo'
20182 egrep='$egrep'
20183 emacs='$emacs'
20184 endgrent_r_proto='$endgrent_r_proto'
20185 endhostent_r_proto='$endhostent_r_proto'
20186 endnetent_r_proto='$endnetent_r_proto'
20187 endprotoent_r_proto='$endprotoent_r_proto'
20188 endpwent_r_proto='$endpwent_r_proto'
20189 endservent_r_proto='$endservent_r_proto'
20190 eunicefix='$eunicefix'
20191 exe_ext='$exe_ext'
20192 expr='$expr'
20193 extensions='$extensions'
20194 extras='$extras'
20195 fflushNULL='$fflushNULL'
20196 fflushall='$fflushall'
20197 find='$find'
20198 firstmakefile='$firstmakefile'
20199 flex='$flex'
20200 fpossize='$fpossize'
20201 fpostype='$fpostype'
20202 freetype='$freetype'
20203 from='$from'
20204 full_ar='$full_ar'
20205 full_csh='$full_csh'
20206 full_sed='$full_sed'
20207 gccosandvers='$gccosandvers'
20208 gccversion='$gccversion'
20209 getgrent_r_proto='$getgrent_r_proto'
20210 getgrgid_r_proto='$getgrgid_r_proto'
20211 getgrnam_r_proto='$getgrnam_r_proto'
20212 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20213 gethostbyname_r_proto='$gethostbyname_r_proto'
20214 gethostent_r_proto='$gethostent_r_proto'
20215 getlogin_r_proto='$getlogin_r_proto'
20216 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20217 getnetbyname_r_proto='$getnetbyname_r_proto'
20218 getnetent_r_proto='$getnetent_r_proto'
20219 getprotobyname_r_proto='$getprotobyname_r_proto'
20220 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20221 getprotoent_r_proto='$getprotoent_r_proto'
20222 getpwent_r_proto='$getpwent_r_proto'
20223 getpwnam_r_proto='$getpwnam_r_proto'
20224 getpwuid_r_proto='$getpwuid_r_proto'
20225 getservbyname_r_proto='$getservbyname_r_proto'
20226 getservbyport_r_proto='$getservbyport_r_proto'
20227 getservent_r_proto='$getservent_r_proto'
20228 getspnam_r_proto='$getspnam_r_proto'
20229 gidformat='$gidformat'
20230 gidsign='$gidsign'
20231 gidsize='$gidsize'
20232 gidtype='$gidtype'
20233 glibpth='$glibpth'
20234 gmake='$gmake'
20235 gmtime_r_proto='$gmtime_r_proto'
20236 gnulibc_version='$gnulibc_version'
20237 grep='$grep'
20238 groupcat='$groupcat'
20239 groupstype='$groupstype'
20240 gzip='$gzip'
20241 h_fcntl='$h_fcntl'
20242 h_sysfile='$h_sysfile'
20243 hint='$hint'
20244 hostcat='$hostcat'
20245 i16size='$i16size'
20246 i16type='$i16type'
20247 i32size='$i32size'
20248 i32type='$i32type'
20249 i64size='$i64size'
20250 i64type='$i64type'
20251 i8size='$i8size'
20252 i8type='$i8type'
20253 i_arpainet='$i_arpainet'
20254 i_bsdioctl='$i_bsdioctl'
20255 i_crypt='$i_crypt'
20256 i_db='$i_db'
20257 i_dbm='$i_dbm'
20258 i_dirent='$i_dirent'
20259 i_dld='$i_dld'
20260 i_dlfcn='$i_dlfcn'
20261 i_fcntl='$i_fcntl'
20262 i_float='$i_float'
20263 i_fp='$i_fp'
20264 i_fp_class='$i_fp_class'
20265 i_gdbm='$i_gdbm'
20266 i_grp='$i_grp'
20267 i_ieeefp='$i_ieeefp'
20268 i_inttypes='$i_inttypes'
20269 i_langinfo='$i_langinfo'
20270 i_libutil='$i_libutil'
20271 i_limits='$i_limits'
20272 i_locale='$i_locale'
20273 i_machcthr='$i_machcthr'
20274 i_malloc='$i_malloc'
20275 i_math='$i_math'
20276 i_memory='$i_memory'
20277 i_mntent='$i_mntent'
20278 i_ndbm='$i_ndbm'
20279 i_netdb='$i_netdb'
20280 i_neterrno='$i_neterrno'
20281 i_netinettcp='$i_netinettcp'
20282 i_niin='$i_niin'
20283 i_poll='$i_poll'
20284 i_prot='$i_prot'
20285 i_pthread='$i_pthread'
20286 i_pwd='$i_pwd'
20287 i_rpcsvcdbm='$i_rpcsvcdbm'
20288 i_sfio='$i_sfio'
20289 i_sgtty='$i_sgtty'
20290 i_shadow='$i_shadow'
20291 i_socks='$i_socks'
20292 i_stdarg='$i_stdarg'
20293 i_stddef='$i_stddef'
20294 i_stdlib='$i_stdlib'
20295 i_string='$i_string'
20296 i_sunmath='$i_sunmath'
20297 i_sysaccess='$i_sysaccess'
20298 i_sysdir='$i_sysdir'
20299 i_sysfile='$i_sysfile'
20300 i_sysfilio='$i_sysfilio'
20301 i_sysin='$i_sysin'
20302 i_sysioctl='$i_sysioctl'
20303 i_syslog='$i_syslog'
20304 i_sysmman='$i_sysmman'
20305 i_sysmode='$i_sysmode'
20306 i_sysmount='$i_sysmount'
20307 i_sysndir='$i_sysndir'
20308 i_sysparam='$i_sysparam'
20309 i_sysresrc='$i_sysresrc'
20310 i_syssecrt='$i_syssecrt'
20311 i_sysselct='$i_sysselct'
20312 i_syssockio='$i_syssockio'
20313 i_sysstat='$i_sysstat'
20314 i_sysstatfs='$i_sysstatfs'
20315 i_sysstatvfs='$i_sysstatvfs'
20316 i_systime='$i_systime'
20317 i_systimek='$i_systimek'
20318 i_systimes='$i_systimes'
20319 i_systypes='$i_systypes'
20320 i_sysuio='$i_sysuio'
20321 i_sysun='$i_sysun'
20322 i_sysutsname='$i_sysutsname'
20323 i_sysvfs='$i_sysvfs'
20324 i_syswait='$i_syswait'
20325 i_termio='$i_termio'
20326 i_termios='$i_termios'
20327 i_time='$i_time'
20328 i_unistd='$i_unistd'
20329 i_ustat='$i_ustat'
20330 i_utime='$i_utime'
20331 i_values='$i_values'
20332 i_varargs='$i_varargs'
20333 i_varhdr='$i_varhdr'
20334 i_vfork='$i_vfork'
20335 ignore_versioned_solibs='$ignore_versioned_solibs'
20336 inc_version_list='$inc_version_list'
20337 inc_version_list_init='$inc_version_list_init'
20338 incpath='$incpath'
20339 inews='$inews'
20340 installarchlib='$installarchlib'
20341 installbin='$installbin'
20342 installman1dir='$installman1dir'
20343 installman3dir='$installman3dir'
20344 installprefix='$installprefix'
20345 installprefixexp='$installprefixexp'
20346 installprivlib='$installprivlib'
20347 installscript='$installscript'
20348 installsitearch='$installsitearch'
20349 installsitebin='$installsitebin'
20350 installsitelib='$installsitelib'
20351 installstyle='$installstyle'
20352 installusrbinperl='$installusrbinperl'
20353 installvendorarch='$installvendorarch'
20354 installvendorbin='$installvendorbin'
20355 installvendorlib='$installvendorlib'
20356 intsize='$intsize'
20357 issymlink='$issymlink'
20358 ivdformat='$ivdformat'
20359 ivsize='$ivsize'
20360 ivtype='$ivtype'
20361 known_extensions='$known_extensions'
20362 ksh='$ksh'
20363 ld='$ld'
20364 lddlflags='$lddlflags'
20365 ldflags='$ldflags'
20366 ldflags_uselargefiles='$ldflags_uselargefiles'
20367 ldlibpthname='$ldlibpthname'
20368 less='$less'
20369 lib_ext='$lib_ext'
20370 libc='$libc'
20371 libperl='$libperl'
20372 libpth='$libpth'
20373 libs='$libs'
20374 libsdirs='$libsdirs'
20375 libsfiles='$libsfiles'
20376 libsfound='$libsfound'
20377 libspath='$libspath'
20378 libswanted='$libswanted'
20379 libswanted_uselargefiles='$libswanted_uselargefiles'
20380 line='$line'
20381 lint='$lint'
20382 lkflags='$lkflags'
20383 ln='$ln'
20384 lns='$lns'
20385 localtime_r_proto='$localtime_r_proto'
20386 locincpth='$locincpth'
20387 loclibpth='$loclibpth'
20388 longdblsize='$longdblsize'
20389 longlongsize='$longlongsize'
20390 longsize='$longsize'
20391 lp='$lp'
20392 lpr='$lpr'
20393 ls='$ls'
20394 lseeksize='$lseeksize'
20395 lseektype='$lseektype'
20396 mail='$mail'
20397 mailx='$mailx'
20398 make='$make'
20399 make_set_make='$make_set_make'
20400 mallocobj='$mallocobj'
20401 mallocsrc='$mallocsrc'
20402 malloctype='$malloctype'
20403 man1dir='$man1dir'
20404 man1direxp='$man1direxp'
20405 man1ext='$man1ext'
20406 man3dir='$man3dir'
20407 man3direxp='$man3direxp'
20408 man3ext='$man3ext'
20409 mips_type='$mips_type'
20410 mkdir='$mkdir'
20411 mmaptype='$mmaptype'
20412 modetype='$modetype'
20413 more='$more'
20414 multiarch='$multiarch'
20415 mv='$mv'
20416 myarchname='$myarchname'
20417 mydomain='$mydomain'
20418 myhostname='$myhostname'
20419 myuname='$myuname'
20420 n='$n'
20421 need_va_copy='$need_va_copy'
20422 netdb_hlen_type='$netdb_hlen_type'
20423 netdb_host_type='$netdb_host_type'
20424 netdb_name_type='$netdb_name_type'
20425 netdb_net_type='$netdb_net_type'
20426 nm='$nm'
20427 nm_opt='$nm_opt'
20428 nm_so_opt='$nm_so_opt'
20429 nonxs_ext='$nonxs_ext'
20430 nroff='$nroff'
20431 nvEUformat='$nvEUformat'
20432 nvFUformat='$nvFUformat'
20433 nvGUformat='$nvGUformat'
20434 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20435 nveformat='$nveformat'
20436 nvfformat='$nvfformat'
20437 nvgformat='$nvgformat'
20438 nvsize='$nvsize'
20439 nvtype='$nvtype'
20440 o_nonblock='$o_nonblock'
20441 obj_ext='$obj_ext'
20442 old_pthread_create_joinable='$old_pthread_create_joinable'
20443 optimize='$optimize'
20444 orderlib='$orderlib'
20445 osname='$osname'
20446 osvers='$osvers'
20447 otherlibdirs='$otherlibdirs'
20448 package='$package'
20449 pager='$pager'
20450 passcat='$passcat'
20451 patchlevel='$patchlevel'
20452 path_sep='$path_sep'
20453 perl5='$perl5'
20454 perl='$perl'
20455 perl_patchlevel='$perl_patchlevel'
20456 perladmin='$perladmin'
20457 perllibs='$perllibs'
20458 perlpath='$perlpath'
20459 pg='$pg'
20460 phostname='$phostname'
20461 pidtype='$pidtype'
20462 plibpth='$plibpth'
20463 pm_apiversion='$pm_apiversion'
20464 pmake='$pmake'
20465 pr='$pr'
20466 prefix='$prefix'
20467 prefixexp='$prefixexp'
20468 privlib='$privlib'
20469 privlibexp='$privlibexp'
20470 procselfexe='$procselfexe'
20471 prototype='$prototype'
20472 ptrsize='$ptrsize'
20473 quadkind='$quadkind'
20474 quadtype='$quadtype'
20475 randbits='$randbits'
20476 randfunc='$randfunc'
20477 random_r_proto='$random_r_proto'
20478 randseedtype='$randseedtype'
20479 ranlib='$ranlib'
20480 rd_nodata='$rd_nodata'
20481 readdir64_r_proto='$readdir64_r_proto'
20482 readdir_r_proto='$readdir_r_proto'
20483 revision='$revision'
20484 rm='$rm'
20485 rmail='$rmail'
20486 run='$run'
20487 runnm='$runnm'
20488 sPRIEUldbl='$sPRIEUldbl'
20489 sPRIFUldbl='$sPRIFUldbl'
20490 sPRIGUldbl='$sPRIGUldbl'
20491 sPRIXU64='$sPRIXU64'
20492 sPRId64='$sPRId64'
20493 sPRIeldbl='$sPRIeldbl'
20494 sPRIfldbl='$sPRIfldbl'
20495 sPRIgldbl='$sPRIgldbl'
20496 sPRIi64='$sPRIi64'
20497 sPRIo64='$sPRIo64'
20498 sPRIu64='$sPRIu64'
20499 sPRIx64='$sPRIx64'
20500 sSCNfldbl='$sSCNfldbl'
20501 sched_yield='$sched_yield'
20502 scriptdir='$scriptdir'
20503 scriptdirexp='$scriptdirexp'
20504 sed='$sed'
20505 seedfunc='$seedfunc'
20506 selectminbits='$selectminbits'
20507 selecttype='$selecttype'
20508 sendmail='$sendmail'
20509 setgrent_r_proto='$setgrent_r_proto'
20510 sethostent_r_proto='$sethostent_r_proto'
20511 setlocale_r_proto='$setlocale_r_proto'
20512 setnetent_r_proto='$setnetent_r_proto'
20513 setprotoent_r_proto='$setprotoent_r_proto'
20514 setpwent_r_proto='$setpwent_r_proto'
20515 setservent_r_proto='$setservent_r_proto'
20516 sh='$sh'
20517 shar='$shar'
20518 sharpbang='$sharpbang'
20519 shmattype='$shmattype'
20520 shortsize='$shortsize'
20521 shrpenv='$shrpenv'
20522 shsharp='$shsharp'
20523 sig_count='$sig_count'
20524 sig_name='$sig_name'
20525 sig_name_init='$sig_name_init'
20526 sig_num='$sig_num'
20527 sig_num_init='$sig_num_init'
20528 sig_size='$sig_size'
20529 signal_t='$signal_t'
20530 sitearch='$sitearch'
20531 sitearchexp='$sitearchexp'
20532 sitebin='$sitebin'
20533 sitebinexp='$sitebinexp'
20534 sitelib='$sitelib'
20535 sitelib_stem='$sitelib_stem'
20536 sitelibexp='$sitelibexp'
20537 siteprefix='$siteprefix'
20538 siteprefixexp='$siteprefixexp'
20539 sizesize='$sizesize'
20540 sizetype='$sizetype'
20541 sleep='$sleep'
20542 smail='$smail'
20543 so='$so'
20544 sockethdr='$sockethdr'
20545 socketlib='$socketlib'
20546 socksizetype='$socksizetype'
20547 sort='$sort'
20548 spackage='$spackage'
20549 spitshell='$spitshell'
20550 srand48_r_proto='$srand48_r_proto'
20551 srandom_r_proto='$srandom_r_proto'
20552 src='$src'
20553 ssizetype='$ssizetype'
20554 startperl='$startperl'
20555 startsh='$startsh'
20556 static_ext='$static_ext'
20557 stdchar='$stdchar'
20558 stdio_base='$stdio_base'
20559 stdio_bufsiz='$stdio_bufsiz'
20560 stdio_cnt='$stdio_cnt'
20561 stdio_filbuf='$stdio_filbuf'
20562 stdio_ptr='$stdio_ptr'
20563 stdio_stream_array='$stdio_stream_array'
20564 strerror_r_proto='$strerror_r_proto'
20565 strings='$strings'
20566 submit='$submit'
20567 subversion='$subversion'
20568 sysman='$sysman'
20569 tail='$tail'
20570 tar='$tar'
20571 targetarch='$targetarch'
20572 tbl='$tbl'
20573 tee='$tee'
20574 test='$test'
20575 timeincl='$timeincl'
20576 timetype='$timetype'
20577 tmpnam_r_proto='$tmpnam_r_proto'
20578 to='$to'
20579 touch='$touch'
20580 tr='$tr'
20581 trnl='$trnl'
20582 troff='$troff'
20583 ttyname_r_proto='$ttyname_r_proto'
20584 u16size='$u16size'
20585 u16type='$u16type'
20586 u32size='$u32size'
20587 u32type='$u32type'
20588 u64size='$u64size'
20589 u64type='$u64type'
20590 u8size='$u8size'
20591 u8type='$u8type'
20592 uidformat='$uidformat'
20593 uidsign='$uidsign'
20594 uidsize='$uidsize'
20595 uidtype='$uidtype'
20596 uname='$uname'
20597 uniq='$uniq'
20598 uquadtype='$uquadtype'
20599 use5005threads='$use5005threads'
20600 use64bitall='$use64bitall'
20601 use64bitint='$use64bitint'
20602 usecrosscompile='$usecrosscompile'
20603 usedl='$usedl'
20604 useithreads='$useithreads'
20605 uselargefiles='$uselargefiles'
20606 uselongdouble='$uselongdouble'
20607 usemorebits='$usemorebits'
20608 usemultiplicity='$usemultiplicity'
20609 usemymalloc='$usemymalloc'
20610 usenm='$usenm'
20611 useopcode='$useopcode'
20612 useperlio='$useperlio'
20613 useposix='$useposix'
20614 usereentrant='$usereentrant'
20615 usesfio='$usesfio'
20616 useshrplib='$useshrplib'
20617 usesocks='$usesocks'
20618 usethreads='$usethreads'
20619 usevendorprefix='$usevendorprefix'
20620 usevfork='$usevfork'
20621 usrinc='$usrinc'
20622 uuname='$uuname'
20623 uvXUformat='$uvXUformat'
20624 uvoformat='$uvoformat'
20625 uvsize='$uvsize'
20626 uvtype='$uvtype'
20627 uvuformat='$uvuformat'
20628 uvxformat='$uvxformat'
20629 vendorarch='$vendorarch'
20630 vendorarchexp='$vendorarchexp'
20631 vendorbin='$vendorbin'
20632 vendorbinexp='$vendorbinexp'
20633 vendorlib='$vendorlib'
20634 vendorlib_stem='$vendorlib_stem'
20635 vendorlibexp='$vendorlibexp'
20636 vendorprefix='$vendorprefix'
20637 vendorprefixexp='$vendorprefixexp'
20638 version='$version'
20639 version_patchlevel_string='$version_patchlevel_string'
20640 versiononly='$versiononly'
20641 vi='$vi'
20642 voidflags='$voidflags'
20643 xlibpth='$xlibpth'
20644 xs_apiversion='$xs_apiversion'
20645 gccansipedantic='$gccansipedantic'
20646 yacc='$yacc'
20647 yaccflags='$yaccflags'
20648 zcat='$zcat'
20649 zip='$zip'
20650 EOT
20651
20652 : Add in command line options if available
20653 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20654
20655 : add special variables
20656 $test -f $src/patchlevel.h && \
20657 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20658 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20659 echo "PERL_CONFIG_SH=true" >>config.sh
20660
20661 : propagate old symbols
20662 if $test -f UU/config.sh; then
20663         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20664         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20665         $sort | $uniq -u >UU/oldsyms
20666         set X `cat UU/oldsyms`
20667         shift
20668         case $# in
20669         0) ;;
20670         *)
20671                 cat <<EOM
20672 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20673 EOM
20674                 echo "# Variables propagated from previous config.sh file." >>config.sh
20675                 for sym in `cat UU/oldsyms`; do
20676                         echo "    Propagating $hint variable "'$'"$sym..."
20677                         eval 'tmp="$'"${sym}"'"'
20678                         echo "$tmp" | \
20679                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20680                 done
20681                 ;;
20682         esac
20683 fi
20684
20685 : Finish up by extracting the .SH files
20686 case "$alldone" in
20687 exit)
20688         $rm -rf UU
20689         echo "Extraction done."
20690         exit 0
20691         ;;
20692 cont)
20693         ;;
20694 '')
20695         dflt=''
20696         nostick=true
20697         $cat <<EOM
20698
20699 If you'd like to make any changes to the config.sh file before I begin
20700 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20701
20702 EOM
20703         rp="Press return or use a shell escape to edit config.sh:"
20704         . UU/myread
20705         nostick=''
20706         case "$ans" in
20707         '') ;;
20708         *) : in case they cannot read
20709                 sh 1>&4 -c "$ans";;
20710         esac
20711         ;;
20712 esac
20713
20714 : if this fails, just run all the .SH files by hand
20715 . ./config.sh
20716
20717 echo " "
20718 exec 1>&4
20719 pwd=`pwd`
20720 . ./UU/extract
20721 cd "$pwd"
20722
20723 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20724         dflt=y
20725         case "$silent" in
20726         true) ;;
20727         *)
20728                 $cat <<EOM
20729
20730 Now you need to generate make dependencies by running "$make depend".
20731 You might prefer to run it in background: "$make depend > makedepend.out &"
20732 It can take a while, so you might not want to run it right now.
20733
20734 EOM
20735                 ;;
20736         esac
20737         rp="Run $make depend now?"
20738         . UU/myread
20739         case "$ans" in
20740         y*)
20741                 $make depend && echo "Now you must run '$make'."
20742                 ;;
20743         *)
20744                 echo "You must run '$make depend' then '$make'."
20745                 ;;
20746         esac
20747 elif test -f [Mm]akefile; then
20748         echo " "
20749         echo "Now you must run a $make."
20750 else
20751         echo "Configure done."
20752 fi
20753
20754 if $test -f Policy.sh; then
20755     $cat <<EOM
20756
20757 If you compile $package on a different machine or from a different object
20758 directory, copy the Policy.sh file from this object directory to the
20759 new one before you run Configure -- this will help you with most of
20760 the policy defaults.
20761
20762 EOM
20763 fi
20764 if $test -f config.msg; then
20765     echo "Hmm.  I also noted the following information while running:"
20766     echo " "
20767     $cat config.msg >&4
20768     $rm -f config.msg
20769 fi
20770 $rm -f kit*isdone ark*isdone
20771 $rm -rf UU
20772
20773 : End of Configure
20774