Re: [REVISED PATCH] Magic v-strings
[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                 else
2158                         : on Eunice apparently
2159                         echo \$dir/\$thing
2160                 fi
2161                 exit 0
2162         fi
2163         ;;
2164         esac
2165 done
2166 echo \$dflt
2167 exit 1
2168 EOSC
2169 chmod +x loc
2170 $eunicefix loc
2171 loclist="
2172 awk
2173 cat
2174 chmod
2175 comm
2176 cp
2177 echo
2178 expr
2179 grep
2180 ls
2181 mkdir
2182 rm
2183 sed
2184 sort
2185 touch
2186 tr
2187 uniq
2188 "
2189 trylist="
2190 Mcc
2191 ar
2192 bison
2193 byacc
2194 cpp
2195 csh
2196 date
2197 egrep
2198 gmake
2199 gzip
2200 less
2201 ln
2202 make
2203 more
2204 nm
2205 nroff
2206 pg
2207 test
2208 uname
2209 zip
2210 "
2211 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2212 pth="$pth /lib /usr/lib"
2213 for file in $loclist; do
2214         eval xxx=\$$file
2215         case "$xxx" in
2216         /*|?:[\\/]*)
2217                 if test -f "$xxx"; then
2218                         : ok
2219                 else
2220                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2221                         xxx=`./loc $file $file $pth`
2222                 fi
2223                 ;;
2224         '') xxx=`./loc $file $file $pth`;;
2225         *) xxx=`./loc $xxx $xxx $pth`;;
2226         esac
2227         eval $file=$xxx$_exe
2228         eval _$file=$xxx
2229         case "$xxx" in
2230         /*)
2231                 echo $file is in $xxx.
2232                 ;;
2233         ?:[\\/]*)
2234                 echo $file is in $xxx.
2235                 ;;
2236         *)
2237                 echo "I don't know where '$file' is, and my life depends on it." >&4
2238                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2239                 exit 1
2240                 ;;
2241         esac
2242 done
2243 echo " "
2244 echo "Don't worry if any of the following aren't found..."
2245 say=offhand
2246 for file in $trylist; do
2247         eval xxx=\$$file
2248         case "$xxx" in
2249         /*|?:[\\/]*)
2250                 if test -f "$xxx"; then
2251                         : ok
2252                 else
2253                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2254                         xxx=`./loc $file $file $pth`
2255                 fi
2256                 ;;
2257         '') xxx=`./loc $file $file $pth`;;
2258         *) xxx=`./loc $xxx $xxx $pth`;;
2259         esac
2260         eval $file=$xxx$_exe
2261         eval _$file=$xxx
2262         case "$xxx" in
2263         /*)
2264                 echo $file is in $xxx.
2265                 ;;
2266         ?:[\\/]*)
2267                 echo $file is in $xxx.
2268                 ;;
2269         *)
2270                 echo "I don't see $file out there, $say."
2271                 say=either
2272                 ;;
2273         esac
2274 done
2275 case "$egrep" in
2276 egrep)
2277         echo "Substituting grep for egrep."
2278         egrep=$grep
2279         _egrep=$grep
2280         ;;
2281 esac
2282 case "$ln" in
2283 ln)
2284         echo "Substituting cp for ln."
2285         ln=$cp
2286         _ln=$cp
2287         ;;
2288 esac
2289 case "$make" in
2290 make)   
2291         case "$gmake" in
2292         gmake)
2293         echo "I can't find make or gmake, and my life depends on it." >&4
2294         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2295         exit 1
2296         ;;
2297         esac
2298         ;;
2299 esac    
2300 case "$gmake" in
2301 gmake)  ;;
2302 *)      # We can't have osname yet.
2303         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2304                 # Assume that gmake, if found, is definitely GNU make
2305                 # and prefer it over the system make.
2306                 echo "Substituting gmake for make."
2307                 make=$gmake
2308                 _make=$gmake
2309         fi
2310         ;;
2311 esac
2312 case "$test" in
2313 test)
2314         echo "Hopefully test is built into your sh."
2315         ;;
2316 *)
2317         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2318                 echo "Using the test built into your sh."
2319                 test=test
2320                 _test=test
2321         fi
2322         ;;
2323 esac
2324 case "$echo" in
2325 echo)
2326         echo "Hopefully echo is built into your sh."
2327         ;;
2328 '') ;;
2329 *)
2330         echo " "
2331 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2332         $echo $n "hi there$c" >foo1
2333         echo $n "hi there$c" >foo2
2334         if cmp foo1 foo2 >/dev/null 2>&1; then
2335                 echo "They are compatible.  In fact, they may be identical."
2336         else
2337                 case "$n" in
2338                 '-n') n='' c='\c';;
2339                 *) n='-n' c='';;
2340                 esac
2341                 cat <<FOO
2342 They are not compatible!  You are probably running ksh on a non-USG system.
2343 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2344 have echo built in and we may have to run some Bourne shell scripts.  That
2345 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2346
2347 FOO
2348                 $echo $n "The star should be here-->$c"
2349                 $echo "*"
2350         fi
2351         $rm -f foo1 foo2
2352         ;;
2353 esac
2354
2355 cat <<EOS >trygcc
2356 $startsh
2357 EOS
2358 cat <<'EOSC' >>trygcc
2359 case "$cc" in
2360 '') ;;
2361 *)  $rm -f try try.*
2362     $cat >try.c <<EOM
2363 int main(int argc, char *argv[]) {
2364   return 0;
2365 }
2366 EOM
2367     if $cc -o try $ccflags $ldflags try.c; then
2368        :
2369     else
2370         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2371         despair=yes
2372         trygcc=yes
2373         case "$cc" in
2374         *gcc*) trygcc=no ;;
2375         esac
2376         case "`$cc -v -c try.c 2>&1`" in
2377         *gcc*) trygcc=no ;;
2378         esac
2379         if $test X"$trygcc" = Xyes; then
2380             if gcc -o try -c try.c; then
2381                 echo " "
2382                 echo "You seem to have a working gcc, though." >&4
2383                 rp="Would you like to use it?"
2384                 dflt=y
2385                 if $test -f myread; then
2386                     . ./myread
2387                 else
2388                     if $test -f UU/myread; then
2389                         . ./UU/myread
2390                     else
2391                         echo "Cannot find myread, sorry.  Aborting." >&2
2392                         exit 1
2393                     fi
2394                 fi  
2395                 case "$ans" in
2396                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2397                        if $test -f usethreads.cbu; then
2398                            $cat >&4 <<EOM 
2399
2400 *** However, any setting of the C compiler flags (e.g. for thread support)
2401 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2402 *** (together with e.g. -Dusethreads).
2403
2404 EOM
2405                        fi;;
2406                 esac
2407             fi
2408         fi
2409     fi
2410     $rm -f try try.*
2411     ;;
2412 esac
2413 EOSC
2414
2415 cat <<EOS >checkcc
2416 $startsh
2417 EOS
2418 cat <<'EOSC' >>checkcc
2419 case "$cc" in        
2420 '') ;;
2421 *)  $rm -f try try.*              
2422     $cat >try.c <<EOM
2423 int main(int argc, char *argv[]) {
2424   return 0;
2425 }
2426 EOM
2427     if $cc -o try $ccflags $ldflags try.c; then
2428        :
2429     else
2430         if $test X"$despair" = Xyes; then
2431            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2432         fi
2433         $cat >&4 <<EOM         
2434 You need to find a working C compiler.
2435 Either (purchase and) install the C compiler supplied by your OS vendor,
2436 or for a free C compiler try http://gcc.gnu.org/
2437 I cannot continue any further, aborting.
2438 EOM
2439         exit 1
2440     fi
2441     $rm -f try try.*
2442     ;;
2443 esac
2444 EOSC
2445
2446 : determine whether symbolic links are supported
2447 echo " "
2448 $touch blurfl
2449 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2450         echo "Symbolic links are supported." >&4
2451         lns="$ln -s"
2452 else
2453         echo "Symbolic links are NOT supported." >&4
2454         lns="$ln"
2455 fi
2456 $rm -f blurfl sym
2457
2458 : determine whether symbolic links are supported
2459 echo " "
2460 case "$lns" in
2461 *"ln"*" -s")
2462         echo "Checking how to test for symbolic links..." >&4
2463         $lns blurfl sym
2464         if $test "X$issymlink" = X; then
2465                 case "$newsh" in
2466                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2467                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2468                 esac
2469                 if test $? = 0; then
2470                         issymlink="test -h"
2471                 else
2472                         echo "Your builtin 'test -h' may be broken." >&4
2473                         case "$test" in
2474                         /*)     ;;
2475                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2476                                 for p in $pth
2477                                 do
2478                                         if test -f "$p/$test"; then
2479                                                 test="$p/$test"
2480                                                 break
2481                                         fi
2482                                 done
2483                                 ;;
2484                         esac
2485                         case "$test" in
2486                         /*)
2487                                 echo "Trying external '$test -h'." >&4
2488                                 issymlink="$test -h"
2489                                 if $test ! -h sym >/dev/null 2>&1; then
2490                                         echo "External '$test -h' is broken, too." >&4
2491                                         issymlink=''
2492                                 fi
2493                                 ;;
2494                         *)      issymlink='' ;;
2495                         esac
2496                 fi              
2497         fi
2498         if $test "X$issymlink" = X; then
2499                 if $test -L sym 2>/dev/null; then
2500                         issymlink="$test -L"
2501                         echo "The builtin '$test -L' worked." >&4
2502                 fi
2503         fi
2504         if $test "X$issymlink" != X; then
2505                 echo "You can test for symbolic links with '$issymlink'." >&4
2506         else
2507                 echo "I do not know how you can test for symbolic links." >&4
2508         fi
2509         $rm -f blurfl sym
2510         ;;
2511 *)      echo "No symbolic links, so not testing for their testing..." >&4
2512         ;;
2513 esac
2514 echo " "
2515
2516
2517 case "$mksymlinks" in
2518 $define|true|[yY]*)
2519         case "$src" in
2520         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2521                 exit 1
2522                 ;;
2523         *)      case "$lns:$issymlink" in
2524                 *"ln"*" -s:"*"test -"?)
2525                         echo "Creating the symbolic links..." >&4
2526                         echo "(First creating the subdirectories...)" >&4
2527                         cd ..
2528                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2529                                 read directory
2530                                 test -z "$directory" && break
2531                                 mkdir -p $directory
2532                         done
2533                         # Sanity check 1.
2534                         if test ! -d t/base; then
2535                                 echo "Failed to create the subdirectories.  Aborting." >&4
2536                                 exit 1
2537                         fi
2538                         echo "(Then creating the symlinks...)" >&4
2539                         awk '{print $1}' $src/MANIFEST | while true; do
2540                                 read filename
2541                                 test -z "$filename" && break
2542                                 if test -f $filename; then
2543                                         if $issymlink $filename; then
2544                                                 rm -f $filename
2545                                         fi
2546                                 fi
2547                                 if test -f $filename; then
2548                                         echo "$filename already exists, not symlinking."
2549                                 else
2550                                         ln -s $src/$filename $filename
2551                                 fi
2552                         done
2553                         # Sanity check 2.
2554                         if test ! -f t/base/lex.t; then
2555                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2556                                 exit 1
2557                         fi
2558                         cd UU
2559                         ;;
2560                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2561                         ;;
2562                 esac
2563                 ;;
2564         esac
2565         ;;
2566 esac
2567
2568
2569 case "$usecrosscompile" in
2570 $define|true|[yY]*)
2571         $echo "Cross-compiling..."
2572         croak=''
2573         case "$cc" in
2574         *-*-gcc) # A cross-compiling gcc, probably.
2575             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2576             ar=$targetarch-ar
2577             # leave out ld, choosing it is more complex
2578             nm=$targetarch-nm
2579             ranlib=$targetarch-ranlib
2580             $echo 'extern int foo;' > try.c
2581             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2582             shift
2583             if $test $# -gt 0; then
2584                 incpth="$incpth $*"
2585                 incpth="`$echo $incpth|$sed 's/^ //'`"
2586                 echo "Guessing incpth '$incpth'." >&4
2587                 for i in $*; do
2588                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2589                     if $test -d $j; then
2590                         libpth="$libpth $j"
2591                     fi
2592                 done   
2593                 libpth="`$echo $libpth|$sed 's/^ //'`"
2594                 echo "Guessing libpth '$libpth'." >&4
2595             fi
2596             $rm -f try.c
2597             ;;
2598         esac
2599         case "$targetarch" in
2600         '') echo "Targetarch not defined." >&4; croak=y ;;
2601         *)  echo "Using targetarch $targetarch." >&4 ;;
2602         esac
2603         case "$incpth" in
2604         '') echo "Incpth not defined." >&4; croak=y ;;
2605         *)  echo "Using incpth '$incpth'." >&4 ;;
2606         esac
2607         case "$libpth" in
2608         '') echo "Libpth not defined." >&4; croak=y ;;
2609         *)  echo "Using libpth '$libpth'." >&4 ;;
2610         esac
2611         case "$usrinc" in
2612         '') for i in $incpth; do
2613                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2614                     usrinc=$i
2615                     echo "Guessing usrinc $usrinc." >&4
2616                     break
2617                 fi
2618             done
2619             case "$usrinc" in
2620             '') echo "Usrinc not defined." >&4; croak=y ;;
2621             esac
2622             ;;
2623         *)  echo "Using usrinc $usrinc." >&4 ;;
2624         esac
2625         case "$targethost" in
2626         '') echo "Targethost not defined." >&4; croak=y ;;
2627         *)  echo "Using targethost $targethost." >&4
2628         esac
2629         locincpth=' '
2630         loclibpth=' '
2631         case "$croak" in
2632         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2633         esac
2634         case "$src" in
2635         /*) run=$src/Cross/run
2636             targetmkdir=$src/Cross/mkdir
2637             to=$src/Cross/to
2638             from=$src/Cross/from
2639             ;;
2640         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2641             run=$pwd/Cross/run
2642             targetmkdir=$pwd/Cross/mkdir
2643             to=$pwd/Cross/to
2644             from=$pwd/Cross/from
2645             ;;
2646         esac
2647         case "$targetrun" in
2648         '') targetrun=ssh ;;
2649         esac
2650         case "$targetto" in
2651         '') targetto=scp ;;
2652         esac
2653         case "$targetfrom" in
2654         '') targetfrom=scp ;;
2655         esac
2656         run=$run-$targetrun
2657         to=$to-$targetto
2658         from=$from-$targetfrom
2659         case "$targetdir" in
2660         '')  targetdir=/tmp
2661              echo "Guessing targetdir $targetdir." >&4
2662              ;;
2663         esac
2664         case "$targetuser" in
2665         '')  targetuser=root
2666              echo "Guessing targetuser $targetuser." >&4
2667              ;;
2668         esac
2669         case "$targetfrom" in
2670         scp)    q=-q ;;
2671         *)      q='' ;;
2672         esac
2673         case "$targetrun" in
2674         ssh|rsh)
2675             cat >$run <<EOF
2676 #!/bin/sh
2677 case "\$1" in
2678 -cwd)
2679   shift
2680   cwd=\$1
2681   shift
2682   ;;
2683 esac
2684 case "\$cwd" in
2685 '') cwd=$targetdir ;;
2686 esac
2687 exe=\$1
2688 shift
2689 if $test ! -f \$exe.xok; then
2690   $to \$exe
2691   $touch \$exe.xok
2692 fi
2693 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2694 EOF
2695             ;;
2696         *)  echo "Unknown targetrun '$targetrun'" >&4
2697             exit 1
2698             ;;
2699         esac
2700         case "$targetmkdir" in
2701         */Cross/mkdir)
2702             cat >$targetmkdir <<EOF
2703 #!/bin/sh
2704 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2705 EOF
2706             $chmod a+rx $targetmkdir
2707             ;;
2708         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2709             exit 1
2710             ;;
2711         esac
2712         case "$targetto" in
2713         scp|rcp)
2714             cat >$to <<EOF
2715 #!/bin/sh
2716 for f in \$@
2717 do
2718   case "\$f" in
2719   /*)
2720     $targetmkdir \`dirname \$f\`
2721     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2722     ;;
2723   *)
2724     $targetmkdir $targetdir/\`dirname \$f\`
2725     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2726     ;;
2727   esac
2728 done
2729 exit 0
2730 EOF
2731             ;;
2732         cp) cat >$to <<EOF
2733 #!/bin/sh
2734 for f in \$@
2735 do
2736   case "\$f" in
2737   /*)
2738     $mkdir -p $targetdir/\`dirname \$f\`
2739     $cp \$f $targetdir/\$f || exit 1
2740     ;;
2741   *)
2742     $targetmkdir $targetdir/\`dirname \$f\`
2743     $cp \$f $targetdir/\$f || exit 1
2744     ;;
2745   esac
2746 done
2747 exit 0
2748 EOF
2749             ;;
2750         *)  echo "Unknown targetto '$targetto'" >&4
2751             exit 1
2752             ;;
2753         esac
2754         case "$targetfrom" in
2755         scp|rcp)
2756           cat >$from <<EOF
2757 #!/bin/sh
2758 for f in \$@
2759 do
2760   $rm -f \$f
2761   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2762 done
2763 exit 0
2764 EOF
2765             ;;
2766         cp) cat >$from <<EOF
2767 #!/bin/sh
2768 for f in \$@
2769 do
2770   $rm -f \$f
2771   cp $targetdir/\$f . || exit 1
2772 done
2773 exit 0
2774 EOF
2775             ;;
2776         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2777             exit 1
2778             ;;
2779         esac
2780         if $test ! -f $run; then
2781             echo "Target 'run' script '$run' not found." >&4
2782         else
2783             $chmod a+rx $run
2784         fi
2785         if $test ! -f $to; then
2786             echo "Target 'to' script '$to' not found." >&4
2787         else
2788             $chmod a+rx $to
2789         fi
2790         if $test ! -f $from; then
2791             echo "Target 'from' script '$from' not found." >&4
2792         else
2793             $chmod a+rx $from
2794         fi
2795         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2796             exit 1
2797         fi
2798         cat >&4 <<EOF
2799 Using '$run' for remote execution,
2800 and '$from' and '$to'
2801 for remote file transfer.
2802 EOF
2803         ;;
2804 *)      run=''
2805         to=:
2806         from=:
2807         usecrosscompile='undef'
2808         targetarch=''
2809         ;;
2810 esac
2811
2812 : see whether [:lower:] and [:upper:] are supported character classes
2813 echo " "
2814 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2815 ABYZ)
2816         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2817         up='[:upper:]'
2818         low='[:lower:]'
2819         ;;
2820 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2821         # (0xc9 and 0xd1), therefore that is a nice testing point.
2822         if test "X$up" = X -o "X$low" = X; then
2823             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2824             ij) up='[A-Z]'
2825                 low='[a-z]'
2826                 ;;
2827             esac
2828         fi
2829         if test "X$up" = X -o "X$low" = X; then
2830             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2831             ij) up='A-Z'
2832                 low='a-z'
2833                 ;;
2834             esac
2835         fi
2836         if test "X$up" = X -o "X$low" = X; then
2837             case "`echo IJ | od -x 2>/dev/null`" in
2838             *C9D1*|*c9d1*)
2839                 echo "Hey, this might be EBCDIC." >&4
2840                 if test "X$up" = X -o "X$low" = X; then
2841                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2842                     ij) up='[A-IJ-RS-Z]'
2843                         low='[a-ij-rs-z]'
2844                         ;;
2845                     esac
2846                 fi
2847                 if test "X$up" = X -o "X$low" = X; then
2848                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2849                     ij) up='A-IJ-RS-Z'
2850                         low='a-ij-rs-z'
2851                         ;;
2852                     esac
2853                 fi
2854                 ;;
2855             esac
2856         fi
2857 esac
2858 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2859 ij)
2860     echo "Using $up and $low to convert case." >&4
2861     ;;
2862 *)
2863     echo "I don't know how to translate letters from upper to lower case." >&4
2864     echo "Your tr is not acting any way I know of." >&4
2865     exit 1
2866     ;;
2867 esac
2868 : set up the translation script tr, must be called with ./tr of course
2869 cat >tr <<EOSC
2870 $startsh
2871 case "\$1\$2" in
2872 '[A-Z][a-z]') exec $tr '$up' '$low';;
2873 '[a-z][A-Z]') exec $tr '$low' '$up';;
2874 esac
2875 exec $tr "\$@"
2876 EOSC
2877 chmod +x tr
2878 $eunicefix tr
2879
2880 : Try to determine whether config.sh was made on this system
2881 case "$config_sh" in
2882 '')
2883 myuname=`$uname -a 2>/dev/null`
2884 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2885 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2886 # because the A-Z/a-z are not consecutive.
2887 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2888         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2889 newmyuname="$myuname"
2890 dflt=n
2891 case "$knowitall" in
2892 '')
2893         if test -f ../config.sh; then
2894                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2895                         eval "`grep myuname= ../config.sh`"
2896                 fi
2897                 if test "X$myuname" = "X$newmyuname"; then
2898                         dflt=y
2899                 fi
2900         fi
2901         ;;
2902 *) dflt=y;;
2903 esac
2904
2905 : Get old answers from old config file if Configure was run on the
2906 : same system, otherwise use the hints.
2907 hint=default
2908 cd ..
2909 if test -f config.sh; then
2910         echo " "
2911         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2912         . UU/myread
2913         case "$ans" in
2914         n*|N*) echo "OK, I'll ignore it."
2915                 mv config.sh config.sh.old
2916                 myuname="$newmyuname"
2917                 ;;
2918         *)  echo "Fetching default answers from your old config.sh file..." >&4
2919                 tmp_n="$n"
2920                 tmp_c="$c"
2921                 tmp_sh="$sh"
2922                 . ./config.sh
2923                 cp config.sh UU
2924                 n="$tmp_n"
2925                 c="$tmp_c"
2926                 : Older versions did not always set $sh.  Catch re-use of such
2927                 : an old config.sh.
2928                 case "$sh" in
2929                 '') sh="$tmp_sh" ;;
2930                 esac
2931                 hint=previous
2932                 ;;
2933         esac
2934 fi
2935 . ./UU/checkcc
2936 if test ! -f config.sh; then
2937         $cat <<EOM
2938
2939 First time through, eh?  I have some defaults handy for some systems
2940 that need some extra help getting the Configure answers right:
2941
2942 EOM
2943         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2944         dflt=''
2945         : Half the following guesses are probably wrong... If you have better
2946         : tests or hints, please send them to perlbug@perl.org
2947         : The metaconfig authors would also appreciate a copy...
2948         $test -f /irix && osname=irix
2949         $test -f /xenix && osname=sco_xenix
2950         $test -f /dynix && osname=dynix
2951         $test -f /dnix && osname=dnix
2952         $test -f /lynx.os && osname=lynxos
2953         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2954         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2955         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2956         $test -f /bin/mips && /bin/mips && osname=mips
2957         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2958                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2959         $test -d /usr/apollo/bin && osname=apollo
2960         $test -f /etc/saf/_sactab && osname=svr4
2961         $test -d /usr/include/minix && osname=minix
2962         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2963         if $test -d /MachTen -o -d /MachTen_Folder; then
2964                 osname=machten
2965                 if $test -x /sbin/version; then
2966                         osvers=`/sbin/version | $awk '{print $2}' |
2967                         $sed -e 's/[A-Za-z]$//'`
2968                 elif $test -x /usr/etc/version; then
2969                         osvers=`/usr/etc/version | $awk '{print $2}' |
2970                         $sed -e 's/[A-Za-z]$//'`
2971                 else
2972                         osvers="$2.$3"
2973                 fi
2974         fi
2975
2976         $test -f /sys/posix.dll &&
2977                 $test -f /usr/bin/what &&
2978                 set X `/usr/bin/what /sys/posix.dll` &&
2979                 $test "$3" = UWIN &&
2980                 osname=uwin &&
2981                 osvers="$5"
2982
2983         if $test -f $uname; then
2984                 set X $myuname
2985                 shift
2986
2987                 case "$5" in
2988                 fps*) osname=fps ;;
2989                 mips*)
2990                         case "$4" in
2991                         umips) osname=umips ;;
2992                         *) osname=mips ;;
2993                         esac;;
2994                 [23]100) osname=mips ;;
2995                 next*) osname=next ;;
2996                 i386*)
2997                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2998                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2999                                 osname='sco'
3000                                 osvers=$tmp
3001                         elif $test -f /etc/kconfig; then
3002                                 osname=isc
3003                                 if test "$lns" = "$ln -s"; then
3004                                         osvers=4
3005                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3006                                         osvers=3
3007                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3008                                         osvers=2
3009                                 fi
3010                         fi
3011                         tmp=''
3012                         ;;
3013                 pc*)
3014                         if test -n "$DJGPP"; then
3015                                 osname=dos
3016                                 osvers=djgpp
3017                         fi
3018                         ;;
3019                 esac
3020
3021                 case "$1" in
3022                 aix) osname=aix
3023                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3024                         case "$tmp" in
3025                         'not found') osvers="$4"."$3" ;;
3026                         '<3240'|'<>3240') osvers=3.2.0 ;;
3027                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3028                         '=3250'|'>3250') osvers=3.2.5 ;;
3029                         *) osvers=$tmp;;
3030                         esac
3031                         ;;
3032                 bsd386) osname=bsd386
3033                         osvers=`$uname -r`
3034                         ;;
3035                 cygwin*) osname=cygwin
3036                         osvers="$3"
3037                         ;;
3038                 *dc.osx) osname=dcosx
3039                         osvers="$3"
3040                         ;;
3041                 dnix) osname=dnix
3042                         osvers="$3"
3043                         ;;
3044                 domainos) osname=apollo
3045                         osvers="$3"
3046                         ;;
3047                 dgux) osname=dgux 
3048                         osvers="$3"
3049                         ;;
3050                 dynixptx*) osname=dynixptx
3051                         osvers=`echo "$4"|sed 's/^v//'`
3052                         ;;
3053                 freebsd) osname=freebsd 
3054                         osvers="$3" ;;
3055                 genix) osname=genix ;;
3056                 hp*) osname=hpux 
3057                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3058                         ;;
3059                 irix*) osname=irix
3060                         case "$3" in
3061                         4*) osvers=4 ;;
3062                         5*) osvers=5 ;;
3063                         *)      osvers="$3" ;;
3064                         esac
3065                         ;;
3066                 linux) osname=linux
3067                         case "$3" in
3068                         *)      osvers="$3" ;;
3069                         esac
3070                         ;;
3071                 MiNT) osname=mint
3072                         ;;
3073                 netbsd*) osname=netbsd
3074                         osvers="$3"
3075                         ;;
3076                 news-os) osvers="$3"
3077                         case "$3" in
3078                         4*) osname=newsos4 ;;
3079                         *) osname=newsos ;;
3080                         esac
3081                         ;;
3082                 next*) osname=next ;;
3083                 nonstop-ux) osname=nonstopux ;;
3084                 openbsd) osname=openbsd
3085                         osvers="$3"
3086                         ;;
3087                 POSIX-BC | posix-bc ) osname=posix-bc
3088                         osvers="$3"
3089                         ;;
3090                 powerux | power_ux | powermax_os | powermaxos | \
3091                 powerunix | power_unix) osname=powerux
3092                         osvers="$3"
3093                         ;;
3094                 qnx) osname=qnx
3095                         osvers="$4"
3096                         ;;
3097                 solaris) osname=solaris
3098                         case "$3" in
3099                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3100                         *)      osvers="$3" ;;
3101                         esac
3102                         ;;
3103                 sunos) osname=sunos
3104                         case "$3" in
3105                         5*) osname=solaris
3106                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3107                         *)      osvers="$3" ;;
3108                         esac
3109                         ;;
3110                 titanos) osname=titanos
3111                         case "$3" in
3112                         1*) osvers=1 ;;
3113                         2*) osvers=2 ;;
3114                         3*) osvers=3 ;;
3115                         4*) osvers=4 ;;
3116                         *)      osvers="$3" ;;
3117                         esac
3118                         ;;
3119                 ultrix) osname=ultrix
3120                         osvers="$3"
3121                         ;;
3122                 osf1|mls+)      case "$5" in
3123                                 alpha)
3124                                         osname=dec_osf
3125                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3126                                         case "$osvers" in
3127                                         [1-9].[0-9]*) ;;
3128                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3129                                         esac
3130                                         ;;
3131                         hp*)    osname=hp_osf1  ;;
3132                         mips)   osname=mips_osf1 ;;
3133                         esac
3134                         ;;
3135                 unixware) osname=svr5
3136                         osvers="$4"
3137                         ;;
3138                 uts)    osname=uts
3139                         osvers="$3"
3140                         ;;
3141                 vos) osvers="$3"
3142                         ;;
3143                 $2) case "$osname" in
3144                         *isc*) ;;
3145                         *freebsd*) ;;
3146                         svr*)
3147                                 : svr4.x or possibly later
3148                                 case "svr$3" in 
3149                                 ${osname}*)
3150                                         osname=svr$3
3151                                         osvers=$4
3152                                         ;;
3153                                 esac
3154                                 case "$osname" in
3155                                 svr4.0)
3156                                         : Check for ESIX
3157                                         if test -f /stand/boot ; then
3158                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3159                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3160                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3161                                                         if test -n "$isesix"; then
3162                                                                 osname=esix4
3163                                                         fi
3164                                                 fi
3165                                         fi
3166                                         ;;
3167                                 esac
3168                                 ;;
3169                         *)      if test -f /etc/systemid; then
3170                                         osname=sco
3171                                         set `echo $3 | $sed 's/\./ /g'` $4
3172                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3173                                                 osvers=$1.$2.$3
3174                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3175                                                 osvers=$1.$2
3176                                         elif $test -f $src/hints/sco_$1.sh; then
3177                                                 osvers=$1
3178                                         fi
3179                                 else
3180                                         case "$osname" in
3181                                         '') : Still unknown.  Probably a generic Sys V.
3182                                                 osname="sysv"
3183                                                 osvers="$3"
3184                                                 ;;
3185                                         esac
3186                                 fi
3187                                 ;;
3188                         esac
3189                         ;;
3190                 *)      case "$osname" in
3191                         '') : Still unknown.  Probably a generic BSD.
3192                                 osname="$1"
3193                                 osvers="$3"
3194                                 ;;
3195                         esac
3196                         ;;
3197                 esac
3198         else
3199                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3200                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3201                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3202                                 osname=news_os
3203                         fi
3204                         $rm -f UU/kernel.what
3205                 elif test -d c:/.; then
3206                         set X $myuname
3207                         osname=os2
3208                         osvers="$5"
3209                 fi
3210         fi
3211         
3212         case "$targetarch" in
3213         '') ;;
3214         *)  hostarch=$osname
3215             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3216             osvers=''
3217             ;;
3218         esac
3219
3220         : Now look for a hint file osname_osvers, unless one has been
3221         : specified already.
3222         case "$hintfile" in
3223         ''|' ')
3224                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3225                 : Also try without trailing minor version numbers.
3226                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3227                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3228                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3229                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3230                 case "$file" in
3231                 '') dflt=none ;;
3232                 *)  case "$osvers" in
3233                         '') dflt=$file
3234                                 ;;
3235                         *)  if $test -f $src/hints/$file.sh ; then
3236                                         dflt=$file
3237                                 elif $test -f $src/hints/$xfile.sh ; then
3238                                         dflt=$xfile
3239                                 elif $test -f $src/hints/$xxfile.sh ; then
3240                                         dflt=$xxfile
3241                                 elif $test -f $src/hints/$xxxfile.sh ; then
3242                                         dflt=$xxxfile
3243                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3244                                         dflt=$xxxxfile
3245                                 elif $test -f "$src/hints/${osname}.sh" ; then
3246                                         dflt="${osname}"
3247                                 else
3248                                         dflt=none
3249                                 fi
3250                                 ;;
3251                         esac
3252                         ;;
3253                 esac
3254                 if $test -f Policy.sh ; then
3255                         case "$dflt" in
3256                         *Policy*) ;;
3257                         none) dflt="Policy" ;;
3258                         *) dflt="Policy $dflt" ;;
3259                         esac
3260                 fi
3261                 ;;
3262         *)
3263                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3264                 ;;
3265         esac
3266
3267         if $test -f Policy.sh ; then
3268                 $cat <<EOM
3269
3270 There's also a Policy hint file available, which should make the
3271 site-specific (policy) questions easier to answer.
3272 EOM
3273
3274         fi
3275
3276         $cat <<EOM
3277
3278 You may give one or more space-separated answers, or "none" if appropriate.
3279 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3280 is a good thing.  DO NOT give a wrong version or a wrong OS.
3281
3282 EOM
3283
3284         rp="Which of these apply, if any?"
3285         . UU/myread
3286         tans=$ans
3287         for file in $tans; do
3288                 if $test X$file = XPolicy -a -f Policy.sh; then
3289                         . Policy.sh
3290                         $cat Policy.sh >> UU/config.sh
3291                 elif $test -f $src/hints/$file.sh; then
3292                         . $src/hints/$file.sh
3293                         $cat $src/hints/$file.sh >> UU/config.sh
3294                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3295                         : nothing
3296                 else
3297                         : Give one chance to correct a possible typo.
3298                         echo "$file.sh does not exist"
3299                         dflt=$file
3300                         rp="hint to use instead?"
3301                         . UU/myread
3302                         for file in $ans; do
3303                                 if $test -f "$src/hints/$file.sh"; then
3304                                         . $src/hints/$file.sh
3305                                         $cat $src/hints/$file.sh >> UU/config.sh
3306                                 elif $test X$ans = X -o X$ans = Xnone ; then
3307                                         : nothing
3308                                 else
3309                                         echo "$file.sh does not exist -- ignored."
3310                                 fi
3311                         done
3312                 fi
3313         done
3314
3315         hint=recommended
3316         : Remember our hint file for later.
3317         if $test -f "$src/hints/$file.sh" ; then
3318                 hintfile="$file"
3319         else
3320                 hintfile=''
3321         fi
3322 fi
3323 cd UU
3324 ;;
3325 *)
3326         echo " "
3327         echo "Fetching default answers from $config_sh..." >&4
3328         tmp_n="$n"
3329         tmp_c="$c"
3330         cd ..
3331         cp $config_sh config.sh 2>/dev/null
3332         chmod +w config.sh
3333         . ./config.sh
3334         cd UU
3335         cp ../config.sh .
3336         n="$tmp_n"
3337         c="$tmp_c"
3338         hint=previous
3339         ;;
3340 esac
3341 test "$override" && . ./optdef.sh
3342
3343 : Restore computed paths
3344 for file in $loclist $trylist; do
3345         eval $file="\$_$file"
3346 done
3347
3348 cat << EOM
3349
3350 Configure uses the operating system name and version to set some defaults.
3351 The default value is probably right if the name rings a bell. Otherwise,
3352 since spelling matters for me, either accept the default or answer "none"
3353 to leave it blank.
3354
3355 EOM
3356 case "$osname" in
3357         ''|' ')
3358                 case "$hintfile" in
3359                 ''|' '|none) dflt=none ;;
3360                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3361                 esac
3362                 ;;
3363         *) dflt="$osname" ;;
3364 esac
3365 rp="Operating system name?"
3366 . ./myread
3367 case "$ans" in
3368 none)  osname='' ;;
3369 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3370 esac
3371 echo " "
3372 case "$osvers" in
3373         ''|' ')
3374                 case "$hintfile" in
3375                 ''|' '|none) dflt=none ;;
3376                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3377                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3378                         case "$dflt" in
3379                         ''|' ') dflt=none ;;
3380                         esac
3381                         ;;
3382                 esac
3383                 ;;
3384         *) dflt="$osvers" ;;
3385 esac
3386 rp="Operating system version?"
3387 . ./myread
3388 case "$ans" in
3389 none)  osvers='' ;;
3390 *) osvers="$ans" ;;
3391 esac
3392
3393
3394 . ./posthint.sh
3395
3396 : who configured the system
3397 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3398 cf_by=`(logname) 2>/dev/null`
3399 case "$cf_by" in
3400 "")
3401         cf_by=`(whoami) 2>/dev/null`
3402         case "$cf_by" in
3403         "") cf_by=unknown ;;
3404         esac ;;
3405 esac
3406
3407 : set up the script used to warn in case of inconsistency
3408 cat <<EOS >whoa
3409 $startsh
3410 EOS
3411 cat <<'EOSC' >>whoa
3412 dflt=y
3413 echo " "
3414 echo "*** WHOA THERE!!! ***" >&4
3415 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3416 rp="    Keep the $hint value?"
3417 . ./myread
3418 case "$ans" in
3419 y) td=$was; tu=$was;;
3420 esac
3421 EOSC
3422
3423 : function used to set $1 to $val
3424 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3425 case "$val$was" in
3426 $define$undef) . ./whoa; eval "$var=\$td";;
3427 $undef$define) . ./whoa; eval "$var=\$tu";;
3428 *) eval "$var=$val";;
3429 esac'
3430
3431 case "$usesocks" in
3432 $define|true|[yY]*)     dflt='y';;
3433 *) dflt='n';;
3434 esac
3435 cat <<EOM
3436
3437 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3438 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3439 to use the PerlIO abstraction layer, this will be implicitly selected.
3440
3441 If this doesn't make any sense to you, just accept the default '$dflt'.
3442 EOM
3443 rp='Build Perl for SOCKS?'
3444 . ./myread
3445 case "$ans" in
3446 y|Y)    val="$define" ;;     
3447 *)      val="$undef" ;;
3448 esac
3449 set usesocks
3450 eval $setvar
3451
3452 case "$usesocks" in
3453 $define|true|[yY]*) useperlio="$define";;
3454 esac
3455
3456 case "$useperlio" in
3457 $define|true|[yY]*|'')  dflt='y';;
3458 *) dflt='n';;
3459 esac
3460 cat <<EOM
3461
3462 Previous version of $package used the standard IO mechanisms as
3463 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3464 alternate IO mechanisms via the PerlIO abstraction layer, but the
3465 stdio mechanism is still available if needed.  The abstraction layer
3466 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3467 Using PerlIO with sfio may cause problems with some extension modules.
3468
3469 If this doesn't make any sense to you, just accept the default '$dflt'.
3470 EOM
3471 rp='Use the PerlIO abstraction layer?'
3472 . ./myread
3473 case "$ans" in
3474 y|Y) 
3475         val="$define"
3476         ;;
3477 *)      
3478         echo "Ok, doing things the stdio way."
3479         val="$undef"
3480         ;;
3481 esac
3482 set useperlio
3483 eval $setvar 
3484
3485 case "$usesocks" in
3486 $define|true|[yY]*)
3487         case "$useperlio" in
3488         $define|true|[yY]*) ;;
3489         *)      cat >&4 <<EOM
3490
3491 You are using the SOCKS proxy protocol library which means that you
3492 should also use the PerlIO layer.  You may be headed for trouble.
3493
3494 EOM
3495                 ;;
3496         esac
3497         ;;
3498 esac
3499
3500         
3501 case "$usethreads" in
3502 $define|true|[yY]*)     dflt='y';;
3503 *)     # Catch case where user specified ithreads or 5005threads but
3504        # forgot -Dusethreads (A.D. 4/2002)
3505        case "$useithreads$use5005threads" in
3506        *$define*)      
3507                 case "$useperlio" in
3508                 "$define")      dflt='y' ;;
3509                 *)              dflt='n' ;;
3510                 esac
3511                 ;;
3512        *)       dflt='n';;
3513        esac
3514        ;;
3515 esac
3516 cat <<EOM
3517
3518 Perl can be built to take advantage of threads on some systems.
3519 To do so, Configure can be run with -Dusethreads.
3520
3521 Note that Perl built with threading support runs slightly slower
3522 and uses more memory than plain Perl. The current implementation
3523 is believed to be stable, but it is fairly new, and so should be
3524 treated with caution.
3525
3526 If this doesn't make any sense to you, just accept the default '$dflt'.
3527 EOM
3528 rp='Build a threading Perl?'
3529 . ./myread
3530 case "$ans" in
3531 y|Y)    val="$define" ;;
3532 *)      val="$undef" ;;
3533 esac
3534 set usethreads
3535 eval $setvar
3536
3537 case "$usethreads" in
3538 $define)
3539         $cat <<EOM
3540
3541 Since release 5.6, Perl has had two different threading implementations,
3542 the newer interpreter-based version (ithreads) with one interpreter per
3543 thread, and the older 5.005 version (5005threads).
3544 The 5005threads version is effectively unmaintained and will probably be
3545 removed in Perl 5.10, so there should be no need to build a Perl using it
3546 unless needed for backwards compatibility with some existing 5.005threads
3547 code.
3548
3549 EOM
3550         : Default to ithreads unless overridden on command line or with
3551         : old config.sh
3552         dflt='y'
3553         case "$use5005threads" in
3554                 $define|true|[yY]*) dflt='n';;
3555         esac
3556         case "$useithreads" in
3557                 $undef|false|[nN]*) dflt='n';;
3558         esac
3559         rp='Use the newer interpreter-based ithreads?'
3560         . ./myread
3561         case "$ans" in
3562         y|Y)    val="$define" ;;
3563         *)      val="$undef" ;;
3564         esac
3565         set useithreads
3566         eval $setvar
3567         : Now set use5005threads to the opposite value.
3568         case "$useithreads" in
3569         $define) val="$undef" ;;
3570         *) val="$define" ;;
3571         esac
3572         set use5005threads
3573         eval $setvar
3574         ;;
3575 *)
3576         useithreads="$undef"
3577         use5005threads="$undef"
3578         ;;
3579 esac
3580
3581 case "$useithreads$use5005threads" in
3582 "$define$define")
3583         $cat >&4 <<EOM
3584
3585 You cannot have both the ithreads and the 5.005 threads enabled
3586 at the same time.  Disabling the 5.005 threads since they are
3587 much less stable than the ithreads.
3588
3589 EOM
3590         use5005threads="$undef"
3591         ;;
3592 esac
3593
3594 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3595         cat >&4 <<EOF
3596 ***
3597 *** To build with ithreads you must also use the PerlIO layer.
3598 *** Cannot continue, aborting.
3599 ***
3600 EOF
3601         exit 1
3602 fi
3603
3604 case "$d_oldpthreads" in
3605 '')     : Configure tests would be welcome here.  For now, assume undef.
3606         val="$undef" ;;
3607 *)      val="$d_oldpthreads" ;;
3608 esac
3609 set d_oldpthreads
3610 eval $setvar
3611
3612
3613 case "$usethreads" in
3614 "$define"|true|[yY]*)
3615 : Look for a hint-file generated 'call-back-unit'.  If the
3616 : user has specified that a threading perl is to be built,
3617 : we may need to set or change some other defaults.
3618         if $test -f usethreads.cbu; then
3619                 echo "Your platform has some specific hints for threaded builds, using them..."
3620                 . ./usethreads.cbu
3621         else
3622                 $cat <<EOM
3623 (Your platform doesn't have any specific hints for threaded builds.
3624  Assuming POSIX threads, then.)
3625 EOM
3626         fi
3627         ;;
3628 esac
3629
3630 cat <<EOM
3631
3632 Perl can be built so that multiple Perl interpreters can coexist
3633 within the same Perl executable.
3634 EOM
3635
3636 case "$useithreads" in
3637 $define)
3638         cat <<EOM
3639 This multiple interpreter support is required for interpreter-based threads.
3640 EOM
3641         val="$define"
3642         ;;
3643 *)      case "$usemultiplicity" in
3644         $define|true|[yY]*)     dflt='y';;
3645         *) dflt='n';;
3646         esac
3647         echo " "
3648         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3649         rp='Build Perl for multiplicity?'
3650         . ./myread
3651         case "$ans" in
3652         y|Y)    val="$define" ;;
3653         *)      val="$undef" ;;
3654         esac
3655         ;;
3656 esac
3657 set usemultiplicity
3658 eval $setvar
3659
3660
3661 case "$usemorebits" in
3662 "$define"|true|[yY]*)
3663         use64bitint="$define"
3664         uselongdouble="$define"
3665         usemorebits="$define"
3666         ;;
3667 *)      usemorebits="$undef"
3668         ;;
3669 esac
3670
3671 : make some quick guesses about what we are up against
3672 echo " "
3673 $echo $n "Hmm...  $c"
3674 echo exit 1 >bsd
3675 echo exit 1 >usg
3676 echo exit 1 >v7
3677 echo exit 1 >osf1
3678 echo exit 1 >eunice
3679 echo exit 1 >xenix
3680 echo exit 1 >venix
3681 echo exit 1 >os2
3682 d_bsd="$undef"
3683 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3684 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3685 then
3686         echo "Looks kind of like an OSF/1 system, but we'll see..."
3687         echo exit 0 >osf1
3688 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3689         xxx=`./loc addbib blurfl $pth`
3690         if $test -f $xxx; then
3691         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3692                 echo exit 0 >bsd
3693                 echo exit 0 >usg
3694         else
3695                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3696                         echo "Looks kind of like an extended USG system, but we'll see..."
3697                 else
3698                         echo "Looks kind of like a USG system, but we'll see..."
3699                 fi
3700                 echo exit 0 >usg
3701         fi
3702 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3703         echo "Looks kind of like a BSD system, but we'll see..."
3704         d_bsd="$define"
3705         echo exit 0 >bsd
3706 else
3707         echo "Looks kind of like a Version 7 system, but we'll see..."
3708         echo exit 0 >v7
3709 fi
3710 case "$eunicefix" in
3711 *unixtovms*)
3712         $cat <<'EOI'
3713 There is, however, a strange, musty smell in the air that reminds me of
3714 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3715 EOI
3716         echo exit 0 >eunice
3717         d_eunice="$define"
3718 : it so happens the Eunice I know will not run shell scripts in Unix format
3719         ;;
3720 *)
3721         echo " "
3722         echo "Congratulations.  You aren't running Eunice."
3723         d_eunice="$undef"
3724         ;;
3725 esac
3726 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3727 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3728 : semicolon as a patch separator
3729 case "$p_" in
3730 :) ;;
3731 *)
3732         $cat <<'EOI'
3733 I have the feeling something is not exactly right, however...don't tell me...
3734 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3735 (Or you may be running DOS with DJGPP.)
3736 EOI
3737         echo exit 0 >os2
3738         ;;
3739 esac
3740 if test -f /xenix; then
3741         echo "Actually, this looks more like a XENIX system..."
3742         echo exit 0 >xenix
3743         d_xenix="$define"
3744 else
3745         echo " "
3746         echo "It's not Xenix..."
3747         d_xenix="$undef"
3748 fi
3749 chmod +x xenix
3750 $eunicefix xenix
3751 if test -f /venix; then
3752         echo "Actually, this looks more like a VENIX system..."
3753         echo exit 0 >venix
3754 else
3755         echo " "
3756         if ./xenix; then
3757                 : null
3758         else
3759                 echo "Nor is it Venix..."
3760         fi
3761 fi
3762 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3763 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3764 $rm -f foo
3765
3766 case "$cc" in
3767 '') dflt=cc;;
3768 *) dflt="$cc";;
3769 esac
3770 rp="Use which C compiler?"
3771 . ./myread
3772 cc="$ans"
3773
3774 : See if they have not cc but they do have gcc
3775 . ./trygcc
3776 : Look for a hint-file generated 'call-back-unit'.  Now that the
3777 : user has specified the compiler, we may need to set or change some
3778 : other defaults.
3779 if $test -f cc.cbu; then
3780     . ./cc.cbu
3781 fi
3782 . ./checkcc
3783
3784 echo " "
3785 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3786 $cat >try.c <<EOM
3787 #include <stdio.h>
3788 int main() {
3789 #ifdef __GNUC__
3790 #ifdef __VERSION__
3791         printf("%s\n", __VERSION__);
3792 #else
3793         printf("%s\n", "1");
3794 #endif
3795 #endif
3796         exit(0);
3797 }
3798 EOM
3799 if $cc -o try $ccflags $ldflags try.c; then
3800         gccversion=`$run ./try`
3801         case "$gccversion" in
3802         '') echo "You are not using GNU cc." ;;
3803         *)  echo "You are using GNU cc $gccversion."
3804             ccname=gcc  
3805             ;;
3806         esac
3807 else
3808         echo " "
3809         echo "*** WHOA THERE!!! ***" >&4
3810         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3811         case "$knowitall" in
3812         '')
3813         echo "    You'd better start hunting for one and let me know about it." >&4
3814                 exit 1
3815                 ;;
3816         esac
3817 fi
3818 $rm -f try try.*
3819 case "$gccversion" in
3820 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3821 esac
3822 case "$gccversion" in
3823 '') gccosandvers='' ;;
3824 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3825    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3826    gccshortvers=''
3827    case "$gccosandvers" in
3828    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3829    $osname$osvers) ;; # looking good
3830    $osname*) cat <<EOM >&4
3831
3832 *** WHOA THERE!!! ***
3833
3834     Your gcc has not been compiled for the exact release of
3835     your operating system ($gccosandvers versus $osname$osvers).
3836
3837     In general it is a good idea to keep gcc synchronized with
3838     the operating system because otherwise serious problems
3839     may ensue when trying to compile software, like Perl.
3840
3841     I'm trying to be optimistic here, though, and will continue.
3842     If later during the configuration and build icky compilation
3843     problems appear (headerfile conflicts being the most common
3844     manifestation), I suggest reinstalling the gcc to match
3845     your operating system release.
3846
3847 EOM
3848       ;;
3849    *) gccosandvers='' ;; # failed to parse, better be silent
3850    esac
3851    ;;
3852 esac
3853 case "$ccname" in
3854 '') ccname="$cc" ;;
3855 esac
3856
3857 # gcc 3.* complain about adding -Idirectories that they already know about,
3858 # so we will take those off from locincpth.
3859 case "$gccversion" in
3860 3*)
3861     echo "main(){}">try.c
3862     for incdir in $locincpth; do
3863        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3864              grep '^cc1: warning: changing search order '`
3865        if test "X$warn" != X; then
3866            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3867        fi
3868     done
3869     $rm -f try try.*
3870 esac
3871
3872 : decide how portable to be.  Allow command line overrides.
3873 case "$d_portable" in
3874 "$undef") ;;
3875 *)      d_portable="$define" ;;
3876 esac
3877
3878 : set up shell script to do ~ expansion
3879 cat >filexp <<EOSS
3880 $startsh
3881 : expand filename
3882 case "\$1" in
3883  ~/*|~)
3884         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3885         ;;
3886  ~*)
3887         if $test -f /bin/csh; then
3888                 /bin/csh -f -c "glob \$1"
3889                 failed=\$?
3890                 echo ""
3891                 exit \$failed
3892         else
3893                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3894                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3895                 if $test ! -d "\$dir"; then
3896                         me=\`basename \$0\`
3897                         echo "\$me: can't locate home directory for: \$name" >&2
3898                         exit 1
3899                 fi
3900                 case "\$1" in
3901                 */*)
3902                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3903                         ;;
3904                 *)
3905                         echo \$dir
3906                         ;;
3907                 esac
3908         fi
3909         ;;
3910 *)
3911         echo \$1
3912         ;;
3913 esac
3914 EOSS
3915 chmod +x filexp
3916 $eunicefix filexp
3917
3918 : now set up to get a file name
3919 cat <<EOS >getfile
3920 $startsh
3921 EOS
3922 cat <<'EOSC' >>getfile
3923 tilde=''
3924 fullpath=''
3925 already=''
3926 skip=''
3927 none_ok=''
3928 exp_file=''
3929 nopath_ok=''
3930 orig_rp="$rp"
3931 orig_dflt="$dflt"
3932 case "$gfpth" in
3933 '') gfpth='.' ;;
3934 esac
3935
3936 case "$fn" in
3937 *\(*)
3938         : getfile will accept an answer from the comma-separated list
3939         : enclosed in parentheses even if it does not meet other criteria.
3940         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3941         fn=`echo $fn | sed 's/(.*)//'`
3942         ;;
3943 esac
3944
3945 case "$fn" in
3946 *:*)
3947         loc_file=`expr $fn : '.*:\(.*\)'`
3948         fn=`expr $fn : '\(.*\):.*'`
3949         ;;
3950 esac
3951
3952 case "$fn" in
3953 *~*) tilde=true;;
3954 esac
3955 case "$fn" in
3956 */*) fullpath=true;;
3957 esac
3958 case "$fn" in
3959 *+*) skip=true;;
3960 esac
3961 case "$fn" in
3962 *n*) none_ok=true;;
3963 esac
3964 case "$fn" in
3965 *e*) exp_file=true;;
3966 esac
3967 case "$fn" in
3968 *p*) nopath_ok=true;;
3969 esac
3970
3971 case "$fn" in
3972 *f*) type='File';;
3973 *d*) type='Directory';;
3974 *l*) type='Locate';;
3975 esac
3976
3977 what="$type"
3978 case "$what" in
3979 Locate) what='File';;
3980 esac
3981
3982 case "$exp_file" in
3983 '')
3984         case "$d_portable" in
3985         "$define") ;;
3986         *) exp_file=true;;
3987         esac
3988         ;;
3989 esac
3990
3991 cd ..
3992 while test "$type"; do
3993         redo=''
3994         rp="$orig_rp"
3995         dflt="$orig_dflt"
3996         case "$tilde" in
3997         true) rp="$rp (~name ok)";;
3998         esac
3999         . UU/myread
4000         if test -f UU/getfile.ok && \
4001                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4002         then
4003                 value="$ans"
4004                 ansexp="$ans"
4005                 break
4006         fi
4007         case "$ans" in
4008         none)
4009                 value=''
4010                 ansexp=''
4011                 case "$none_ok" in
4012                 true) type='';;
4013                 esac
4014                 ;;
4015         *)
4016                 case "$tilde" in
4017                 '') value="$ans"
4018                         ansexp="$ans";;
4019                 *)
4020                         value=`UU/filexp $ans`
4021                         case $? in
4022                         0)
4023                                 if test "$ans" != "$value"; then
4024                                         echo "(That expands to $value on this system.)"
4025                                 fi
4026                                 ;;
4027                         *) value="$ans";;
4028                         esac
4029                         ansexp="$value"
4030                         case "$exp_file" in
4031                         '') value="$ans";;
4032                         esac
4033                         ;;
4034                 esac
4035                 case "$fullpath" in
4036                 true)
4037                         case "$ansexp" in
4038                         /*) value="$ansexp" ;;
4039                         [a-zA-Z]:/*) value="$ansexp" ;;
4040                         *)
4041                                 redo=true
4042                                 case "$already" in
4043                                 true)
4044                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4045                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4046                                         ;;
4047                                 *)
4048                                 echo "Please give a full path name, starting with slash." >&4
4049                                         case "$tilde" in
4050                                         true)
4051                                 echo "Note that using ~name is ok provided it expands well." >&4
4052                                                 already=true
4053                                                 ;;
4054                                         esac
4055                                 esac
4056                                 ;;
4057                         esac
4058                         ;;
4059                 esac
4060                 case "$redo" in
4061                 '')
4062                         case "$type" in
4063                         File)
4064                                 for fp in $gfpth; do
4065                                         if test "X$fp" = X.; then
4066                                             pf="$ansexp"
4067                                         else    
4068                                             pf="$fp/$ansexp"
4069                                         fi
4070                                         if test -f "$pf"; then
4071                                                 type=''
4072                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4073                                         then
4074                                                 echo "($value is not a plain file, but that's ok.)"
4075                                                 type=''
4076                                         fi
4077                                         if test X"$type" = X; then
4078                                             value="$pf"
4079                                             break
4080                                         fi
4081                                 done
4082                                 ;;
4083                         Directory)
4084                                 for fp in $gfpth; do
4085                                         if test "X$fp" = X.; then
4086                                             dir="$ans"
4087                                             direxp="$ansexp"
4088                                         else    
4089                                             dir="$fp/$ansexp"
4090                                             direxp="$fp/$ansexp"
4091                                         fi
4092                                         if test -d "$direxp"; then
4093                                                 type=''
4094                                                 value="$dir"
4095                                                 break
4096                                         fi
4097                                 done
4098                                 ;;
4099                         Locate)
4100                                 if test -d "$ansexp"; then
4101                                         echo "(Looking for $loc_file in directory $value.)"
4102                                         value="$value/$loc_file"
4103                                         ansexp="$ansexp/$loc_file"
4104                                 fi
4105                                 if test -f "$ansexp"; then
4106                                         type=''
4107                                 fi
4108                                 case "$nopath_ok" in
4109                                 true)   case "$value" in
4110                                         */*) ;;
4111                                         *)      echo "Assuming $value will be in people's path."
4112                                                 type=''
4113                                                 ;;
4114                                         esac
4115                                         ;;
4116                                 esac
4117                                 ;;
4118                         esac
4119
4120                         case "$skip" in
4121                         true) type='';
4122                         esac
4123
4124                         case "$type" in
4125                         '') ;;
4126                         *)
4127                                 if test "$fastread" = yes; then
4128                                         dflt=y
4129                                 else
4130                                         dflt=n
4131                                 fi
4132                                 rp="$what $value doesn't exist.  Use that name anyway?"
4133                                 . UU/myread
4134                                 dflt=''
4135                                 case "$ans" in
4136                                 y*) type='';;
4137                                 *) echo " ";;
4138                                 esac
4139                                 ;;
4140                         esac
4141                         ;;
4142                 esac
4143                 ;;
4144         esac
4145 done
4146 cd UU
4147 ans="$value"
4148 rp="$orig_rp"
4149 dflt="$orig_dflt"
4150 rm -f getfile.ok
4151 test "X$gfpthkeep" != Xy && gfpth=""
4152 EOSC
4153
4154 : What should the include directory be ?
4155 echo " "
4156 $echo $n "Hmm...  $c"
4157 dflt='/usr/include'
4158 incpath=''
4159 mips_type=''
4160 if $test -f /bin/mips && /bin/mips; then
4161         echo "Looks like a MIPS system..."
4162         $cat >usr.c <<'EOCP'
4163 #ifdef SYSTYPE_BSD43
4164 /bsd43
4165 #endif
4166 EOCP
4167         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4168                 dflt='/bsd43/usr/include'
4169                 incpath='/bsd43'
4170                 mips_type='BSD 4.3'
4171         else
4172                 mips_type='System V'
4173         fi
4174         $rm -f usr.c usr.out
4175         echo "and you're compiling with the $mips_type compiler and libraries."
4176         xxx_prompt=y
4177         echo "exit 0" >mips
4178 else
4179         echo "Doesn't look like a MIPS system."
4180         xxx_prompt=n
4181         echo "exit 1" >mips
4182 fi
4183 chmod +x mips
4184 $eunicefix mips
4185 case "$usrinc" in
4186 '') ;;
4187 *) dflt="$usrinc";;
4188 esac
4189 case "$xxx_prompt" in
4190 y)      fn=d/
4191         echo " "
4192         rp='Where are the include files you want to use?'
4193         . ./getfile
4194         usrinc="$ans"
4195         ;;
4196 *)      usrinc="$dflt"
4197         ;;
4198 esac
4199
4200 : see how we invoke the C preprocessor
4201 echo " "
4202 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4203 cat <<'EOT' >testcpp.c
4204 #define ABC abc
4205 #define XYZ xyz
4206 ABC.XYZ
4207 EOT
4208 cd ..
4209 if test ! -f cppstdin; then
4210         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4211                 # AIX cc -E doesn't show the absolute headerfile
4212                 # locations but we'll cheat by using the -M flag.
4213                 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
4214         else
4215                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4216         fi
4217 else
4218         echo "Keeping your $hint cppstdin wrapper."
4219 fi
4220 chmod 755 cppstdin
4221 wrapper=`pwd`/cppstdin
4222 ok='false'
4223 cd UU
4224
4225 if $test "X$cppstdin" != "X" && \
4226         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4227         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4228 then
4229         echo "You used to use $cppstdin $cppminus so we'll use that again."
4230         case "$cpprun" in
4231         '') echo "But let's see if we can live without a wrapper..." ;;
4232         *)
4233                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4234                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4235                 then
4236                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4237                         ok='true'
4238                 else
4239                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4240                 fi
4241                 ;;
4242         esac
4243 else
4244         case "$cppstdin" in
4245         '') ;;
4246         *)
4247                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4248                 ;;
4249         esac
4250 fi
4251
4252 if $ok; then
4253         : nothing
4254 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4255         $cc -E <testcpp.c >testcpp.out 2>&1; \
4256         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4257         echo "Yup, it does."
4258         x_cpp="$cc -E"
4259         x_minus='';
4260 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4261         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4262         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4263         echo "Yup, it does."
4264         x_cpp="$cc -E"
4265         x_minus='-';
4266 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4267         $cc -P <testcpp.c >testcpp.out 2>&1; \
4268         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4269         echo "Yipee, that works!"
4270         x_cpp="$cc -P"
4271         x_minus='';
4272 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4273         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4274         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4275         echo "At long last!"
4276         x_cpp="$cc -P"
4277         x_minus='-';
4278 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4279         $cpp <testcpp.c >testcpp.out 2>&1; \
4280         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4281         echo "It works!"
4282         x_cpp="$cpp"
4283         x_minus='';
4284 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4285         $cpp - <testcpp.c >testcpp.out 2>&1; \
4286         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4287         echo "Hooray, it works!  I was beginning to wonder."
4288         x_cpp="$cpp"
4289         x_minus='-';
4290 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4291         $wrapper <testcpp.c >testcpp.out 2>&1; \
4292         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4293         x_cpp="$wrapper"
4294         x_minus=''
4295         echo "Eureka!"
4296 else
4297         dflt=''
4298         rp="No dice.  I can't find a C preprocessor.  Name one:"
4299         . ./myread
4300         x_cpp="$ans"
4301         x_minus=''
4302         $x_cpp <testcpp.c >testcpp.out 2>&1
4303         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4304                 echo "OK, that will do." >&4
4305         else
4306 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4307                 exit 1
4308         fi
4309 fi
4310
4311 case "$ok" in
4312 false)
4313         cppstdin="$x_cpp"
4314         cppminus="$x_minus"
4315         cpprun="$x_cpp"
4316         cpplast="$x_minus"
4317         set X $x_cpp
4318         shift
4319         case "$1" in
4320         "$cpp")
4321                 echo "Perhaps can we force $cc -E using a wrapper..."
4322                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4323                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4324                 then
4325                         echo "Yup, we can."
4326                         cppstdin="$wrapper"
4327                         cppminus='';
4328                 else
4329                         echo "Nope, we'll have to live without it..."
4330                 fi
4331                 ;;
4332         esac
4333         case "$cpprun" in
4334         "$wrapper")
4335                 cpprun=''
4336                 cpplast=''
4337                 ;;
4338         esac
4339         ;;
4340 esac
4341
4342 case "$cppstdin" in
4343 "$wrapper"|'cppstdin') ;;
4344 *) $rm -f $wrapper;;
4345 esac
4346 $rm -f testcpp.c testcpp.out
4347
4348 : Set private lib path
4349 case "$plibpth" in
4350 '') if ./mips; then
4351                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4352         fi;;
4353 esac
4354 case "$libpth" in
4355 ' ') dlist='';;
4356 '') dlist="$loclibpth $plibpth $glibpth";;
4357 *) dlist="$libpth";;
4358 esac
4359
4360 : Now check and see which directories actually exist, avoiding duplicates
4361 libpth=''
4362 for xxx in $dlist
4363 do
4364     if $test -d $xxx; then
4365                 case " $libpth " in
4366                 *" $xxx "*) ;;
4367                 *) libpth="$libpth $xxx";;
4368                 esac
4369     fi
4370 done
4371 $cat <<'EOM'
4372
4373 Some systems have incompatible or broken versions of libraries.  Among
4374 the directories listed in the question below, please remove any you
4375 know not to be holding relevant libraries, and add any that are needed.
4376 Say "none" for none.
4377
4378 EOM
4379 case "$libpth" in
4380 '') dflt='none';;
4381 *)
4382         set X $libpth
4383         shift
4384         dflt=${1+"$@"}
4385         ;;
4386 esac
4387 rp="Directories to use for library searches?"
4388 . ./myread
4389 case "$ans" in
4390 none) libpth=' ';;
4391 *) libpth="$ans";;
4392 esac
4393
4394 : compute shared library extension
4395 case "$so" in
4396 '')
4397         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4398                 dflt='sl'
4399         else
4400                 dflt='so'
4401         fi
4402         ;;
4403 *) dflt="$so";;
4404 esac
4405 $cat <<EOM
4406
4407 On some systems, shared libraries may be available.  Answer 'none' if
4408 you want to suppress searching of shared libraries for the remainder
4409 of this configuration.
4410
4411 EOM
4412 rp='What is the file extension used for shared libraries?'
4413 . ./myread
4414 so="$ans"
4415
4416 : Define several unixisms.
4417 : Hints files or command line option can be used to override them.
4418 : The convoluted testing is in case hints files set either the old
4419 : or the new name.
4420 case "$_exe" in
4421 '')     case "$exe_ext" in
4422         '')     ;;
4423         *)      _exe="$exe_ext" ;;
4424         esac
4425         ;;
4426 esac
4427 case "$_a" in
4428 '')     case "$lib_ext" in
4429     '') _a='.a';;
4430         *)      _a="$lib_ext" ;;
4431         esac
4432         ;;
4433 esac
4434 case "$_o" in
4435 '') case "$obj_ext" in
4436         '')     _o='.o';;
4437         *)      _o="$obj_ext";;
4438         esac
4439         ;;
4440 esac
4441 case "$p_" in
4442 '') case "$path_sep" in
4443         '')     p_=':';;
4444         *)      p_="$path_sep";;
4445         esac
4446         ;;
4447 esac
4448 exe_ext=$_exe
4449 lib_ext=$_a
4450 obj_ext=$_o
4451 path_sep=$p_
4452
4453 : Which makefile gets called first.  This is used by make depend.
4454 case "$firstmakefile" in
4455 '') firstmakefile='makefile';;
4456 esac
4457
4458 : Looking for optional libraries
4459 echo " "
4460 echo "Checking for optional libraries..." >&4
4461 case "$libs" in
4462 ' '|'') dflt='';;
4463 *) dflt="$libs";;
4464 esac
4465 case "$libswanted" in
4466 '') libswanted='c_s';;
4467 esac
4468 case "$usesocks" in
4469 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4470 esac
4471 libsfound=''
4472 libsfiles=''
4473 libsdirs=''
4474 libspath=''
4475 for thisdir in $libpth $xlibpth; do
4476   test -d $thisdir && libspath="$libspath $thisdir"
4477 done
4478 for thislib in $libswanted; do
4479         for thisdir in $libspath; do
4480             xxx=''
4481             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4482                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4483                 $test -f "$xxx" && eval $libscheck
4484                 $test -f "$xxx" && libstyle=shared
4485             fi
4486             if test ! -f "$xxx"; then
4487                 xxx=$thisdir/lib$thislib.$so
4488                 $test -f "$xxx" && eval $libscheck
4489                 $test -f "$xxx" && libstyle=shared
4490             fi  
4491             if test ! -f "$xxx"; then
4492                 xxx=$thisdir/lib$thislib$_a
4493                 $test -f "$xxx" && eval $libscheck
4494                 $test -f "$xxx" && libstyle=static
4495             fi
4496             if test ! -f "$xxx"; then
4497                 xxx=$thisdir/$thislib$_a
4498                 $test -f "$xxx" && eval $libscheck
4499                 $test -f "$xxx" && libstyle=static
4500             fi
4501             if test ! -f "$xxx"; then
4502                 xxx=$thisdir/lib${thislib}_s$_a
4503                 $test -f "$xxx" && eval $libscheck
4504                 $test -f "$xxx" && libstyle=static
4505                 $test -f "$xxx" && thislib=${thislib}_s
4506             fi
4507             if test ! -f "$xxx"; then
4508                 xxx=$thisdir/Slib$thislib$_a
4509                 $test -f "$xxx" && eval $libscheck
4510                 $test -f "$xxx" && libstyle=static
4511             fi
4512             if $test -f "$xxx"; then
4513                 case "$libstyle" in
4514                 shared) echo "Found -l$thislib (shared)." ;;
4515                 static) echo "Found -l$thislib." ;;
4516                 *)      echo "Found -l$thislib ($libstyle)." ;;
4517                 esac
4518                 case " $dflt " in
4519                 *"-l$thislib "*);;
4520                 *) dflt="$dflt -l$thislib"
4521                    libsfound="$libsfound $xxx"
4522                    yyy=`basename $xxx`
4523                    libsfiles="$libsfiles $yyy"
4524                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4525                    case " $libsdirs " in
4526                    *" $yyy "*) ;;
4527                    *) libsdirs="$libsdirs $yyy" ;;
4528                    esac
4529                    ;;
4530                 esac
4531                 break
4532             fi  
4533         done
4534         if $test ! -f "$xxx"; then
4535             echo "No -l$thislib."
4536         fi
4537 done
4538 set X $dflt
4539 shift
4540 dflt="$*"
4541 case "$libs" in
4542 '') dflt="$dflt";;
4543 *) dflt="$libs";;
4544 esac
4545 case "$dflt" in
4546 ' '|'') dflt='none';;
4547 esac
4548
4549 $cat <<EOM
4550
4551 In order to compile $package on your machine, a number of libraries
4552 are usually needed.  Include any other special libraries here as well.
4553 Say "none" for none.  The default list is almost always right.
4554 EOM
4555
4556 echo " "
4557 rp="What libraries to use?"
4558 . ./myread
4559 case "$ans" in
4560 none) libs=' ';;
4561 *) libs="$ans";;
4562 esac
4563
4564 : determine optimization, if desired, or use for debug flag also
4565 case "$optimize" in
4566 ' '|$undef) dflt='none';;
4567 '') dflt='-O';;
4568 *) dflt="$optimize";;
4569 esac
4570 $cat <<EOH
4571
4572 By default, $package compiles with the -O flag to use the optimizer.
4573 Alternately, you might want to use the symbolic debugger, which uses
4574 the -g flag (on traditional Unix systems).  Either flag can be
4575 specified here.  To use neither flag, specify the word "none".
4576
4577 EOH
4578 rp="What optimizer/debugger flag should be used?"
4579 . ./myread
4580 optimize="$ans"
4581 case "$optimize" in
4582 'none') optimize=" ";;
4583 esac
4584
4585 dflt=''
4586 : We will not override a previous value, but we might want to
4587 : augment a hint file
4588 case "$hint" in
4589 default|recommended)
4590         case "$gccversion" in
4591         1*) dflt='-fpcc-struct-return' ;;
4592         esac
4593         case "$optimize" in
4594         *-g*) dflt="$dflt -DDEBUGGING";;
4595         esac
4596         case "$gccversion" in
4597         2*) if test -d /etc/conf/kconfig.d &&
4598                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4599                 then
4600                         dflt="$dflt -posix"
4601                 fi
4602                 ;;
4603         esac
4604         case "$gccversion" in
4605         1*) ;;
4606         2.[0-8]*) ;;
4607         ?*)     echo " "
4608                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4609                 echo 'int main(void) { return 0; }' > gcctest.c
4610                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4611                         echo "Yes, it does." 2>&1
4612                         case "$ccflags" in
4613                         *strict-aliasing*) 
4614                                 echo "Leaving current flags $ccflags alone." 2>&1
4615                                 ;;
4616                         *) dflt="$dflt -fno-strict-aliasing" ;;
4617                         esac
4618                 else
4619                         echo "Nope, it doesn't, but that's ok." 2>&1
4620                 fi
4621                 ;;
4622         esac
4623         ;;
4624 esac
4625
4626 case "$mips_type" in
4627 *BSD*|'') inclwanted="$locincpth $usrinc";;
4628 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4629 esac
4630 for thisincl in $inclwanted; do
4631         if $test -d $thisincl; then
4632                 if $test x$thisincl != x$usrinc; then
4633                         case "$dflt" in
4634                         *" -I$thisincl "*);;
4635                         *) dflt="$dflt -I$thisincl ";;
4636                         esac
4637                 fi
4638         fi
4639 done
4640
4641 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4642         xxx=true;
4643 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4644         xxx=true;
4645 else
4646         xxx=false;
4647 fi;
4648 if $xxx; then
4649         case "$dflt" in
4650         *$2*);;
4651         *) dflt="$dflt -D$2";;
4652         esac;
4653 fi'
4654
4655 set signal.h LANGUAGE_C; eval $inctest
4656
4657 case "$usesocks" in
4658 $define)
4659         ccflags="$ccflags -DSOCKS"
4660         ;;
4661 esac
4662
4663 case "$hint" in
4664 default|recommended) dflt="$ccflags $dflt" ;;
4665 *) dflt="$ccflags";;
4666 esac
4667
4668 case "$dflt" in
4669 ''|' ') dflt=none;;
4670 esac
4671
4672 $cat <<EOH
4673
4674 Your C compiler may want other flags.  For this question you should include
4675 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4676 but you should NOT include libraries or ld flags like -lwhatever.  If you
4677 want $package to honor its debug switch, you should include -DDEBUGGING here.
4678 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4679
4680 To use no flags, specify the word "none".
4681
4682 EOH
4683 set X $dflt
4684 shift
4685 dflt=${1+"$@"}
4686 rp="Any additional cc flags?"
4687 . ./myread
4688 case "$ans" in
4689 none) ccflags='';;
4690 *) ccflags="$ans";;
4691 esac
4692
4693 : the following weeds options from ccflags that are of no interest to cpp
4694 case "$cppflags" in
4695 '') cppflags="$ccflags" ;;
4696 *)  cppflags="$cppflags $ccflags" ;;
4697 esac
4698 case "$gccversion" in
4699 1*) cppflags="$cppflags -D__GNUC__"
4700 esac
4701 case "$mips_type" in
4702 '');;
4703 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4704 esac
4705 case "$cppflags" in
4706 '');;
4707 *)
4708         echo " "
4709         echo "Let me guess what the preprocessor flags are..." >&4
4710         set X $cppflags
4711         shift
4712         cppflags=''
4713         $cat >cpp.c <<'EOM'
4714 #define BLURFL foo
4715
4716 BLURFL xx LFRULB
4717 EOM
4718         previous=''
4719         for flag in $*
4720         do
4721                 case "$flag" in
4722                 -*) ftry="$flag";;
4723                 *) ftry="$previous $flag";;
4724                 esac
4725                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4726                         >cpp1.out 2>/dev/null && \
4727                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4728                         >cpp2.out 2>/dev/null && \
4729                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4730                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4731                 then
4732                         cppflags="$cppflags $ftry"
4733                         previous=''
4734                 else
4735                         previous="$flag"
4736                 fi
4737         done
4738         set X $cppflags
4739         shift
4740         cppflags=${1+"$@"}
4741         case "$cppflags" in
4742         *-*)  echo "They appear to be: $cppflags";;
4743         esac
4744         $rm -f cpp.c cpp?.out
4745         ;;
4746 esac
4747
4748 : flags used in final linking phase
4749 case "$ldflags" in
4750 '') if ./venix; then
4751                 dflt='-i -z'
4752         else
4753                 dflt=''
4754         fi
4755         case "$ccflags" in
4756         *-posix*) dflt="$dflt -posix" ;;
4757         esac
4758         ;;
4759 *) dflt="$ldflags";;
4760 esac
4761
4762 : Try to guess additional flags to pick up local libraries.
4763 for thislibdir in $libpth; do
4764         case " $loclibpth " in
4765         *" $thislibdir "*)
4766                 case "$dflt " in 
4767                 *"-L$thislibdir "*) ;;
4768                 *)  dflt="$dflt -L$thislibdir" ;;
4769                 esac
4770                 ;;
4771         esac
4772 done
4773
4774 case "$dflt" in
4775 '') dflt='none' ;;
4776 esac
4777
4778 $cat <<EOH
4779
4780 Your C linker may need flags.  For this question you should
4781 include -L/whatever and any other flags used by the C linker, but you
4782 should NOT include libraries like -lwhatever.
4783
4784 Make sure you include the appropriate -L/path flags if your C linker
4785 does not normally search all of the directories you specified above,
4786 namely
4787         $libpth
4788 To use no flags, specify the word "none".
4789
4790 EOH
4791
4792 rp="Any additional ld flags (NOT including libraries)?"
4793 . ./myread
4794 case "$ans" in
4795 none) ldflags='';;
4796 *) ldflags="$ans";;
4797 esac
4798 rmlist="$rmlist pdp11"
4799
4800 : coherency check
4801 echo " "
4802 echo "Checking your choice of C compiler and flags for coherency..." >&4
4803 $cat > try.c <<'EOF'
4804 #include <stdio.h>
4805 int main() { printf("Ok\n"); exit(0); }
4806 EOF
4807 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4808 shift
4809 $cat >try.msg <<'EOM'
4810 I've tried to compile and run the following simple program:
4811
4812 EOM
4813 $cat try.c >> try.msg
4814
4815 $cat >> try.msg <<EOM
4816
4817 I used the command:
4818
4819         $*
4820         $run ./try
4821
4822 and I got the following output:
4823
4824 EOM
4825 dflt=y
4826 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4827         if $sh -c "$run ./try" >>try.msg 2>&1; then
4828                 xxx=`$run ./try`
4829                 case "$xxx" in
4830                 "Ok") dflt=n ;;
4831                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4832                         case " $libs " in
4833                         *" -lsfio "*)
4834                                 cat >> try.msg <<'EOQS'
4835 If $libs contains -lsfio, and sfio is mis-configured, then it
4836 sometimes (apparently) runs and exits with a 0 status, but with no
4837 output!  It may have to do with sfio's use of _exit vs. exit.
4838
4839 EOQS
4840                                 rp="You have a big problem.  Shall I abort Configure"
4841                                 dflt=y
4842                                 ;;
4843                         esac
4844                         ;;
4845                 esac
4846         else
4847                 echo "The program compiled OK, but exited with status $?." >>try.msg
4848                 rp="You have a problem.  Shall I abort Configure"
4849                 dflt=y
4850         fi
4851 else
4852         echo "I can't compile the test program." >>try.msg
4853         rp="You have a BIG problem.  Shall I abort Configure"
4854         dflt=y
4855 fi
4856 case "$dflt" in
4857 y)
4858         $cat try.msg >&4
4859         case "$knowitall" in
4860         '')
4861                 echo "(The supplied flags or libraries might be incorrect.)"
4862                 ;;
4863         *) dflt=n;;
4864         esac
4865         echo " "
4866         . ./myread
4867         case "$ans" in
4868         n*|N*) ;;
4869         *)      echo "Ok.  Stopping Configure." >&4
4870                 exit 1
4871                 ;;
4872         esac
4873         ;;
4874 n) echo "OK, that should do.";;
4875 esac
4876 $rm -f try try.* core
4877
4878 : define a shorthand compile call
4879 compile='
4880 mc_file=$1;
4881 shift;
4882 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4883 : define a shorthand compile call for compilations that should be ok.
4884 compile_ok='
4885 mc_file=$1;
4886 shift;
4887 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4888
4889 : check for lengths of integral types
4890 echo " "
4891 case "$intsize" in
4892 '')
4893         echo "Checking to see how big your integers are..." >&4
4894         $cat >try.c <<'EOCP'
4895 #include <stdio.h>
4896 int main()
4897 {
4898         printf("intsize=%d;\n", (int)sizeof(int));
4899         printf("longsize=%d;\n", (int)sizeof(long));
4900         printf("shortsize=%d;\n", (int)sizeof(short));
4901         exit(0);
4902 }
4903 EOCP
4904         set try
4905         if eval $compile_ok && $run ./try > /dev/null; then
4906                 eval `$run ./try`
4907                 echo "Your integers are $intsize bytes long."
4908                 echo "Your long integers are $longsize bytes long."
4909                 echo "Your short integers are $shortsize bytes long."
4910         else
4911                 $cat >&4 <<EOM
4912 !
4913 Help! I can't compile and run the intsize test program: please enlighten me!
4914 (This is probably a misconfiguration in your system or libraries, and
4915 you really ought to fix it.  Still, I'll try anyway.)
4916 !
4917 EOM
4918                 dflt=4
4919                 rp="What is the size of an integer (in bytes)?"
4920                 . ./myread
4921                 intsize="$ans"
4922                 dflt=$intsize
4923                 rp="What is the size of a long integer (in bytes)?"
4924                 . ./myread
4925                 longsize="$ans"
4926                 dflt=2
4927                 rp="What is the size of a short integer (in bytes)?"
4928                 . ./myread
4929                 shortsize="$ans"
4930         fi
4931         ;;
4932 esac
4933 $rm -f try try.*
4934
4935 : check for long long
4936 echo " "
4937 echo "Checking to see if you have long long..." >&4
4938 echo 'int main() { long long x = 7; return 0; }' > try.c
4939 set try
4940 if eval $compile; then
4941         val="$define"
4942         echo "You have long long."
4943 else
4944         val="$undef"
4945         echo "You do not have long long."
4946 fi
4947 $rm try.*
4948 set d_longlong
4949 eval $setvar
4950
4951 : check for length of long long
4952 case "${d_longlong}${longlongsize}" in
4953 $define)
4954         echo " "
4955         echo "Checking to see how big your long longs are..." >&4
4956         $cat >try.c <<'EOCP'
4957 #include <stdio.h>
4958 int main()
4959 {
4960     printf("%d\n", (int)sizeof(long long));
4961     return(0);
4962 }
4963 EOCP
4964         set try
4965         if eval $compile_ok; then
4966                 longlongsize=`$run ./try`
4967                 echo "Your long longs are $longlongsize bytes long."
4968         else
4969                 dflt='8'
4970                 echo " "
4971                 echo "(I can't seem to compile the test program.  Guessing...)"
4972                 rp="What is the size of a long long (in bytes)?"
4973                 . ./myread
4974                 longlongsize="$ans"
4975         fi
4976         if $test "X$longsize" = "X$longlongsize"; then
4977                 echo "(That isn't any different from an ordinary long.)"
4978         fi      
4979         ;;
4980 esac
4981 $rm -f try.* try
4982
4983 : determine filename position in cpp output
4984 echo " "
4985 echo "Computing filename position in cpp output for #include directives..." >&4
4986 case "$osname" in
4987 vos) testaccess=-e ;;
4988 *)   testaccess=-r ;;
4989 esac
4990 echo '#include <stdio.h>' > foo.c
4991 $cat >fieldn <<EOF
4992 $startsh
4993 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4994 $grep '^[       ]*#.*stdio\.h' | \
4995 while read cline; do
4996         pos=1
4997         set \$cline
4998         while $test \$# -gt 0; do
4999                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5000                         echo "\$pos"
5001                         exit 0
5002                 fi
5003                 shift
5004                 pos=\`expr \$pos + 1\`
5005         done
5006 done
5007 EOF
5008 chmod +x fieldn
5009 fieldn=`./fieldn`
5010 $rm -f foo.c fieldn
5011 case $fieldn in
5012 '') pos='???';;
5013 1) pos=first;;
5014 2) pos=second;;
5015 3) pos=third;;
5016 *) pos="${fieldn}th";;
5017 esac
5018 echo "Your cpp writes the filename in the $pos field of the line."
5019
5020 case "$osname" in
5021 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5022 *)   cppfilter='' ;;
5023 esac
5024 : locate header file
5025 $cat >findhdr <<EOF
5026 $startsh
5027 wanted=\$1
5028 name=''
5029 for usrincdir in $usrinc
5030 do
5031         if test -f \$usrincdir/\$wanted; then
5032                 echo "\$usrincdir/\$wanted"
5033                 exit 0
5034         fi
5035 done
5036 awkprg='{ print \$$fieldn }'
5037 echo "#include <\$wanted>" > foo\$\$.c
5038 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5039 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5040 while read cline; do
5041         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5042         case "\$name" in
5043         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5044         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5045         *) exit 2;;
5046         esac;
5047 done;
5048 #
5049 # status = 0: grep returned 0 lines, case statement not executed
5050 # status = 1: headerfile found
5051 # status = 2: while loop executed, no headerfile found
5052 #
5053 status=\$?
5054 $rm -f foo\$\$.c;
5055 if test \$status -eq 1; then
5056         exit 0;
5057 fi
5058 exit 1
5059 EOF
5060 chmod +x findhdr
5061
5062 : define an alternate in-header-list? function
5063 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5064 cont=true; xxf="echo \"<\$1> found.\" >&4";
5065 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5066 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5067 esac;
5068 case $# in 4) instead=instead;; *) instead="at last";; esac;
5069 while $test "$cont"; do
5070         xxx=`./findhdr $1`
5071         var=$2; eval "was=\$$2";
5072         if $test "$xxx" && $test -r "$xxx";
5073         then eval $xxf;
5074         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5075                 cont="";
5076         else eval $xxnf;
5077         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5078         set $yyy; shift; shift; yyy=$@;
5079         case $# in 0) cont="";;
5080         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5081                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5082         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5083                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5084         esac;
5085 done;
5086 while $test "$yyy";
5087 do set $yyy; var=$2; eval "was=\$$2";
5088         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5089         set $yyy; shift; shift; yyy=$@;
5090 done'
5091
5092 : see if inttypes.h is available
5093 : we want a real compile instead of Inhdr because some systems
5094 : have an inttypes.h which includes non-existent headers
5095 echo " "
5096 $cat >try.c <<EOCP
5097 #include <inttypes.h>
5098 int main() {
5099         static int32_t foo32 = 0x12345678;
5100 }
5101 EOCP
5102 set try
5103 if eval $compile; then
5104         echo "<inttypes.h> found." >&4
5105         val="$define"
5106 else
5107         echo "<inttypes.h> NOT found." >&4
5108         val="$undef"
5109 fi
5110 $rm -f try.c try
5111 set i_inttypes
5112 eval $setvar
5113
5114 : check for int64_t
5115 echo " "
5116 echo "Checking to see if you have int64_t..." >&4
5117 $cat >try.c <<EOCP
5118 #include <sys/types.h>
5119 #$i_inttypes I_INTTYPES
5120 #ifdef I_INTTYPES
5121 #include <inttypes.h>
5122 #endif
5123 int main() { int64_t x = 7; }
5124 EOCP
5125 set try
5126 if eval $compile; then
5127         val="$define"
5128         echo "You have int64_t."
5129 else
5130         val="$undef"
5131         echo "You do not have int64_t."
5132 fi
5133 $rm -f try try.*
5134 set d_int64_t
5135 eval $setvar
5136
5137
5138 echo " "
5139 echo "Checking which 64-bit integer type we could use..." >&4
5140
5141 case "$intsize" in
5142 8) val=int
5143    set quadtype
5144    eval $setvar
5145    val='"unsigned int"'
5146    set uquadtype
5147    eval $setvar
5148    quadkind=1
5149    ;;
5150 *) case "$longsize" in
5151    8) val=long
5152       set quadtype
5153       eval $setvar
5154       val='"unsigned long"'
5155       set uquadtype
5156       eval $setvar
5157       quadkind=2
5158       ;;
5159    *) case "$d_longlong:$longlongsize" in
5160       define:8)
5161         val='"long long"'
5162         set quadtype
5163         eval $setvar
5164         val='"unsigned long long"'
5165         set uquadtype
5166         eval $setvar
5167         quadkind=3
5168         ;;
5169       *) case "$d_int64_t" in
5170          define)
5171            val=int64_t
5172            set quadtype
5173            eval $setvar
5174            val=uint64_t
5175            set uquadtype
5176            eval $setvar
5177            quadkind=4
5178            ;;
5179          esac
5180          ;;
5181       esac
5182       ;;
5183    esac
5184    ;;
5185 esac
5186
5187 case "$quadtype" in
5188 '')     echo "Alas, no 64-bit integer types in sight." >&4
5189         d_quad="$undef"
5190         ;;
5191 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5192         d_quad="$define"
5193         ;;
5194 esac
5195
5196
5197 case "$uselonglong" in
5198 "$define"|true|[yY]*)
5199         cat <<EOM >&4
5200
5201 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5202 EOM
5203         use64bitint="$define"
5204         ;;
5205 esac                          
5206 case "$use64bits" in
5207 "$define"|true|[yY]*)
5208         cat <<EOM >&4
5209
5210 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5211 EOM
5212         use64bitint="$define"
5213         ;;
5214 esac                          
5215 case "$use64bitints" in
5216 "$define"|true|[yY]*)
5217         cat <<EOM >&4
5218
5219 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5220 EOM
5221         use64bitint="$define"
5222         ;;
5223 esac                          
5224 case "$use64bitsint" in
5225 "$define"|true|[yY]*)
5226         cat <<EOM >&4
5227
5228 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5229 EOM
5230         use64bitint="$define"
5231         ;;
5232 esac                          
5233 case "$uselonglongs" in
5234 "$define"|true|[yY]*)
5235         cat <<EOM >&4
5236
5237 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5238 EOM
5239         use64bitint="$define"
5240         ;;
5241 esac                          
5242 case "$use64bitsall" in
5243 "$define"|true|[yY]*)
5244         cat <<EOM >&4
5245
5246 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5247 EOM
5248         use64bitall="$define"
5249         ;;
5250 esac                          
5251
5252 case "$ccflags" in
5253 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5254 esac
5255 case "$use64bitall" in
5256 "$define"|true|[yY]*) use64bitint="$define" ;;
5257 esac
5258
5259 case "$longsize" in
5260 8) cat <<EOM
5261
5262 You have natively 64-bit long integers.
5263 EOM
5264    val="$define"
5265    ;;
5266 *) case "$use64bitint" in
5267    "$define"|true|[yY]*) dflt='y';;
5268    *) dflt='n';;
5269    esac
5270    case "$d_quad" in
5271    "$define") ;;
5272    *) dflt='n' ;;
5273    esac
5274    cat <<EOM
5275
5276 Perl can be built to take advantage of 64-bit integer types
5277 on some systems.  To do so, Configure can be run with -Duse64bitint.
5278 Choosing this option will most probably introduce binary incompatibilities.
5279
5280 If this doesn't make any sense to you, just accept the default '$dflt'.
5281 (The default has been chosen based on your configuration.)
5282 EOM
5283    rp='Try to use 64-bit integers, if available?'
5284    . ./myread
5285    case "$ans" in
5286    [yY]*) val="$define" ;;
5287    *)     val="$undef"  ;;
5288    esac
5289    ;;
5290 esac
5291 set use64bitint
5292 eval $setvar
5293
5294 case "$use64bitall" in
5295 "$define"|true|[yY]*) dflt='y' ;;
5296 *) case "$longsize" in
5297    8) dflt='y' ;;
5298    *) dflt='n' ;;
5299    esac
5300    ;;
5301 esac    
5302 cat <<EOM
5303
5304 You may also choose to try maximal 64-bitness.  It means using as much
5305 64-bitness as possible on the platform.  This in turn means even more
5306 binary incompatibilities.  On the other hand, your platform may not
5307 have any more 64-bitness available than what you already have chosen.
5308
5309 If this doesn't make any sense to you, just accept the default '$dflt'.
5310 (The default has been chosen based on your configuration.)
5311 EOM
5312 rp='Try to use maximal 64-bit support, if available?'
5313 . ./myread
5314 case "$ans" in
5315 [yY]*) val="$define" ;;
5316 *)     val="$undef"  ;;
5317 esac
5318 set use64bitall
5319 eval $setvar
5320 case "$use64bitall" in
5321 "$define")
5322         case "$use64bitint" in
5323         "$undef")
5324                 cat <<EOM
5325
5326 Since you have chosen a maximally 64-bit build, I'm also turning on
5327 the use of 64-bit integers.
5328 EOM
5329                 use64bitint="$define" ;;
5330         esac
5331         ;;
5332 esac
5333
5334 case "$use64bitint" in
5335 "$define"|true|[yY]*)
5336 : Look for a hint-file generated 'call-back-unit'.  If the
5337 : user has specified that a 64-bit perl is to be built,
5338 : we may need to set or change some other defaults.
5339         if $test -f use64bitint.cbu; then
5340                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5341                 . ./use64bitint.cbu
5342         fi
5343         case "$longsize" in
5344         4) case "$archname64" in
5345            '') archname64=64int ;;
5346            esac
5347            ;;
5348         esac
5349         ;;
5350 esac
5351
5352 case "$use64bitall" in
5353 "$define"|true|[yY]*)
5354 : Look for a hint-file generated 'call-back-unit'.  If the
5355 : user has specified that a maximally 64-bit perl is to be built,
5356 : we may need to set or change some other defaults.
5357         if $test -f use64bitall.cbu; then
5358                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5359                 . ./use64bitall.cbu
5360         fi
5361         case "$longsize" in
5362         4) case "$archname64" in
5363            ''|64int) archname64=64all ;;
5364            esac
5365            ;;
5366         esac
5367         ;;
5368 esac
5369
5370 echo " "
5371 echo "Checking for GNU C Library..." >&4
5372 cat >try.c <<'EOCP'
5373 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5374    alone are insufficient to distinguish different versions, such as
5375    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5376    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5377 */
5378 #include <stdio.h>
5379 int main(void)
5380 {
5381 #ifdef __GLIBC__
5382 #   ifdef __GLIBC_MINOR__
5383 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5384 #           include <gnu/libc-version.h>
5385             printf("%s\n",  gnu_get_libc_version());
5386 #       else
5387             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5388 #       endif
5389 #   else
5390         printf("%d\n",  __GLIBC__);
5391 #   endif
5392     return 0;
5393 #else
5394     return 1;
5395 #endif
5396 }
5397 EOCP
5398 set try
5399 if eval $compile_ok && $run ./try > glibc.ver; then
5400         val="$define"
5401         gnulibc_version=`$cat glibc.ver`
5402         echo "You are using the GNU C Library version $gnulibc_version"
5403 else
5404         val="$undef"
5405         gnulibc_version=''
5406         echo "You are not using the GNU C Library"
5407 fi
5408 $rm -f try try.* glibc.ver
5409 set d_gnulibc
5410 eval $setvar
5411
5412 : see if nm is to be used to determine whether a symbol is defined or not
5413 case "$usenm" in
5414 '')
5415         dflt=''
5416         case "$d_gnulibc" in
5417         "$define")
5418                 echo " "
5419                 echo "nm probably won't work on the GNU C Library." >&4
5420                 dflt=n
5421                 ;;
5422         esac
5423         case "$dflt" in
5424         '') 
5425                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
5426                         echo " "
5427                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5428                         echo "'nm' won't be sufficient on this sytem." >&4
5429                         dflt=n
5430                 fi
5431                 ;;
5432         esac
5433         case "$dflt" in
5434         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5435                 if $test $dflt -gt 20; then
5436                         dflt=y
5437                 else
5438                         dflt=n
5439                 fi
5440                 ;;
5441         esac
5442         ;;
5443 *)
5444         case "$usenm" in
5445         true|$define) dflt=y;;
5446         *) dflt=n;;
5447         esac
5448         ;;
5449 esac
5450 $cat <<EOM
5451
5452 I can use $nm to extract the symbols from your C libraries. This
5453 is a time consuming task which may generate huge output on the disk (up
5454 to 3 megabytes) but that should make the symbols extraction faster. The
5455 alternative is to skip the 'nm' extraction part and to compile a small
5456 test program instead to determine whether each symbol is present. If
5457 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5458 this may be the best solution.
5459
5460 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5461
5462 EOM
5463 rp="Shall I use $nm to extract C symbols from the libraries?"
5464 . ./myread
5465 case "$ans" in
5466 [Nn]*) usenm=false;;
5467 *) usenm=true;;
5468 esac
5469
5470 runnm=$usenm
5471 case "$reuseval" in
5472 true) runnm=false;;
5473 esac
5474
5475 : nm options which may be necessary
5476 case "$nm_opt" in
5477 '') if $test -f /mach_boot; then
5478                 nm_opt=''       # Mach
5479         elif $test -d /usr/ccs/lib; then
5480                 nm_opt='-p'     # Solaris (and SunOS?)
5481         elif $test -f /dgux; then
5482                 nm_opt='-p'     # DG-UX
5483         elif $test -f /lib64/rld; then
5484                 nm_opt='-p'     # 64-bit Irix
5485         else
5486                 nm_opt=''
5487         fi;;
5488 esac
5489
5490 : nm options which may be necessary for shared libraries but illegal
5491 : for archive libraries.  Thank you, Linux.
5492 case "$nm_so_opt" in
5493 '')     case "$myuname" in
5494         *linux*)
5495                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5496                         nm_so_opt='--dynamic'
5497                 fi
5498                 ;;
5499         esac
5500         ;;
5501 esac
5502
5503 case "$runnm" in
5504 true)
5505 : get list of predefined functions in a handy place
5506 echo " "
5507 case "$libc" in
5508 '') libc=unknown
5509         case "$libs" in
5510         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5511         esac
5512         ;;
5513 esac
5514 case "$libs" in
5515 '') ;;
5516 *)  for thislib in $libs; do
5517         case "$thislib" in
5518         -lc|-lc_s)
5519                 : Handle C library specially below.
5520                 ;;
5521         -l*)
5522                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5523                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5524                         :
5525                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5526                         :
5527                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5528                         :
5529                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5530                         :
5531                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5532                         :
5533                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5534                         :
5535                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5536                         :
5537                 else
5538                         try=''
5539                 fi
5540                 libnames="$libnames $try"
5541                 ;;
5542         *) libnames="$libnames $thislib" ;;
5543         esac
5544         done
5545         ;;
5546 esac
5547 xxx=normal
5548 case "$libc" in
5549 unknown)
5550         set /lib/libc.$so
5551         for xxx in $libpth; do
5552                 $test -r $1 || set $xxx/libc.$so
5553                 : The messy sed command sorts on library version numbers.
5554                 $test -r $1 || \
5555                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5556                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5557                                 h
5558                                 s/[0-9][0-9]*/0000&/g
5559                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5560                                 G
5561                                 s/\n/ /' | \
5562                          $sort | $sed -e 's/^.* //'`
5563                 eval set \$$#
5564         done
5565         $test -r $1 || set /usr/ccs/lib/libc.$so
5566         $test -r $1 || set /lib/libsys_s$_a
5567         ;;
5568 *)
5569         set blurfl
5570         ;;
5571 esac
5572 if $test -r "$1"; then
5573         echo "Your (shared) C library seems to be in $1."
5574         libc="$1"
5575 elif $test -r /lib/libc && $test -r /lib/clib; then
5576         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5577         xxx=apollo
5578         libc='/lib/clib /lib/libc'
5579         if $test -r /lib/syslib; then
5580                 echo "(Your math library is in /lib/syslib.)"
5581                 libc="$libc /lib/syslib"
5582         fi
5583 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5584         echo "Your C library seems to be in $libc, as you said before."
5585 elif $test -r $incpath/usr/lib/libc$_a; then
5586         libc=$incpath/usr/lib/libc$_a;
5587         echo "Your C library seems to be in $libc.  That's fine."
5588 elif $test -r /lib/libc$_a; then
5589         libc=/lib/libc$_a;
5590         echo "Your C library seems to be in $libc.  You're normal."
5591 else
5592         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5593                 :
5594         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5595                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5596         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5597                 :
5598         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5599                 :
5600         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5601                 :
5602         else
5603                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5604         fi
5605         if $test -r "$tans"; then
5606                 echo "Your C library seems to be in $tans, of all places."
5607                 libc=$tans
5608         else
5609                 libc='blurfl'
5610         fi
5611 fi
5612 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5613         dflt="$libc"
5614         cat <<EOM
5615
5616 If the guess above is wrong (which it might be if you're using a strange
5617 compiler, or your machine supports multiple models), you can override it here.
5618
5619 EOM
5620 else
5621         dflt=''
5622         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5623         cat >&4 <<EOM
5624 I can't seem to find your C library.  I've looked in the following places:
5625
5626 EOM
5627         $sed 's/^/      /' libpath
5628         cat <<EOM
5629
5630 None of these seems to contain your C library. I need to get its name...
5631
5632 EOM
5633 fi
5634 fn=f
5635 rp='Where is your C library?'
5636 . ./getfile
5637 libc="$ans"
5638
5639 echo " "
5640 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5641 set X `cat libnames`
5642 shift
5643 xxx=files
5644 case $# in 1) xxx=file; esac
5645 echo "Extracting names from the following $xxx for later perusal:" >&4
5646 echo " "
5647 $sed 's/^/      /' libnames >&4
5648 echo " "
5649 $echo $n "This may take a while...$c" >&4
5650
5651 for file in $*; do
5652         case $file in
5653         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5654         *) $nm $nm_opt $file 2>/dev/null;;
5655         esac
5656 done >libc.tmp
5657
5658 $echo $n ".$c"
5659 $grep fprintf libc.tmp > libc.ptf
5660 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5661 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5662 xxx='[ADTSIW]'
5663 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5664         eval $xscan;\
5665         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5666                 eval $xrun
5667 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5668         eval $xscan;\
5669         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5670                 eval $xrun
5671 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5672         eval $xscan;\
5673         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5674                 eval $xrun
5675 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5676         eval $xscan;\
5677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5678                 eval $xrun
5679 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5680         eval $xscan;\
5681         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5682                 eval $xrun
5683 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5684         eval $xscan;\
5685         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5686                 eval $xrun
5687 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5688                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5689         eval $xscan;\
5690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5691                 eval $xrun
5692 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5693         eval $xscan;\
5694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5695                 eval $xrun
5696 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5697         eval $xscan;\
5698         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5699                 eval $xrun
5700 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5701         eval $xscan;\
5702         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5703                 eval $xrun
5704 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5705         eval $xscan;\
5706         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5707                 eval $xrun
5708 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5709         eval $xscan;\
5710         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5711                 eval $xrun
5712 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5713         eval $xscan;\
5714         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5715                 eval $xrun
5716 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5717         eval $xscan;\
5718         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5719                 eval $xrun
5720 else
5721         $nm -p $* 2>/dev/null >libc.tmp
5722         $grep fprintf libc.tmp > libc.ptf
5723         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5724                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5725         then
5726                 nm_opt='-p'
5727                 eval $xrun
5728         else
5729                 echo " "
5730                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5731                 com=''
5732                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5733                         for thisname in $libnames $libc; do
5734                                 $ar t $thisname >>libc.tmp
5735                         done
5736                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5737                         echo "Ok." >&4
5738                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5739                         # Repeat libc to extract forwarders to DLL entries too
5740                         for thisname in $libnames $libc; do
5741                                 $ar tv $thisname >>libc.tmp
5742                                 # Revision 50 of EMX has bug in $ar.
5743                                 # it will not extract forwarders to DLL entries
5744                                 # Use emximp which will extract exactly them.
5745                                 emximp -o tmp.imp $thisname \
5746                                     2>/dev/null && \
5747                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5748                                     < tmp.imp >>libc.tmp
5749                                 $rm tmp.imp
5750                         done
5751                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5752                         echo "Ok." >&4
5753                 else
5754                         echo "$ar didn't seem to work right." >&4
5755                         echo "Maybe this is a Cray...trying bld instead..." >&4
5756                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5757                         then
5758                                 for thisname in $libnames; do
5759                                         bld t $libnames | \
5760                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5761                                         $ar t $thisname >>libc.tmp
5762                                 done
5763                                 echo "Ok." >&4
5764                         else
5765                                 echo "That didn't work either.  Giving up." >&4
5766                                 exit 1
5767                         fi
5768                 fi
5769         fi
5770 fi
5771 nm_extract="$com"
5772 case "$PASE" in
5773 define)
5774     echo " "
5775     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
5776     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
5777     ;;
5778 *)  if $test -f /lib/syscalls.exp; then
5779         echo " "
5780         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5781         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5782     fi
5783     ;;
5784 esac
5785 ;;
5786 esac
5787 $rm -f libnames libpath
5788
5789 : is a C symbol defined?
5790 csym='tlook=$1;
5791 case "$3" in
5792 -v) tf=libc.tmp; tc=""; tdc="";;
5793 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5794 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5795 esac;
5796 tx=yes;
5797 case "$reuseval-$4" in
5798 true-) ;;
5799 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5800 esac;
5801 case "$tx" in
5802 yes)
5803         case "$runnm" in
5804         true)
5805                 if $contains $tlook $tf >/dev/null 2>&1;
5806                 then tval=true;
5807                 else tval=false;
5808                 fi;;
5809         *)
5810                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5811                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5812                 then tval=true;
5813                 else tval=false;
5814                 fi;
5815                 $rm -f t t.c;;
5816         esac;;
5817 *)
5818         case "$tval" in
5819         $define) tval=true;;
5820         *) tval=false;;
5821         esac;;
5822 esac;
5823 eval "$2=$tval"'
5824
5825 : define an is-in-libc? function
5826 inlibc='echo " "; td=$define; tu=$undef;
5827 sym=$1; var=$2; eval "was=\$$2";
5828 tx=yes;
5829 case "$reuseval$was" in
5830 true) ;;
5831 true*) tx=no;;
5832 esac;
5833 case "$tx" in
5834 yes)
5835         set $sym tres -f;
5836         eval $csym;
5837         case "$tres" in
5838         true)
5839                 echo "$sym() found." >&4;
5840                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5841         *)
5842                 echo "$sym() NOT found." >&4;
5843                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5844         esac;;
5845 *)
5846         case "$was" in
5847         $define) echo "$sym() found." >&4;;
5848         *) echo "$sym() NOT found." >&4;;
5849         esac;;
5850 esac'
5851
5852 : see if sqrtl exists
5853 set sqrtl d_sqrtl
5854 eval $inlibc
5855
5856 hasproto='varname=$1; func=$2; shift; shift;
5857 while $test $# -ge 2; do
5858         case "$1" in
5859         $define) echo "#include <$2>";;
5860         esac ;
5861     shift 2;
5862 done > try.c;
5863 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
5864 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
5865         echo "$func() prototype found.";
5866         val="$define";
5867 else
5868         echo "$func() prototype NOT found.";
5869         val="$undef";
5870 fi;
5871 set $varname;
5872 eval $setvar;
5873 $rm -f try.c tryout.c'
5874
5875 : check for length of double
5876 echo " "
5877 case "$doublesize" in
5878 '')
5879         echo "Checking to see how big your double precision numbers are..." >&4
5880         $cat >try.c <<'EOCP'
5881 #include <stdio.h>
5882 int main()
5883 {
5884     printf("%d\n", (int)sizeof(double));
5885     exit(0);
5886 }
5887 EOCP
5888         set try
5889         if eval $compile_ok; then
5890                 doublesize=`$run ./try`
5891                 echo "Your double is $doublesize bytes long."
5892         else
5893                 dflt='8'
5894                 echo "(I can't seem to compile the test program.  Guessing...)"
5895                 rp="What is the size of a double precision number (in bytes)?"
5896                 . ./myread
5897                 doublesize="$ans"
5898         fi
5899         ;;
5900 esac
5901 $rm -f try.c try
5902
5903 : check for long doubles
5904 echo " "
5905 echo "Checking to see if you have long double..." >&4
5906 echo 'int main() { long double x = 7.0; }' > try.c
5907 set try
5908 if eval $compile; then
5909         val="$define"
5910         echo "You have long double."
5911 else
5912         val="$undef"
5913         echo "You do not have long double."
5914 fi
5915 $rm try.*
5916 set d_longdbl
5917 eval $setvar
5918
5919 : check for length of long double
5920 case "${d_longdbl}${longdblsize}" in
5921 $define)
5922         echo " "
5923         echo "Checking to see how big your long doubles are..." >&4
5924         $cat >try.c <<'EOCP'
5925 #include <stdio.h>
5926 int main()
5927 {
5928         printf("%d\n", sizeof(long double));
5929 }
5930 EOCP
5931         set try
5932         set try
5933         if eval $compile; then
5934                 longdblsize=`$run ./try`
5935                 echo "Your long doubles are $longdblsize bytes long."
5936         else
5937                 dflt='8'
5938                 echo " "
5939                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5940                 rp="What is the size of a long double (in bytes)?"
5941                 . ./myread
5942                 longdblsize="$ans"
5943         fi
5944         if $test "X$doublesize" = "X$longdblsize"; then
5945                 echo "(That isn't any different from an ordinary double.)"
5946         fi      
5947         ;;
5948 esac
5949 $rm -f try.* try
5950
5951 echo " "
5952
5953 if $test X"$d_longdbl" = X"$define"; then
5954
5955 echo "Checking how to print long doubles..." >&4
5956
5957 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5958         $cat >try.c <<'EOCP'
5959 #include <sys/types.h>
5960 #include <stdio.h>
5961 int main() {
5962   double d = 123.456;
5963   printf("%.3f\n", d);
5964 }
5965 EOCP
5966         set try
5967         if eval $compile; then
5968                 yyy=`$run ./try`
5969                 case "$yyy" in
5970                 123.456)
5971                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5972                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5973                         echo "We will use %f."
5974                         ;;
5975                 esac
5976         fi
5977 fi
5978
5979 if $test X"$sPRIfldbl" = X; then
5980         $cat >try.c <<'EOCP'
5981 #include <sys/types.h>
5982 #include <stdio.h>
5983 int main() {
5984   long double d = 123.456;
5985   printf("%.3Lf\n", d);
5986 }
5987 EOCP
5988         set try
5989         if eval $compile; then
5990                 yyy=`$run ./try`
5991                 case "$yyy" in
5992                 123.456)
5993                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5994                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5995                         echo "We will use %Lf."
5996                         ;;
5997                 esac
5998         fi
5999 fi
6000
6001 if $test X"$sPRIfldbl" = X; then
6002         $cat >try.c <<'EOCP'
6003 #include <sys/types.h>
6004 #include <stdio.h>
6005 int main() {
6006   long double d = 123.456;
6007   printf("%.3llf\n", d);
6008 }
6009 EOCP
6010         set try
6011         if eval $compile; then
6012                 yyy=`$run ./try`
6013                 case "$yyy" in
6014                 123.456)
6015                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6016                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6017                         echo "We will use %llf."
6018                         ;;
6019                 esac
6020         fi
6021 fi
6022
6023 if $test X"$sPRIfldbl" = X; then
6024         $cat >try.c <<'EOCP'
6025 #include <sys/types.h>
6026 #include <stdio.h>
6027 int main() {
6028   long double d = 123.456;
6029   printf("%.3lf\n", d);
6030 }
6031 EOCP
6032         set try
6033         if eval $compile; then
6034                 yyy=`$run ./try`
6035                 case "$yyy" in
6036                 123.456)
6037                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6038                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6039                         echo "We will use %lf."
6040                         ;;
6041                 esac
6042         fi
6043 fi
6044
6045 if $test X"$sPRIfldbl" = X; then
6046         echo "Cannot figure out how to print long doubles." >&4
6047 else
6048         sSCNfldbl=$sPRIfldbl    # expect consistency
6049 fi
6050
6051 $rm -f try try.*
6052
6053 fi # d_longdbl
6054
6055 case "$sPRIfldbl" in
6056 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6057         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6058         d_SCNfldbl="$undef";
6059         ;;
6060 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6061         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6062         d_SCNfldbl="$define";
6063         ;;
6064 esac
6065
6066 : see if modfl exists
6067 set modfl d_modfl
6068 eval $inlibc
6069
6070 : see if prototype for modfl is available
6071 echo " "
6072 set d_modflproto modfl math.h
6073 eval $hasproto
6074
6075 d_modfl_pow32_bug="$undef"
6076
6077 case "$d_longdbl$d_modfl" in
6078 $define$define)
6079         $cat <<EOM
6080 Checking to see whether your modfl() is okay for large values...
6081 EOM
6082 $cat >try.c <<EOCP
6083 #include <math.h> 
6084 #include <stdio.h>
6085 EOCP
6086 if $test "X$d_modflproto" != "X$define"; then
6087         $cat >>try.c <<EOCP
6088 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6089 long double modfl (long double, long double *);
6090 EOCP
6091 fi
6092 $cat >>try.c <<EOCP
6093 int main() {
6094     long double nv = 4294967303.15;
6095     long double v, w;
6096     v = modfl(nv, &w);         
6097 #ifdef __GLIBC__
6098     printf("glibc");
6099 #endif
6100     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6101     return 0;
6102 }
6103 EOCP
6104         case "$osname:$gccversion" in
6105         aix:)   saveccflags="$ccflags"
6106                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6107         esac
6108         set try
6109         if eval $compile; then
6110                 foo=`$run ./try`
6111                 case "$foo" in
6112                 *" 4294967303.150000 1.150000 4294967302.000000")
6113                         echo >&4 "Your modfl() is broken for large values."
6114                         d_modfl_pow32_bug="$define"
6115                         case "$foo" in
6116                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6117                         ;;
6118                         esac
6119                         ;;
6120                 *" 4294967303.150000 0.150000 4294967303.000000")
6121                         echo >&4 "Your modfl() seems okay for large values."
6122                         ;;
6123                 *)      echo >&4 "I don't understand your modfl() at all."
6124                         d_modfl="$undef"
6125                         ;;
6126                 esac
6127                 $rm -f try.* try core core.try.*
6128         else
6129                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6130                 d_modfl="$undef"
6131         fi
6132         case "$osname:$gccversion" in
6133         aix:)   ccflags="$saveccflags" ;; # restore
6134         esac
6135         ;;
6136 esac
6137
6138 case "$ccflags" in
6139 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6140 esac
6141
6142 case "$uselongdouble" in
6143 $define|true|[yY]*)     dflt='y';;
6144 *) dflt='n';;
6145 esac
6146 cat <<EOM
6147
6148 Perl can be built to take advantage of long doubles which
6149 (if available) may give more accuracy and range for floating point numbers.
6150
6151 If this doesn't make any sense to you, just accept the default '$dflt'.
6152 EOM
6153 rp='Try to use long doubles if available?'
6154 . ./myread
6155 case "$ans" in
6156 y|Y)    val="$define"   ;;
6157 *)      val="$undef"    ;;
6158 esac
6159 set uselongdouble
6160 eval $setvar
6161
6162 case "$uselongdouble" in
6163 true|[yY]*) uselongdouble="$define" ;;
6164 esac
6165
6166 case "$uselongdouble" in
6167 $define)
6168 : Look for a hint-file generated 'call-back-unit'.  If the
6169 : user has specified that long doubles should be used,
6170 : we may need to set or change some other defaults.
6171         if $test -f uselongdouble.cbu; then
6172                 echo "Your platform has some specific hints for long doubles, using them..."
6173                 . ./uselongdouble.cbu
6174         else
6175                 $cat <<EOM
6176 (Your platform doesn't have any specific hints for long doubles.)
6177 EOM
6178         fi
6179         ;;
6180 esac
6181
6182 message=X
6183 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6184 $define:$define:$define)
6185         : You have both
6186         ;;
6187 $define:$define:$undef)
6188         message="I could not find modfl"
6189         ;;
6190 $define:$undef:$define)
6191         message="I could not find sqrtl"
6192         ;;
6193 $define:$undef:$undef)
6194         message="I found neither sqrtl nor modfl"
6195         ;;
6196 esac
6197
6198 if $test "$message" != X; then
6199         $cat <<EOM >&4
6200
6201 *** You requested the use of long doubles but you do not seem to have
6202 *** the mathematic functions for long doubles.
6203 *** ($message)
6204 *** I'm disabling the use of long doubles.
6205
6206 EOM
6207
6208         uselongdouble=$undef
6209 fi
6210
6211 : determine the architecture name
6212 echo " "
6213 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6214         tarch=`arch`"-$osname"
6215 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6216         if uname -m > tmparch 2>&1 ; then
6217                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6218                         -e 's/$/'"-$osname/" tmparch`
6219         else
6220                 tarch="$osname"
6221         fi
6222         $rm -f tmparch
6223 else
6224         tarch="$osname"
6225 fi
6226 case "$myarchname" in
6227 ''|"$tarch") ;;
6228 *)
6229         echo "(Your architecture name used to be $myarchname.)"
6230         archname=''
6231         ;;
6232 esac
6233 case "$targetarch" in
6234 '') ;;
6235 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6236 esac
6237 myarchname="$tarch"
6238 case "$archname" in
6239 '') dflt="$tarch";;
6240 *) dflt="$archname";;
6241 esac
6242 rp='What is your architecture name'
6243 . ./myread
6244 archname="$ans"
6245 case "$usethreads" in
6246 $define)
6247         echo "Threads selected." >&4
6248         case "$archname" in
6249         *-thread*) echo "...and architecture name already has -thread." >&4
6250                 ;;
6251         *)      archname="$archname-thread"
6252                 echo "...setting architecture name to $archname." >&4
6253                 ;;
6254         esac
6255         ;;
6256 esac
6257 case "$usemultiplicity" in
6258 $define)
6259         echo "Multiplicity selected." >&4
6260         case "$archname" in
6261         *-multi*) echo "...and architecture name already has -multi." >&4
6262                 ;;
6263         *)      archname="$archname-multi"
6264                 echo "...setting architecture name to $archname." >&4
6265                 ;;
6266         esac
6267         ;;
6268 esac
6269 case "$use64bitint$use64bitall" in
6270 *"$define"*)
6271         case "$archname64" in
6272         '')
6273                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6274                 ;;
6275         *)
6276                 case "$use64bitint" in
6277                 "$define") echo "64 bit integers selected." >&4 ;;
6278                 esac
6279                 case "$use64bitall" in
6280                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6281                 esac
6282                 case "$archname" in
6283                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6284                         ;;
6285                 *)      archname="$archname-$archname64"
6286                         echo "...setting architecture name to $archname." >&4
6287                         ;;
6288                 esac
6289                 ;;
6290         esac
6291 esac
6292 case "$uselongdouble" in
6293 $define)
6294         echo "Long doubles selected." >&4
6295         case "$longdblsize" in
6296         $doublesize)
6297                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6298                 ;;
6299         *)
6300                 case "$archname" in
6301                 *-ld*) echo "...and architecture name already has -ld." >&4
6302                         ;;
6303                 *)      archname="$archname-ld"
6304                         echo "...setting architecture name to $archname." >&4
6305                         ;;
6306                 esac
6307                 ;;
6308         esac
6309         ;;
6310 esac
6311 case "$useperlio" in
6312 $define)
6313         echo "Perlio selected." >&4
6314         ;;
6315 *)
6316         echo "Perlio not selected, using stdio." >&4
6317         case "$archname" in
6318         *-stdio*) echo "...and architecture name already has -stdio." >&4
6319                 ;;
6320         *)      archname="$archname-stdio"
6321                 echo "...setting architecture name to $archname." >&4
6322                 ;;
6323         esac
6324         ;;
6325 esac
6326
6327 : determine root of directory hierarchy where package will be installed.
6328 case "$prefix" in
6329 '')
6330         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6331         ;;
6332 *?/)
6333         dflt=`echo "$prefix" | sed 's/.$//'`
6334         ;;
6335 *)
6336         dflt="$prefix"
6337         ;;
6338 esac
6339 $cat <<EOM
6340
6341 By default, $package will be installed in $dflt/bin, manual pages
6342 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6343 installation directories. Typically this is something like /usr/local.
6344 If you wish to have binaries under /usr/bin but other parts of the
6345 installation under /usr/local, that's ok: you will be prompted
6346 separately for each of the installation directories, the prefix being
6347 only used to set the defaults.
6348
6349 EOM
6350 fn=d~
6351 rp='Installation prefix to use?'
6352 . ./getfile
6353 oldprefix=''
6354 case "$prefix" in
6355 '') ;;
6356 *)
6357         case "$ans" in
6358         "$prefix") ;;
6359         *) oldprefix="$prefix";;
6360         esac
6361         ;;
6362 esac
6363 prefix="$ans"
6364 prefixexp="$ansexp"
6365
6366 case "$afsroot" in
6367 '')     afsroot=/afs ;;
6368 *)      afsroot=$afsroot ;;
6369 esac
6370
6371 : is AFS running?
6372 echo " "
6373 case "$afs" in
6374 $define|true)   afs=true ;;
6375 $undef|false)   afs=false ;;
6376 *)      if test -d $afsroot; then
6377                 afs=true
6378         else
6379                 afs=false
6380         fi
6381         ;;
6382 esac
6383 if $afs; then
6384         echo "AFS may be running... I'll be extra cautious then..." >&4
6385 else
6386         echo "AFS does not seem to be running..." >&4
6387 fi
6388
6389 : determine installation prefix for where package is to be installed.
6390 if $afs; then 
6391 $cat <<EOM
6392
6393 Since you are running AFS, I need to distinguish the directory in which
6394 files will reside from the directory in which they are installed (and from
6395 which they are presumably copied to the former directory by occult means).
6396
6397 EOM
6398         case "$installprefix" in
6399         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6400         *) dflt="$installprefix";;
6401         esac
6402 else
6403 $cat <<EOM
6404
6405 In some special cases, particularly when building $package for distribution,
6406 it is convenient to distinguish between the directory in which files should 
6407 be installed from the directory ($prefix) in which they 
6408 will eventually reside.  For most users, these two directories are the same.
6409
6410 EOM
6411         case "$installprefix" in
6412         '') dflt=$prefix ;;
6413         *) dflt=$installprefix;;
6414         esac
6415 fi
6416 fn=d~
6417 rp='What installation prefix should I use for installing files?'
6418 . ./getfile
6419 installprefix="$ans"
6420 installprefixexp="$ansexp"
6421
6422 : set the prefixit variable, to compute a suitable default value
6423 prefixit='case "$3" in
6424 ""|none)
6425         case "$oldprefix" in
6426         "") eval "$1=\"\$$2\"";;
6427         *)
6428                 case "$3" in
6429                 "") eval "$1=";;
6430                 none)
6431                         eval "tp=\"\$$2\"";
6432                         case "$tp" in
6433                         ""|" ") eval "$1=\"\$$2\"";;
6434                         *) eval "$1=";;
6435                         esac;;
6436                 esac;;
6437         esac;;
6438 *)
6439         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6440         case "$tp" in
6441         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6442         /*-$oldprefix/*|\~*-$oldprefix/*)
6443                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6444         *) eval "$1=\"\$$2\"";;
6445         esac;;
6446 esac'
6447
6448 : get the patchlevel
6449 echo " "
6450 echo "Getting the current patchlevel..." >&4
6451 if $test -r $rsrc/patchlevel.h;then
6452         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6453         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6454         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6455         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6456         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6457         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6458        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6459 else
6460         revision=0
6461         patchlevel=0
6462         subversion=0
6463         api_revision=0
6464         api_version=0
6465         api_subversion=0
6466         perl_patchlevel=0
6467         $echo "(You do not have patchlevel.h.  Eek.)"
6468 fi
6469 if $test -r $rsrc/.patch ; then  
6470         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6471                 perl_patchlevel=`cat $rsrc/.patch`
6472         fi
6473 fi
6474 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6475 version_patchlevel_string="version $patchlevel subversion $subversion"
6476 case "$perl_patchlevel" in
6477 0|'') ;;
6478 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6479 esac
6480
6481 $echo "(You have $package $version_patchlevel_string.)"
6482
6483 case "$osname" in
6484 dos|vms)
6485         : XXX Should be a Configure test for double-dots in filenames.
6486         version=`echo $revision $patchlevel $subversion | \
6487                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6488         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6489                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6490         ;;
6491 *)
6492         version=`echo $revision $patchlevel $subversion | \
6493                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6494         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6495                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6496         ;;
6497 esac
6498 : Special case the 5.005_xx maintenance series, which used 5.005
6499 : without any subversion label as a subdirectory in $sitelib
6500 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6501         api_versionstring='5.005'
6502 fi
6503
6504 : determine installation style
6505 : For now, try to deduce it from prefix unless it is already set.
6506 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6507 case "$installstyle" in
6508 '')     case "$prefix" in
6509                 *perl*) dflt='lib';;
6510                 *) dflt='lib/perl5' ;;
6511         esac
6512         ;;
6513 *)      dflt="$installstyle" ;;
6514 esac
6515 : Probably not worth prompting for this since we prompt for all
6516 : the directories individually, and the prompt would be too long and
6517 : confusing anyway.
6518 installstyle=$dflt
6519
6520 : determine where private library files go
6521 : Usual default is /usr/local/lib/perl5/$version.
6522 : Also allow things like /opt/perl/lib/$version, since 
6523 : /opt/perl/lib/perl5... would be redundant.
6524 : The default "style" setting is made in installstyle.U
6525 case "$installstyle" in
6526 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6527 *)       set dflt privlib lib/$version ;;
6528 esac
6529 eval $prefixit
6530 $cat <<EOM
6531
6532 There are some auxiliary files for $package that need to be put into a
6533 private library directory that is accessible by everyone.
6534
6535 EOM
6536 fn=d~+
6537 rp='Pathname where the private library files will reside?'
6538 . ./getfile
6539 privlib="$ans"
6540 privlibexp="$ansexp"
6541 : Change installation prefix, if necessary.
6542 if $test X"$prefix" != X"$installprefix"; then
6543         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6544 else
6545         installprivlib="$privlibexp"
6546 fi
6547
6548 : set the prefixup variable, to restore leading tilda escape
6549 prefixup='case "$prefixexp" in
6550 "$prefix") ;;
6551 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6552 esac'
6553
6554 : determine where public architecture dependent libraries go
6555 set archlib archlib
6556 eval $prefixit
6557 : privlib default is /usr/local/lib/$package/$version
6558 : archlib default is /usr/local/lib/$package/$version/$archname
6559 : privlib may have an optional trailing /share.
6560 tdflt=`echo $privlib | $sed 's,/share$,,'`
6561 tdflt=$tdflt/$archname
6562 case "$archlib" in
6563 '')     dflt=$tdflt
6564         ;;
6565 *)      dflt="$archlib"
6566     ;;
6567 esac
6568 $cat <<EOM
6569
6570 $spackage contains architecture-dependent library files.  If you are
6571 sharing libraries in a heterogeneous environment, you might store
6572 these files in a separate location.  Otherwise, you can just include
6573 them with the rest of the public library files.
6574
6575 EOM
6576 fn=d+~
6577 rp='Where do you want to put the public architecture-dependent libraries?'
6578 . ./getfile
6579 archlib="$ans"
6580 archlibexp="$ansexp"
6581 if $test X"$archlib" = X"$privlib"; then
6582         d_archlib="$undef"
6583 else
6584         d_archlib="$define"
6585 fi
6586 : Change installation prefix, if necessary.
6587 if $test X"$prefix" != X"$installprefix"; then
6588         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6589 else
6590         installarchlib="$archlibexp"
6591 fi
6592
6593 : see if setuid scripts can be secure
6594 $cat <<EOM
6595
6596 Some kernels have a bug that prevents setuid #! scripts from being
6597 secure.  Some sites have disabled setuid #! scripts because of this.
6598
6599 First let's decide if your kernel supports secure setuid #! scripts.
6600 (If setuid #! scripts would be secure but have been disabled anyway,
6601 don't say that they are secure if asked.)
6602
6603 EOM
6604
6605 val="$undef"
6606 if $test -d /dev/fd; then
6607         echo "#!$ls" >reflect
6608         chmod +x,u+s reflect
6609         ./reflect >flect 2>&1
6610         if $contains "/dev/fd" flect >/dev/null; then
6611                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6612                 val="$define"
6613         else
6614                 $cat <<EOM
6615 If you are not sure if they are secure, I can check but I'll need a
6616 username and password different from the one you are using right now.
6617 If you don't have such a username or don't want me to test, simply
6618 enter 'none'.
6619
6620 EOM
6621                 rp='Other username to test security of setuid scripts with?'
6622                 dflt='none'
6623                 . ./myread
6624                 case "$ans" in
6625                 n|none)
6626                         case "$d_suidsafe" in
6627                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6628                                 dflt=n;;
6629                         "$undef")
6630                                 echo "Well, the $hint value is *not* secure." >&4
6631                                 dflt=n;;
6632                         *)      echo "Well, the $hint value *is* secure." >&4
6633                                 dflt=y;;
6634                         esac
6635                         ;;
6636                 *)
6637                         $rm -f reflect flect
6638                         echo "#!$ls" >reflect
6639                         chmod +x,u+s reflect
6640                         echo >flect
6641                         chmod a+w flect
6642                         echo '"su" will (probably) prompt you for '"$ans's password."
6643                         su $ans -c './reflect >flect'
6644                         if $contains "/dev/fd" flect >/dev/null; then
6645                                 echo "Okay, it looks like setuid scripts are secure." >&4
6646                                 dflt=y
6647                         else
6648                                 echo "I don't think setuid scripts are secure." >&4
6649                                 dflt=n
6650                         fi
6651                         ;;
6652                 esac
6653                 rp='Does your kernel have *secure* setuid scripts?'
6654                 . ./myread
6655                 case "$ans" in
6656                 [yY]*)  val="$define";;
6657                 *)      val="$undef";;
6658                 esac
6659         fi
6660 else
6661         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6662         echo "(That's for file descriptors, not floppy disks.)"
6663         val="$undef"
6664 fi
6665 set d_suidsafe
6666 eval $setvar
6667
6668 $rm -f reflect flect
6669
6670 : now see if they want to do setuid emulation
6671 echo " "
6672 val="$undef"
6673 case "$d_suidsafe" in
6674 "$define")
6675         val="$undef"
6676         echo "No need to emulate SUID scripts since they are secure here." >&4
6677         ;;
6678 *)
6679         $cat <<EOM
6680 Some systems have disabled setuid scripts, especially systems where
6681 setuid scripts cannot be secure.  On systems where setuid scripts have
6682 been disabled, the setuid/setgid bits on scripts are currently
6683 useless.  It is possible for $package to detect those bits and emulate
6684 setuid/setgid in a secure fashion.  This emulation will only work if
6685 setuid scripts have been disabled in your kernel.
6686
6687 EOM
6688         case "$d_dosuid" in
6689         "$define") dflt=y ;;
6690         *) dflt=n ;;
6691         esac
6692         rp="Do you want to do setuid/setgid emulation?"
6693         . ./myread
6694         case "$ans" in
6695         [yY]*)  val="$define";;
6696         *)      val="$undef";;
6697         esac
6698         ;;
6699 esac
6700 set d_dosuid
6701 eval $setvar
6702
6703 : see if this is a malloc.h system
6704 set malloc.h i_malloc
6705 eval $inhdr
6706
6707 : see if stdlib is available
6708 set stdlib.h i_stdlib
6709 eval $inhdr
6710
6711 : check for void type
6712 echo " "
6713 echo "Checking to see how well your C compiler groks the void type..." >&4
6714 case "$voidflags" in
6715 '')
6716         $cat >try.c <<'EOCP'
6717 #if TRY & 1
6718 void sub() {
6719 #else
6720 sub() {
6721 #endif
6722         extern void moo();      /* function returning void */
6723         void (*goo)();          /* ptr to func returning void */
6724 #if TRY & 8
6725         void *hue;              /* generic ptr */
6726 #endif
6727 #if TRY & 2
6728         void (*foo[10])();
6729 #endif
6730
6731 #if TRY & 4
6732         if(goo == moo) {
6733                 exit(0);
6734         }
6735 #endif
6736         exit(0);
6737 }
6738 int main() { sub(); }
6739 EOCP
6740         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6741                 voidflags=$defvoidused
6742         echo "Good.  It appears to support void to the level $package wants.">&4
6743                 if $contains warning .out >/dev/null 2>&1; then
6744                         echo "However, you might get some warnings that look like this:"
6745                         $cat .out
6746                 fi
6747         else
6748 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6749                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6750                         echo "It supports 1..."
6751                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6752                                 echo "It also supports 2..."
6753                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6754                                         voidflags=7
6755                                         echo "And it supports 4 but not 8 definitely."
6756                                 else
6757                                         echo "It doesn't support 4..."
6758                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6759                                                 voidflags=11
6760                                                 echo "But it supports 8."
6761                                         else
6762                                                 voidflags=3
6763                                                 echo "Neither does it support 8."
6764                                         fi
6765                                 fi
6766                         else
6767                                 echo "It does not support 2..."
6768                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6769                                         voidflags=13
6770                                         echo "But it supports 4 and 8."
6771                                 else
6772                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6773                                                 voidflags=5
6774                                                 echo "And it supports 4 but has not heard about 8."
6775                                         else
6776                                                 echo "However it supports 8 but not 4."
6777                                         fi
6778                                 fi
6779                         fi
6780                 else
6781                         echo "There is no support at all for void."
6782                         voidflags=0
6783                 fi
6784         fi
6785 esac
6786 case "$voidflags" in
6787 "$defvoidused") ;;
6788 *)      $cat >&4 <<'EOM'
6789   Support flag bits are:
6790     1: basic void declarations.
6791     2: arrays of pointers to functions returning void.
6792     4: operations between pointers to and addresses of void functions.
6793     8: generic void pointers.
6794 EOM
6795         dflt="$voidflags";
6796         rp="Your void support flags add up to what?"
6797         . ./myread
6798         voidflags="$ans"
6799         ;;
6800 esac
6801 $rm -f try.* .out
6802
6803 : check for length of pointer
6804 echo " "
6805 case "$ptrsize" in
6806 '')
6807         echo "Checking to see how big your pointers are..." >&4
6808         if test "$voidflags" -gt 7; then
6809                 echo '#define VOID_PTR char *' > try.c
6810         else
6811                 echo '#define VOID_PTR void *' > try.c
6812         fi
6813         $cat >>try.c <<'EOCP'
6814 #include <stdio.h>
6815 int main()
6816 {
6817     printf("%d\n", (int)sizeof(VOID_PTR));
6818     exit(0);
6819 }
6820 EOCP
6821         set try
6822         if eval $compile_ok; then
6823                 ptrsize=`$run ./try`
6824                 echo "Your pointers are $ptrsize bytes long."
6825         else
6826                 dflt='4'
6827                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6828                 rp="What is the size of a pointer (in bytes)?"
6829                 . ./myread
6830                 ptrsize="$ans"
6831         fi
6832         ;;
6833 esac
6834 $rm -f try.c try
6835 case "$use64bitall" in
6836 "$define"|true|[yY]*)
6837         case "$ptrsize" in
6838         4)      cat <<EOM >&4
6839
6840 *** You have chosen a maximally 64-bit build, but your pointers
6841 *** are only 4 bytes wide, disabling maximal 64-bitness.
6842
6843 EOM
6844                 use64bitall="$undef"
6845                 case "$use64bitint" in
6846                 "$define"|true|[yY]*) ;;
6847                 *)      cat <<EOM >&4
6848
6849 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6850
6851 EOM
6852                         use64bitint="$define"
6853                         ;;
6854                 esac
6855                 ;;
6856         esac
6857         ;;
6858 esac
6859
6860
6861 : determine which malloc to compile in
6862 echo " "
6863 case "$usemymalloc" in
6864 [yY]*|true|$define)     dflt='y' ;;
6865 [nN]*|false|$undef)     dflt='n' ;;
6866 *)      case "$ptrsize" in
6867         4) dflt='y' ;;
6868         *) dflt='n' ;;
6869         esac
6870         ;;
6871 esac
6872 rp="Do you wish to attempt to use the malloc that comes with $package?"
6873 . ./myread
6874 usemymalloc="$ans"
6875 case "$ans" in
6876 y*|true)
6877         usemymalloc='y'
6878         mallocsrc='malloc.c'
6879         mallocobj="malloc$_o"
6880         d_mymalloc="$define"
6881         case "$libs" in
6882         *-lmalloc*)
6883                 : Remove malloc from list of libraries to use
6884                 echo "Removing unneeded -lmalloc from library list" >&4
6885                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6886                 shift
6887                 libs="$*"
6888                 echo "libs = $libs" >&4
6889                 ;;
6890         esac
6891         ;;
6892 *)
6893         usemymalloc='n'
6894         mallocsrc=''
6895         mallocobj=''
6896         d_mymalloc="$undef"
6897         ;;
6898 esac
6899
6900 : compute the return types of malloc and free
6901 echo " "
6902 $cat >malloc.c <<END
6903 #$i_malloc I_MALLOC
6904 #$i_stdlib I_STDLIB
6905 #include <stdio.h>
6906 #include <sys/types.h>
6907 #ifdef I_MALLOC
6908 #include <malloc.h>
6909 #endif
6910 #ifdef I_STDLIB
6911 #include <stdlib.h>
6912 #endif
6913 #ifdef TRY_MALLOC
6914 void *malloc();
6915 #endif
6916 #ifdef TRY_FREE
6917 void free();
6918 #endif
6919 END
6920 case "$malloctype" in
6921 '')
6922         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6923                 malloctype='void *'
6924         else
6925                 malloctype='char *'
6926         fi
6927         ;;
6928 esac
6929 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6930
6931 case "$freetype" in
6932 '')
6933         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6934                 freetype='void'
6935         else
6936                 freetype='int'
6937         fi
6938         ;;
6939 esac
6940 echo "Your system uses $freetype free(), it would seem." >&4
6941 $rm -f malloc.[co]
6942 $cat <<EOM
6943
6944 After $package is installed, you may wish to install various
6945 add-on modules and utilities.  Typically, these add-ons will
6946 be installed under $prefix with the rest
6947 of this package.  However, you may wish to install such add-ons
6948 elsewhere under a different prefix.
6949
6950 If you do not wish to put everything under a single prefix, that's
6951 ok.  You will be prompted for the individual locations; this siteprefix
6952 is only used to suggest the defaults.
6953
6954 The default should be fine for most people.
6955
6956 EOM
6957 fn=d~+
6958 rp='Installation prefix to use for add-on modules and utilities?'
6959 : XXX Here might be another good place for an installstyle setting.
6960 case "$siteprefix" in
6961 '') dflt=$prefix ;;
6962 *)  dflt=$siteprefix ;;
6963 esac
6964 . ./getfile
6965 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6966 oldsiteprefix=''
6967 case "$siteprefix" in
6968 '') ;;
6969 *)      case "$ans" in
6970         "$prefix") ;;
6971         *) oldsiteprefix="$prefix";;
6972         esac
6973         ;;
6974 esac
6975 siteprefix="$ans"
6976 siteprefixexp="$ansexp"
6977
6978 : determine where site specific libraries go.
6979 : Usual default is /usr/local/lib/perl5/site_perl/$version
6980 : The default "style" setting is made in installstyle.U
6981 : XXX No longer works with Prefixit stuff.
6982 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6983 case "$sitelib" in
6984 '') case "$installstyle" in
6985         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6986         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6987         esac
6988         ;;
6989 *)      dflt="$sitelib"
6990         ;;
6991 esac
6992 $cat <<EOM
6993
6994 The installation process will create a directory for
6995 site-specific extensions and modules.  Most users find it convenient
6996 to place all site-specific files in this directory rather than in the
6997 main distribution directory.
6998
6999 EOM
7000 fn=d~+
7001 rp='Pathname for the site-specific library files?'
7002 . ./getfile
7003 sitelib="$ans"
7004 sitelibexp="$ansexp"
7005 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7006 : Change installation prefix, if necessary.
7007 if $test X"$prefix" != X"$installprefix"; then
7008         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7009 else
7010         installsitelib="$sitelibexp"
7011 fi
7012
7013 : determine where site specific architecture-dependent libraries go.
7014 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7015 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7016 : sitelib may have an optional trailing /share.
7017 case "$sitearch" in
7018 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7019         dflt="$dflt/$archname"
7020         ;;
7021 *)      dflt="$sitearch"
7022         ;;
7023 esac
7024 set sitearch sitearch none
7025 eval $prefixit
7026 $cat <<EOM
7027
7028 The installation process will also create a directory for
7029 architecture-dependent site-specific extensions and modules.
7030
7031 EOM
7032 fn=d~+
7033 rp='Pathname for the site-specific architecture-dependent library files?'
7034 . ./getfile
7035 sitearch="$ans"
7036 sitearchexp="$ansexp"
7037 : Change installation prefix, if necessary.
7038 if $test X"$prefix" != X"$installprefix"; then
7039         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7040 else
7041         installsitearch="$sitearchexp"
7042 fi
7043
7044 $cat <<EOM
7045
7046 The installation process will also create a directory for
7047 vendor-supplied add-ons.  Vendors who supply perl with their system
7048 may find it convenient to place all vendor-supplied files in this
7049 directory rather than in the main distribution directory.  This will
7050 ease upgrades between binary-compatible maintenance versions of perl.
7051
7052 Of course you may also use these directories in whatever way you see
7053 fit.  For example, you might use them to access modules shared over a
7054 company-wide network.
7055
7056 The default answer should be fine for most people.
7057 This causes further questions about vendor add-ons to be skipped
7058 and no vendor-specific directories will be configured for perl.
7059
7060 EOM
7061 rp='Do you want to configure vendor-specific add-on directories?'
7062 case "$usevendorprefix" in
7063 define|true|[yY]*) dflt=y ;;
7064 *)      : User may have set vendorprefix directly on Configure command line.
7065         case "$vendorprefix" in
7066         ''|' ') dflt=n ;;
7067         *)      dflt=y ;;
7068         esac
7069         ;;
7070 esac
7071 . ./myread
7072 case "$ans" in
7073 [yY]*)  fn=d~+
7074         rp='Installation prefix to use for vendor-supplied add-ons?'
7075         case "$vendorprefix" in
7076         '') dflt='' ;;
7077         *)  dflt=$vendorprefix ;;
7078         esac
7079         . ./getfile
7080         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7081         oldvendorprefix=''
7082         case "$vendorprefix" in
7083         '') ;;
7084         *)      case "$ans" in
7085                 "$prefix") ;;
7086                 *) oldvendorprefix="$prefix";;
7087                 esac
7088                 ;;
7089         esac
7090         usevendorprefix="$define"
7091         vendorprefix="$ans"
7092         vendorprefixexp="$ansexp"
7093         ;;
7094 *)      usevendorprefix="$undef"
7095         vendorprefix=''
7096         vendorprefixexp=''
7097         ;;
7098 esac
7099
7100 case "$vendorprefix" in
7101 '')     d_vendorlib="$undef"
7102         vendorlib=''
7103         vendorlibexp=''
7104         ;;
7105 *)      d_vendorlib="$define"
7106         : determine where vendor-supplied modules go.
7107         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7108         case "$vendorlib" in
7109         '')
7110                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7111                 case "$installstyle" in
7112                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7113                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7114                 esac
7115                 ;;
7116         *)      dflt="$vendorlib"
7117                 ;;
7118         esac
7119         fn=d~+
7120         rp='Pathname for the vendor-supplied library files?'
7121         . ./getfile
7122         vendorlib="$ans"
7123         vendorlibexp="$ansexp"
7124         ;;
7125 esac
7126 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7127 : Change installation prefix, if necessary.
7128 if $test X"$prefix" != X"$installprefix"; then
7129         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7130 else
7131         installvendorlib="$vendorlibexp"
7132 fi
7133
7134 case "$vendorprefix" in
7135 '')     d_vendorarch="$undef"
7136         vendorarch=''
7137         vendorarchexp=''
7138         ;;
7139 *)      d_vendorarch="$define"
7140         : determine where vendor-supplied architecture-dependent libraries go.
7141         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7142         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7143         : vendorlib may have an optional trailing /share.
7144         case "$vendorarch" in
7145         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7146                 dflt="$dflt/$archname"
7147                 ;;
7148         *)      dflt="$vendorarch" ;;
7149         esac
7150         fn=d~+
7151         rp='Pathname for vendor-supplied architecture-dependent files?'
7152         . ./getfile
7153         vendorarch="$ans"
7154         vendorarchexp="$ansexp"
7155         ;;
7156 esac
7157 : Change installation prefix, if necessary.
7158 if $test X"$prefix" != X"$installprefix"; then
7159         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7160 else
7161         installvendorarch="$vendorarchexp"
7162 fi
7163
7164 : Final catch-all directories to search
7165 $cat <<EOM
7166
7167 Lastly, you can have perl look in other directories for extensions and
7168 modules in addition to those already specified.
7169 These directories will be searched after 
7170         $sitearch 
7171         $sitelib 
7172 EOM
7173 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7174 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7175 echo ' '
7176 case "$otherlibdirs" in
7177 ''|' ') dflt='none' ;;
7178 *)      dflt="$otherlibdirs" ;;
7179 esac
7180 $cat <<EOM
7181 Enter a colon-separated set of extra paths to include in perl's @INC
7182 search path, or enter 'none' for no extra paths.
7183
7184 EOM
7185
7186 rp='Colon-separated list of additional directories for perl to search?'
7187 . ./myread
7188 case "$ans" in
7189 ' '|''|none)    otherlibdirs=' ' ;;     
7190 *)      otherlibdirs="$ans" ;;
7191 esac
7192 case "$otherlibdirs" in
7193 ' ') val=$undef ;;
7194 *)      val=$define ;;
7195 esac
7196 set d_perl_otherlibdirs
7197 eval $setvar
7198
7199 : Cruising for prototypes
7200 echo " "
7201 echo "Checking out function prototypes..." >&4
7202 $cat >prototype.c <<'EOCP'
7203 int main(int argc, char *argv[]) {
7204         exit(0);}
7205 EOCP
7206 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7207         echo "Your C compiler appears to support function prototypes."
7208         val="$define"
7209 else
7210         echo "Your C compiler doesn't seem to understand function prototypes."
7211         val="$undef"
7212 fi
7213 set prototype
7214 eval $setvar
7215 $rm -f prototype*
7216
7217 case "$prototype" in
7218 "$define") ;;
7219 *)      ansi2knr='ansi2knr'
7220         echo " "
7221         cat <<EOM >&4
7222
7223 $me:  FATAL ERROR:
7224 This version of $package can only be compiled by a compiler that 
7225 understands function prototypes.  Unfortunately, your C compiler 
7226         $cc $ccflags
7227 doesn't seem to understand them.  Sorry about that.
7228
7229 If GNU cc is available for your system, perhaps you could try that instead.  
7230
7231 Eventually, we hope to support building Perl with pre-ANSI compilers.
7232 If you would like to help in that effort, please contact <perlbug@perl.org>.
7233
7234 Aborting Configure now.
7235 EOM
7236         exit 2
7237         ;;
7238 esac
7239
7240 : determine where public executables go
7241 echo " "
7242 set dflt bin bin
7243 eval $prefixit
7244 fn=d~
7245 rp='Pathname where the public executables will reside?'
7246 . ./getfile
7247 if $test "X$ansexp" != "X$binexp"; then
7248         installbin=''
7249 fi
7250 bin="$ans"
7251 binexp="$ansexp"
7252 : Change installation prefix, if necessary.
7253 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7254 if $test X"$prefix" != X"$installprefix"; then
7255         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7256 else
7257         installbin="$binexp"
7258 fi
7259
7260 echo " "
7261 case "$extras" in
7262 '') dflt='n';;
7263 *) dflt='y';;
7264 esac
7265 cat <<EOM
7266 Perl can be built with extra modules or bundles of modules which
7267 will be fetched from the CPAN and installed alongside Perl.
7268
7269 Notice that you will need access to the CPAN; either via the Internet,
7270 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7271 be asked later to configure the CPAN.pm module which will in turn do
7272 the installation of the rest of the extra modules or bundles.)
7273
7274 Notice also that if the modules require any external software such as
7275 libraries and headers (the libz library and the zlib.h header for the
7276 Compress::Zlib module, for example) you MUST have any such software
7277 already installed, this configuration process will NOT install such
7278 things for you.
7279
7280 If this doesn't make any sense to you, just accept the default '$dflt'.
7281 EOM
7282 rp='Install any extra modules (y or n)?'
7283 . ./myread
7284 case "$ans" in
7285 y|Y)
7286         cat <<EOM
7287
7288 Please list any extra modules or bundles to be installed from CPAN,
7289 with spaces between the names.  The names can be in any format the
7290 'install' command of CPAN.pm will understand.  (Answer 'none',
7291 without the quotes, to install no extra modules or bundles.)
7292 EOM
7293         rp='Extras?'
7294         dflt="$extras"
7295         . ./myread
7296         extras="$ans"
7297 esac
7298 case "$extras" in
7299 ''|'none')
7300         val=''
7301         $rm -f ../extras.lst
7302         ;;
7303 *)      echo "(Saving the list of extras for later...)"
7304         echo "$extras" > ../extras.lst
7305         val="'$extras'"
7306         ;;
7307 esac
7308 set extras
7309 eval $setvar
7310 echo " "
7311
7312 : Find perl5.005 or later.
7313 echo "Looking for a previously installed perl5.005 or later... "
7314 case "$perl5" in
7315 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7316                 : Check if this perl is recent and can load a simple module
7317                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7318                         perl5=$tdir/perl
7319                         break;
7320                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7321                         perl5=$tdir/perl5
7322                         break;
7323                 fi
7324         done
7325         ;;
7326 *)      perl5="$perl5"
7327         ;;
7328 esac
7329 case "$perl5" in
7330 '')     echo "None found.  That's ok.";;
7331 *)      echo "Using $perl5." ;;
7332 esac
7333
7334 : Determine list of previous versions to include in @INC
7335 $cat > getverlist <<EOPL
7336 #!$perl5 -w
7337 use File::Basename;
7338 \$api_versionstring = "$api_versionstring";
7339 \$version = "$version";
7340 \$stem = "$sitelib_stem";
7341 \$archname = "$archname";
7342 EOPL
7343         $cat >> getverlist <<'EOPL'
7344 # Can't have leading @ because metaconfig interprets it as a command!
7345 ;@inc_version_list=();
7346 # XXX Redo to do opendir/readdir? 
7347 if (-d $stem) {
7348     chdir($stem);
7349     ;@candidates = glob("5.*");
7350 }
7351 else {
7352     ;@candidates = ();
7353 }
7354
7355 # XXX ToDo:  These comparisons must be reworked when two-digit
7356 # subversions come along, so that 5.7.10 compares as greater than
7357 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7358 # widespread that we can use the built-in version vectors rather
7359 # than reinventing them here.  For 5.6.0, however, we must
7360 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7361 foreach $d (@candidates) {
7362     if ($d lt $version) {
7363         if ($d ge $api_versionstring) {
7364             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7365         }
7366         elsif ($d ge "5.005") {
7367             unshift(@inc_version_list, grep { -d } $d);
7368         }
7369     }
7370     else {
7371         # Skip newer version.  I.e. don't look in
7372         # 5.7.0 if we're installing 5.6.1.
7373     }
7374 }
7375
7376 if (@inc_version_list) {
7377     print join(' ', @inc_version_list);
7378 }
7379 else {
7380     # Blank space to preserve value for next Configure run.
7381     print " ";
7382 }
7383 EOPL
7384 chmod +x getverlist
7385 case "$inc_version_list" in
7386 '')     if test -x "$perl5$exe_ext"; then
7387                 dflt=`$perl5 getverlist`
7388         else
7389                 dflt='none'
7390         fi
7391         ;;
7392 $undef) dflt='none' ;;
7393 *)  eval dflt=\"$inc_version_list\" ;;
7394 esac
7395 case "$dflt" in
7396 ''|' ') dflt=none ;;
7397 esac
7398 case "$dflt" in
7399 5.005) dflt=none ;;
7400 esac
7401 $cat <<EOM
7402
7403 In order to ease the process of upgrading, this version of perl 
7404 can be configured to use modules built and installed with earlier 
7405 versions of perl that were installed under $prefix.  Specify here
7406 the list of earlier versions that this version of perl should check.
7407 If Configure detected no earlier versions of perl installed under
7408 $prefix, then the list will be empty.  Answer 'none' to tell perl
7409 to not search earlier versions.
7410
7411 The default should almost always be sensible, so if you're not sure,
7412 just accept the default.
7413 EOM
7414
7415 rp='List of earlier versions to include in @INC?'
7416 . ./myread
7417 case "$ans" in
7418 [Nn]one|''|' ') inc_version_list=' ' ;;
7419 *) inc_version_list="$ans" ;;
7420 esac
7421 case "$inc_version_list" in
7422 ''|' ') 
7423         inc_version_list_init='0';;
7424 *)      inc_version_list_init=`echo $inc_version_list |
7425                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7426         ;;
7427 esac
7428 $rm -f getverlist
7429
7430 : determine whether to install perl also as /usr/bin/perl
7431
7432 echo " "
7433 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7434         $cat <<EOM
7435 Many scripts expect perl to be installed as /usr/bin/perl.
7436
7437 If you want to, I can install the perl you are about to compile
7438 as /usr/bin/perl (in addition to $bin/perl).
7439 EOM
7440         if test -f /usr/bin/perl; then
7441             $cat <<EOM
7442
7443 However, please note that because you already have a /usr/bin/perl,
7444 overwriting that with a new Perl would very probably cause problems.
7445 Therefore I'm assuming you don't want to do that (unless you insist).
7446
7447 EOM
7448             case "$installusrbinperl" in
7449             "$define"|[yY]*)    dflt='y';;
7450             *)                  dflt='n';;
7451             esac
7452         else
7453             $cat <<EOM
7454
7455 Since you don't have a /usr/bin/perl I'm assuming creating one is okay. 
7456
7457 EOM
7458             case "$installusrbinperl" in
7459             "$undef"|[nN]*)     dflt='n';;
7460             *)                  dflt='y';;
7461             esac
7462         fi
7463         rp="Do you want to install perl as /usr/bin/perl?"
7464         . ./myread
7465         case "$ans" in
7466         [yY]*)  val="$define";;
7467         *)      val="$undef" ;;
7468         esac
7469 else
7470         val="$undef"
7471 fi
7472 set installusrbinperl
7473 eval $setvar
7474
7475 : see if dld is available
7476 set dld.h i_dld
7477 eval $inhdr
7478
7479 : see if dlopen exists
7480 xxx_runnm="$runnm"
7481 runnm=false
7482 set dlopen d_dlopen
7483 eval $inlibc
7484 runnm="$xxx_runnm"
7485
7486 : determine which dynamic loading, if any, to compile in
7487 echo " "
7488 dldir="ext/DynaLoader"
7489 case "$usedl" in
7490 $define|y|true)
7491         dflt='y'
7492         usedl="$define"
7493         ;;
7494 $undef|n|false)
7495         dflt='n'
7496         usedl="$undef"
7497         ;;
7498 *) 
7499         dflt='n'
7500         case "$d_dlopen" in
7501             $define) dflt='y' ;;
7502         esac
7503         case "$i_dld" in
7504             $define) dflt='y' ;;
7505         esac
7506         : Does a dl_xxx.xs file exist for this operating system
7507         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7508         ;;
7509 esac
7510 rp="Do you wish to use dynamic loading?"
7511 . ./myread
7512 usedl="$ans"
7513 case "$ans" in
7514 y*) usedl="$define"
7515         case "$dlsrc" in
7516         '')
7517                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7518                         dflt="$dldir/dl_${osname}.xs"
7519                 elif $test "$d_dlopen" = "$define" ; then
7520                         dflt="$dldir/dl_dlopen.xs"
7521                 elif $test "$i_dld" = "$define" ; then
7522                         dflt="$dldir/dl_dld.xs"
7523                 else
7524                         dflt=''
7525                 fi
7526                 ;;
7527         *)      dflt="$dldir/$dlsrc"
7528                 ;;
7529         esac
7530     echo "The following dynamic loading files are available:"
7531         : Can not go over to $dldir because getfile has path hard-coded in.
7532         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7533         rp="Source file to use for dynamic loading"
7534         fn="fne"
7535         gfpth="$src"
7536         . ./getfile
7537         usedl="$define"
7538         : emulate basename
7539         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7540
7541         $cat << EOM
7542
7543 Some systems may require passing special flags to $cc -c to
7544 compile modules that will be used to create a shared library.
7545 To use no flags, say "none".
7546
7547 EOM
7548     case "$cccdlflags" in
7549     '') case "$gccversion" in
7550                 '') case "$osname" in
7551                         hpux)   dflt='+z' ;;
7552                         next)   dflt='none' ;;
7553                         irix*)  dflt='-KPIC' ;;
7554                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7555                         sunos)  dflt='-pic' ;;
7556                         *)      dflt='none' ;;
7557                     esac
7558                         ;;
7559                 *)  case "$osname" in
7560                         darwin) dflt='none' ;;
7561                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7562                         *)      dflt='-fpic' ;;
7563                     esac ;;
7564             esac ;;
7565         ' ') dflt='none' ;;
7566     *)  dflt="$cccdlflags" ;;
7567     esac
7568     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7569     . ./myread
7570     case "$ans" in
7571     none) cccdlflags=' ' ;;
7572     *) cccdlflags="$ans" ;;
7573     esac
7574
7575     cat << EOM
7576
7577 Some systems use ld to create libraries that can be dynamically loaded,
7578 while other systems (such as those using ELF) use $cc.
7579
7580 EOM
7581         case "$ld" in
7582         '')     $cat >try.c <<'EOM'
7583 /* Test for whether ELF binaries are produced */
7584 #include <fcntl.h>
7585 #include <stdlib.h>
7586 int main() {
7587         char b[4];
7588         int i = open("a.out",O_RDONLY);
7589         if(i == -1) 
7590                 exit(1); /* fail */
7591         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7592                 exit(0); /* succeed (yes, it's ELF) */
7593         else
7594                 exit(1); /* fail */
7595 }
7596 EOM
7597                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7598                         cat <<EOM
7599 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7600 EOM
7601                         dflt="$cc"
7602                 else
7603                         echo "I'll use ld to build dynamic libraries."
7604                         dflt='ld'
7605                 fi
7606                 rm -f try.c a.out
7607                 ;;
7608         *)      dflt="$ld"
7609                 ;;
7610         esac
7611
7612     rp="What command should be used to create dynamic libraries?"
7613     . ./myread
7614         ld="$ans"
7615
7616     cat << EOM
7617
7618 Some systems may require passing special flags to $ld to create a
7619 library that can be dynamically loaded.  If your ld flags include
7620 -L/other/path options to locate libraries outside your loader's normal
7621 search path, you may need to specify those -L options here as well.  To
7622 use no flags, say "none".
7623
7624 EOM
7625     case "$lddlflags" in
7626     '') case "$osname" in
7627                         beos) dflt='-nostart' ;;
7628                         hpux) dflt='-b';
7629                               case "$gccversion" in
7630                               '') dflt="$dflt +vnocompatwarnings" ;;
7631                               esac
7632                               ;;        
7633                         linux|irix*)    dflt='-shared' ;;
7634                         next)  dflt='none' ;;
7635                         solaris) dflt='-G' ;;
7636                         sunos) dflt='-assert nodefinitions' ;;
7637                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7638                 *)     dflt='none' ;;
7639                         esac
7640                         ;;
7641     *) dflt="$lddlflags" ;;
7642     esac
7643
7644         : Try to guess additional flags to pick up local libraries.
7645         : Be careful not to append to a plain 'none'
7646         case "$dflt" in
7647         none) dflt='' ;;
7648         esac
7649         for thisflag in $ldflags; do
7650                 case "$thisflag" in
7651                 -L*|-R*|-Wl,-R*)
7652                         case " $dflt " in
7653                         *" $thisflag "*) ;;
7654                         *) dflt="$dflt $thisflag" ;;
7655                         esac
7656                         ;;
7657                 esac
7658         done
7659
7660         case "$dflt" in
7661         ''|' ') dflt='none' ;;
7662         esac
7663
7664     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7665     . ./myread
7666     case "$ans" in
7667     none) lddlflags=' ' ;;
7668     *) lddlflags="$ans" ;;
7669     esac
7670
7671         cat <<EOM
7672
7673 Some systems may require passing special flags to $cc to indicate that
7674 the resulting executable will use dynamic linking.  To use no flags,
7675 say "none".
7676
7677 EOM
7678     case "$ccdlflags" in
7679     '') case "$osname" in
7680                 hpux)   dflt='-Wl,-E' ;;
7681                 linux)  dflt='-rdynamic' ;;
7682                 next)   dflt='none' ;;
7683                 sunos)  dflt='none' ;;
7684                 *)      dflt='none' ;;
7685             esac ;;
7686     ' ')  dflt='none' ;;
7687     *)  dflt="$ccdlflags" ;;
7688     esac
7689     rp="Any special flags to pass to $cc to use dynamic linking?"
7690     . ./myread
7691     case "$ans" in
7692     none) ccdlflags=' ' ;;
7693     *) ccdlflags="$ans" ;;
7694     esac
7695     ;;
7696 *)  usedl="$undef"
7697         ld='ld'
7698     dlsrc='dl_none.xs'
7699     lddlflags=''
7700     ccdlflags=''
7701     ;;
7702 esac
7703
7704 also=''
7705 case "$usedl" in
7706 $undef)
7707         # No dynamic loading being used, so don't bother even to prompt.
7708         useshrplib='false'
7709         ;;
7710 *)      case "$useshrplib" in
7711         '')     case "$osname" in
7712                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7713                         dflt=y
7714                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7715                         ;;
7716                 next*)
7717                         case "$osvers" in
7718                         4*)     dflt=y
7719                                 also='Building a shared libperl is needed for MAB support.'
7720                                 ;;
7721                         *)      dflt=n
7722                                 ;;
7723                         esac
7724                         ;;
7725                 *)      dflt=n
7726                         ;;
7727                 esac
7728                 ;;
7729         $define|true|[Yy]*)
7730                 dflt=y
7731                 ;;
7732         *)      dflt=n
7733                 ;;
7734         esac
7735         $cat << EOM
7736
7737 The perl executable is normally obtained by linking perlmain.c with
7738 libperl${_a}, any static extensions (usually just DynaLoader), and
7739 any other libraries needed on this system (such as -lm, etc.).  Since
7740 your system supports dynamic loading, it is probably possible to build
7741 a shared libperl.$so.  If you will have more than one executable linked
7742 to libperl.$so, this will significantly reduce the size of each
7743 executable, but it may have a noticeable affect on performance.  The
7744 default is probably sensible for your system.
7745 $also
7746
7747 EOM
7748         rp="Build a shared libperl.$so (y/n)"
7749         . ./myread
7750         case "$ans" in
7751         true|$define|[Yy]*)
7752                 useshrplib='true'  ;;
7753         *)      useshrplib='false' ;;
7754         esac
7755         ;;
7756 esac
7757
7758 case "$useshrplib" in
7759 true)
7760         case "$libperl" in
7761         '')
7762                 # Figure out a good name for libperl.so.  Since it gets stored in
7763                 # a version-specific architecture-dependent library, the version
7764                 # number isn't really that important, except for making cc/ld happy.
7765                 #
7766                 # A name such as libperl.so.3.1
7767                 majmin="libperl.$so.$patchlevel.$subversion"
7768                 # A name such as libperl.so.301
7769                 majonly=`echo $patchlevel $subversion |
7770                         $awk '{printf "%d%02d", $1, $2}'`
7771                 majonly=libperl.$so.$majonly
7772                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7773                 # rely on figuring it out from the naming of libc.
7774                 case "${osname}${osvers}" in
7775                 next4*)
7776                         dflt=libperl.5.$so
7777                         # XXX How handle the --version stuff for MAB?
7778                         ;;
7779                 linux*)  # ld won't link with a bare -lperl otherwise.
7780                         dflt=libperl.$so
7781                         ;;
7782                 cygwin*) # ld links against an importlib
7783                         dflt=libperl$lib_ext
7784                         ;;
7785                 *)      # Try to guess based on whether libc has major.minor.
7786                         case "$libc" in
7787                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7788                         *libc.$so.[0-9]*) dflt=$majonly ;;
7789                         *)      dflt=libperl.$so ;;
7790                         esac
7791                         ;;
7792                 esac
7793                 ;;
7794         *)      dflt=$libperl
7795                 ;;
7796         esac
7797         cat << EOM
7798
7799 I need to select a good name for the shared libperl.  If your system uses
7800 library names with major and minor numbers, then you might want something
7801 like $majmin.  Alternatively, if your system uses a single version
7802 number for shared libraries, then you might want to use $majonly.
7803 Or, your system might be quite happy with a simple libperl.$so.
7804
7805 Since the shared libperl will get installed into a version-specific
7806 architecture-dependent directory, the version number of the shared perl
7807 library probably isn't important, so the default should be o.k.
7808
7809 EOM
7810         rp='What name do you want to give to the shared libperl?'
7811         . ./myread
7812         libperl=$ans
7813         echo "Ok, I'll use $libperl"
7814         ;;
7815 *)
7816         libperl="libperl${_a}"
7817         ;;
7818 esac
7819
7820 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7821 case "$shrpdir" in
7822 '') ;;
7823 *)      $cat >&4 <<EOM
7824 WARNING:  Use of the shrpdir variable for the installation location of
7825 the shared $libperl is not supported.  It was never documented and
7826 will not work in this version.  Let me (perlbug@perl.org)
7827 know of any problems this may cause.
7828
7829 EOM
7830         case "$shrpdir" in
7831         "$archlibexp/CORE")
7832                 $cat >&4 <<EOM
7833 But your current setting of $shrpdir is
7834 the default anyway, so it's harmless.
7835 EOM
7836                 ;;
7837         *)
7838                 $cat >&4 <<EOM
7839 Further, your current attempted setting of $shrpdir
7840 conflicts with the value of $archlibexp/CORE
7841 that installperl will use.
7842 EOM
7843                 ;;
7844         esac
7845         ;;
7846 esac
7847
7848 # How will the perl executable find the installed shared $libperl?
7849 # Add $xxx to ccdlflags.
7850 # If we can't figure out a command-line option, use $shrpenv to
7851 # set env LD_RUN_PATH.  The main perl makefile uses this.
7852 shrpdir=$archlibexp/CORE
7853 xxx=''
7854 tmp_shrpenv=''
7855 if "$useshrplib"; then
7856     case "$osname" in 
7857         aix)
7858                 # We'll set it in Makefile.SH...
7859                 ;;
7860         solaris)
7861                 xxx="-R $shrpdir"
7862                 ;;
7863         freebsd|netbsd)
7864                 xxx="-Wl,-R$shrpdir"
7865                 ;;
7866         bsdos|linux|irix*|dec_osf)
7867                 xxx="-Wl,-rpath,$shrpdir"
7868                 ;;
7869         next)
7870                 # next doesn't like the default...
7871                 ;;
7872         beos)
7873                 # beos doesn't like the default, either.
7874                 ;;
7875         hpux*)
7876                 # hpux doesn't like the default, either.
7877                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7878                 ;;
7879         *)
7880                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7881                 ;;
7882         esac
7883         case "$xxx" in
7884         '') ;;
7885         *)      
7886                 # Only add $xxx if it isn't already in ccdlflags.
7887                 case " $ccdlflags " in
7888                 *" $xxx "*)     ;;
7889                 *)      ccdlflags="$ccdlflags $xxx"
7890                         cat <<EOM >&4
7891
7892 Adding $xxx to the flags
7893 passed to $ld so that the perl executable will find the 
7894 installed shared $libperl.
7895
7896 EOM
7897                         ;;
7898                 esac
7899                 ;;
7900         esac
7901 fi
7902 # Fix ccdlflags in AIX for building external extensions.
7903 # (For building Perl itself bare -bE:perl.exp is needed,
7904 #  Makefile.SH takes care of this.)
7905 case "$osname" in
7906 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7907 esac
7908 # Respect a hint or command-line value.
7909 case "$shrpenv" in
7910 '') shrpenv="$tmp_shrpenv" ;;
7911 esac
7912 case "$ldlibpthname" in
7913 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7914 none)   ldlibpthname='' ;;
7915 esac
7916
7917 : determine where manual pages are on this system
7918 echo " "
7919 case "$sysman" in
7920 '') 
7921         syspath='/usr/share/man/man1 /usr/man/man1'
7922         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7923         syspath="$syspath /usr/man/u_man/man1"
7924         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7925         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7926         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7927         sysman=`./loc . /usr/man/man1 $syspath`
7928         ;;
7929 esac
7930 if $test -d "$sysman"; then
7931         echo "System manual is in $sysman." >&4
7932 else
7933         echo "Could not find manual pages in source form." >&4
7934 fi
7935
7936 : determine where manual pages go
7937 set man1dir man1dir none
7938 eval $prefixit
7939 $cat <<EOM
7940
7941 $spackage has manual pages available in source form.
7942 EOM
7943 case "$nroff" in
7944 nroff)
7945         echo "However, you don't have nroff, so they're probably useless to you."
7946         case "$man1dir" in
7947         '') man1dir="none";;
7948         esac;;
7949 esac
7950 echo "If you don't want the manual sources installed, answer 'none'."
7951 case "$man1dir" in
7952 ' ') dflt=none
7953         ;;
7954 '')
7955         lookpath="$prefixexp/share/man/man1"
7956         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7957         lookpath="$lookpath $prefixexp/man/p_man/man1"
7958         lookpath="$lookpath $prefixexp/man/u_man/man1"
7959         lookpath="$lookpath $prefixexp/man/man.1"
7960         case "$sysman" in
7961         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7962         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7963         esac
7964         set dflt
7965         eval $prefixup
7966         ;;
7967 *)  dflt="$man1dir"
7968         ;;
7969 esac
7970 echo " "
7971 fn=dn+~
7972 rp="Where do the main $spackage manual pages (source) go?"
7973 . ./getfile
7974 if $test "X$man1direxp" != "X$ansexp"; then
7975         installman1dir=''
7976 fi
7977 man1dir="$ans"
7978 man1direxp="$ansexp"
7979 case "$man1dir" in
7980 '')     man1dir=' '
7981         installman1dir='';;
7982 esac
7983
7984 : Change installation prefix, if necessary.
7985 if $test X"$prefix" != X"$installprefix"; then
7986         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7987 else
7988         installman1dir="$man1direxp"
7989 fi
7990
7991 : What suffix to use on installed man pages
7992
7993 case "$man1dir" in
7994 ' ')
7995         man1ext='0'
7996         ;;
7997 *)
7998         rp="What suffix should be used for the main $spackage man pages?"
7999         case "$man1ext" in
8000         '')     case "$man1dir" in
8001                 *1)  dflt=1 ;;
8002                 *1p) dflt=1p ;;
8003                 *1pm) dflt=1pm ;;
8004                 *l) dflt=l;;
8005                 *n) dflt=n;;
8006                 *o) dflt=o;;
8007                 *p) dflt=p;;
8008                 *C) dflt=C;;
8009                 *L) dflt=L;;
8010                 *L1) dflt=L1;;
8011                 *) dflt=1;;
8012                 esac
8013                 ;;
8014         *)      dflt="$man1ext";;
8015         esac
8016         . ./myread
8017         man1ext="$ans"
8018         ;;
8019 esac
8020
8021 : see if we can have long filenames
8022 echo " "
8023 first=123456789abcdef
8024 $rm -f $first
8025 if (echo hi >$first) 2>/dev/null; then
8026         if $test -f 123456789abcde; then
8027                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8028                 val="$undef"
8029         else
8030                 echo 'You can have filenames longer than 14 characters.'>&4
8031                 val="$define"
8032         fi
8033 else
8034         $cat <<'EOM'
8035 You can't have filenames longer than 14 chars.
8036 You can't even think about them!
8037 EOM
8038         val="$undef"
8039 fi 
8040 set d_flexfnam
8041 eval $setvar
8042 $rm -rf 123456789abcde*
8043
8044 : determine where library module manual pages go
8045 set man3dir man3dir none
8046 eval $prefixit
8047 $cat <<EOM
8048
8049 $spackage has manual pages for many of the library modules.
8050 EOM
8051
8052 case "$nroff" in
8053 nroff)
8054         $cat <<'EOM'
8055 However, you don't have nroff, so they're probably useless to you.
8056 EOM
8057         case "$man3dir" in
8058         '') man3dir="none";;
8059         esac;;
8060 esac
8061
8062 case "$d_flexfnam" in
8063 undef)
8064         $cat <<'EOM'
8065 However, your system can't handle the long file names like File::Basename.3. 
8066 EOM
8067         case "$man3dir" in
8068         '') man3dir="none";;
8069         esac;;
8070 esac
8071
8072 echo "If you don't want the manual sources installed, answer 'none'."
8073 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8074 case "$man3dir" in
8075 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8076         if $test -d "$privlib/man/man3"; then
8077                 cat <<EOM >&4
8078
8079 WARNING:  Previous versions of perl installed man3 pages into
8080 $privlib/man/man3.  This version will suggest a 
8081 new default of $dflt.  
8082 EOM
8083                 tdflt=$dflt
8084                 dflt='n'
8085                 rp='Do you wish to preserve the old behavior?(y/n)'
8086                 . ./myread
8087                 case "$ans" in
8088                 y*) dflt="$privlib/man/man3" ;;
8089                 *)  dflt=$tdflt ;;
8090                 esac
8091     fi
8092         ;;
8093 *)      dflt="$man3dir" ;;
8094 esac
8095 case "$dflt" in
8096 ' ') dflt=none ;;
8097 esac
8098 echo " "
8099 fn=dn+~
8100 rp="Where do the $package library man pages (source) go?"
8101 . ./getfile
8102 man3dir="$ans"
8103 man3direxp="$ansexp"
8104 case "$man3dir" in
8105 '')     man3dir=' '
8106         installman3dir='';;
8107 esac
8108
8109 : Change installation prefix, if necessary.
8110 if $test X"$prefix" != X"$installprefix"; then
8111         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8112 else
8113         installman3dir="$man3direxp"
8114 fi
8115
8116 : What suffix to use on installed man pages
8117 case "$man3dir" in
8118 ' ')
8119         man3ext='0'
8120         ;;
8121 *)
8122         rp="What suffix should be used for the $package library man pages?"
8123         case "$man3ext" in
8124         '')     case "$man3dir" in
8125                 *3)  dflt=3 ;;
8126                 *3p) dflt=3p ;;
8127                 *3pm) dflt=3pm ;;
8128                 *l) dflt=l;;
8129                 *n) dflt=n;;
8130                 *o) dflt=o;;
8131                 *p) dflt=p;;
8132                 *C) dflt=C;;
8133                 *L) dflt=L;;
8134                 *L3) dflt=L3;;
8135                 *) dflt=3;;
8136                 esac
8137                 ;;
8138         *)      dflt="$man3ext";;
8139         esac
8140         . ./myread
8141         man3ext="$ans"
8142         ;;
8143 esac
8144
8145 : see if we have to deal with yellow pages, now NIS.
8146 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8147         if $test -f /usr/etc/nibindd; then
8148                 echo " "
8149                 echo "I'm fairly confident you're on a NeXT."
8150                 echo " "
8151                 rp='Do you get the hosts file via NetInfo?'
8152                 dflt=y
8153                 case "$hostcat" in
8154                 nidump*) ;;
8155                 '') ;;
8156                 *) dflt=n;;
8157                 esac
8158                 . ./myread
8159                 case "$ans" in
8160                 y*) hostcat='nidump hosts .';;
8161                 *)      case "$hostcat" in
8162                         nidump*) hostcat='';;
8163                         esac
8164                         ;;
8165                 esac
8166         fi
8167         case "$hostcat" in
8168         nidump*) ;;
8169         *)
8170                 case "$hostcat" in
8171                 *ypcat*) dflt=y;;
8172                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8173                                 dflt=y
8174                         else
8175                                 dflt=n
8176                         fi;;
8177                 *) dflt=n;;
8178                 esac
8179                 echo " "
8180                 rp='Are you getting the hosts file via yellow pages?'
8181                 . ./myread
8182                 case "$ans" in
8183                 y*) hostcat='ypcat hosts';;
8184                 *) hostcat='cat /etc/hosts';;
8185                 esac
8186                 ;;
8187         esac
8188 fi
8189 case "$hostcat" in
8190 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8191 esac
8192 case "$groupcat" in
8193 '') test -f /etc/group && groupcat='cat /etc/group';;
8194 esac
8195 case "$passcat" in
8196 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8197 esac
8198
8199 : now get the host name
8200 echo " "
8201 echo "Figuring out host name..." >&4
8202 case "$myhostname" in
8203 '') cont=true
8204         echo 'Maybe "hostname" will work...'
8205         if tans=`sh -c hostname 2>&1` ; then
8206                 myhostname=$tans
8207                 phostname=hostname
8208                 cont=''
8209         fi
8210         ;;
8211 *) cont='';;
8212 esac
8213 if $test "$cont"; then
8214         if ./xenix; then
8215                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8216                 if tans=`cat /etc/systemid 2>&1` ; then
8217                         myhostname=$tans
8218                         phostname='cat /etc/systemid'
8219                         echo "Whadyaknow.  Xenix always was a bit strange..."
8220                         cont=''
8221                 fi
8222         elif $test -r /etc/systemid; then
8223                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8224         fi
8225 fi
8226 if $test "$cont"; then
8227         echo 'No, maybe "uuname -l" will work...'
8228         if tans=`sh -c 'uuname -l' 2>&1` ; then
8229                 myhostname=$tans
8230                 phostname='uuname -l'
8231         else
8232                 echo 'Strange.  Maybe "uname -n" will work...'
8233                 if tans=`sh -c 'uname -n' 2>&1` ; then
8234                         myhostname=$tans
8235                         phostname='uname -n'
8236                 else
8237                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8238                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8239                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8240                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8241                         else
8242                                 case "$myhostname" in
8243                                 '') echo "Does this machine have an identity crisis or something?"
8244                                         phostname='';;
8245                                 *)
8246                                         echo "Well, you said $myhostname before..."
8247                                         phostname='echo $myhostname';;
8248                                 esac
8249                         fi
8250                 fi
8251         fi
8252 fi
8253 case "$myhostname" in
8254 '') myhostname=noname ;;
8255 esac
8256 : you do not want to know about this
8257 set $myhostname
8258 myhostname=$1
8259
8260 : verify guess
8261 if $test "$myhostname" ; then
8262         dflt=y
8263         rp='Your host name appears to be "'$myhostname'".'" Right?"
8264         . ./myread
8265         case "$ans" in
8266         y*) ;;
8267         *) myhostname='';;
8268         esac
8269 fi
8270
8271 : bad guess or no guess
8272 while $test "X$myhostname" = X ; do
8273         dflt=''
8274         rp="Please type the (one word) name of your host:"
8275         . ./myread
8276         myhostname="$ans"
8277 done
8278
8279 : translate upper to lower if necessary
8280 case "$myhostname" in
8281 *[A-Z]*)
8282         echo "(Normalizing case in your host name)"
8283         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8284         ;;
8285 esac
8286
8287 case "$myhostname" in
8288 *.*)
8289         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8290         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8291         echo "(Trimming domain name from host name--host name is now $myhostname)"
8292         ;;
8293 *) case "$mydomain" in
8294         '')
8295                 {
8296                         test "X$hostcat" = "Xypcat hosts" &&
8297                         ypmatch "$myhostname" hosts 2>/dev/null |\
8298                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8299                         $test -s hosts
8300                 } || {
8301                         test "X$hostcat" != "X" &&
8302                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8303                                         /[       ]$myhostname[  . ]/p" > hosts
8304                 }
8305                 tmp_re="[       . ]"
8306                 if $test -f hosts; then
8307                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8308                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8309                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8310                                 hosts | $sort | $uniq | \
8311                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8312                         case `$echo X$dflt` in
8313                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8314                                 dflt=.
8315                                 ;;
8316                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8317                                 ;;
8318                         esac
8319                 else
8320                         echo "(I cannot locate a hosts database anywhere)"
8321                         dflt=.
8322                 fi
8323                 case "$dflt" in
8324                 .)
8325                         tans=`./loc resolv.conf X /etc /usr/etc`
8326                         if $test -f "$tans"; then
8327                                 echo "(Attempting domain name extraction from $tans)"
8328                                 dflt=.`$sed -n -e 's/   / /g' \
8329                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8330                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8331                                 case "$dflt" in
8332                                 .) dflt=.`$sed -n -e 's/        / /g' \
8333                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8334                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8335                                         ;;
8336                                 esac
8337                         fi
8338                         ;;
8339                 esac
8340                 case "$dflt" in
8341                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8342                         dflt=.`sh -c domainname 2>/dev/null`
8343                         case "$dflt" in
8344                         '') dflt='.';;
8345                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8346                         esac
8347                         ;;
8348                 esac
8349                 case "$dflt$osname" in
8350                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8351                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8352                         ;;
8353                 esac
8354                 case "$dflt" in
8355                 .) echo "(Lost all hope -- silly guess then)"
8356                         dflt='.nonet'
8357                         ;;
8358                 esac
8359                 $rm -f hosts
8360                 ;;
8361         *) dflt="$mydomain";;
8362         esac;;
8363 esac
8364 echo " "
8365 rp="What is your domain name?"
8366 . ./myread
8367 tans="$ans"
8368 case "$ans" in
8369 '') ;;
8370 .*) ;;
8371 *) tans=".$tans";;
8372 esac
8373 mydomain="$tans"
8374
8375 : translate upper to lower if necessary
8376 case "$mydomain" in
8377 *[A-Z]*)
8378         echo "(Normalizing case in your domain name)"
8379         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8380         ;;
8381 esac
8382
8383 : a little sanity check here
8384 case "$phostname" in
8385 '') ;;
8386 *)
8387         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8388         $myhostname$mydomain|$myhostname) ;;
8389         *)
8390                 case "$phostname" in
8391                 sed*)
8392                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8393                         ;;
8394                 *)
8395                         echo "(That doesn't agree with your $phostname command, by the way.)"
8396                         ;;
8397                 esac
8398         ;;
8399         esac
8400         ;;
8401 esac
8402
8403 $cat <<EOM
8404
8405 I need to get your e-mail address in Internet format if possible, i.e.
8406 something like user@host.domain. Please answer accurately since I have
8407 no easy means to double check it. The default value provided below
8408 is most probably close to reality but may not be valid from outside
8409 your organization...
8410
8411 EOM
8412 cont=x
8413 while test "$cont"; do
8414         case "$cf_email" in
8415         '') dflt="$cf_by@$myhostname$mydomain";;
8416         *) dflt="$cf_email";;
8417         esac
8418         rp='What is your e-mail address?'
8419         . ./myread
8420         cf_email="$ans"
8421         case "$cf_email" in
8422         *@*.*) cont='' ;;
8423         *)
8424                 rp='Address does not look like an Internet one.  Use it anyway?'
8425                 case "$fastread" in
8426                 yes) dflt=y ;;
8427                 *) dflt=n ;;
8428                 esac
8429                 . ./myread
8430                 case "$ans" in
8431                 y*) cont='' ;;
8432                 *) echo " " ;;
8433                 esac
8434                 ;;
8435         esac
8436 done
8437
8438 $cat <<EOM
8439
8440 If you or somebody else will be maintaining perl at your site, please
8441 fill in the correct e-mail address here so that they may be contacted
8442 if necessary. Currently, the "perlbug" program included with perl
8443 will send mail to this address in addition to perlbug@perl.org. You may
8444 enter "none" for no administrator.
8445
8446 EOM
8447 case "$perladmin" in
8448 '') dflt="$cf_email";;
8449 *) dflt="$perladmin";;
8450 esac
8451 rp='Perl administrator e-mail address'
8452 . ./myread
8453 perladmin="$ans"
8454
8455 : determine whether to only install version-specific parts.
8456 echo " "
8457 $cat <<EOM
8458 Do you want to install only the version-specific parts of the perl
8459 distribution?  Usually you do *not* want to do this.
8460 EOM
8461 case "$versiononly" in
8462 "$define"|[Yy]*|true) dflt='y' ;;
8463 *) dflt='n';
8464 esac
8465 rp="Do you want to install only the version-specific parts of perl?"
8466 . ./myread
8467 case "$ans" in
8468 [yY]*)  val="$define";;
8469 *)      val="$undef" ;;
8470 esac
8471 set versiononly
8472 eval $setvar
8473
8474 case "$versiononly" in
8475 "$define") inc_version_list=''
8476            inc_version_list_init=0
8477            ;;
8478 esac
8479
8480 : figure out how to guarantee perl startup
8481 case "$startperl" in
8482 '')
8483         case "$sharpbang" in
8484         *!)
8485                 $cat <<EOH
8486
8487 I can use the #! construct to start perl on your system. This will
8488 make startup of perl scripts faster, but may cause problems if you
8489 want to share those scripts and perl is not in a standard place
8490 ($binexp/perl) on all your platforms. The alternative is to force
8491 a shell by starting the script with a single ':' character.
8492
8493 EOH
8494                 case "$versiononly" in
8495                 "$define")      dflt="$binexp/perl$version";;  
8496                 *)              dflt="$binexp/perl";;
8497                 esac
8498                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8499                 . ./myread
8500                 case "$ans" in
8501                 none)   startperl=": # use perl";;
8502                 *)      startperl="#!$ans"
8503                         if $test 30 -lt `echo "$ans" | wc -c`; then
8504                                 $cat >&4 <<EOM
8505
8506 WARNING:  Some systems limit the #! command to 32 characters.
8507 If you experience difficulty running Perl scripts with #!, try
8508 installing Perl in a directory with a shorter pathname.
8509
8510 EOM
8511                         fi ;;
8512                 esac
8513                 ;;
8514         *) startperl=": # use perl"
8515                 ;;
8516         esac
8517         ;;
8518 esac
8519 echo "I'll use $startperl to start perl scripts."
8520
8521 : figure best path for perl in scripts
8522 case "$perlpath" in
8523 '')
8524         case "$versiononly" in
8525         "$define")      perlpath="$binexp/perl$version";;
8526         *)              perlpath="$binexp/perl";;
8527         esac
8528         case "$startperl" in
8529         *!*) ;;
8530         *)
8531                 $cat <<EOH
8532
8533 I will use the "eval 'exec'" idiom to start Perl on your system.
8534 I can use the full path of your Perl binary for this purpose, but
8535 doing so may cause problems if you want to share those scripts and
8536 Perl is not always in a standard place ($binexp/perl).
8537
8538 EOH
8539                 dflt="$binexp/perl"
8540                 rp="What path shall I use in \"eval 'exec'\"?"
8541                 . ./myread
8542                 perlpath="$ans"
8543                 ;;
8544         esac
8545         ;;
8546 esac
8547 case "$startperl" in
8548 *!*)    ;;
8549 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8550 esac
8551
8552 : determine where public executable scripts go
8553 set scriptdir scriptdir
8554 eval $prefixit
8555 case "$scriptdir" in
8556 '')
8557         dflt="$bin"
8558         : guess some guesses
8559         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8560         $test -d /usr/share/bin     && dflt=/usr/share/bin
8561         $test -d /usr/local/script  && dflt=/usr/local/script
8562         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8563         $test -d $prefixexp/script  && dflt=$prefixexp/script
8564         set dflt
8565         eval $prefixup
8566         ;;
8567 *)  dflt="$scriptdir"
8568         ;;
8569 esac
8570 $cat <<EOM
8571  
8572 Some installations have a separate directory just for executable scripts so
8573 that they can mount it across multiple architectures but keep the scripts in
8574 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8575 Or you might just lump your scripts in with all your other executables.
8576  
8577 EOM
8578 fn=d~
8579 rp='Where do you keep publicly executable scripts?'
8580 . ./getfile
8581 if $test "X$ansexp" != "X$scriptdirexp"; then
8582         installscript=''
8583 fi
8584 scriptdir="$ans"
8585 scriptdirexp="$ansexp"
8586 : Change installation prefix, if necessary.
8587 if $test X"$prefix" != X"$installprefix"; then
8588         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8589 else
8590         installscript="$scriptdirexp"
8591 fi
8592
8593 : determine where add-on public executables go
8594 case "$sitebin" in
8595 '')     dflt=$siteprefix/bin ;;
8596 *)      dflt=$sitebin ;;
8597 esac
8598 fn=d~
8599 rp='Pathname where the add-on public executables should be installed?'
8600 . ./getfile
8601 sitebin="$ans"
8602 sitebinexp="$ansexp"
8603 : Change installation prefix, if necessary.
8604 if $test X"$prefix" != X"$installprefix"; then
8605         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8606 else
8607         installsitebin="$sitebinexp"
8608 fi
8609
8610 : define an is-a-typedef? function
8611 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8612 case "$inclist" in
8613 "") inclist="sys/types.h";;
8614 esac;
8615 eval "varval=\$$var";
8616 case "$varval" in
8617 "")
8618         $rm -f temp.c;
8619         for inc in $inclist; do
8620                 echo "#include <$inc>" >>temp.c;
8621         done;
8622         echo "#ifdef $type" >> temp.c;
8623         echo "printf(\"We have $type\");" >> temp.c;
8624         echo "#endif" >> temp.c;
8625         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8626         if $contains $type temp.E >/dev/null 2>&1; then
8627                 eval "$var=\$type";
8628         else
8629                 eval "$var=\$def";
8630         fi;
8631         $rm -f temp.?;;
8632 *) eval "$var=\$varval";;
8633 esac'
8634
8635 : define an is-a-typedef? function that prompts if the type is not available.
8636 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8637 case "$inclist" in
8638 "") inclist="sys/types.h";;
8639 esac;
8640 eval "varval=\$$var";
8641 case "$varval" in
8642 "")
8643         $rm -f temp.c;
8644         for inc in $inclist; do
8645                 echo "#include <$inc>" >>temp.c;
8646         done;
8647         echo "#ifdef $type" >> temp.c;
8648         echo "printf(\"We have $type\");" >> temp.c;
8649         echo "#endif" >> temp.c;
8650         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8651         echo " " ;
8652         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8653         if $contains $type temp.E >/dev/null 2>&1; then
8654                 echo "$type found." >&4;
8655                 eval "$var=\$type";
8656         else
8657                 echo "$type NOT found." >&4;
8658                 dflt="$def";
8659                 . ./myread ;
8660                 eval "$var=\$ans";
8661         fi;
8662         $rm -f temp.?;;
8663 *) eval "$var=\$varval";;
8664 esac'
8665
8666 : see what type lseek is declared as in the kernel
8667 rp="What is the type used for lseek's offset on this system?"
8668 set off_t lseektype long stdio.h sys/types.h
8669 eval $typedef_ask
8670
8671 echo " "
8672 echo "Checking to see how big your file offsets are..." >&4
8673 $cat >try.c <<EOCP
8674 #include <sys/types.h>
8675 #include <stdio.h>
8676 int main()
8677 {
8678     printf("%d\n", (int)sizeof($lseektype));
8679     return(0); 
8680 }
8681 EOCP
8682 set try
8683 if eval $compile_ok; then
8684         lseeksize=`$run ./try`
8685         echo "Your file offsets are $lseeksize bytes long."
8686 else
8687         dflt=$longsize
8688         echo " "
8689         echo "(I can't seem to compile the test program.  Guessing...)"
8690         rp="What is the size of your file offsets (in bytes)?"
8691         . ./myread
8692         lseeksize="$ans"
8693 fi
8694 $rm -f try.c try
8695
8696 : see what type file positions are declared as in the library
8697 rp="What is the type for file position used by fsetpos()?"
8698 set fpos_t fpostype long stdio.h sys/types.h
8699 eval $typedef_ask
8700
8701 echo " "
8702 case "$fpostype" in
8703 *_t) zzz="$fpostype"    ;;
8704 *)   zzz="fpos_t"       ;;
8705 esac
8706 echo "Checking the size of $zzz..." >&4 
8707 cat > try.c <<EOCP
8708 #include <sys/types.h>
8709 #include <stdio.h>
8710 int main() {
8711     printf("%d\n", (int)sizeof($fpostype));
8712     exit(0);
8713 }
8714 EOCP
8715 set try
8716 if eval $compile_ok; then
8717         yyy=`$run ./try`
8718         case "$yyy" in
8719         '')     fpossize=4
8720                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8721                 ;;
8722         *)      fpossize=$yyy
8723                 echo "Your $zzz is $fpossize bytes long."
8724                 ;;
8725         esac
8726 else
8727         dflt="$longsize"
8728         echo " " >&4
8729         echo "(I can't compile the test program.  Guessing...)" >&4
8730         rp="What is the size of your file positions (in bytes)?"
8731         . ./myread
8732         fpossize="$ans"
8733 fi
8734
8735
8736
8737 # Backward compatibility (uselfs is deprecated).
8738 case "$uselfs" in
8739 "$define"|true|[yY]*)
8740         cat <<EOM >&4
8741
8742 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8743 EOM
8744         uselargefiles="$define"
8745         ;;
8746 esac                          
8747
8748 case "$lseeksize:$fpossize" in
8749 8:8) cat <<EOM
8750
8751 You can have files larger than 2 gigabytes.
8752 EOM
8753    val="$define" ;;
8754 *)    case "$uselargefiles" in
8755    "$undef"|false|[nN]*) dflt='n' ;;
8756    *)   dflt='y' ;;
8757    esac
8758    cat <<EOM
8759
8760 Perl can be built to understand large files (files larger than 2 gigabytes)
8761 on some systems.  To do so, Configure can be run with -Duselargefiles.
8762
8763 If this doesn't make any sense to you, just accept the default '$dflt'.
8764 EOM
8765    rp='Try to understand large files, if available?'
8766    . ./myread
8767    case "$ans" in
8768    y|Y)         val="$define" ;;
8769    *)           val="$undef"  ;;
8770    esac
8771    ;;
8772 esac
8773 set uselargefiles
8774 eval $setvar
8775 case "$uselargefiles" in
8776 "$define")
8777 : Look for a hint-file generated 'call-back-unit'.  If the
8778 : user has specified that a large files perl is to be built,
8779 : we may need to set or change some other defaults.
8780         if $test -f uselargefiles.cbu; then
8781                 echo "Your platform has some specific hints for large file builds, using them..."
8782                 . ./uselargefiles.cbu
8783                 echo " "
8784                 echo "Rechecking to see how big your file offsets are..." >&4
8785                 $cat >try.c <<EOCP
8786 #include <sys/types.h>
8787 #include <stdio.h>
8788 int main()
8789 {
8790     printf("%d\n", (int)sizeof($lseektype));
8791     return(0); 
8792 }
8793 EOCP
8794                 set try
8795                 if eval $compile_ok; then
8796                         lseeksize=`$run ./try`
8797                         $echo "Your file offsets are now $lseeksize bytes long."
8798                 else
8799                         dflt="$lseeksize"
8800                         echo " "
8801                         echo "(I can't seem to compile the test program.  Guessing...)"
8802                         rp="What is the size of your file offsets (in bytes)?"
8803                         . ./myread
8804                         lseeksize="$ans"
8805                 fi
8806                 case "$fpostype" in
8807                 *_t) zzz="$fpostype"    ;;
8808                 *)   zzz="fpos_t"       ;;
8809                 esac
8810                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8811                 $cat > try.c <<EOCP
8812 #include <sys/types.h>
8813 #include <stdio.h>
8814 int main() {
8815     printf("%d\n", (int)sizeof($fpostype));
8816     exit(0);
8817 }
8818 EOCP
8819                 set try
8820                 if eval $compile_ok; then
8821                         yyy=`$run ./try`
8822                         dflt="$lseeksize"
8823                         case "$yyy" in
8824                         '')     echo " "
8825                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8826                                 ;;
8827                         *)      fpossize=$yyy
8828                                 echo " $fpossize bytes." >&4
8829                                 ;;
8830                         esac
8831                 else
8832                         dflt="$fpossize"
8833                         echo " "
8834                         echo "(I can't compile the test program.  Guessing...)" >&4
8835                         rp="What is the size of your file positions (in bytes)?"
8836                         . ./myread
8837                         fpossize="$ans"
8838                 fi
8839                 $rm -f try.c try
8840         fi
8841         ;;
8842 esac
8843
8844 case "$vendorprefix" in
8845 '')     d_vendorbin="$undef"
8846         vendorbin=''
8847         vendorbinexp=''
8848         ;;
8849 *)      d_vendorbin="$define"
8850         : determine where vendor-supplied executables go.
8851         case "$vendorbin" in
8852         '') dflt=$vendorprefix/bin ;;
8853         *)      dflt="$vendorbin" ;;
8854         esac
8855         fn=d~+
8856         rp='Pathname for the vendor-supplied executables directory?'
8857         . ./getfile
8858         vendorbin="$ans"
8859         vendorbinexp="$ansexp"
8860         ;;
8861 esac
8862 : Change installation prefix, if necessary.
8863 if $test X"$prefix" != X"$installprefix"; then
8864         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8865 else
8866         installvendorbin="$vendorbinexp"
8867 fi
8868
8869 : see if qgcvt exists
8870 set qgcvt d_qgcvt
8871 eval $inlibc
8872
8873 : Check how to convert floats to strings.
8874
8875 if test "X$d_Gconvert" = X; then
8876
8877 echo " "
8878 echo "Checking for an efficient way to convert floats to strings."
8879 echo " " > try.c
8880 case "$uselongdouble" in
8881 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8882 esac
8883 case "$d_longdbl" in
8884 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8885 esac
8886 case "$d_PRIgldbl" in
8887 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8888 esac
8889 $cat >>try.c <<EOP
8890 #ifdef TRY_gconvert
8891 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8892 char *myname = "gconvert";
8893 #endif
8894 #ifdef TRY_gcvt
8895 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8896 char *myname = "gcvt";
8897 #endif
8898 #ifdef TRY_qgcvt
8899 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8900 char *myname = "qgcvt";
8901 #define DOUBLETYPE long double
8902 #endif
8903 #ifdef TRY_sprintf
8904 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8905 #ifdef HAS_PRIgldbl
8906 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8907 #else
8908 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8909 #endif
8910 #else
8911 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8912 #endif
8913 char *myname = "sprintf";
8914 #endif
8915
8916 #ifndef DOUBLETYPE
8917 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8918 #define DOUBLETYPE long double
8919 #else
8920 #define DOUBLETYPE double
8921 #endif
8922 #endif
8923
8924 #include <stdio.h>
8925
8926 #define I_STDLIB $i_stdlib
8927 #ifdef I_STDLIB
8928 #include <stdlib.h>
8929 #endif
8930
8931 int
8932 checkit(expect, got)
8933 char *expect;
8934 char *got;
8935 {
8936     if (strcmp(expect, got)) {
8937                 printf("%s oddity:  Expected %s, got %s\n",
8938                         myname, expect, got);
8939                 exit(1);
8940         }
8941 }
8942
8943 int main()
8944
8945         char buf[64]; 
8946         buf[63] = '\0';
8947
8948         /* This must be 1st test on (which?) platform */
8949         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8950         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8951         checkit("0.1", buf);
8952
8953         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8954         checkit("0.01", buf);
8955
8956         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8957         checkit("0.001", buf);
8958
8959         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8960         checkit("0.0001", buf);
8961
8962         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8963         if (strlen(buf) > 5)
8964             checkit("9e-005", buf); /* for Microsoft ?? */
8965         else
8966             checkit("9e-05", buf);
8967
8968         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8969         checkit("1", buf);
8970
8971         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8972         checkit("1.1", buf);
8973
8974         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8975         checkit("1.01", buf);
8976
8977         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8978         checkit("1.001", buf);
8979
8980         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8981         checkit("1.0001", buf);
8982
8983         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8984         checkit("1.00001", buf);
8985
8986         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8987         checkit("1.000001", buf);
8988
8989         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8990         checkit("0", buf);
8991
8992         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8993         checkit("-1", buf);
8994
8995         /* Some Linux gcvt's give 1.e+5 here. */
8996         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8997         checkit("100000", buf);
8998         
8999         /* Some Linux gcvt's give -1.e+5 here. */
9000         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9001         checkit("-100000", buf);
9002
9003         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9004         checkit("123.456", buf);
9005
9006         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9007         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9008         /* 34 should be enough to scare even long double
9009          * places into using the e notation. */
9010         if (strlen(buf) > 5)
9011             checkit("1e+034", buf); /* for Microsoft */
9012         else
9013             checkit("1e+34", buf);
9014
9015         /* For Perl, if you add additional tests here, also add them to
9016          * t/base/num.t for benefit of platforms not using Configure or
9017          * overriding d_Gconvert */
9018
9019         exit(0);
9020 }
9021 EOP
9022 : first add preferred functions to our list
9023 xxx_list=""
9024 for xxx_convert in $gconvert_preference; do
9025     case $xxx_convert in
9026     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9027     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9028     esac 
9029 done
9030 : then add any others
9031 for xxx_convert in gconvert gcvt sprintf; do
9032     case "$xxx_list" in
9033     *$xxx_convert*) ;;
9034     *) xxx_list="$xxx_list $xxx_convert" ;;
9035     esac 
9036 done
9037
9038 case "$d_longdbl$uselongdouble" in
9039 "$define$define")
9040     : again, add prefered functions to our list first
9041     xxx_ld_list=""
9042     for xxx_convert in $gconvert_ld_preference; do
9043         case $xxx_convert in
9044         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9045         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9046         esac
9047     done
9048     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9049     for xxx_convert in qgcvt sprintf $xxx_list; do
9050         case "$xxx_ld_list" in
9051         $xxx_convert*|*" $xxx_convert"*) ;;
9052         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9053         esac
9054     done
9055     : if sprintf cannot do long doubles, move it to the end
9056     if test "$d_PRIgldbl" != "$define"; then
9057         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9058     fi
9059     : if no qgcvt, remove it
9060     if test "$d_qgcvt" != "$define"; then
9061         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9062     fi
9063     : use the ld_list
9064     xxx_list="$xxx_ld_list"
9065     ;;
9066 esac
9067
9068 for xxx_convert in $xxx_list; do
9069         echo "Trying $xxx_convert..."
9070         $rm -f try try$_o
9071         set try -DTRY_$xxx_convert
9072         if eval $compile; then
9073                 echo "$xxx_convert() found." >&4
9074                 if $run ./try; then
9075                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9076                         break;
9077                 else
9078                         echo "...But $xxx_convert didn't work as I expected."
9079                         xxx_convert=''
9080                 fi
9081         else
9082                 echo "$xxx_convert NOT found." >&4
9083         fi
9084 done
9085
9086 if test X$xxx_convert = X; then
9087     echo "*** WHOA THERE!!! ***" >&4
9088     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9089     xxx_convert=sprintf
9090 fi
9091
9092 case "$xxx_convert" in
9093 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9094 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9095 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9096 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9097    "$define$define$define")
9098       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9099    "$define$define$undef")
9100       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9101    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9102    esac
9103    ;;  
9104 esac
9105
9106 fi
9107
9108 : see if _fwalk exists
9109 set fwalk d__fwalk
9110 eval $inlibc
9111
9112 : Initialize h_fcntl
9113 h_fcntl=false
9114
9115 : Initialize h_sysfile
9116 h_sysfile=false
9117
9118 : access call always available on UNIX
9119 set access d_access
9120 eval $inlibc
9121
9122 : locate the flags for 'access()'
9123 case "$d_access" in
9124 "$define")
9125         echo " "
9126         $cat >access.c <<'EOCP'
9127 #include <sys/types.h>
9128 #ifdef I_FCNTL
9129 #include <fcntl.h>
9130 #endif
9131 #ifdef I_SYS_FILE
9132 #include <sys/file.h>
9133 #endif
9134 #ifdef I_UNISTD
9135 #include <unistd.h>
9136 #endif
9137 int main() {
9138         exit(R_OK);
9139 }
9140 EOCP
9141         : check sys/file.h first, no particular reason here
9142         if $test `./findhdr sys/file.h` && \
9143                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9144                 h_sysfile=true;
9145                 echo "<sys/file.h> defines the *_OK access constants." >&4
9146         elif $test `./findhdr fcntl.h` && \
9147                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9148                 h_fcntl=true;
9149                 echo "<fcntl.h> defines the *_OK access constants." >&4
9150         elif $test `./findhdr unistd.h` && \
9151                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9152                 echo "<unistd.h> defines the *_OK access constants." >&4
9153         else
9154                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9155         fi
9156         ;;
9157 esac
9158 $rm -f access*
9159
9160 : see if accessx exists
9161 set accessx d_accessx
9162 eval $inlibc
9163
9164 : see if alarm exists
9165 set alarm d_alarm
9166 eval $inlibc
9167
9168 : see if POSIX threads are available
9169 set pthread.h i_pthread
9170 eval $inhdr
9171
9172 : define a fucntion to check prototypes
9173 $cat > protochk <<EOSH
9174 $startsh
9175 cc="$cc"
9176 optimize="$optimize"
9177 ccflags="$ccflags"
9178 prototype="$prototype"
9179 define="$define"
9180 rm=$rm
9181 usethreads=$usethreads
9182 i_pthread=$i_pthread
9183 pthread_h_first=$pthread_h_first
9184 EOSH
9185
9186 $cat >> protochk <<'EOSH'
9187
9188 $rm -f try.c
9189 foo="$1"
9190 shift
9191 while test $# -ge 2; do
9192         case "$1" in
9193                 $define) echo "#include <$2>" >> try.c ;;
9194                 literal) echo "$2" >> try.c ;;
9195         esac
9196     # Extra magic for the benefit of systems that need pthread.h
9197     # to be included early to correctly detect threadsafe functions.
9198     # Such functions must guarantee themselves, though, that the usethreads
9199     # and i_pthread have been defined, before calling protochk.
9200     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9201         echo "#include <pthread.h>" >> try.c
9202         pthread_h_done=yes
9203     fi
9204     shift 2
9205 done
9206 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9207 cat >> try.c <<'EOCP'
9208 #ifdef CAN_PROTOTYPE
9209 #define _(args) args
9210 #else
9211 #define _(args) ()
9212 #endif
9213 EOCP
9214 echo "$foo" >> try.c
9215 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9216 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9217 status=$?
9218 $rm -f try.[co]
9219 exit $status
9220 EOSH
9221 chmod +x protochk
9222 $eunicefix protochk
9223
9224 : see if sys/types.h has to be included
9225 set sys/types.h i_systypes
9226 eval $inhdr
9227
9228 : see if sys/select.h has to be included
9229 set sys/select.h i_sysselct
9230 eval $inhdr
9231
9232 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9233 while $test $# -ge 2; do
9234         case "$1" in
9235         $define) echo "#include <$2>";;
9236         esac ;
9237     shift 2;
9238 done > try.c;
9239 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9240 set try;
9241 if eval $compile; then
9242         val="$define";
9243 else
9244         val="$undef";
9245 fi;
9246 set $varname;
9247 eval $setvar;
9248 $rm -f try.c try.o'
9249
9250 : see if we should include time.h, sys/time.h, or both
9251 echo " "
9252 if test "X$timeincl" = X; then
9253         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9254         $echo $n "I'm now running the test program...$c"
9255         $cat >try.c <<'EOCP'
9256 #include <sys/types.h>
9257 #ifdef I_TIME
9258 #include <time.h>
9259 #endif
9260 #ifdef I_SYSTIME
9261 #ifdef SYSTIMEKERNEL
9262 #define KERNEL
9263 #endif
9264 #include <sys/time.h>
9265 #endif
9266 #ifdef I_SYSSELECT
9267 #include <sys/select.h>
9268 #endif
9269 int main()
9270 {
9271         struct tm foo;
9272 #ifdef S_TIMEVAL
9273         struct timeval bar;
9274 #endif
9275 #ifdef S_TIMEZONE
9276         struct timezone tzp;
9277 #endif
9278         if (foo.tm_sec == foo.tm_sec)
9279                 exit(0);
9280 #ifdef S_TIMEVAL
9281         if (bar.tv_sec == bar.tv_sec)
9282                 exit(0);
9283 #endif
9284         exit(1);
9285 }
9286 EOCP
9287         flags=''
9288         for s_timezone in '-DS_TIMEZONE' ''; do
9289         sysselect=''
9290         for s_timeval in '-DS_TIMEVAL' ''; do
9291         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9292         for i_time in '' '-DI_TIME'; do
9293         for i_systime in '-DI_SYSTIME' ''; do
9294                 case "$flags" in
9295                 '') $echo $n ".$c"
9296                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9297                         if eval $compile; then
9298                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9299                                 shift
9300                                 flags="$*"
9301                                 echo " "
9302                                 $echo $n "Succeeded with $flags$c"
9303                         fi
9304                         ;;
9305                 esac
9306         done
9307         done
9308         done
9309         done
9310         done
9311         timeincl=''
9312         echo " "
9313         case "$flags" in
9314         *SYSTIMEKERNEL*) i_systimek="$define"
9315                 timeincl=`./findhdr sys/time.h`
9316                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9317         *) i_systimek="$undef";;
9318         esac
9319         case "$flags" in
9320         *I_TIME*) i_time="$define"
9321                 timeincl=`./findhdr time.h`" $timeincl"
9322                 echo "We'll include <time.h>." >&4;;
9323         *) i_time="$undef";;
9324         esac
9325         case "$flags" in
9326         *I_SYSTIME*) i_systime="$define"
9327                 timeincl=`./findhdr sys/time.h`" $timeincl"
9328                 echo "We'll include <sys/time.h>." >&4;;
9329         *) i_systime="$undef";;
9330         esac
9331         $rm -f try.c try
9332 fi
9333 : see if struct tm knows about tm_zone
9334 case "$i_systime$i_time" in
9335 *$define*) 
9336         echo " "
9337         echo "Checking to see if your struct tm has tm_zone field..." >&4
9338         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9339         eval $hasfield
9340         ;;
9341 *)      val="$undef"
9342         set d_tm_tm_zone
9343         eval $setvar
9344         ;;
9345 esac
9346 case "$d_tm_tm_zone" in
9347 "$define")      echo "Yes, it does."   ;;
9348 *)              echo "No, it doesn't." ;;
9349 esac
9350 : see if struct tm knows about tm_gmtoff
9351 case "$i_systime$i_time" in
9352 *$define*) 
9353         echo " "
9354         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9355         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9356         eval $hasfield
9357         ;;
9358 *)      val="$undef"
9359         set d_tm_tm_gmtoff
9360         eval $setvar
9361         ;;
9362 esac
9363 case "$d_tm_tm_gmtoff" in
9364 "$define")      echo "Yes, it does."   ;;
9365 *)              echo "No, it doesn't." ;;
9366 esac
9367
9368 : see if asctime_r exists
9369 set asctime_r d_asctime_r
9370 eval $inlibc
9371 case "$d_asctime_r" in
9372 "$define")
9373         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9374         case "$d_asctime_r_proto:$usethreads" in
9375         ":define")      d_asctime_r_proto=define
9376                 set d_asctime_r_proto asctime_r $hdrs
9377                 eval $hasproto ;;
9378         *)      ;;
9379         esac
9380         case "$d_asctime_r_proto" in
9381         define)
9382         case "$asctime_r_proto" in
9383         ''|0) try='char* asctime_r(const struct tm*, char*);'
9384         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9385         esac
9386         case "$asctime_r_proto" in
9387         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9388         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9389         esac
9390         case "$asctime_r_proto" in
9391         ''|0) try='int asctime_r(const struct tm*, char*);'
9392         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9393         esac
9394         case "$asctime_r_proto" in
9395         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9396         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9397         esac
9398         case "$asctime_r_proto" in
9399         ''|0)   d_asctime_r=undef
9400                 asctime_r_proto=0
9401                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9402         * )     case "$asctime_r_proto" in
9403                 REENTRANT_PROTO*) ;;
9404                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9405                 esac
9406                 echo "Prototype: $try" ;;
9407         esac
9408         ;;
9409         *)      case "$usethreads" in
9410                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9411                 esac
9412                 d_asctime_r=undef
9413                 asctime_r_proto=0
9414                 ;;
9415         esac
9416         ;;
9417 *)      asctime_r_proto=0
9418         ;;
9419 esac
9420
9421 : see if atolf exists
9422 set atolf d_atolf
9423 eval $inlibc
9424
9425 : see if atoll exists
9426 set atoll d_atoll
9427 eval $inlibc
9428
9429 : Look for GNU-cc style attribute checking
9430 echo " "
9431 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9432 $cat >attrib.c <<'EOCP'
9433 #include <stdio.h>
9434 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9435 EOCP
9436 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9437         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9438                 echo "Your C compiler doesn't fully support __attribute__."
9439                 val="$undef"
9440         else
9441                 echo "Your C compiler supports __attribute__."
9442                 val="$define"
9443         fi
9444 else
9445         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9446         val="$undef"
9447 fi
9448 set d_attribut
9449 eval $setvar
9450 $rm -f attrib*
9451
9452 : see if bcmp exists
9453 set bcmp d_bcmp
9454 eval $inlibc
9455
9456 : see if bcopy exists
9457 set bcopy d_bcopy
9458 eval $inlibc
9459
9460 : see if this is a unistd.h system
9461 set unistd.h i_unistd
9462 eval $inhdr
9463
9464 : see if getpgrp exists
9465 set getpgrp d_getpgrp
9466 eval $inlibc
9467
9468 case "$d_getpgrp" in
9469 "$define")
9470         echo " "
9471         echo "Checking to see which flavor of getpgrp is in use..."
9472         $cat >try.c <<EOP
9473 #$i_unistd I_UNISTD
9474 #include <sys/types.h>
9475 #ifdef I_UNISTD
9476 #  include <unistd.h>
9477 #endif
9478 int main()
9479 {
9480         if (getuid() == 0) {
9481                 printf("(I see you are running Configure as super-user...)\n");
9482                 setuid(1);
9483         }
9484 #ifdef TRY_BSD_PGRP
9485         if (getpgrp(1) == 0)
9486                 exit(0);
9487 #else
9488         if (getpgrp() > 0)
9489                 exit(0);
9490 #endif
9491         exit(1);
9492 }
9493 EOP
9494         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9495                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9496                 val="$define"
9497         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9498                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9499                 val="$undef"
9500         else
9501                 echo "I can't seem to compile and run the test program."
9502                 if ./usg; then
9503                         xxx="a USG one, i.e. you use getpgrp()."
9504                 else
9505                         # SVR4 systems can appear rather BSD-ish.
9506                         case "$i_unistd" in
9507                         $undef)
9508                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9509                                 val="$define"
9510                                 ;;
9511                         $define)
9512                                 xxx="probably a USG one, i.e. you use getpgrp()."
9513                                 val="$undef"
9514                                 ;;
9515                         esac
9516                 fi
9517                 echo "Assuming your getpgrp is $xxx" >&4
9518         fi
9519         ;;
9520 *) val="$undef";;
9521 esac
9522 set d_bsdgetpgrp
9523 eval $setvar
9524 $rm -f try try.*
9525
9526 : see if setpgrp exists
9527 set setpgrp d_setpgrp
9528 eval $inlibc
9529
9530 case "$d_setpgrp" in
9531 "$define")
9532         echo " "
9533         echo "Checking to see which flavor of setpgrp is in use..."
9534         $cat >try.c <<EOP
9535 #$i_unistd I_UNISTD
9536 #include <sys/types.h>
9537 #ifdef I_UNISTD
9538 #  include <unistd.h>
9539 #endif
9540 int main()
9541 {
9542         if (getuid() == 0) {
9543                 printf("(I see you are running Configure as super-user...)\n");
9544                 setuid(1);
9545         }
9546 #ifdef TRY_BSD_PGRP
9547         if (-1 == setpgrp(1, 1))
9548                 exit(0);
9549 #else
9550         if (setpgrp() != -1)
9551                 exit(0);
9552 #endif
9553         exit(1);
9554 }
9555 EOP
9556         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9557                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9558                 val="$define"
9559         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9560                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9561                 val="$undef"
9562         else
9563                 echo "(I can't seem to compile and run the test program.)"
9564                 if ./usg; then
9565                         xxx="a USG one, i.e. you use setpgrp()."
9566                 else
9567                         # SVR4 systems can appear rather BSD-ish.
9568                         case "$i_unistd" in
9569                         $undef)
9570                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9571                                 val="$define"
9572                                 ;;
9573                         $define)
9574                                 xxx="probably a USG one, i.e. you use setpgrp()."
9575                                 val="$undef"
9576                                 ;;
9577                         esac
9578                 fi
9579                 echo "Assuming your setpgrp is $xxx" >&4
9580         fi
9581         ;;
9582 *) val="$undef";;
9583 esac
9584 set d_bsdsetpgrp
9585 eval $setvar
9586 $rm -f try try.*
9587 : see if bzero exists
9588 set bzero d_bzero
9589 eval $inlibc
9590
9591 : see if signal is declared as pointer to function returning int or void
9592 echo " "
9593 xxx=`./findhdr signal.h`
9594 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9595 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9596         echo "You have int (*signal())() instead of void." >&4
9597         val="$undef"
9598 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9599         echo "You have void (*signal())()." >&4
9600         val="$define"
9601 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9602         echo "You have int (*signal())() instead of void." >&4
9603         val="$undef"
9604 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9605         echo "You have void (*signal())()." >&4
9606         val="$define"
9607 else
9608         case "$d_voidsig" in
9609         '')
9610         echo "I can't determine whether signal handler returns void or int..." >&4
9611                 dflt=void
9612                 rp="What type does your signal handler return?"
9613                 . ./myread
9614                 case "$ans" in
9615                 v*) val="$define";;
9616                 *) val="$undef";;
9617                 esac;;
9618         "$define")
9619                 echo "As you already told me, signal handler returns void." >&4
9620                 val="$define"
9621                 ;;
9622         *)      echo "As you already told me, signal handler returns int." >&4
9623                 val="$undef"
9624                 ;;
9625         esac
9626 fi
9627 set d_voidsig
9628 eval $setvar
9629 case "$d_voidsig" in
9630 "$define") signal_t="void";;
9631 *) signal_t="int";;
9632 esac
9633 $rm -f $$.tmp
9634
9635 : check for ability to cast large floats to 32-bit ints.
9636 echo " "
9637 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9638 if $test "$intsize" -ge 4; then
9639         xxx=int
9640 else
9641         xxx=long
9642 fi
9643 $cat >try.c <<EOCP
9644 #include <stdio.h>
9645 #include <sys/types.h>
9646 #include <signal.h>
9647 $signal_t blech(s) int s; { exit(3); }
9648 int main()
9649 {
9650         $xxx i32;
9651         double f, g;
9652         int result = 0;
9653         char str[16];
9654         signal(SIGFPE, blech);
9655
9656         /* Don't let compiler optimize the test away.  Store the number 
9657            in a writable string for gcc to pass to sscanf under HP/UX.
9658         */
9659         sprintf(str, "2147483647");
9660         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9661         g = 10 * f;
9662         i32  = ($xxx) g;
9663
9664         /* x86 processors will probably give 0x8000 0000, which is a
9665        sign change.  We don't want that.  We want to mimic SPARC
9666            behavior here, which is to preserve the sign and give
9667            back 0x7fff ffff.
9668         */
9669         if (i32 != ($xxx) f)
9670                 result |= 1;
9671         exit(result);
9672 }
9673 EOCP
9674 set try
9675 if eval $compile_ok; then
9676         $run ./try
9677         yyy=$?
9678 else
9679         echo "(I can't seem to compile the test program--assuming it can't)"
9680         yyy=1
9681 fi
9682 case "$yyy" in
9683 0)      val="$define"
9684         echo "Yup, it can."
9685         ;;
9686 *)      val="$undef"
9687         echo "Nope, it can't."
9688         ;;
9689 esac
9690 set d_casti32
9691 eval $setvar
9692 $rm -f try try.*
9693
9694 : check for ability to cast negative floats to unsigned
9695 echo " "
9696 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9697 $cat >try.c <<EOCP
9698 #include <stdio.h>
9699 #include <sys/types.h>
9700 #include <signal.h>
9701 $signal_t blech(s) int s; { exit(7); }
9702 $signal_t blech_in_list(s) int s; { exit(4); }
9703 unsigned long dummy_long(p) unsigned long p; { return p; }
9704 unsigned int dummy_int(p) unsigned int p; { return p; }
9705 unsigned short dummy_short(p) unsigned short p; { return p; }
9706 int main()
9707 {
9708         double f;
9709         unsigned long along;
9710         unsigned int aint;
9711         unsigned short ashort;
9712         int result = 0;
9713         char str[16];
9714         
9715         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9716            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9717            optimized the whole file away
9718         */
9719         /* Store the number in a writable string for gcc to pass to 
9720            sscanf under HP/UX.
9721         */
9722         sprintf(str, "-123");
9723         sscanf(str, "%lf", &f);  /* f = -123.; */
9724
9725         signal(SIGFPE, blech);
9726         along = (unsigned long)f;
9727         aint = (unsigned int)f;
9728         ashort = (unsigned short)f;
9729         if (along != (unsigned long)-123)
9730                 result |= 1;
9731         if (aint != (unsigned int)-123)
9732                 result |= 1;
9733         if (ashort != (unsigned short)-123)
9734                 result |= 1;
9735         sprintf(str, "1073741824.");
9736         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9737         f = f + f;
9738         along = 0;
9739         along = (unsigned long)f;
9740         if (along != 0x80000000)
9741                 result |= 2;
9742         f -= 1.;
9743         along = 0;
9744         along = (unsigned long)f;
9745         if (along != 0x7fffffff)
9746                 result |= 1;
9747         f += 2.;
9748         along = 0;
9749         along = (unsigned long)f;
9750         if (along != 0x80000001)
9751                 result |= 2;
9752         if (result)
9753                 exit(result);
9754         signal(SIGFPE, blech_in_list);
9755         sprintf(str, "123.");
9756         sscanf(str, "%lf", &f);  /* f = 123.; */
9757         along = dummy_long((unsigned long)f);
9758         aint = dummy_int((unsigned int)f);
9759         ashort = dummy_short((unsigned short)f);
9760         if (along != (unsigned long)123)
9761                 result |= 4;
9762         if (aint != (unsigned int)123)
9763                 result |= 4;
9764         if (ashort != (unsigned short)123)
9765                 result |= 4;
9766         exit(result);
9767
9768 }
9769 EOCP
9770 set try
9771 if eval $compile_ok; then
9772         $run ./try
9773         castflags=$?
9774 else
9775         echo "(I can't seem to compile the test program--assuming it can't)"
9776         castflags=7
9777 fi
9778 case "$castflags" in
9779 0)      val="$define"
9780         echo "Yup, it can."
9781         ;;
9782 *)      val="$undef"
9783         echo "Nope, it can't."
9784         ;;
9785 esac
9786 set d_castneg
9787 eval $setvar
9788 $rm -f try.*
9789
9790 : see if vprintf exists
9791 echo " "
9792 if set vprintf val -f d_vprintf; eval $csym; $val; then
9793         echo 'vprintf() found.' >&4
9794         val="$define"
9795         $cat >try.c <<'EOF'
9796 #include <varargs.h>
9797
9798 int main() { xxx("foo"); }
9799
9800 xxx(va_alist)
9801 va_dcl
9802 {
9803         va_list args;
9804         char buf[10];
9805
9806         va_start(args);
9807         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9808 }
9809 EOF
9810         set try
9811         if eval $compile && $run ./try; then
9812                 echo "Your vsprintf() returns (int)." >&4
9813                 val2="$undef"
9814         else
9815                 echo "Your vsprintf() returns (char*)." >&4
9816                 val2="$define"
9817         fi
9818 else
9819         echo 'vprintf() NOT found.' >&4
9820                 val="$undef"
9821                 val2="$undef"
9822 fi
9823 $rm -f try try.*
9824 set d_vprintf
9825 eval $setvar
9826 val=$val2
9827 set d_charvspr
9828 eval $setvar
9829
9830 : see if chown exists
9831 set chown d_chown
9832 eval $inlibc
9833
9834 : see if chroot exists
9835 set chroot d_chroot
9836 eval $inlibc
9837
9838 : see if chsize exists
9839 set chsize d_chsize
9840 eval $inlibc
9841
9842 : see if class exists
9843 set class d_class
9844 eval $inlibc
9845
9846 hasstruct='varname=$1; struct=$2; shift; shift;
9847 while $test $# -ge 2; do
9848         case "$1" in
9849         $define) echo "#include <$2>";;
9850         esac ;
9851     shift 2;
9852 done > try.c;
9853 echo "int main () { struct $struct foo; }" >> try.c;
9854 set try;
9855 if eval $compile; then
9856         val="$define";
9857 else
9858         val="$undef";
9859 fi;
9860 set $varname;
9861 eval $setvar;
9862 $rm -f try.c try.o'
9863
9864 socketlib=''
9865 sockethdr=''
9866 : see whether socket exists
9867 echo " "
9868 $echo $n "Hmm... $c" >&4
9869 if set socket val -f d_socket; eval $csym; $val; then
9870         echo "Looks like you have Berkeley networking support." >&4
9871         d_socket="$define"
9872         if set setsockopt val -f; eval $csym; $val; then
9873                 d_oldsock="$undef"
9874         else
9875                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9876                 d_oldsock="$define"
9877         fi
9878 else
9879         if $contains socklib libc.list >/dev/null 2>&1; then
9880                 echo "Looks like you have Berkeley networking support." >&4
9881                 d_socket="$define"
9882                 : we will have to assume that it supports the 4.2 BSD interface
9883                 d_oldsock="$undef"
9884         else
9885                 echo "You don't have Berkeley networking in libc$_a..." >&4
9886                 if test "X$d_socket" = "X$define"; then
9887                    echo "...but you seem to believe that you have sockets." >&4
9888                 else
9889                         for net in net socket
9890                         do
9891                                 if test -f /usr/lib/lib$net$_a; then
9892                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9893                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9894                                         if $contains socket libc.list >/dev/null 2>&1; then
9895                                                 d_socket="$define"
9896                                                 socketlib="-l$net"
9897                                                 case "$net" in
9898                                                 net)
9899                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9900                                                         sockethdr="-I/usr/netinclude"
9901                                                         ;;
9902                                                 esac
9903                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9904                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9905                                                         d_oldsock="$undef"
9906                                                 else
9907                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9908                                                         d_oldsock="$define"
9909                                                 fi
9910                                                 break
9911                                         fi
9912                                 fi
9913                         done
9914                         if test "X$d_socket" != "X$define"; then
9915                            echo "or anywhere else I see." >&4
9916                            d_socket="$undef"
9917                            d_oldsock="$undef"
9918                         fi
9919                 fi
9920         fi
9921 fi
9922
9923 : see if socketpair exists
9924 set socketpair d_sockpair
9925 eval $inlibc
9926
9927
9928 echo " "
9929 echo "Checking the availability of certain socket constants..." >&4
9930 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9931         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9932         $cat >try.c <<EOF
9933 #include <sys/types.h>
9934 #include <sys/socket.h>
9935 int main() {
9936     int i = $ENUM;
9937 }
9938 EOF
9939         val="$undef"
9940         set try; if eval $compile; then
9941                 val="$define"
9942         fi
9943         set d_${enum}; eval $setvar
9944         $rm -f try.c try
9945 done
9946
9947 : see if this is a sys/uio.h system
9948 set sys/uio.h i_sysuio
9949 eval $inhdr
9950
9951
9952 echo " "
9953 echo "Checking to see if your system supports struct cmsghdr..." >&4
9954 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9955 eval $hasstruct
9956 case "$d_cmsghdr_s" in
9957 "$define")      echo "Yes, it does."   ;;
9958 *)              echo "No, it doesn't." ;;
9959 esac
9960
9961
9962 : check for const keyword
9963 echo " "
9964 echo 'Checking to see if your C compiler knows about "const"...' >&4
9965 $cat >const.c <<'EOCP'
9966 typedef struct spug { int drokk; } spug;
9967 main()
9968 {
9969         const char *foo;
9970         const spug y;
9971 }
9972 EOCP
9973 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9974         val="$define"
9975         echo "Yup, it does."
9976 else
9977         val="$undef"
9978         echo "Nope, it doesn't."
9979 fi
9980 set d_const
9981 eval $setvar
9982
9983 : see if crypt exists
9984 echo " "
9985 set crypt d_crypt
9986 eval $inlibc
9987 case "$d_crypt" in
9988 $define) cryptlib='' ;;
9989 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9990                 echo 'crypt() found.' >&4
9991                 val="$define"
9992                 cryptlib=''
9993         else
9994                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9995                 if $test -z "$cryptlib"; then
9996                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9997                 else
9998                         cryptlib=-lcrypt
9999                 fi
10000                 if $test -z "$cryptlib"; then
10001                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10002                 else
10003                         cryptlib=-lcrypt
10004                 fi
10005                 if $test -z "$cryptlib"; then
10006                         cryptlib=`./loc libcrypt$_a "" $libpth`
10007                 else
10008                         cryptlib=-lcrypt
10009                 fi
10010                 if $test -z "$cryptlib"; then
10011                         echo 'crypt() NOT found.' >&4
10012                         val="$undef"
10013                 else
10014                         val="$define"
10015                 fi
10016         fi
10017         set d_crypt
10018         eval $setvar
10019         ;;
10020 esac
10021
10022 : see if this is a crypt.h system
10023 set crypt.h i_crypt
10024 eval $inhdr
10025
10026 : see if crypt_r exists
10027 set crypt_r d_crypt_r
10028 eval $inlibc
10029 case "$d_crypt_r" in
10030 "$define")
10031         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10032         case "$d_crypt_r_proto:$usethreads" in
10033         ":define")      d_crypt_r_proto=define
10034                 set d_crypt_r_proto crypt_r $hdrs
10035                 eval $hasproto ;;
10036         *)      ;;
10037         esac
10038         case "$d_crypt_r_proto" in
10039         define)
10040         case "$crypt_r_proto" in
10041         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10042         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10043         esac
10044         case "$crypt_r_proto" in
10045         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10046         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10047         esac
10048         case "$crypt_r_proto" in
10049         ''|0)   d_crypt_r=undef
10050                 crypt_r_proto=0
10051                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10052         * )     case "$crypt_r_proto" in
10053                 REENTRANT_PROTO*) ;;
10054                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10055                 esac
10056                 echo "Prototype: $try" ;;
10057         esac
10058         ;;
10059         *)      case "$usethreads" in
10060                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10061                 esac
10062                 d_crypt_r=undef
10063                 crypt_r_proto=0
10064                 ;;
10065         esac
10066         ;;
10067 *)      crypt_r_proto=0
10068         ;;
10069 esac
10070
10071 : get csh whereabouts
10072 case "$csh" in
10073 'csh') val="$undef" ;;
10074 *) val="$define" ;;
10075 esac
10076 set d_csh
10077 eval $setvar
10078 : Respect a hint or command line value for full_csh.
10079 case "$full_csh" in
10080 '') full_csh=$csh ;;
10081 esac
10082
10083 : see if ctermid_r exists
10084 set ctermid_r d_ctermid_r
10085 eval $inlibc
10086 case "$d_ctermid_r" in
10087 "$define")
10088         hdrs="$i_systypes sys/types.h define stdio.h "
10089         case "$d_ctermid_r_proto:$usethreads" in
10090         ":define")      d_ctermid_r_proto=define
10091                 set d_ctermid_r_proto ctermid_r $hdrs
10092                 eval $hasproto ;;
10093         *)      ;;
10094         esac
10095         case "$d_ctermid_r_proto" in
10096         define)
10097         case "$ctermid_r_proto" in
10098         ''|0) try='char* ctermid_r(char*);'
10099         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10100         esac
10101         case "$ctermid_r_proto" in
10102         ''|0)   d_ctermid_r=undef
10103                 ctermid_r_proto=0
10104                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10105         * )     case "$ctermid_r_proto" in
10106                 REENTRANT_PROTO*) ;;
10107                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10108                 esac
10109                 echo "Prototype: $try" ;;
10110         esac
10111         ;;
10112         *)      case "$usethreads" in
10113                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10114                 esac
10115                 d_ctermid_r=undef
10116                 ctermid_r_proto=0
10117                 ;;
10118         esac
10119         ;;
10120 *)      ctermid_r_proto=0
10121         ;;
10122 esac
10123
10124 : see if ctime_r exists
10125 set ctime_r d_ctime_r
10126 eval $inlibc
10127 case "$d_ctime_r" in
10128 "$define")
10129         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10130         case "$d_ctime_r_proto:$usethreads" in
10131         ":define")      d_ctime_r_proto=define
10132                 set d_ctime_r_proto ctime_r $hdrs
10133                 eval $hasproto ;;
10134         *)      ;;
10135         esac
10136         case "$d_ctime_r_proto" in
10137         define)
10138         case "$ctime_r_proto" in
10139         ''|0) try='char* ctime_r(const time_t*, char*);'
10140         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10141         esac
10142         case "$ctime_r_proto" in
10143         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10144         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10145         esac
10146         case "$ctime_r_proto" in
10147         ''|0) try='int ctime_r(const time_t*, char*);'
10148         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10149         esac
10150         case "$ctime_r_proto" in
10151         ''|0) try='int ctime_r(const time_t*, char*, int);'
10152         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10153         esac
10154         case "$ctime_r_proto" in
10155         ''|0)   d_ctime_r=undef
10156                 ctime_r_proto=0
10157                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10158         * )     case "$ctime_r_proto" in
10159                 REENTRANT_PROTO*) ;;
10160                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10161                 esac
10162                 echo "Prototype: $try" ;;
10163         esac
10164         ;;
10165         *)      case "$usethreads" in
10166                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10167                 esac
10168                 d_ctime_r=undef
10169                 ctime_r_proto=0
10170                 ;;
10171         esac
10172         ;;
10173 *)      ctime_r_proto=0
10174         ;;
10175 esac
10176
10177 : see if cuserid exists
10178 set cuserid d_cuserid
10179 eval $inlibc
10180
10181 : see if this is a limits.h system
10182 set limits.h i_limits
10183 eval $inhdr
10184
10185 : see if this is a float.h system
10186 set float.h i_float
10187 eval $inhdr
10188
10189 : See if number of significant digits in a double precision number is known
10190 echo " "
10191 $cat >dbl_dig.c <<EOM
10192 #$i_limits I_LIMITS
10193 #$i_float I_FLOAT
10194 #ifdef I_LIMITS
10195 #include <limits.h>
10196 #endif
10197 #ifdef I_FLOAT
10198 #include <float.h>
10199 #endif
10200 #ifdef DBL_DIG
10201 printf("Contains DBL_DIG");
10202 #endif
10203 EOM
10204 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10205 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10206         echo "DBL_DIG found." >&4
10207         val="$define"
10208 else
10209         echo "DBL_DIG NOT found." >&4
10210         val="$undef"
10211 fi
10212 $rm -f dbl_dig.?
10213 set d_dbl_dig
10214 eval $setvar
10215
10216 : see if dbm.h is available
10217 : see if dbmclose exists
10218 set dbmclose d_dbmclose
10219 eval $inlibc
10220
10221 case "$d_dbmclose" in
10222 $define)
10223         set dbm.h i_dbm
10224         eval $inhdr
10225         case "$i_dbm" in
10226         $define)
10227                 val="$undef"
10228                 set i_rpcsvcdbm
10229                 eval $setvar
10230                 ;;
10231         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10232                 eval $inhdr
10233                 ;;
10234         esac
10235         ;;
10236 *)      echo "We won't be including <dbm.h>"
10237         val="$undef"
10238         set i_dbm
10239         eval $setvar
10240         val="$undef"
10241         set i_rpcsvcdbm
10242         eval $setvar
10243         ;;
10244 esac
10245
10246 : see if prototype for dbminit is available
10247 echo " "
10248 set d_dbminitproto dbminit $i_dbm dbm.h
10249 eval $hasproto
10250
10251 : see if difftime exists
10252 set difftime d_difftime
10253 eval $inlibc
10254
10255 : see if this is a dirent system
10256 echo " "
10257 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10258         val="$define"
10259         echo "<dirent.h> found." >&4
10260 else
10261         val="$undef"
10262         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10263                 echo "<sys/dir.h> found." >&4
10264                 echo " "
10265         else
10266                 xinc=`./findhdr sys/ndir.h`
10267         fi
10268         echo "<dirent.h> NOT found." >&4
10269 fi
10270 set i_dirent
10271 eval $setvar
10272
10273 : Look for type of directory structure.
10274 echo " "
10275 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10276
10277 case "$direntrytype" in
10278 ''|' ')
10279         case "$i_dirent" in
10280         $define) guess1='struct dirent' ;;
10281         *) guess1='struct direct'  ;;
10282         esac
10283         ;;
10284 *)      guess1="$direntrytype"
10285         ;;
10286 esac
10287
10288 case "$guess1" in
10289 'struct dirent') guess2='struct direct' ;;
10290 *) guess2='struct dirent' ;;
10291 esac
10292                 
10293 if $contains "$guess1" try.c >/dev/null 2>&1; then
10294         direntrytype="$guess1"
10295         echo "Your directory entries are $direntrytype." >&4
10296 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10297         direntrytype="$guess2"
10298         echo "Your directory entries seem to be $direntrytype." >&4
10299 else
10300         echo "I don't recognize your system's directory entries." >&4
10301         rp="What type is used for directory entries on this system?"
10302         dflt="$guess1"
10303         . ./myread
10304         direntrytype="$ans"
10305 fi
10306 $rm -f try.c
10307
10308
10309 : see if the directory entry stores field length
10310 echo " "
10311 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10312 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10313         echo "Good, your directory entry keeps length information in d_namlen." >&4
10314         val="$define"
10315 else
10316         echo "Your directory entry does not know about the d_namlen field." >&4
10317         val="$undef"
10318 fi
10319 set d_dirnamlen
10320 eval $setvar
10321 $rm -f try.c
10322
10323 : see if this is an sysdir system
10324 set sys/dir.h i_sysdir
10325 eval $inhdr
10326
10327 : see if this is an sysndir system
10328 set sys/ndir.h i_sysndir
10329 eval $inhdr
10330
10331 : Look for dirfd
10332 echo " "
10333 $cat >dirfd.c <<EOM
10334 #include <stdio.h>
10335 #$i_dirent I_DIRENT             /**/
10336 #$i_sysdir I_SYS_DIR            /**/
10337 #$i_sysndir I_SYS_NDIR          /**/
10338 #$i_systypes I_SYS_TYPES        /**/
10339 #if defined(I_SYS_TYPES)
10340 #include <sys/types.h>
10341 #endif
10342 #if defined(I_DIRENT)
10343 #include <dirent.h>
10344 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10345 #include <sys/dir.h>
10346 #endif
10347 #else
10348 #ifdef I_SYS_NDIR
10349 #include <sys/ndir.h>
10350 #else
10351 #ifdef I_SYS_DIR
10352 #ifdef hp9000s500
10353 #include <ndir.h>       /* may be wrong in the future */
10354 #else
10355 #include <sys/dir.h>
10356 #endif
10357 #endif
10358 #endif
10359 #endif 
10360 int main() {
10361         DIR *dirp = opendir(".");
10362         if (dirfd(dirp) >= 0)
10363                 exit(0);
10364         else
10365                 exit(1);
10366 }
10367 EOM
10368 set dirfd
10369 if eval $compile; then
10370         val="$define"
10371 fi
10372 case "$val" in
10373 $define)        echo "dirfd() found." >&4       ;;
10374 *)              echo "dirfd() NOT found." >&4   ;;
10375 esac
10376 set d_dirfd
10377 eval $setvar
10378 $rm -f dirfd*
10379
10380 : see if dlerror exists
10381 xxx_runnm="$runnm"
10382 runnm=false
10383 set dlerror d_dlerror
10384 eval $inlibc
10385 runnm="$xxx_runnm"
10386
10387 : see if dlfcn is available
10388 set dlfcn.h i_dlfcn
10389 eval $inhdr
10390
10391 case "$usedl" in
10392 $define|y|true)
10393         $cat << EOM
10394
10395 On a few systems, the dynamically loaded modules that perl generates and uses
10396 will need a different extension than shared libs. The default will probably
10397 be appropriate.
10398
10399 EOM
10400         case "$dlext" in
10401         '')     dflt="$so" ;;
10402         *)      dflt="$dlext" ;;
10403         esac
10404         rp='What is the extension of dynamically loaded modules'
10405         . ./myread
10406         dlext="$ans"
10407         ;;
10408 *)
10409         dlext="none"
10410         ;;
10411 esac
10412
10413 : Check if dlsym need a leading underscore
10414 echo " "
10415 val="$undef"
10416
10417 case "$dlsrc" in
10418 dl_dlopen.xs)
10419         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10420         $cat >dyna.c <<'EOM'
10421 fred () { }
10422 EOM
10423
10424 $cat >fred.c<<EOM
10425
10426 #include <stdio.h>
10427 #$i_dlfcn I_DLFCN
10428 #ifdef I_DLFCN
10429 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10430 #else
10431 #include <sys/types.h>
10432 #include <nlist.h>
10433 #include <link.h>
10434 #endif
10435
10436 extern int fred() ;
10437
10438 int main()
10439 {
10440     void * handle ;
10441     void * symbol ;
10442 #ifndef RTLD_LAZY
10443     int mode = 1 ;
10444 #else
10445     int mode = RTLD_LAZY ;
10446 #endif
10447     handle = dlopen("./dyna.$dlext", mode) ;
10448     if (handle == NULL) {
10449         printf ("1\n") ;
10450         fflush (stdout) ;
10451         exit(0);
10452     }
10453     symbol = dlsym(handle, "fred") ;
10454     if (symbol == NULL) {
10455         /* try putting a leading underscore */
10456         symbol = dlsym(handle, "_fred") ;
10457         if (symbol == NULL) {
10458             printf ("2\n") ;
10459             fflush (stdout) ;
10460             exit(0);
10461         }
10462         printf ("3\n") ;
10463     }
10464     else
10465         printf ("4\n") ;
10466     fflush (stdout) ;
10467     exit(0);
10468 }
10469 EOM
10470         : Call the object file tmp-dyna.o in case dlext=o.
10471         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10472                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10473                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10474                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10475                 xxx=`$run ./fred`
10476                 case $xxx in
10477                 1)      echo "Test program failed using dlopen." >&4
10478                         echo "Perhaps you should not use dynamic loading." >&4;;
10479                 2)      echo "Test program failed using dlsym." >&4
10480                         echo "Perhaps you should not use dynamic loading." >&4;;
10481                 3)      echo "dlsym needs a leading underscore" >&4
10482                         val="$define" ;;
10483                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10484                 esac
10485         else
10486                 echo "I can't compile and run the test program." >&4
10487                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10488         fi
10489         ;;
10490 esac
10491                 
10492 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10493
10494 set d_dlsymun
10495 eval $setvar
10496
10497 : see if drand48_r exists
10498 set drand48_r d_drand48_r
10499 eval $inlibc
10500 case "$d_drand48_r" in
10501 "$define")
10502         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10503         case "$d_drand48_r_proto:$usethreads" in
10504         ":define")      d_drand48_r_proto=define
10505                 set d_drand48_r_proto drand48_r $hdrs
10506                 eval $hasproto ;;
10507         *)      ;;
10508         esac
10509         case "$d_drand48_r_proto" in
10510         define)
10511         case "$drand48_r_proto" in
10512         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10513         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10514         esac
10515         case "$drand48_r_proto" in
10516         ''|0)   d_drand48_r=undef
10517                 drand48_r_proto=0
10518                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10519         * )     case "$drand48_r_proto" in
10520                 REENTRANT_PROTO*) ;;
10521                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10522                 esac
10523                 echo "Prototype: $try" ;;
10524         esac
10525         ;;
10526         *)      case "$usethreads" in
10527                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10528                 esac
10529                 d_drand48_r=undef
10530                 drand48_r_proto=0
10531                 ;;
10532         esac
10533         ;;
10534 *)      drand48_r_proto=0
10535         ;;
10536 esac
10537
10538 : see if prototype for drand48 is available
10539 echo " "
10540 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10541 eval $hasproto
10542
10543 : see if dup2 exists
10544 set dup2 d_dup2
10545 eval $inlibc
10546
10547 : see if eaccess exists
10548 set eaccess d_eaccess
10549 eval $inlibc
10550
10551 : see if endgrent exists
10552 set endgrent d_endgrent
10553 eval $inlibc
10554
10555 : see if this is an grp system
10556 set grp.h i_grp
10557 eval $inhdr
10558
10559 case "$i_grp" in
10560 $define)
10561         xxx=`./findhdr grp.h`
10562         $cppstdin $cppflags $cppminus < $xxx >$$.h
10563
10564         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10565                 val="$define"
10566         else
10567                 val="$undef"
10568         fi
10569         set d_grpasswd
10570         eval $setvar
10571
10572         $rm -f $$.h
10573         ;;
10574 *)
10575         val="$undef";
10576         set d_grpasswd; eval $setvar
10577         ;;
10578 esac
10579
10580 : see if endgrent_r exists
10581 set endgrent_r d_endgrent_r
10582 eval $inlibc
10583 case "$d_endgrent_r" in
10584 "$define")
10585         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10586         case "$d_endgrent_r_proto:$usethreads" in
10587         ":define")      d_endgrent_r_proto=define
10588                 set d_endgrent_r_proto endgrent_r $hdrs
10589                 eval $hasproto ;;
10590         *)      ;;
10591         esac
10592         case "$d_endgrent_r_proto" in
10593         define)
10594         case "$endgrent_r_proto" in
10595         ''|0) try='int endgrent_r(FILE**);'
10596         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10597         esac
10598         case "$endgrent_r_proto" in
10599         ''|0) try='void endgrent_r(FILE**);'
10600         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10601         esac
10602         case "$endgrent_r_proto" in
10603         ''|0)   d_endgrent_r=undef
10604                 endgrent_r_proto=0
10605                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10606         * )     case "$endgrent_r_proto" in
10607                 REENTRANT_PROTO*) ;;
10608                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10609                 esac
10610                 echo "Prototype: $try" ;;
10611         esac
10612         ;;
10613         *)      case "$usethreads" in
10614                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10615                 esac
10616                 d_endgrent_r=undef
10617                 endgrent_r_proto=0
10618                 ;;
10619         esac
10620         ;;
10621 *)      endgrent_r_proto=0
10622         ;;
10623 esac
10624
10625 : see if endhostent exists
10626 set endhostent d_endhent
10627 eval $inlibc
10628
10629 : see if this is a netdb.h system
10630 set netdb.h i_netdb
10631 eval $inhdr
10632
10633 : see if endhostent_r exists
10634 set endhostent_r d_endhostent_r
10635 eval $inlibc
10636 case "$d_endhostent_r" in
10637 "$define")
10638         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10639         case "$d_endhostent_r_proto:$usethreads" in
10640         ":define")      d_endhostent_r_proto=define
10641                 set d_endhostent_r_proto endhostent_r $hdrs
10642                 eval $hasproto ;;
10643         *)      ;;
10644         esac
10645         case "$d_endhostent_r_proto" in
10646         define)
10647         case "$endhostent_r_proto" in
10648         ''|0) try='int endhostent_r(struct hostent_data*);'
10649         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10650         esac
10651         case "$endhostent_r_proto" in
10652         ''|0) try='void endhostent_r(struct hostent_data*);'
10653         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10654         esac
10655         case "$endhostent_r_proto" in
10656         ''|0)   d_endhostent_r=undef
10657                 endhostent_r_proto=0
10658                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10659         * )     case "$endhostent_r_proto" in
10660                 REENTRANT_PROTO*) ;;
10661                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10662                 esac
10663                 echo "Prototype: $try" ;;
10664         esac
10665         ;;
10666         *)      case "$usethreads" in
10667                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10668                 esac
10669                 d_endhostent_r=undef
10670                 endhostent_r_proto=0
10671                 ;;
10672         esac
10673         ;;
10674 *)      endhostent_r_proto=0
10675         ;;
10676 esac
10677
10678 : see if endnetent exists
10679 set endnetent d_endnent
10680 eval $inlibc
10681
10682 : see if endnetent_r exists
10683 set endnetent_r d_endnetent_r
10684 eval $inlibc
10685 case "$d_endnetent_r" in
10686 "$define")
10687         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10688         case "$d_endnetent_r_proto:$usethreads" in
10689         ":define")      d_endnetent_r_proto=define
10690                 set d_endnetent_r_proto endnetent_r $hdrs
10691                 eval $hasproto ;;
10692         *)      ;;
10693         esac
10694         case "$d_endnetent_r_proto" in
10695         define)
10696         case "$endnetent_r_proto" in
10697         ''|0) try='int endnetent_r(struct netent_data*);'
10698         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10699         esac
10700         case "$endnetent_r_proto" in
10701         ''|0) try='void endnetent_r(struct netent_data*);'
10702         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10703         esac
10704         case "$endnetent_r_proto" in
10705         ''|0)   d_endnetent_r=undef
10706                 endnetent_r_proto=0
10707                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10708         * )     case "$endnetent_r_proto" in
10709                 REENTRANT_PROTO*) ;;
10710                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10711                 esac
10712                 echo "Prototype: $try" ;;
10713         esac
10714         ;;
10715         *)      case "$usethreads" in
10716                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10717                 esac
10718                 d_endnetent_r=undef
10719                 endnetent_r_proto=0
10720                 ;;
10721         esac
10722         ;;
10723 *)      endnetent_r_proto=0
10724         ;;
10725 esac
10726
10727 : see if endprotoent exists
10728 set endprotoent d_endpent
10729 eval $inlibc
10730
10731 : see if endprotoent_r exists
10732 set endprotoent_r d_endprotoent_r
10733 eval $inlibc
10734 case "$d_endprotoent_r" in
10735 "$define")
10736         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10737         case "$d_endprotoent_r_proto:$usethreads" in
10738         ":define")      d_endprotoent_r_proto=define
10739                 set d_endprotoent_r_proto endprotoent_r $hdrs
10740                 eval $hasproto ;;
10741         *)      ;;
10742         esac
10743         case "$d_endprotoent_r_proto" in
10744         define)
10745         case "$endprotoent_r_proto" in
10746         ''|0) try='int endprotoent_r(struct protoent_data*);'
10747         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10748         esac
10749         case "$endprotoent_r_proto" in
10750         ''|0) try='void endprotoent_r(struct protoent_data*);'
10751         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10752         esac
10753         case "$endprotoent_r_proto" in
10754         ''|0)   d_endprotoent_r=undef
10755                 endprotoent_r_proto=0
10756                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10757         * )     case "$endprotoent_r_proto" in
10758                 REENTRANT_PROTO*) ;;
10759                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10760                 esac
10761                 echo "Prototype: $try" ;;
10762         esac
10763         ;;
10764         *)      case "$usethreads" in
10765                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10766                 esac
10767                 d_endprotoent_r=undef
10768                 endprotoent_r_proto=0
10769                 ;;
10770         esac
10771         ;;
10772 *)      endprotoent_r_proto=0
10773         ;;
10774 esac
10775
10776 : see if endpwent exists
10777 set endpwent d_endpwent
10778 eval $inlibc
10779
10780 : see if this is a pwd.h system
10781 set pwd.h i_pwd
10782 eval $inhdr
10783
10784 case "$i_pwd" in
10785 $define)
10786         xxx=`./findhdr pwd.h`
10787         $cppstdin $cppflags $cppminus < $xxx >$$.h
10788
10789         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10790                 val="$define"
10791         else
10792                 val="$undef"
10793         fi
10794         set d_pwquota
10795         eval $setvar
10796
10797         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10798                 val="$define"
10799         else
10800                 val="$undef"
10801         fi
10802         set d_pwage
10803         eval $setvar
10804
10805         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10806                 val="$define"
10807         else
10808                 val="$undef"
10809         fi
10810         set d_pwchange
10811         eval $setvar
10812
10813         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10814                 val="$define"
10815         else
10816                 val="$undef"
10817         fi
10818         set d_pwclass
10819         eval $setvar
10820
10821         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10822                 val="$define"
10823         else
10824                 val="$undef"
10825         fi
10826         set d_pwexpire
10827         eval $setvar
10828
10829         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10830                 val="$define"
10831         else
10832                 val="$undef"
10833         fi
10834         set d_pwcomment
10835         eval $setvar
10836
10837         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10838                 val="$define"
10839         else
10840                 val="$undef"
10841         fi
10842         set d_pwgecos
10843         eval $setvar
10844
10845         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10846                 val="$define"
10847         else
10848                 val="$undef"
10849         fi
10850         set d_pwpasswd
10851         eval $setvar
10852
10853         $rm -f $$.h
10854         ;;
10855 *)
10856         val="$undef"; 
10857         set d_pwquota; eval $setvar
10858         set d_pwage; eval $setvar
10859         set d_pwchange; eval $setvar
10860         set d_pwclass; eval $setvar
10861         set d_pwexpire; eval $setvar
10862         set d_pwcomment; eval $setvar
10863         set d_pwgecos; eval $setvar
10864         set d_pwpasswd; eval $setvar
10865         ;;
10866 esac
10867
10868 : see if endpwent_r exists
10869 set endpwent_r d_endpwent_r
10870 eval $inlibc
10871 case "$d_endpwent_r" in
10872 "$define")
10873         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10874         case "$d_endpwent_r_proto:$usethreads" in
10875         ":define")      d_endpwent_r_proto=define
10876                 set d_endpwent_r_proto endpwent_r $hdrs
10877                 eval $hasproto ;;
10878         *)      ;;
10879         esac
10880         case "$d_endpwent_r_proto" in
10881         define)
10882         case "$endpwent_r_proto" in
10883         ''|0) try='int endpwent_r(FILE**);'
10884         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10885         esac
10886         case "$endpwent_r_proto" in
10887         ''|0) try='void endpwent_r(FILE**);'
10888         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10889         esac
10890         case "$endpwent_r_proto" in
10891         ''|0)   d_endpwent_r=undef
10892                 endpwent_r_proto=0
10893                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10894         * )     case "$endpwent_r_proto" in
10895                 REENTRANT_PROTO*) ;;
10896                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10897                 esac
10898                 echo "Prototype: $try" ;;
10899         esac
10900         ;;
10901         *)      case "$usethreads" in
10902                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10903                 esac
10904                 d_endpwent_r=undef
10905                 endpwent_r_proto=0
10906                 ;;
10907         esac
10908         ;;
10909 *)      endpwent_r_proto=0
10910         ;;
10911 esac
10912
10913 : see if endservent exists
10914 set endservent d_endsent
10915 eval $inlibc
10916
10917 : see if endservent_r exists
10918 set endservent_r d_endservent_r
10919 eval $inlibc
10920 case "$d_endservent_r" in
10921 "$define")
10922         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10923         case "$d_endservent_r_proto:$usethreads" in
10924         ":define")      d_endservent_r_proto=define
10925                 set d_endservent_r_proto endservent_r $hdrs
10926                 eval $hasproto ;;
10927         *)      ;;
10928         esac
10929         case "$d_endservent_r_proto" in
10930         define)
10931         case "$endservent_r_proto" in
10932         ''|0) try='int endservent_r(struct servent_data*);'
10933         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10934         esac
10935         case "$endservent_r_proto" in
10936         ''|0) try='void endservent_r(struct servent_data*);'
10937         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10938         esac
10939         case "$endservent_r_proto" in
10940         ''|0)   d_endservent_r=undef
10941                 endservent_r_proto=0
10942                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10943         * )     case "$endservent_r_proto" in
10944                 REENTRANT_PROTO*) ;;
10945                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10946                 esac
10947                 echo "Prototype: $try" ;;
10948         esac
10949         ;;
10950         *)      case "$usethreads" in
10951                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10952                 esac
10953                 d_endservent_r=undef
10954                 endservent_r_proto=0
10955                 ;;
10956         esac
10957         ;;
10958 *)      endservent_r_proto=0
10959         ;;
10960 esac
10961
10962 : Locate the flags for 'open()'
10963 echo " "
10964 $cat >try.c <<'EOCP'
10965 #include <sys/types.h>
10966 #ifdef I_FCNTL
10967 #include <fcntl.h>
10968 #endif
10969 #ifdef I_SYS_FILE
10970 #include <sys/file.h>
10971 #endif
10972 int main() {
10973         if(O_RDONLY);
10974 #ifdef O_TRUNC
10975         exit(0);
10976 #else
10977         exit(1);
10978 #endif
10979 }
10980 EOCP
10981 : check sys/file.h first to get FREAD on Sun
10982 if $test `./findhdr sys/file.h` && \
10983                 set try -DI_SYS_FILE && eval $compile; then
10984         h_sysfile=true;
10985         echo "<sys/file.h> defines the O_* constants..." >&4
10986         if $run ./try; then
10987                 echo "and you have the 3 argument form of open()." >&4
10988                 val="$define"
10989         else
10990                 echo "but not the 3 argument form of open().  Oh, well." >&4
10991                 val="$undef"
10992         fi
10993 elif $test `./findhdr fcntl.h` && \
10994                 set try -DI_FCNTL && eval $compile; then
10995         h_fcntl=true;
10996         echo "<fcntl.h> defines the O_* constants..." >&4
10997         if $run ./try; then
10998                 echo "and you have the 3 argument form of open()." >&4
10999                 val="$define"
11000         else
11001                 echo "but not the 3 argument form of open().  Oh, well." >&4
11002                 val="$undef"
11003         fi
11004 else
11005         val="$undef"
11006         echo "I can't find the O_* constant definitions!  You got problems." >&4
11007 fi
11008 set d_open3
11009 eval $setvar
11010 $rm -f try try.*
11011
11012 : see which of string.h or strings.h is needed
11013 echo " "
11014 strings=`./findhdr string.h`
11015 if $test "$strings" && $test -r "$strings"; then
11016         echo "Using <string.h> instead of <strings.h>." >&4
11017         val="$define"
11018 else
11019         val="$undef"
11020         strings=`./findhdr strings.h`
11021         if $test "$strings" && $test -r "$strings"; then
11022                 echo "Using <strings.h> instead of <string.h>." >&4
11023         else
11024                 echo "No string header found -- You'll surely have problems." >&4
11025         fi
11026 fi
11027 set i_string
11028 eval $setvar
11029 case "$i_string" in
11030 "$undef") strings=`./findhdr strings.h`;;
11031 *)        strings=`./findhdr string.h`;;
11032 esac
11033
11034 : see if this is a sys/file.h system
11035 val=''
11036 set sys/file.h val
11037 eval $inhdr
11038
11039 : do we need to include sys/file.h ?
11040 case "$val" in
11041 "$define")
11042         echo " "
11043         if $h_sysfile; then
11044                 val="$define"
11045                 echo "We'll be including <sys/file.h>." >&4
11046         else
11047                 val="$undef"
11048                 echo "We won't be including <sys/file.h>." >&4
11049         fi
11050         ;;
11051 *)
11052         h_sysfile=false
11053         ;;
11054 esac
11055 set i_sysfile
11056 eval $setvar
11057
11058 : see if fcntl.h is there
11059 val=''
11060 set fcntl.h val
11061 eval $inhdr
11062
11063 : see if we can include fcntl.h
11064 case "$val" in
11065 "$define")
11066         echo " "
11067         if $h_fcntl; then
11068                 val="$define"
11069                 echo "We'll be including <fcntl.h>." >&4
11070         else
11071                 val="$undef"
11072                 if $h_sysfile; then
11073         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11074                 else
11075                         echo "We won't be including <fcntl.h>." >&4
11076                 fi
11077         fi
11078         ;;
11079 *)
11080         h_fcntl=false
11081         val="$undef"
11082         ;;
11083 esac
11084 set i_fcntl
11085 eval $setvar
11086
11087 : check for non-blocking I/O stuff
11088 case "$h_sysfile" in
11089 true) echo "#include <sys/file.h>" > head.c;;
11090 *)
11091        case "$h_fcntl" in
11092        true) echo "#include <fcntl.h>" > head.c;;
11093        *) echo "#include <sys/fcntl.h>" > head.c;;
11094        esac
11095        ;;
11096 esac
11097 echo " "
11098 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11099 case "$o_nonblock" in
11100 '')
11101         $cat head.c > try.c
11102         $cat >>try.c <<EOCP
11103 #include <stdio.h>
11104 #include <stdlib.h>
11105 #$i_fcntl I_FCNTL
11106 #ifdef I_FCNTL
11107 #include <fcntl.h>
11108 #endif
11109 int main() {
11110 #ifdef O_NONBLOCK
11111         printf("O_NONBLOCK\n");
11112         exit(0);
11113 #endif
11114 #ifdef O_NDELAY
11115         printf("O_NDELAY\n");
11116         exit(0);
11117 #endif
11118 #ifdef FNDELAY
11119         printf("FNDELAY\n");
11120         exit(0);
11121 #endif
11122         exit(0);
11123 }
11124 EOCP
11125         set try
11126         if eval $compile_ok; then
11127                 o_nonblock=`$run ./try`
11128                 case "$o_nonblock" in
11129                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11130                 *) echo "Seems like we can use $o_nonblock.";;
11131                 esac
11132         else
11133                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11134         fi
11135         ;;
11136 *) echo "Using $hint value $o_nonblock.";;
11137 esac
11138 $rm -f try try.* .out core
11139
11140 echo " "
11141 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11142 case "$eagain" in
11143 '')
11144         $cat head.c > try.c
11145         $cat >>try.c <<EOCP
11146 #include <errno.h>
11147 #include <sys/types.h>
11148 #include <signal.h>
11149 #include <stdio.h> 
11150 #include <stdlib.h> 
11151 #$i_fcntl I_FCNTL
11152 #ifdef I_FCNTL
11153 #include <fcntl.h>
11154 #endif
11155 #define MY_O_NONBLOCK $o_nonblock
11156 #ifndef errno  /* XXX need better Configure test */
11157 extern int errno;
11158 #endif
11159 #$i_unistd I_UNISTD
11160 #ifdef I_UNISTD
11161 #include <unistd.h>
11162 #endif
11163 #$i_string I_STRING
11164 #ifdef I_STRING
11165 #include <string.h>
11166 #else
11167 #include <strings.h>
11168 #endif
11169 $signal_t blech(x) int x; { exit(3); }
11170 EOCP
11171         $cat >> try.c <<'EOCP'
11172 int main()
11173 {
11174         int pd[2];
11175         int pu[2];
11176         char buf[1];
11177         char string[100];
11178
11179         pipe(pd);       /* Down: child -> parent */
11180         pipe(pu);       /* Up: parent -> child */
11181         if (0 != fork()) {
11182                 int ret;
11183                 close(pd[1]);   /* Parent reads from pd[0] */
11184                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11185 #ifdef F_SETFL
11186                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11187                         exit(1);
11188 #else
11189                 exit(4);
11190 #endif
11191                 signal(SIGALRM, blech);
11192                 alarm(5);
11193                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11194                         exit(2);
11195                 sprintf(string, "%d\n", ret);
11196                 write(2, string, strlen(string));
11197                 alarm(0);
11198 #ifdef EAGAIN
11199                 if (errno == EAGAIN) {
11200                         printf("EAGAIN\n");
11201                         goto ok;
11202                 }
11203 #endif
11204 #ifdef EWOULDBLOCK
11205                 if (errno == EWOULDBLOCK)
11206                         printf("EWOULDBLOCK\n");
11207 #endif
11208         ok:
11209                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11210                 sleep(2);                               /* Give it time to close our pipe */
11211                 alarm(5);
11212                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11213                 alarm(0);
11214                 sprintf(string, "%d\n", ret);
11215                 write(4, string, strlen(string));
11216                 exit(0);
11217         }
11218
11219         close(pd[0]);                   /* We write to pd[1] */
11220         close(pu[1]);                   /* We read from pu[0] */
11221         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11222         close(pd[1]);                   /* Pipe pd is now fully closed! */
11223         exit(0);                                /* Bye bye, thank you for playing! */
11224 }
11225 EOCP
11226         set try
11227         if eval $compile_ok; then
11228                 echo "$startsh" >mtry
11229                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11230                 chmod +x mtry
11231                 ./mtry >/dev/null 2>&1
11232                 case $? in
11233                 0) eagain=`$cat try.out`;;
11234                 1) echo "Could not perform non-blocking setting!";;
11235                 2) echo "I did a successful read() for something that was not there!";;
11236                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11237                 4) echo "Could not find F_SETFL!";;
11238                 *) echo "Something terribly wrong happened during testing.";;
11239                 esac
11240                 rd_nodata=`$cat try.ret`
11241                 echo "A read() system call with no data present returns $rd_nodata."
11242                 case "$rd_nodata" in
11243                 0|-1) ;;
11244                 *)
11245                         echo "(That's peculiar, fixing that to be -1.)"
11246                         rd_nodata=-1
11247                         ;;
11248                 esac
11249                 case "$eagain" in
11250                 '')
11251                         echo "Forcing errno EAGAIN on read() with no data available."
11252                         eagain=EAGAIN
11253                         ;;
11254                 *)
11255                         echo "Your read() sets errno to $eagain when no data is available."
11256                         ;;
11257                 esac
11258                 status=`$cat try.err`
11259                 case "$status" in
11260                 0) echo "And it correctly returns 0 to signal EOF.";;
11261                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11262                 *) echo "However, your read() returns '$status' on EOF??";;
11263                 esac
11264                 val="$define"
11265                 if test "$status" = "$rd_nodata"; then
11266                         echo "WARNING: you can't distinguish between EOF and no data!"
11267                         val="$undef"
11268                 fi
11269         else
11270                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11271                 eagain=EAGAIN
11272         fi
11273         set d_eofnblk
11274         eval $setvar
11275         ;;
11276 *)
11277         echo "Using $hint value $eagain."
11278         echo "Your read() returns $rd_nodata when no data is present."
11279         case "$d_eofnblk" in
11280         "$define") echo "And you can see EOF because read() returns 0.";;
11281         "$undef") echo "But you can't see EOF status from read() returned value.";;
11282         *)
11283                 echo "(Assuming you can't see EOF status from read anyway.)"
11284                 d_eofnblk=$undef
11285                 ;;
11286         esac
11287         ;;
11288 esac
11289 $rm -f try try.* .out core head.c mtry
11290
11291 : see if fchdir exists
11292 set fchdir d_fchdir
11293 eval $inlibc
11294
11295 : see if fchmod exists
11296 set fchmod d_fchmod
11297 eval $inlibc
11298
11299 : see if fchown exists
11300 set fchown d_fchown
11301 eval $inlibc
11302
11303 : see if this is an fcntl system
11304 set fcntl d_fcntl
11305 eval $inlibc
11306
11307 echo " "
11308 : See if fcntl-based locking works.
11309 $cat >try.c <<EOCP
11310 #include <stdlib.h>
11311 #include <unistd.h>
11312 #include <fcntl.h>
11313 #include <signal.h>
11314 $signal_t blech(x) int x; { exit(3); }
11315 int main() {
11316 #if defined(F_SETLK) && defined(F_SETLKW)
11317      struct flock flock;
11318      int retval, fd;
11319      fd = open("try.c", O_RDONLY);
11320      flock.l_type = F_RDLCK;
11321      flock.l_whence = SEEK_SET;
11322      flock.l_start = flock.l_len = 0;
11323      signal(SIGALRM, blech);
11324      alarm(10);
11325      retval = fcntl(fd, F_SETLK, &flock);
11326      close(fd);
11327      (retval < 0 ? exit(2) : exit(0));
11328 #else
11329      exit(2);
11330 #endif
11331 }
11332 EOCP
11333 echo "Checking if fcntl-based file locking works... "
11334 case "$d_fcntl" in
11335 "$define")
11336         set try
11337         if eval $compile_ok; then
11338                 if $run ./try; then
11339                         echo "Yes, it seems to work."
11340                         val="$define"
11341                 else
11342                         echo "Nope, it didn't work."
11343                         val="$undef"
11344                         case "$?" in
11345                         3) $cat >&4 <<EOM
11346 ***
11347 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11348 *** This is (almost) impossible.
11349 *** If your NFS lock daemons are not feeling well, something like
11350 *** this may happen, please investigate.  Cannot continue, aborting.
11351 ***
11352 EOM
11353                                 exit 1
11354                                 ;;
11355                         esac
11356                 fi
11357         else
11358                 echo "I'm unable to compile the test program, so I'll assume not."
11359                 val="$undef"
11360         fi
11361         ;;
11362 *) val="$undef";
11363         echo "Nope, since you don't even have fcntl()."
11364         ;;
11365 esac
11366 set d_fcntl_can_lock
11367 eval $setvar
11368 $rm -f try*
11369
11370
11371 : check for fd_set items
11372 $cat <<EOM
11373
11374 Checking to see how well your C compiler handles fd_set and friends ...
11375 EOM
11376 $cat >try.c <<EOCP
11377 #$i_systime I_SYS_TIME
11378 #$i_sysselct I_SYS_SELECT
11379 #$d_socket HAS_SOCKET
11380 #include <sys/types.h>
11381 #ifdef HAS_SOCKET
11382 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11383 #endif
11384 #ifdef I_SYS_TIME
11385 #include <sys/time.h>
11386 #endif
11387 #ifdef I_SYS_SELECT
11388 #include <sys/select.h>
11389 #endif
11390 int main() {
11391         fd_set fds;
11392
11393 #ifdef TRYBITS
11394         if(fds.fds_bits);
11395 #endif
11396
11397 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11398         exit(0);
11399 #else
11400         exit(1);
11401 #endif
11402 }
11403 EOCP
11404 set try -DTRYBITS
11405 if eval $compile; then
11406         d_fds_bits="$define"
11407         d_fd_set="$define"
11408         echo "Well, your system knows about the normal fd_set typedef..." >&4
11409         if $run ./try; then
11410                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11411                 d_fd_macros="$define"
11412         else
11413                 $cat >&4 <<'EOM'
11414 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11415 EOM
11416                 d_fd_macros="$undef"
11417         fi
11418 else
11419         $cat <<'EOM'
11420 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11421 EOM
11422         set try
11423         if eval $compile; then
11424                 d_fds_bits="$undef"
11425                 d_fd_set="$define"
11426                 echo "Well, your system has some sort of fd_set available..." >&4
11427                 if $run ./try; then
11428                         echo "and you have the normal fd_set macros." >&4
11429                         d_fd_macros="$define"
11430                 else
11431                         $cat <<'EOM'
11432 but not the normal fd_set macros!  Gross!  More work for me...
11433 EOM
11434                         d_fd_macros="$undef"
11435                 fi
11436         else
11437         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11438                 d_fd_set="$undef"
11439                 d_fds_bits="$undef"
11440                 d_fd_macros="$undef"
11441         fi
11442 fi
11443 $rm -f try try.*
11444
11445 : see if fgetpos exists
11446 set fgetpos d_fgetpos
11447 eval $inlibc
11448
11449 : see if finite exists
11450 set finite d_finite
11451 eval $inlibc
11452
11453 : see if finitel exists
11454 set finitel d_finitel
11455 eval $inlibc
11456
11457 : see if flock exists
11458 set flock d_flock
11459 eval $inlibc
11460
11461 : see if prototype for flock is available
11462 echo " "
11463 set d_flockproto flock $i_sysfile sys/file.h
11464 eval $hasproto
11465
11466 : see if fork exists
11467 set fork d_fork
11468 eval $inlibc
11469
11470 : see if fp_class exists
11471 set fp_class d_fp_class
11472 eval $inlibc
11473
11474 : see if pathconf exists
11475 set pathconf d_pathconf
11476 eval $inlibc
11477
11478 : see if fpathconf exists
11479 set fpathconf d_fpathconf
11480 eval $inlibc
11481
11482 : see if fpclass exists
11483 set fpclass d_fpclass
11484 eval $inlibc
11485
11486 : see if fpclassify exists
11487 set fpclassify d_fpclassify
11488 eval $inlibc
11489
11490 : see if fpclassl exists
11491 set fpclassl d_fpclassl
11492 eval $inlibc
11493
11494
11495 : check for fpos64_t
11496 echo " "
11497 echo "Checking to see if you have fpos64_t..." >&4
11498 $cat >try.c <<EOCP
11499 #include <stdio.h>
11500 int main() { fpos64_t x = 7; }
11501 EOCP
11502 set try
11503 if eval $compile; then
11504         val="$define"
11505         echo "You have fpos64_t."
11506 else
11507         val="$undef"
11508         echo "You do not have fpos64_t."
11509         case "$fpossize" in
11510         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11511         esac
11512 fi
11513 $rm -f try.* try
11514 set d_fpos64_t
11515 eval $setvar
11516
11517 : see if frexpl exists
11518 set frexpl d_frexpl
11519 eval $inlibc
11520
11521 : see if this is a sys/param system
11522 set sys/param.h i_sysparam
11523 eval $inhdr
11524
11525 : see if this is a sys/mount.h system
11526 set sys/mount.h i_sysmount
11527 eval $inhdr
11528
11529
11530 echo " "
11531 echo "Checking to see if your system supports struct fs_data..." >&4
11532 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11533 eval $hasstruct
11534 case "$d_fs_data_s" in
11535 "$define")      echo "Yes, it does."   ;;
11536 *)              echo "No, it doesn't." ;;
11537 esac
11538
11539 : see if fseeko exists
11540 set fseeko d_fseeko
11541 eval $inlibc
11542 case "$longsize" in
11543 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11544 esac
11545
11546 : see if fsetpos exists
11547 set fsetpos d_fsetpos
11548 eval $inlibc
11549
11550
11551 : see if fstatfs exists
11552 set fstatfs d_fstatfs
11553 eval $inlibc
11554
11555
11556 : see if statvfs exists
11557 set statvfs d_statvfs
11558 eval $inlibc
11559
11560 : see if fstatvfs exists
11561 set fstatvfs d_fstatvfs
11562 eval $inlibc
11563
11564
11565 : see if fsync exists
11566 set fsync d_fsync
11567 eval $inlibc
11568
11569 : see if ftello exists
11570 set ftello d_ftello
11571 eval $inlibc
11572 case "$longsize" in
11573 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11574 esac
11575
11576 : see if getcwd exists
11577 set getcwd d_getcwd
11578 eval $inlibc
11579
11580 : see if getespwnam exists
11581 set getespwnam d_getespwnam
11582 eval $inlibc
11583
11584
11585 : see if getfsstat exists
11586 set getfsstat d_getfsstat
11587 eval $inlibc
11588
11589 : see if getgrent exists
11590 set getgrent d_getgrent
11591 eval $inlibc
11592
11593 : see if getgrent_r exists
11594 set getgrent_r d_getgrent_r
11595 eval $inlibc
11596 case "$d_getgrent_r" in
11597 "$define")
11598         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11599         case "$d_getgrent_r_proto:$usethreads" in
11600         ":define")      d_getgrent_r_proto=define
11601                 set d_getgrent_r_proto getgrent_r $hdrs
11602                 eval $hasproto ;;
11603         *)      ;;
11604         esac
11605         case "$d_getgrent_r_proto" in
11606         define)
11607         case "$getgrent_r_proto" in
11608         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11609         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11610         esac
11611         case "$getgrent_r_proto" in
11612         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11613         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11614         esac
11615         case "$getgrent_r_proto" in
11616         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11617         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11618         esac
11619         case "$getgrent_r_proto" in
11620         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11621         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11622         esac
11623         case "$getgrent_r_proto" in
11624         ''|0) try='int getgrent_r(struct group*, char*, int);'
11625         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11626         esac
11627         case "$getgrent_r_proto" in
11628         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11629         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11630         esac
11631         case "$getgrent_r_proto" in
11632         ''|0)   d_getgrent_r=undef
11633                 getgrent_r_proto=0
11634                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11635         * )     case "$getgrent_r_proto" in
11636                 REENTRANT_PROTO*) ;;
11637                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11638                 esac
11639                 echo "Prototype: $try" ;;
11640         esac
11641         ;;
11642         *)      case "$usethreads" in
11643                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11644                 esac
11645                 d_getgrent_r=undef
11646                 getgrent_r_proto=0
11647                 ;;
11648         esac
11649         ;;
11650 *)      getgrent_r_proto=0
11651         ;;
11652 esac
11653
11654 : see if getgrgid_r exists
11655 set getgrgid_r d_getgrgid_r
11656 eval $inlibc
11657 case "$d_getgrgid_r" in
11658 "$define")
11659         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11660         case "$d_getgrgid_r_proto:$usethreads" in
11661         ":define")      d_getgrgid_r_proto=define
11662                 set d_getgrgid_r_proto getgrgid_r $hdrs
11663                 eval $hasproto ;;
11664         *)      ;;
11665         esac
11666         case "$d_getgrgid_r_proto" in
11667         define)
11668         case "$getgrgid_r_proto" in
11669         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11670         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11671         esac
11672         case "$getgrgid_r_proto" in
11673         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11674         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11675         esac
11676         case "$getgrgid_r_proto" in
11677         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11678         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11679         esac
11680         case "$getgrgid_r_proto" in
11681         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11682         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11683         esac
11684         case "$getgrgid_r_proto" in
11685         ''|0)   d_getgrgid_r=undef
11686                 getgrgid_r_proto=0
11687                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11688         * )     case "$getgrgid_r_proto" in
11689                 REENTRANT_PROTO*) ;;
11690                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11691                 esac
11692                 echo "Prototype: $try" ;;
11693         esac
11694         ;;
11695         *)      case "$usethreads" in
11696                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11697                 esac
11698                 d_getgrgid_r=undef
11699                 getgrgid_r_proto=0
11700                 ;;
11701         esac
11702         ;;
11703 *)      getgrgid_r_proto=0
11704         ;;
11705 esac
11706
11707 : see if getgrnam_r exists
11708 set getgrnam_r d_getgrnam_r
11709 eval $inlibc
11710 case "$d_getgrnam_r" in
11711 "$define")
11712         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11713         case "$d_getgrnam_r_proto:$usethreads" in
11714         ":define")      d_getgrnam_r_proto=define
11715                 set d_getgrnam_r_proto getgrnam_r $hdrs
11716                 eval $hasproto ;;
11717         *)      ;;
11718         esac
11719         case "$d_getgrnam_r_proto" in
11720         define)
11721         case "$getgrnam_r_proto" in
11722         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11723         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11724         esac
11725         case "$getgrnam_r_proto" in
11726         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11727         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11728         esac
11729         case "$getgrnam_r_proto" in
11730         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11731         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11732         esac
11733         case "$getgrnam_r_proto" in
11734         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11735         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11736         esac
11737         case "$getgrnam_r_proto" in
11738         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11739         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11740         esac
11741         case "$getgrnam_r_proto" in
11742         ''|0)   d_getgrnam_r=undef
11743                 getgrnam_r_proto=0
11744                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11745         * )     case "$getgrnam_r_proto" in
11746                 REENTRANT_PROTO*) ;;
11747                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11748                 esac
11749                 echo "Prototype: $try" ;;
11750         esac
11751         ;;
11752         *)      case "$usethreads" in
11753                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11754                 esac
11755                 d_getgrnam_r=undef
11756                 getgrnam_r_proto=0
11757                 ;;
11758         esac
11759         ;;
11760 *)      getgrnam_r_proto=0
11761         ;;
11762 esac
11763
11764 : see if gethostbyaddr exists
11765 set gethostbyaddr d_gethbyaddr
11766 eval $inlibc
11767
11768 : see if gethostbyname exists
11769 set gethostbyname d_gethbyname
11770 eval $inlibc
11771
11772 : see if gethostent exists
11773 set gethostent d_gethent
11774 eval $inlibc
11775
11776 : see how we will look up host name
11777 echo " "
11778 call=''
11779 if set gethostname val -f d_gethname; eval $csym; $val; then
11780         echo 'gethostname() found.' >&4
11781         d_gethname="$define"
11782         call=gethostname
11783 fi
11784 if set uname val -f d_uname; eval $csym; $val; then
11785         if ./xenix; then
11786                 $cat <<'EOM'
11787 uname() was found, but you're running xenix, and older versions of xenix
11788 have a broken uname(). If you don't really know whether your xenix is old
11789 enough to have a broken system call, use the default answer.
11790
11791 EOM
11792                 dflt=y
11793                 case "$d_uname" in
11794                 "$define") dflt=n;;
11795                 esac
11796                 rp='Is your uname() broken?'
11797                 . ./myread
11798                 case "$ans" in
11799                 n*) d_uname="$define"; call=uname;;
11800                 esac
11801         else
11802                 echo 'uname() found.' >&4
11803                 d_uname="$define"
11804                 case "$call" in
11805                 '') call=uname ;;
11806                 esac
11807         fi
11808 fi
11809 case "$d_gethname" in
11810 '') d_gethname="$undef";;
11811 esac
11812 case "$d_uname" in
11813 '') d_uname="$undef";;
11814 esac
11815 case "$d_uname$d_gethname" in
11816 *define*)
11817         dflt=n
11818         cat <<EOM
11819  
11820 Every now and then someone has a $call() that lies about the hostname
11821 but can't be fixed for political or economic reasons.  If you wish, I can
11822 pretend $call() isn't there and maybe compute hostname at run-time
11823 thanks to the '$phostname' command.
11824
11825 EOM
11826         rp="Shall I ignore $call() from now on?"
11827         . ./myread
11828         case "$ans" in
11829         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11830         esac;;
11831 esac
11832 case "$phostname" in
11833 '') aphostname='';;
11834 *) case "$aphostname" in
11835         /*) ;;
11836         *) set X $phostname
11837                 shift
11838                 file=$1
11839                 shift
11840                 file=`./loc $file $file $pth`
11841                 aphostname=`echo $file $*`
11842                 ;;
11843         esac
11844         ;;
11845 esac
11846 case "$d_uname$d_gethname" in
11847 *define*) ;;
11848 *)
11849         case "$phostname" in
11850         '')
11851                 echo "There will be no way for $package to get your hostname." >&4;;
11852         *)
11853         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11854                 ;;
11855         esac;;
11856 esac
11857 case "$d_phostname" in
11858 '') d_phostname="$undef";;
11859 esac
11860
11861 : see if gethostbyaddr_r exists
11862 set gethostbyaddr_r d_gethostbyaddr_r
11863 eval $inlibc
11864 case "$d_gethostbyaddr_r" in
11865 "$define")
11866         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11867         case "$d_gethostbyaddr_r_proto:$usethreads" in
11868         ":define")      d_gethostbyaddr_r_proto=define
11869                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11870                 eval $hasproto ;;
11871         *)      ;;
11872         esac
11873         case "$d_gethostbyaddr_r_proto" in
11874         define)
11875         case "$gethostbyaddr_r_proto" in
11876         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11877         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11878         esac
11879         case "$gethostbyaddr_r_proto" in
11880         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11881         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11882         esac
11883         case "$gethostbyaddr_r_proto" in
11884         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11885         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11886         esac
11887         case "$gethostbyaddr_r_proto" in
11888         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11889         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11890         esac
11891         case "$gethostbyaddr_r_proto" in
11892         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11893         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11894         esac
11895         case "$gethostbyaddr_r_proto" in
11896         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11897         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11898         esac
11899         case "$gethostbyaddr_r_proto" in
11900         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11901         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11902         esac
11903         case "$gethostbyaddr_r_proto" in
11904         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11905         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11906         esac
11907         case "$gethostbyaddr_r_proto" in
11908         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11909         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11910         esac
11911         case "$gethostbyaddr_r_proto" in
11912         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11913         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11914         esac
11915         case "$gethostbyaddr_r_proto" in
11916         ''|0)   d_gethostbyaddr_r=undef
11917                 gethostbyaddr_r_proto=0
11918                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11919         * )     case "$gethostbyaddr_r_proto" in
11920                 REENTRANT_PROTO*) ;;
11921                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11922                 esac
11923                 echo "Prototype: $try" ;;
11924         esac
11925         ;;
11926         *)      case "$usethreads" in
11927                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11928                 esac
11929                 d_gethostbyaddr_r=undef
11930                 gethostbyaddr_r_proto=0
11931                 ;;
11932         esac
11933         ;;
11934 *)      gethostbyaddr_r_proto=0
11935         ;;
11936 esac
11937
11938 : see if gethostbyname_r exists
11939 set gethostbyname_r d_gethostbyname_r
11940 eval $inlibc
11941 case "$d_gethostbyname_r" in
11942 "$define")
11943         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11944         case "$d_gethostbyname_r_proto:$usethreads" in
11945         ":define")      d_gethostbyname_r_proto=define
11946                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11947                 eval $hasproto ;;
11948         *)      ;;
11949         esac
11950         case "$d_gethostbyname_r_proto" in
11951         define)
11952         case "$gethostbyname_r_proto" in
11953         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11954         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11955         esac
11956         case "$gethostbyname_r_proto" in
11957         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11958         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11959         esac
11960         case "$gethostbyname_r_proto" in
11961         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11962         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11963         esac
11964         case "$gethostbyname_r_proto" in
11965         ''|0)   d_gethostbyname_r=undef
11966                 gethostbyname_r_proto=0
11967                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11968         * )     case "$gethostbyname_r_proto" in
11969                 REENTRANT_PROTO*) ;;
11970                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11971                 esac
11972                 echo "Prototype: $try" ;;
11973         esac
11974         ;;
11975         *)      case "$usethreads" in
11976                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11977                 esac
11978                 d_gethostbyname_r=undef
11979                 gethostbyname_r_proto=0
11980                 ;;
11981         esac
11982         ;;
11983 *)      gethostbyname_r_proto=0
11984         ;;
11985 esac
11986
11987 : see if gethostent_r exists
11988 set gethostent_r d_gethostent_r
11989 eval $inlibc
11990 case "$d_gethostent_r" in
11991 "$define")
11992         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11993         case "$d_gethostent_r_proto:$usethreads" in
11994         ":define")      d_gethostent_r_proto=define
11995                 set d_gethostent_r_proto gethostent_r $hdrs
11996                 eval $hasproto ;;
11997         *)      ;;
11998         esac
11999         case "$d_gethostent_r_proto" in
12000         define)
12001         case "$gethostent_r_proto" in
12002         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12003         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12004         esac
12005         case "$gethostent_r_proto" in
12006         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12007         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12008         esac
12009         case "$gethostent_r_proto" in
12010         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12011         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12012         esac
12013         case "$gethostent_r_proto" in
12014         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12015         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12016         esac
12017         case "$gethostent_r_proto" in
12018         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12019         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12020         esac
12021         case "$gethostent_r_proto" in
12022         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12023         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12024         esac
12025         case "$gethostent_r_proto" in
12026         ''|0)   d_gethostent_r=undef
12027                 gethostent_r_proto=0
12028                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12029         * )     case "$gethostent_r_proto" in
12030                 REENTRANT_PROTO*) ;;
12031                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12032                 esac
12033                 echo "Prototype: $try" ;;
12034         esac
12035         ;;
12036         *)      case "$usethreads" in
12037                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12038                 esac
12039                 d_gethostent_r=undef
12040                 gethostent_r_proto=0
12041                 ;;
12042         esac
12043         ;;
12044 *)      gethostent_r_proto=0
12045         ;;
12046 esac
12047
12048 : see if prototypes for various gethostxxx netdb.h functions are available
12049 echo " "
12050 set d_gethostprotos gethostent $i_netdb netdb.h
12051 eval $hasproto
12052
12053 : see if getitimer exists
12054 set getitimer d_getitimer
12055 eval $inlibc
12056
12057 : see if getlogin exists
12058 set getlogin d_getlogin
12059 eval $inlibc
12060
12061 : see if getlogin_r exists
12062 set getlogin_r d_getlogin_r
12063 eval $inlibc
12064 case "$d_getlogin_r" in
12065 "$define")
12066         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12067         case "$d_getlogin_r_proto:$usethreads" in
12068         ":define")      d_getlogin_r_proto=define
12069                 set d_getlogin_r_proto getlogin_r $hdrs
12070                 eval $hasproto ;;
12071         *)      ;;
12072         esac
12073         case "$d_getlogin_r_proto" in
12074         define)
12075         case "$getlogin_r_proto" in
12076         ''|0) try='int getlogin_r(char*, size_t);'
12077         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12078         esac
12079         case "$getlogin_r_proto" in
12080         ''|0) try='int getlogin_r(char*, int);'
12081         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12082         esac
12083         case "$getlogin_r_proto" in
12084         ''|0) try='char* getlogin_r(char*, size_t);'
12085         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12086         esac
12087         case "$getlogin_r_proto" in
12088         ''|0) try='char* getlogin_r(char*, int);'
12089         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12090         esac
12091         case "$getlogin_r_proto" in
12092         ''|0)   d_getlogin_r=undef
12093                 getlogin_r_proto=0
12094                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12095         * )     case "$getlogin_r_proto" in
12096                 REENTRANT_PROTO*) ;;
12097                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12098                 esac
12099                 echo "Prototype: $try" ;;
12100         esac
12101         ;;
12102         *)      case "$usethreads" in
12103                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12104                 esac
12105                 d_getlogin_r=undef
12106                 getlogin_r_proto=0
12107                 ;;
12108         esac
12109         ;;
12110 *)      getlogin_r_proto=0
12111         ;;
12112 esac
12113
12114 : see if getmnt exists
12115 set getmnt d_getmnt
12116 eval $inlibc
12117
12118 : see if getmntent exists
12119 set getmntent d_getmntent
12120 eval $inlibc
12121
12122 : see if getnetbyaddr exists
12123 set getnetbyaddr d_getnbyaddr
12124 eval $inlibc
12125
12126 : see if getnetbyname exists
12127 set getnetbyname d_getnbyname
12128 eval $inlibc
12129
12130 : see if getnetent exists
12131 set getnetent d_getnent
12132 eval $inlibc
12133
12134 : see if getnetbyaddr_r exists
12135 set getnetbyaddr_r d_getnetbyaddr_r
12136 eval $inlibc
12137 case "$d_getnetbyaddr_r" in
12138 "$define")
12139         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12140         case "$d_getnetbyaddr_r_proto:$usethreads" in
12141         ":define")      d_getnetbyaddr_r_proto=define
12142                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12143                 eval $hasproto ;;
12144         *)      ;;
12145         esac
12146         case "$d_getnetbyaddr_r_proto" in
12147         define)
12148         case "$getnetbyaddr_r_proto" in
12149         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12150         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12151         esac
12152         case "$getnetbyaddr_r_proto" in
12153         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12154         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12155         esac
12156         case "$getnetbyaddr_r_proto" in
12157         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12158         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12159         esac
12160         case "$getnetbyaddr_r_proto" in
12161         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12162         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12163         esac
12164         case "$getnetbyaddr_r_proto" in
12165         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12166         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12167         esac
12168         case "$getnetbyaddr_r_proto" in
12169         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12170         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12171         esac
12172         case "$getnetbyaddr_r_proto" in
12173         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12174         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12175         esac
12176         case "$getnetbyaddr_r_proto" in
12177         ''|0)   d_getnetbyaddr_r=undef
12178                 getnetbyaddr_r_proto=0
12179                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12180         * )     case "$getnetbyaddr_r_proto" in
12181                 REENTRANT_PROTO*) ;;
12182                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12183                 esac
12184                 echo "Prototype: $try" ;;
12185         esac
12186         ;;
12187         *)      case "$usethreads" in
12188                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12189                 esac
12190                 d_getnetbyaddr_r=undef
12191                 getnetbyaddr_r_proto=0
12192                 ;;
12193         esac
12194         ;;
12195 *)      getnetbyaddr_r_proto=0
12196         ;;
12197 esac
12198
12199 : see if getnetbyname_r exists
12200 set getnetbyname_r d_getnetbyname_r
12201 eval $inlibc
12202 case "$d_getnetbyname_r" in
12203 "$define")
12204         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12205         case "$d_getnetbyname_r_proto:$usethreads" in
12206         ":define")      d_getnetbyname_r_proto=define
12207                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12208                 eval $hasproto ;;
12209         *)      ;;
12210         esac
12211         case "$d_getnetbyname_r_proto" in
12212         define)
12213         case "$getnetbyname_r_proto" in
12214         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12215         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12216         esac
12217         case "$getnetbyname_r_proto" in
12218         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12219         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12220         esac
12221         case "$getnetbyname_r_proto" in
12222         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12223         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12224         esac
12225         case "$getnetbyname_r_proto" in
12226         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12227         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12228         esac
12229         case "$getnetbyname_r_proto" in
12230         ''|0)   d_getnetbyname_r=undef
12231                 getnetbyname_r_proto=0
12232                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12233         * )     case "$getnetbyname_r_proto" in
12234                 REENTRANT_PROTO*) ;;
12235                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12236                 esac
12237                 echo "Prototype: $try" ;;
12238         esac
12239         ;;
12240         *)      case "$usethreads" in
12241                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12242                 esac
12243                 d_getnetbyname_r=undef
12244                 getnetbyname_r_proto=0
12245                 ;;
12246         esac
12247         ;;
12248 *)      getnetbyname_r_proto=0
12249         ;;
12250 esac
12251
12252 : see if getnetent_r exists
12253 set getnetent_r d_getnetent_r
12254 eval $inlibc
12255 case "$d_getnetent_r" in
12256 "$define")
12257         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12258         case "$d_getnetent_r_proto:$usethreads" in
12259         ":define")      d_getnetent_r_proto=define
12260                 set d_getnetent_r_proto getnetent_r $hdrs
12261                 eval $hasproto ;;
12262         *)      ;;
12263         esac
12264         case "$d_getnetent_r_proto" in
12265         define)
12266         case "$getnetent_r_proto" in
12267         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12268         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12269         esac
12270         case "$getnetent_r_proto" in
12271         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12272         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12273         esac
12274         case "$getnetent_r_proto" in
12275         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12276         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12277         esac
12278         case "$getnetent_r_proto" in
12279         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12280         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12281         esac
12282         case "$getnetent_r_proto" in
12283         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12284         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12285         esac
12286         case "$getnetent_r_proto" in
12287         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12288         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12289         esac
12290         case "$getnetent_r_proto" in
12291         ''|0)   d_getnetent_r=undef
12292                 getnetent_r_proto=0
12293                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12294         * )     case "$getnetent_r_proto" in
12295                 REENTRANT_PROTO*) ;;
12296                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12297                 esac
12298                 echo "Prototype: $try" ;;
12299         esac
12300         ;;
12301         *)      case "$usethreads" in
12302                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12303                 esac
12304                 d_getnetent_r=undef
12305                 getnetent_r_proto=0
12306                 ;;
12307         esac
12308         ;;
12309 *)      getnetent_r_proto=0
12310         ;;
12311 esac
12312
12313 : see if prototypes for various getnetxxx netdb.h functions are available
12314 echo " "
12315 set d_getnetprotos getnetent $i_netdb netdb.h
12316 eval $hasproto
12317
12318 : see if getpagesize exists
12319 set getpagesize d_getpagsz
12320 eval $inlibc
12321
12322
12323 : see if getprotobyname exists
12324 set getprotobyname d_getpbyname
12325 eval $inlibc
12326
12327 : see if getprotobynumber exists
12328 set getprotobynumber d_getpbynumber
12329 eval $inlibc
12330
12331 : see if getprotoent exists
12332 set getprotoent d_getpent
12333 eval $inlibc
12334
12335 : see if getpgid exists
12336 set getpgid d_getpgid
12337 eval $inlibc
12338
12339 : see if getpgrp2 exists
12340 set getpgrp2 d_getpgrp2
12341 eval $inlibc
12342
12343 : see if getppid exists
12344 set getppid d_getppid
12345 eval $inlibc
12346
12347 : see if getpriority exists
12348 set getpriority d_getprior
12349 eval $inlibc
12350
12351 : see if getprotobyname_r exists
12352 set getprotobyname_r d_getprotobyname_r
12353 eval $inlibc
12354 case "$d_getprotobyname_r" in
12355 "$define")
12356         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12357         case "$d_getprotobyname_r_proto:$usethreads" in
12358         ":define")      d_getprotobyname_r_proto=define
12359                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12360                 eval $hasproto ;;
12361         *)      ;;
12362         esac
12363         case "$d_getprotobyname_r_proto" in
12364         define)
12365         case "$getprotobyname_r_proto" in
12366         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12367         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12368         esac
12369         case "$getprotobyname_r_proto" in
12370         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12371         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12372         esac
12373         case "$getprotobyname_r_proto" in
12374         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12375         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12376         esac
12377         case "$getprotobyname_r_proto" in
12378         ''|0)   d_getprotobyname_r=undef
12379                 getprotobyname_r_proto=0
12380                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12381         * )     case "$getprotobyname_r_proto" in
12382                 REENTRANT_PROTO*) ;;
12383                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12384                 esac
12385                 echo "Prototype: $try" ;;
12386         esac
12387         ;;
12388         *)      case "$usethreads" in
12389                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12390                 esac
12391                 d_getprotobyname_r=undef
12392                 getprotobyname_r_proto=0
12393                 ;;
12394         esac
12395         ;;
12396 *)      getprotobyname_r_proto=0
12397         ;;
12398 esac
12399
12400 : see if getprotobynumber_r exists
12401 set getprotobynumber_r d_getprotobynumber_r
12402 eval $inlibc
12403 case "$d_getprotobynumber_r" in
12404 "$define")
12405         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12406         case "$d_getprotobynumber_r_proto:$usethreads" in
12407         ":define")      d_getprotobynumber_r_proto=define
12408                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12409                 eval $hasproto ;;
12410         *)      ;;
12411         esac
12412         case "$d_getprotobynumber_r_proto" in
12413         define)
12414         case "$getprotobynumber_r_proto" in
12415         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12416         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12417         esac
12418         case "$getprotobynumber_r_proto" in
12419         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12420         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12421         esac
12422         case "$getprotobynumber_r_proto" in
12423         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12424         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12425         esac
12426         case "$getprotobynumber_r_proto" in
12427         ''|0)   d_getprotobynumber_r=undef
12428                 getprotobynumber_r_proto=0
12429                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12430         * )     case "$getprotobynumber_r_proto" in
12431                 REENTRANT_PROTO*) ;;
12432                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12433                 esac
12434                 echo "Prototype: $try" ;;
12435         esac
12436         ;;
12437         *)      case "$usethreads" in
12438                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12439                 esac
12440                 d_getprotobynumber_r=undef
12441                 getprotobynumber_r_proto=0
12442                 ;;
12443         esac
12444         ;;
12445 *)      getprotobynumber_r_proto=0
12446         ;;
12447 esac
12448
12449 : see if getprotoent_r exists
12450 set getprotoent_r d_getprotoent_r
12451 eval $inlibc
12452 case "$d_getprotoent_r" in
12453 "$define")
12454         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12455         case "$d_getprotoent_r_proto:$usethreads" in
12456         ":define")      d_getprotoent_r_proto=define
12457                 set d_getprotoent_r_proto getprotoent_r $hdrs
12458                 eval $hasproto ;;
12459         *)      ;;
12460         esac
12461         case "$d_getprotoent_r_proto" in
12462         define)
12463         case "$getprotoent_r_proto" in
12464         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12465         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12466         esac
12467         case "$getprotoent_r_proto" in
12468         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12469         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12470         esac
12471         case "$getprotoent_r_proto" in
12472         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12473         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12474         esac
12475         case "$getprotoent_r_proto" in
12476         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12477         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12478         esac
12479         case "$getprotoent_r_proto" in
12480         ''|0)   d_getprotoent_r=undef
12481                 getprotoent_r_proto=0
12482                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12483         * )     case "$getprotoent_r_proto" in
12484                 REENTRANT_PROTO*) ;;
12485                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12486                 esac
12487                 echo "Prototype: $try" ;;
12488         esac
12489         ;;
12490         *)      case "$usethreads" in
12491                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12492                 esac
12493                 d_getprotoent_r=undef
12494                 getprotoent_r_proto=0
12495                 ;;
12496         esac
12497         ;;
12498 *)      getprotoent_r_proto=0
12499         ;;
12500 esac
12501
12502 : see if prototypes for various getprotoxxx netdb.h functions are available
12503 echo " "
12504 set d_getprotoprotos getprotoent $i_netdb netdb.h
12505 eval $hasproto
12506
12507 : see if getprpwnam exists
12508 set getprpwnam d_getprpwnam
12509 eval $inlibc
12510
12511 : see if getpwent exists
12512 set getpwent d_getpwent
12513 eval $inlibc
12514
12515 : see if getpwent_r exists
12516 set getpwent_r d_getpwent_r
12517 eval $inlibc
12518 case "$d_getpwent_r" in
12519 "$define")
12520         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12521         case "$d_getpwent_r_proto:$usethreads" in
12522         ":define")      d_getpwent_r_proto=define
12523                 set d_getpwent_r_proto getpwent_r $hdrs
12524                 eval $hasproto ;;
12525         *)      ;;
12526         esac
12527         case "$d_getpwent_r_proto" in
12528         define)
12529         case "$getpwent_r_proto" in
12530         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12531         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12532         esac
12533         case "$getpwent_r_proto" in
12534         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12535         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12536         esac
12537         case "$getpwent_r_proto" in
12538         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12539         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12540         esac
12541         case "$getpwent_r_proto" in
12542         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12543         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12544         esac
12545         case "$getpwent_r_proto" in
12546         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12547         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12548         esac
12549         case "$getpwent_r_proto" in
12550         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12551         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12552         esac
12553         case "$getpwent_r_proto" in
12554         ''|0)   d_getpwent_r=undef
12555                 getpwent_r_proto=0
12556                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12557         * )     case "$getpwent_r_proto" in
12558                 REENTRANT_PROTO*) ;;
12559                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12560                 esac
12561                 echo "Prototype: $try" ;;
12562         esac
12563         ;;
12564         *)      case "$usethreads" in
12565                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12566                 esac
12567                 d_getpwent_r=undef
12568                 getpwent_r_proto=0
12569                 ;;
12570         esac
12571         ;;
12572 *)      getpwent_r_proto=0
12573         ;;
12574 esac
12575
12576 : see if getpwnam_r exists
12577 set getpwnam_r d_getpwnam_r
12578 eval $inlibc
12579 case "$d_getpwnam_r" in
12580 "$define")
12581         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12582         case "$d_getpwnam_r_proto:$usethreads" in
12583         ":define")      d_getpwnam_r_proto=define
12584                 set d_getpwnam_r_proto getpwnam_r $hdrs
12585                 eval $hasproto ;;
12586         *)      ;;
12587         esac
12588         case "$d_getpwnam_r_proto" in
12589         define)
12590         case "$getpwnam_r_proto" in
12591         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12592         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12593         esac
12594         case "$getpwnam_r_proto" in
12595         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12596         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12597         esac
12598         case "$getpwnam_r_proto" in
12599         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12600         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12601         esac
12602         case "$getpwnam_r_proto" in
12603         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12604         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12605         esac
12606         case "$getpwnam_r_proto" in
12607         ''|0)   d_getpwnam_r=undef
12608                 getpwnam_r_proto=0
12609                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12610         * )     case "$getpwnam_r_proto" in
12611                 REENTRANT_PROTO*) ;;
12612                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12613                 esac
12614                 echo "Prototype: $try" ;;
12615         esac
12616         ;;
12617         *)      case "$usethreads" in
12618                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12619                 esac
12620                 d_getpwnam_r=undef
12621                 getpwnam_r_proto=0
12622                 ;;
12623         esac
12624         ;;
12625 *)      getpwnam_r_proto=0
12626         ;;
12627 esac
12628
12629 : see if getpwuid_r exists
12630 set getpwuid_r d_getpwuid_r
12631 eval $inlibc
12632 case "$d_getpwuid_r" in
12633 "$define")
12634         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12635         case "$d_getpwuid_r_proto:$usethreads" in
12636         ":define")      d_getpwuid_r_proto=define
12637                 set d_getpwuid_r_proto getpwuid_r $hdrs
12638                 eval $hasproto ;;
12639         *)      ;;
12640         esac
12641         case "$d_getpwuid_r_proto" in
12642         define)
12643         case "$getpwuid_r_proto" in
12644         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12645         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12646         esac
12647         case "$getpwuid_r_proto" in
12648         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12649         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12650         esac
12651         case "$getpwuid_r_proto" in
12652         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12653         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12654         esac
12655         case "$getpwuid_r_proto" in
12656         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12657         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12658         esac
12659         case "$getpwuid_r_proto" in
12660         ''|0)   d_getpwuid_r=undef
12661                 getpwuid_r_proto=0
12662                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12663         * )     case "$getpwuid_r_proto" in
12664                 REENTRANT_PROTO*) ;;
12665                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12666                 esac
12667                 echo "Prototype: $try" ;;
12668         esac
12669         ;;
12670         *)      case "$usethreads" in
12671                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12672                 esac
12673                 d_getpwuid_r=undef
12674                 getpwuid_r_proto=0
12675                 ;;
12676         esac
12677         ;;
12678 *)      getpwuid_r_proto=0
12679         ;;
12680 esac
12681
12682
12683 : see if getservbyname exists
12684 set getservbyname d_getsbyname
12685 eval $inlibc
12686
12687 : see if getservbyport exists
12688 set getservbyport d_getsbyport
12689 eval $inlibc
12690
12691 : see if getservent exists
12692 set getservent d_getsent
12693 eval $inlibc
12694
12695 : see if getservbyname_r exists
12696 set getservbyname_r d_getservbyname_r
12697 eval $inlibc
12698 case "$d_getservbyname_r" in
12699 "$define")
12700         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12701         case "$d_getservbyname_r_proto:$usethreads" in
12702         ":define")      d_getservbyname_r_proto=define
12703                 set d_getservbyname_r_proto getservbyname_r $hdrs
12704                 eval $hasproto ;;
12705         *)      ;;
12706         esac
12707         case "$d_getservbyname_r_proto" in
12708         define)
12709         case "$getservbyname_r_proto" in
12710         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12711         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12712         esac
12713         case "$getservbyname_r_proto" in
12714         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12715         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12716         esac
12717         case "$getservbyname_r_proto" in
12718         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12719         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12720         esac
12721         case "$getservbyname_r_proto" in
12722         ''|0)   d_getservbyname_r=undef
12723                 getservbyname_r_proto=0
12724                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12725         * )     case "$getservbyname_r_proto" in
12726                 REENTRANT_PROTO*) ;;
12727                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12728                 esac
12729                 echo "Prototype: $try" ;;
12730         esac
12731         ;;
12732         *)      case "$usethreads" in
12733                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12734                 esac
12735                 d_getservbyname_r=undef
12736                 getservbyname_r_proto=0
12737                 ;;
12738         esac
12739         ;;
12740 *)      getservbyname_r_proto=0
12741         ;;
12742 esac
12743
12744 : see if getservbyport_r exists
12745 set getservbyport_r d_getservbyport_r
12746 eval $inlibc
12747 case "$d_getservbyport_r" in
12748 "$define")
12749         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12750         case "$d_getservbyport_r_proto:$usethreads" in
12751         ":define")      d_getservbyport_r_proto=define
12752                 set d_getservbyport_r_proto getservbyport_r $hdrs
12753                 eval $hasproto ;;
12754         *)      ;;
12755         esac
12756         case "$d_getservbyport_r_proto" in
12757         define)
12758         case "$getservbyport_r_proto" in
12759         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12760         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12761         esac
12762         case "$getservbyport_r_proto" in
12763         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12764         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12765         esac
12766         case "$getservbyport_r_proto" in
12767         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12768         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12769         esac
12770         case "$getservbyport_r_proto" in
12771         ''|0)   d_getservbyport_r=undef
12772                 getservbyport_r_proto=0
12773                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12774         * )     case "$getservbyport_r_proto" in
12775                 REENTRANT_PROTO*) ;;
12776                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12777                 esac
12778                 echo "Prototype: $try" ;;
12779         esac
12780         ;;
12781         *)      case "$usethreads" in
12782                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12783                 esac
12784                 d_getservbyport_r=undef
12785                 getservbyport_r_proto=0
12786                 ;;
12787         esac
12788         ;;
12789 *)      getservbyport_r_proto=0
12790         ;;
12791 esac
12792
12793 : see if getservent_r exists
12794 set getservent_r d_getservent_r
12795 eval $inlibc
12796 case "$d_getservent_r" in
12797 "$define")
12798         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12799         case "$d_getservent_r_proto:$usethreads" in
12800         ":define")      d_getservent_r_proto=define
12801                 set d_getservent_r_proto getservent_r $hdrs
12802                 eval $hasproto ;;
12803         *)      ;;
12804         esac
12805         case "$d_getservent_r_proto" in
12806         define)
12807         case "$getservent_r_proto" in
12808         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12809         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12810         esac
12811         case "$getservent_r_proto" in
12812         ''|0) try='int getservent_r(struct servent*, char*, int);'
12813         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12814         esac
12815         case "$getservent_r_proto" in
12816         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12817         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12818         esac
12819         case "$getservent_r_proto" in
12820         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12821         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12822         esac
12823         case "$getservent_r_proto" in
12824         ''|0)   d_getservent_r=undef
12825                 getservent_r_proto=0
12826                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12827         * )     case "$getservent_r_proto" in
12828                 REENTRANT_PROTO*) ;;
12829                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12830                 esac
12831                 echo "Prototype: $try" ;;
12832         esac
12833         ;;
12834         *)      case "$usethreads" in
12835                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12836                 esac
12837                 d_getservent_r=undef
12838                 getservent_r_proto=0
12839                 ;;
12840         esac
12841         ;;
12842 *)      getservent_r_proto=0
12843         ;;
12844 esac
12845
12846 : see if prototypes for various getservxxx netdb.h functions are available
12847 echo " "
12848 set d_getservprotos getservent $i_netdb netdb.h
12849 eval $hasproto
12850
12851 : see if getspnam exists
12852 set getspnam d_getspnam
12853 eval $inlibc
12854
12855 : see if this is a shadow.h system
12856 set shadow.h i_shadow
12857 eval $inhdr
12858
12859 : see if getspnam_r exists
12860 set getspnam_r d_getspnam_r
12861 eval $inlibc
12862 case "$d_getspnam_r" in
12863 "$define")
12864         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12865         case "$d_getspnam_r_proto:$usethreads" in
12866         ":define")      d_getspnam_r_proto=define
12867                 set d_getspnam_r_proto getspnam_r $hdrs
12868                 eval $hasproto ;;
12869         *)      ;;
12870         esac
12871         case "$d_getspnam_r_proto" in
12872         define)
12873         case "$getspnam_r_proto" in
12874         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12875         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12876         esac
12877         case "$getspnam_r_proto" in
12878         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12879         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12880         esac
12881         case "$getspnam_r_proto" in
12882         ''|0)   d_getspnam_r=undef
12883                 getspnam_r_proto=0
12884                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12885         * )     case "$getspnam_r_proto" in
12886                 REENTRANT_PROTO*) ;;
12887                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12888                 esac
12889                 echo "Prototype: $try" ;;
12890         esac
12891         ;;
12892         *)      case "$usethreads" in
12893                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12894                 esac
12895                 d_getspnam_r=undef
12896                 getspnam_r_proto=0
12897                 ;;
12898         esac
12899         ;;
12900 *)      getspnam_r_proto=0
12901         ;;
12902 esac
12903
12904 : see if gettimeofday or ftime exists
12905 set gettimeofday d_gettimeod
12906 eval $inlibc
12907 case "$d_gettimeod" in
12908 "$undef")
12909         set ftime d_ftime 
12910         eval $inlibc
12911         ;;
12912 *)
12913         val="$undef"; set d_ftime; eval $setvar
12914         ;;
12915 esac
12916 case "$d_gettimeod$d_ftime" in
12917 "$undef$undef")
12918         echo " "
12919         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12920         ;;
12921 esac
12922
12923 : see if gmtime_r exists
12924 set gmtime_r d_gmtime_r
12925 eval $inlibc
12926 case "$d_gmtime_r" in
12927 "$define")
12928         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12929         case "$d_gmtime_r_proto:$usethreads" in
12930         ":define")      d_gmtime_r_proto=define
12931                 set d_gmtime_r_proto gmtime_r $hdrs
12932                 eval $hasproto ;;
12933         *)      ;;
12934         esac
12935         case "$d_gmtime_r_proto" in
12936         define)
12937         case "$gmtime_r_proto" in
12938         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12939         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12940         esac
12941         case "$gmtime_r_proto" in
12942         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12943         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12944         esac
12945         case "$gmtime_r_proto" in
12946         ''|0)   d_gmtime_r=undef
12947                 gmtime_r_proto=0
12948                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12949         * )     case "$gmtime_r_proto" in
12950                 REENTRANT_PROTO*) ;;
12951                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12952                 esac
12953                 echo "Prototype: $try" ;;
12954         esac
12955         ;;
12956         *)      case "$usethreads" in
12957                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12958                 esac
12959                 d_gmtime_r=undef
12960                 gmtime_r_proto=0
12961                 ;;
12962         esac
12963         ;;
12964 *)      gmtime_r_proto=0
12965         ;;
12966 esac
12967
12968 : see if hasmntopt exists
12969 set hasmntopt d_hasmntopt
12970 eval $inlibc
12971
12972 : see if this is a netinet/in.h or sys/in.h system
12973 set netinet/in.h i_niin sys/in.h i_sysin
12974 eval $inhdr
12975
12976 : see if arpa/inet.h has to be included
12977 set arpa/inet.h i_arpainet
12978 eval $inhdr
12979
12980 : see if htonl --and friends-- exists
12981 val=''
12982 set htonl val
12983 eval $inlibc
12984
12985 : Maybe they are macros.
12986 case "$val" in
12987 $undef)
12988         $cat >htonl.c <<EOM
12989 #include <stdio.h>
12990 #include <sys/types.h>
12991 #$i_niin I_NETINET_IN
12992 #$i_sysin I_SYS_IN
12993 #$i_arpainet I_ARPA_INET
12994 #ifdef I_NETINET_IN
12995 #include <netinet/in.h>
12996 #endif
12997 #ifdef I_SYS_IN
12998 #include <sys/in.h>
12999 #endif
13000 #ifdef I_ARPA_INET
13001 #include <arpa/inet.h>
13002 #endif
13003 #ifdef htonl
13004 printf("Defined as a macro.");
13005 #endif
13006 EOM
13007         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13008         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13009                 val="$define"
13010                 echo "But it seems to be defined as a macro." >&4
13011         fi
13012         $rm -f htonl.?
13013         ;;
13014 esac
13015 set d_htonl
13016 eval $setvar
13017
13018 : index or strchr
13019 echo " "
13020 if set index val -f; eval $csym; $val; then
13021         if set strchr val -f d_strchr; eval $csym; $val; then
13022                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13023                         val="$define"
13024                         vali="$undef"
13025                         echo "strchr() found." >&4
13026                 else
13027                         val="$undef"
13028                         vali="$define"
13029                         echo "index() found." >&4
13030                 fi
13031         else
13032                 val="$undef"
13033                 vali="$define"
13034                 echo "index() found." >&4
13035         fi
13036 else
13037         if set strchr val -f d_strchr; eval $csym; $val; then
13038                 val="$define"
13039                 vali="$undef"
13040                 echo "strchr() found." >&4
13041         else
13042                 echo "No index() or strchr() found!" >&4
13043                 val="$undef"
13044                 vali="$undef"
13045         fi
13046 fi
13047 set d_strchr; eval $setvar
13048 val="$vali"
13049 set d_index; eval $setvar
13050
13051 : check whether inet_aton exists
13052 set inet_aton d_inetaton
13053 eval $inlibc
13054
13055 : Look for isascii
13056 echo " "
13057 $cat >isascii.c <<'EOCP'
13058 #include <stdio.h>
13059 #include <ctype.h>
13060 int main() {
13061         int c = 'A';
13062         if (isascii(c))
13063                 exit(0);
13064         else
13065                 exit(1);
13066 }
13067 EOCP
13068 set isascii
13069 if eval $compile; then
13070         echo "isascii() found." >&4
13071         val="$define"
13072 else
13073         echo "isascii() NOT found." >&4
13074         val="$undef"
13075 fi
13076 set d_isascii
13077 eval $setvar
13078 $rm -f isascii*
13079
13080 : see if isfinite exists
13081 set isfinite d_isfinite
13082 eval $inlibc
13083
13084 : see if isinf exists
13085 set isinf d_isinf
13086 eval $inlibc
13087
13088 : see if isnan exists
13089 set isnan d_isnan
13090 eval $inlibc
13091
13092 : see if isnanl exists
13093 set isnanl d_isnanl
13094 eval $inlibc
13095
13096 : see if killpg exists
13097 set killpg d_killpg
13098 eval $inlibc
13099
13100 : see if lchown exists
13101 echo " "
13102 $cat > try.c <<'EOCP'
13103 /* System header to define __stub macros and hopefully few prototypes,
13104     which can conflict with char lchown(); below.  */
13105 #include <assert.h>
13106 /* Override any gcc2 internal prototype to avoid an error.  */
13107 /* We use char because int might match the return type of a gcc2
13108    builtin and then its argument prototype would still apply.  */
13109 char lchown();
13110 int main() {
13111     /*  The GNU C library defines this for functions which it implements
13112         to always fail with ENOSYS.  Some functions are actually named
13113         something starting with __ and the normal name is an alias.  */
13114 #if defined (__stub_lchown) || defined (__stub___lchown)
13115 choke me
13116 #else
13117 lchown();
13118 #endif
13119 ; return 0; }
13120 EOCP
13121 set try
13122 if eval $compile; then
13123     $echo "lchown() found." >&4
13124     val="$define"
13125 else
13126     $echo "lchown() NOT found." >&4
13127     val="$undef"
13128 fi
13129 set d_lchown
13130 eval $setvar
13131
13132 : See if number of significant digits in a double precision number is known
13133 echo " "
13134 $cat >ldbl_dig.c <<EOM
13135 #$i_limits I_LIMITS
13136 #$i_float I_FLOAT
13137 #ifdef I_LIMITS
13138 #include <limits.h>
13139 #endif
13140 #ifdef I_FLOAT
13141 #include <float.h>
13142 #endif
13143 #ifdef LDBL_DIG
13144 printf("Contains LDBL_DIG");
13145 #endif
13146 EOM
13147 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13148 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13149         echo "LDBL_DIG found." >&4
13150         val="$define"
13151 else
13152         echo "LDBL_DIG NOT found." >&4
13153         val="$undef"
13154 fi
13155 $rm -f ldbl_dig.?
13156 set d_ldbl_dig
13157 eval $setvar
13158
13159 : see if link exists
13160 set link d_link
13161 eval $inlibc
13162
13163 : see if localtime_r exists
13164 set localtime_r d_localtime_r
13165 eval $inlibc
13166 case "$d_localtime_r" in
13167 "$define")
13168         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13169         case "$d_localtime_r_proto:$usethreads" in
13170         ":define")      d_localtime_r_proto=define
13171                 set d_localtime_r_proto localtime_r $hdrs
13172                 eval $hasproto ;;
13173         *)      ;;
13174         esac
13175         case "$d_localtime_r_proto" in
13176         define)
13177         case "$localtime_r_proto" in
13178         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13179         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13180         esac
13181         case "$localtime_r_proto" in
13182         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13183         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13184         esac
13185         case "$localtime_r_proto" in
13186         ''|0)   d_localtime_r=undef
13187                 localtime_r_proto=0
13188                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13189         * )     case "$localtime_r_proto" in
13190                 REENTRANT_PROTO*) ;;
13191                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13192                 esac
13193                 echo "Prototype: $try" ;;
13194         esac
13195         ;;
13196         *)      case "$usethreads" in
13197                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13198                 esac
13199                 d_localtime_r=undef
13200                 localtime_r_proto=0
13201                 ;;
13202         esac
13203         ;;
13204 *)      localtime_r_proto=0
13205         ;;
13206 esac
13207
13208 : see if localeconv exists
13209 set localeconv d_locconv
13210 eval $inlibc
13211
13212 : see if lockf exists
13213 set lockf d_lockf
13214 eval $inlibc
13215
13216 : see if prototype for lseek is available
13217 echo " "
13218 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13219 eval $hasproto
13220
13221 : see if lstat exists
13222 set lstat d_lstat
13223 eval $inlibc
13224
13225 : see if madvise exists
13226 set madvise d_madvise
13227 eval $inlibc
13228
13229 : see if mblen exists
13230 set mblen d_mblen
13231 eval $inlibc
13232
13233 : see if mbstowcs exists
13234 set mbstowcs d_mbstowcs
13235 eval $inlibc
13236
13237 : see if mbtowc exists
13238 set mbtowc d_mbtowc
13239 eval $inlibc
13240
13241 : see if memchr exists
13242 set memchr d_memchr
13243 eval $inlibc
13244
13245 : see if memcmp exists
13246 set memcmp d_memcmp
13247 eval $inlibc
13248
13249 : see if memcpy exists
13250 set memcpy d_memcpy
13251 eval $inlibc
13252
13253 : see if memmove exists
13254 set memmove d_memmove
13255 eval $inlibc
13256
13257 : see if memset exists
13258 set memset d_memset
13259 eval $inlibc
13260
13261 : see if mkdir exists
13262 set mkdir d_mkdir
13263 eval $inlibc
13264
13265 : see if mkdtemp exists
13266 set mkdtemp d_mkdtemp
13267 eval $inlibc
13268
13269 : see if mkfifo exists
13270 set mkfifo d_mkfifo
13271 eval $inlibc
13272
13273 : see if mkstemp exists
13274 set mkstemp d_mkstemp
13275 eval $inlibc
13276
13277 : see if mkstemps exists
13278 set mkstemps d_mkstemps
13279 eval $inlibc
13280
13281 : see if mktime exists
13282 set mktime d_mktime
13283 eval $inlibc
13284
13285 : see if this is a sys/mman.h system
13286 set sys/mman.h i_sysmman
13287 eval $inhdr
13288
13289 : see if mmap exists
13290 set mmap d_mmap
13291 eval $inlibc
13292 : see what shmat returns
13293 : default to something harmless
13294 mmaptype='void *'
13295 case "$i_sysmman$d_mmap" in
13296 "$define$define")
13297         $cat >mmap.c <<'END'
13298 #include <sys/mman.h>
13299 void *mmap();
13300 END
13301         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13302                 mmaptype='void *'
13303         else
13304                 mmaptype='caddr_t'
13305         fi
13306         echo "and it returns ($mmaptype)." >&4
13307         ;;
13308 esac
13309
13310
13311
13312 : see if mprotect exists
13313 set mprotect d_mprotect
13314 eval $inlibc
13315
13316 : see if msgctl exists
13317 set msgctl d_msgctl
13318 eval $inlibc
13319
13320 : see if msgget exists
13321 set msgget d_msgget
13322 eval $inlibc
13323
13324 : see if msgsnd exists
13325 set msgsnd d_msgsnd
13326 eval $inlibc
13327
13328 : see if msgrcv exists
13329 set msgrcv d_msgrcv
13330 eval $inlibc
13331
13332 : see how much of the 'msg*(2)' library is present.
13333 h_msg=true
13334 echo " "
13335 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13336 *"$undef"*) h_msg=false;;
13337 esac
13338 case "$osname" in
13339 freebsd)
13340     case "`ipcs 2>&1`" in
13341     "SVID messages"*"not configured"*)
13342         echo "Your $osname does not have the msg*(2) configured." >&4
13343         h_msg=false
13344         val="$undef"
13345         set msgctl d_msgctl
13346         eval $setvar
13347         set msgget d_msgget
13348         eval $setvar
13349         set msgsnd d_msgsnd
13350         eval $setvar
13351         set msgrcv d_msgrcv
13352         eval $setvar
13353         ;;
13354     esac
13355     ;;
13356 esac
13357 : we could also check for sys/ipc.h ...
13358 if $h_msg && $test `./findhdr sys/msg.h`; then
13359         echo "You have the full msg*(2) library." >&4
13360         val="$define"
13361 else
13362         echo "You don't have the full msg*(2) library." >&4
13363         val="$undef"
13364 fi
13365 set d_msg
13366 eval $setvar
13367
13368
13369 echo " "
13370 echo "Checking to see if your system supports struct msghdr..." >&4
13371 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13372 eval $hasstruct
13373 case "$d_msghdr_s" in
13374 "$define")      echo "Yes, it does."   ;;
13375 *)              echo "No, it doesn't." ;;
13376 esac
13377
13378
13379 : see if msync exists
13380 set msync d_msync
13381 eval $inlibc
13382
13383 : see if munmap exists
13384 set munmap d_munmap
13385 eval $inlibc
13386
13387 : see if nice exists
13388 set nice d_nice
13389 eval $inlibc
13390
13391 : see if this is a langinfo.h system
13392 set langinfo.h i_langinfo
13393 eval $inhdr
13394
13395 : see if nl_langinfo exists
13396 set nl_langinfo d_nl_langinfo
13397 eval $inlibc
13398
13399 : check for length of character
13400 echo " "
13401 case "$charsize" in
13402 '')
13403         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13404         $cat >try.c <<'EOCP'
13405 #include <stdio.h>
13406 int main()
13407 {
13408     printf("%d\n", (int)sizeof(char));
13409     exit(0);
13410 }
13411 EOCP
13412         set try
13413         if eval $compile_ok; then
13414                 dflt=`$run ./try`
13415         else
13416                 dflt='1'
13417                 echo "(I can't seem to compile the test program.  Guessing...)"
13418         fi
13419         ;;
13420 *)
13421         dflt="$charsize"
13422         ;;
13423 esac
13424 rp="What is the size of a character (in bytes)?"
13425 . ./myread
13426 charsize="$ans"
13427 $rm -f try.c try
13428
13429 : check for volatile keyword
13430 echo " "
13431 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13432 $cat >try.c <<'EOCP'
13433 main()
13434 {
13435         typedef struct _goo_struct goo_struct;
13436         goo_struct * volatile goo = ((goo_struct *)0);
13437         struct _goo_struct {
13438                 long long_int;
13439                 int reg_int;
13440                 char char_var;
13441         };
13442         typedef unsigned short foo_t;
13443         char *volatile foo;
13444         volatile int bar;
13445         volatile foo_t blech;
13446         foo = foo;
13447 }
13448 EOCP
13449 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13450         val="$define"
13451         echo "Yup, it does."
13452 else
13453         val="$undef"
13454         echo "Nope, it doesn't."
13455 fi
13456 set d_volatile
13457 eval $setvar
13458 $rm -f try.*
13459
13460
13461 echo " "
13462 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13463
13464 case "$use64bitint:$d_quad:$quadtype" in
13465 define:define:?*)
13466         ivtype="$quadtype"
13467         uvtype="$uquadtype"
13468         ivsize=8
13469         uvsize=8
13470         ;;
13471 *)      ivtype="long"
13472         uvtype="unsigned long"
13473         ivsize=$longsize
13474         uvsize=$longsize
13475         ;;
13476 esac
13477
13478 case "$uselongdouble:$d_longdbl" in
13479 define:define)
13480         nvtype="long double"
13481         nvsize=$longdblsize
13482         ;;
13483 *)      nvtype=double
13484         nvsize=$doublesize
13485         ;;
13486 esac
13487
13488 $echo "(IV will be "$ivtype", $ivsize bytes)"
13489 $echo "(UV will be "$uvtype", $uvsize bytes)"
13490 $echo "(NV will be "$nvtype", $nvsize bytes)"
13491
13492 $cat >try.c <<EOCP
13493 #$i_inttypes I_INTTYPES
13494 #ifdef I_INTTYPES
13495 #include <inttypes.h>
13496 #endif
13497 #include <stdio.h>
13498 int main() {
13499 #ifdef INT8
13500    int8_t i =  INT8_MAX;
13501   uint8_t u = UINT8_MAX;
13502   printf("int8_t\n");
13503 #endif
13504 #ifdef INT16
13505    int16_t i =  INT16_MAX;
13506   uint16_t i = UINT16_MAX;
13507   printf("int16_t\n");
13508 #endif
13509 #ifdef INT32
13510    int32_t i =  INT32_MAX;
13511   uint32_t u = UINT32_MAX;
13512   printf("int32_t\n");
13513 #endif
13514 }
13515 EOCP
13516
13517 case "$i8type" in
13518 '')     case "$charsize" in
13519         1)      i8type=char
13520                 u8type="unsigned char"
13521                 i8size=$charsize
13522                 u8size=$charsize
13523                 ;;
13524         esac
13525         ;;
13526 esac
13527 case "$i8type" in
13528 '')     set try -DINT8
13529         if eval $compile; then
13530                 case "`$run ./try`" in
13531                 int8_t) i8type=int8_t
13532                         u8type=uint8_t
13533                         i8size=1
13534                         u8size=1
13535                         ;;
13536                 esac
13537         fi
13538         ;;
13539 esac
13540 case "$i8type" in
13541 '')     if $test $charsize -ge 1; then
13542                 i8type=char
13543                 u8type="unsigned char"
13544                 i8size=$charsize
13545                 u8size=$charsize
13546         fi
13547         ;;
13548 esac
13549
13550 case "$i16type" in
13551 '')     case "$shortsize" in
13552         2)      i16type=short
13553                 u16type="unsigned short"
13554                 i16size=$shortsize
13555                 u16size=$shortsize
13556                 ;;
13557         esac
13558         ;;
13559 esac
13560 case "$i16type" in
13561 '')     set try -DINT16
13562         if eval $compile; then
13563                 case "`$run ./try`" in
13564                 int16_t)
13565                         i16type=int16_t
13566                         u16type=uint16_t
13567                         i16size=2
13568                         u16size=2
13569                         ;;
13570                 esac
13571         fi
13572         ;;
13573 esac
13574 case "$i16type" in
13575 '')     if $test $shortsize -ge 2; then
13576                 i16type=short
13577                 u16type="unsigned short"
13578                 i16size=$shortsize
13579                 u16size=$shortsize
13580         fi
13581         ;;
13582 esac
13583
13584 case "$i32type" in
13585 '')     case "$longsize" in
13586         4)      i32type=long
13587                 u32type="unsigned long"
13588                 i32size=$longsize
13589                 u32size=$longsize
13590                 ;;
13591         *)      case "$intsize" in
13592                 4)      i32type=int
13593                         u32type="unsigned int"
13594                         i32size=$intsize
13595                         u32size=$intsize
13596                         ;;
13597                 esac
13598                 ;;
13599         esac
13600         ;;
13601 esac
13602 case "$i32type" in
13603 '')     set try -DINT32
13604         if eval $compile; then
13605                 case "`$run ./try`" in
13606                 int32_t)
13607                         i32type=int32_t
13608                         u32type=uint32_t
13609                         i32size=4
13610                         u32size=4
13611                         ;;
13612                 esac
13613         fi
13614         ;;
13615 esac
13616 case "$i32type" in
13617 '')     if $test $intsize -ge 4; then
13618                 i32type=int
13619                 u32type="unsigned int"
13620                 i32size=$intsize
13621                 u32size=$intsize
13622         fi
13623         ;;
13624 esac
13625
13626 case "$i64type" in
13627 '')     case "$d_quad:$quadtype" in
13628         define:?*)
13629                 i64type="$quadtype"
13630                 u64type="$uquadtype"
13631                 i64size=8
13632                 u64size=8
13633                 ;;
13634         esac
13635         ;;
13636 esac
13637
13638 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13639 : volatile so that the compiler has to store it out to memory.
13640 if test X"$d_volatile" = X"$define"; then
13641         volatile=volatile
13642 fi
13643 $cat <<EOP >try.c
13644 #include <stdio.h>
13645 #include <sys/types.h>
13646 #include <signal.h>
13647 #ifdef SIGFPE
13648 $volatile int bletched = 0;
13649 $signal_t blech(s) int s; { bletched = 1; }
13650 #endif
13651 int main() {
13652     $uvtype u = 0;
13653     $nvtype d;
13654     int     n = 8 * $uvsize;
13655     int     i;
13656 #ifdef SIGFPE
13657     signal(SIGFPE, blech);
13658 #endif
13659
13660     for (i = 0; i < n; i++) {
13661       u = u << 1 | ($uvtype)1;
13662       d = ($nvtype)u;
13663       if (($uvtype)d != u)
13664         break;
13665       if (d <= 0)
13666         break;
13667       d = ($nvtype)(u - 1);
13668       if (($uvtype)d != (u - 1))
13669         break;
13670 #ifdef SIGFPE
13671       if (bletched) {
13672         break;
13673 #endif
13674       } 
13675     }
13676     printf("%d\n", ((i == n) ? -n : i));
13677     exit(0);
13678 }
13679 EOP
13680 set try
13681
13682 d_nv_preserves_uv="$undef"
13683 if eval $compile; then
13684         nv_preserves_uv_bits="`$run ./try`"
13685 fi
13686 case "$nv_preserves_uv_bits" in
13687 \-[1-9]*)       
13688         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13689         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13690         d_nv_preserves_uv="$define"
13691         ;;
13692 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13693         d_nv_preserves_uv="$undef" ;;
13694 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13695         nv_preserves_uv_bits="$undef" ;;
13696 esac
13697
13698 $rm -f try.* try
13699
13700
13701 : check for off64_t
13702 echo " "
13703 echo "Checking to see if you have off64_t..." >&4
13704 $cat >try.c <<EOCP
13705 #include <sys/types.h>
13706 #include <unistd.h>
13707 int main() { off64_t x = 7; }
13708 EOCP
13709 set try
13710 if eval $compile; then
13711         val="$define"
13712         echo "You have off64_t."
13713 else
13714         val="$undef"
13715         echo "You do not have off64_t."
13716         case "$lseeksize" in
13717         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13718         esac
13719 fi
13720 $rm -f try.* try
13721 set d_off64_t
13722 eval $setvar
13723
13724 : how to create joinable pthreads
13725 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13726         echo " "
13727         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13728         $cat >try.c <<'EOCP'
13729 #include <pthread.h>
13730 int main() {
13731     int detachstate = JOINABLE;
13732 }
13733 EOCP
13734         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13735         if eval $compile; then
13736                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13737                 val="$undef" # Yes, undef.
13738                 set d_old_pthread_create_joinable
13739                 eval $setvar
13740                 val=""
13741                 set old_pthread_create_joinable
13742                 eval $setvar
13743         else
13744                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13745                 if eval $compile; then
13746                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13747                         val="$define"
13748                         set d_old_pthread_create_joinable
13749                         eval $setvar
13750                         val=PTHREAD_CREATE_UNDETACHED
13751                         set old_pthread_create_joinable
13752                         eval $setvar
13753                 else            
13754                         set try -DJOINABLE=__UNDETACHED
13755                         if eval $compile; then
13756                                 echo "You seem to use __UNDETACHED." >&4
13757                                 val="$define"
13758                                 set d_old_pthread_create_joinable
13759                                 eval $setvar
13760                                 val=__UNDETACHED
13761                                 set old_pthread_create_joinable
13762                                 eval $setvar
13763                         else
13764                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13765                                 val="$define"
13766                                 set d_old_pthread_create_joinable
13767                                 eval $setvar
13768                                 val=0
13769                                 set old_pthread_create_joinable
13770                                 eval $setvar
13771                         fi
13772                 fi
13773         fi
13774         $rm -f try try.*
13775 else
13776     d_old_pthread_create_joinable="$undef"
13777     old_pthread_create_joinable=""
13778 fi
13779
13780 : see if pause exists
13781 set pause d_pause
13782 eval $inlibc
13783
13784 : see if pipe exists
13785 set pipe d_pipe
13786 eval $inlibc
13787
13788 : see if poll exists
13789 set poll d_poll
13790 eval $inlibc
13791
13792 : see if readlink exists
13793 set readlink d_readlink
13794 eval $inlibc
13795
13796 echo " "
13797 procselfexe=''
13798 val="$undef"
13799 case "$d_readlink" in
13800 "$define")
13801         if $issymlink /proc/self/exe ; then
13802                 $ls -l /proc/self/exe > reflect
13803                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13804                         echo "You have Linux-like /proc/self/exe."
13805                         procselfexe='"/proc/self/exe"'
13806                         val="$define"
13807                 fi
13808         fi
13809         if $issymlink /proc/curproc/file ; then
13810                 $ls -l /proc/curproc/file > reflect
13811                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13812                         echo "You have BSD-like /proc/curproc/file."
13813                         procselfexe='"/proc/curproc/file"'
13814                         val="$define"
13815                 fi
13816         fi
13817         ;;
13818 esac
13819 $rm -f reflect
13820 set d_procselfexe
13821 eval $setvar
13822
13823 : see whether the pthread_atfork exists
13824 $cat >try.c <<EOP
13825 #include <pthread.h>
13826 #include <stdio.h>
13827 int main() {
13828 #ifdef  PTHREAD_ATFORK
13829         pthread_atfork(NULL,NULL,NULL);
13830 #endif
13831 }
13832 EOP
13833
13834 : see if pthread_atfork exists
13835 set try -DPTHREAD_ATFORK
13836 if eval $compile; then
13837     val="$define"
13838 else
13839     val="$undef"
13840 fi
13841 case "$usethreads" in
13842 $define)
13843         case "$val" in
13844         $define) echo 'pthread_atfork found.' >&4        ;;
13845         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13846         esac
13847 esac
13848 set d_pthread_atfork
13849 eval $setvar
13850
13851
13852 : see whether the various POSIXish _yields exist
13853 $cat >try.c <<EOP
13854 #include <pthread.h>
13855 #include <stdio.h>
13856 int main() {
13857 #ifdef SCHED_YIELD
13858         sched_yield();
13859 #else
13860 #ifdef PTHREAD_YIELD
13861         pthread_yield();
13862 #else
13863 #ifdef PTHREAD_YIELD_NULL
13864         pthread_yield(NULL);
13865 #endif
13866 #endif
13867 #endif
13868 }
13869 EOP
13870 : see if sched_yield exists
13871 set try -DSCHED_YIELD
13872 if eval $compile; then
13873     val="$define"
13874     sched_yield='sched_yield()'
13875 else
13876     val="$undef"
13877 fi
13878 case "$usethreads" in
13879 $define)
13880         case "$val" in
13881         $define) echo 'sched_yield() found.' >&4        ;;
13882         *)       echo 'sched_yield() NOT found.' >&4    ;;
13883         esac
13884 esac
13885 set d_sched_yield
13886 eval $setvar
13887
13888 : see if pthread_yield exists
13889 set try -DPTHREAD_YIELD
13890 if eval $compile; then
13891     val="$define"
13892     case "$sched_yield" in
13893     '') sched_yield='pthread_yield()' ;;
13894     esac
13895 else
13896     set try -DPTHREAD_YIELD_NULL
13897     if eval $compile; then
13898         val="$define"
13899         case "$sched_yield" in
13900         '') sched_yield='pthread_yield(NULL)' ;;
13901         esac
13902     else
13903         val="$undef"
13904     fi
13905 fi
13906 case "$usethreads" in
13907 $define)
13908         case "$val" in
13909         $define) echo 'pthread_yield() found.' >&4      ;;
13910         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13911         esac
13912         ;;
13913 esac
13914 set d_pthread_yield
13915 eval $setvar
13916
13917 case "$sched_yield" in
13918 '') sched_yield=undef ;;
13919 esac
13920
13921 $rm -f try try.*
13922
13923 : see if random_r exists
13924 set random_r d_random_r
13925 eval $inlibc
13926 case "$d_random_r" in
13927 "$define")
13928         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13929         case "$d_random_r_proto:$usethreads" in
13930         ":define")      d_random_r_proto=define
13931                 set d_random_r_proto random_r $hdrs
13932                 eval $hasproto ;;
13933         *)      ;;
13934         esac
13935         case "$d_random_r_proto" in
13936         define)
13937         case "$random_r_proto" in
13938         ''|0) try='int random_r(int*, struct random_data*);'
13939         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13940         esac
13941         case "$random_r_proto" in
13942         ''|0)   d_random_r=undef
13943                 random_r_proto=0
13944                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13945         * )     case "$random_r_proto" in
13946                 REENTRANT_PROTO*) ;;
13947                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13948                 esac
13949                 echo "Prototype: $try" ;;
13950         esac
13951         ;;
13952         *)      case "$usethreads" in
13953                 define) echo "random_r has no prototype, not using it." >&4 ;;
13954                 esac
13955                 d_random_r=undef
13956                 random_r_proto=0
13957                 ;;
13958         esac
13959         ;;
13960 *)      random_r_proto=0
13961         ;;
13962 esac
13963
13964 : see if readdir and friends exist
13965 set readdir d_readdir
13966 eval $inlibc
13967 set seekdir d_seekdir
13968 eval $inlibc
13969 set telldir d_telldir
13970 eval $inlibc
13971 set rewinddir d_rewinddir
13972 eval $inlibc
13973
13974 : see if readdir64_r exists
13975 set readdir64_r d_readdir64_r
13976 eval $inlibc
13977 case "$d_readdir64_r" in
13978 "$define")
13979         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13980         case "$d_readdir64_r_proto:$usethreads" in
13981         ":define")      d_readdir64_r_proto=define
13982                 set d_readdir64_r_proto readdir64_r $hdrs
13983                 eval $hasproto ;;
13984         *)      ;;
13985         esac
13986         case "$d_readdir64_r_proto" in
13987         define)
13988         case "$readdir64_r_proto" in
13989         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13990         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13991         esac
13992         case "$readdir64_r_proto" in
13993         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13994         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13995         esac
13996         case "$readdir64_r_proto" in
13997         ''|0)   d_readdir64_r=undef
13998                 readdir64_r_proto=0
13999                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14000         * )     case "$readdir64_r_proto" in
14001                 REENTRANT_PROTO*) ;;
14002                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14003                 esac
14004                 echo "Prototype: $try" ;;
14005         esac
14006         ;;
14007         *)      case "$usethreads" in
14008                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14009                 esac
14010                 d_readdir64_r=undef
14011                 readdir64_r_proto=0
14012                 ;;
14013         esac
14014         ;;
14015 *)      readdir64_r_proto=0
14016         ;;
14017 esac
14018
14019 : see if readdir_r exists
14020 set readdir_r d_readdir_r
14021 eval $inlibc
14022 case "$d_readdir_r" in
14023 "$define")
14024         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14025         case "$d_readdir_r_proto:$usethreads" in
14026         ":define")      d_readdir_r_proto=define
14027                 set d_readdir_r_proto readdir_r $hdrs
14028                 eval $hasproto ;;
14029         *)      ;;
14030         esac
14031         case "$d_readdir_r_proto" in
14032         define)
14033         case "$readdir_r_proto" in
14034         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14035         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14036         esac
14037         case "$readdir_r_proto" in
14038         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14039         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14040         esac
14041         case "$readdir_r_proto" in
14042         ''|0)   d_readdir_r=undef
14043                 readdir_r_proto=0
14044                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14045         * )     case "$readdir_r_proto" in
14046                 REENTRANT_PROTO*) ;;
14047                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14048                 esac
14049                 echo "Prototype: $try" ;;
14050         esac
14051         ;;
14052         *)      case "$usethreads" in
14053                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14054                 esac
14055                 d_readdir_r=undef
14056                 readdir_r_proto=0
14057                 ;;
14058         esac
14059         ;;
14060 *)      readdir_r_proto=0
14061         ;;
14062 esac
14063
14064 : see if readv exists
14065 set readv d_readv
14066 eval $inlibc
14067
14068 : see if recvmsg exists
14069 set recvmsg d_recvmsg
14070 eval $inlibc
14071
14072 : see if rename exists
14073 set rename d_rename
14074 eval $inlibc
14075
14076 : see if rmdir exists
14077 set rmdir d_rmdir
14078 eval $inlibc
14079
14080 : see if memory.h is available.
14081 val=''
14082 set memory.h val
14083 eval $inhdr
14084
14085 : See if it conflicts with string.h
14086 case "$val" in
14087 $define)
14088         case "$strings" in
14089         '') ;;
14090         *)
14091                 $cppstdin $cppflags $cppminus < $strings > mem.h
14092                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14093                         echo " "
14094                         echo "We won't be including <memory.h>."
14095                         val="$undef"
14096                 fi
14097                 $rm -f mem.h
14098                 ;;
14099         esac
14100 esac
14101 set i_memory
14102 eval $setvar
14103
14104 : can bcopy handle overlapping blocks?
14105 echo " "
14106 val="$undef"
14107 case "$d_memmove" in
14108 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14109 *)      case "$d_bcopy" in
14110         "$define")
14111                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14112                 $cat >try.c <<EOCP
14113 #$i_memory I_MEMORY
14114 #$i_stdlib I_STDLIB
14115 #$i_string I_STRING
14116 #$i_unistd I_UNISTD
14117 EOCP
14118         $cat >>try.c <<'EOCP'
14119 #include <stdio.h>
14120 #ifdef I_MEMORY
14121 #  include <memory.h>
14122 #endif
14123 #ifdef I_STDLIB
14124 #  include <stdlib.h>
14125 #endif
14126 #ifdef I_STRING
14127 #  include <string.h>
14128 #else
14129 #  include <strings.h>
14130 #endif
14131 #ifdef I_UNISTD
14132 #  include <unistd.h>  /* Needed for NetBSD */
14133 #endif
14134 int main()
14135 {
14136 char buf[128], abc[128];
14137 char *b;
14138 int len;
14139 int off;
14140 int align;
14141
14142 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14143    try to store the string in read-only memory. */
14144 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14145
14146 for (align = 7; align >= 0; align--) {
14147         for (len = 36; len; len--) {
14148                 b = buf+align;
14149                 bcopy(abc, b, len);
14150                 for (off = 1; off <= len; off++) {
14151                         bcopy(b, b+off, len);
14152                         bcopy(b+off, b, len);
14153                         if (bcmp(b, abc, len))
14154                                 exit(1);
14155                 }
14156         }
14157 }
14158 exit(0);
14159 }
14160 EOCP
14161                 set try
14162                 if eval $compile_ok; then
14163                         if ./try 2>/dev/null; then
14164                                 echo "Yes, it can."
14165                                 val="$define"
14166                         else
14167                                 echo "It can't, sorry."
14168                         fi
14169                 else
14170                         echo "(I can't compile the test program, so we'll assume not...)"
14171                 fi
14172                 ;;
14173         esac
14174         $rm -f try.* try core
14175         ;;
14176 esac
14177 set d_safebcpy
14178 eval $setvar
14179
14180 : can memcpy handle overlapping blocks?
14181 echo " "
14182 val="$undef"
14183 case "$d_memmove" in
14184 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14185 *)      case "$d_memcpy" in
14186         "$define")
14187                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14188                 $cat >try.c <<EOCP
14189 #$i_memory I_MEMORY
14190 #$i_stdlib I_STDLIB
14191 #$i_string I_STRING
14192 #$i_unistd I_UNISTD
14193 EOCP
14194         $cat >>try.c <<'EOCP'
14195 #include <stdio.h>
14196 #ifdef I_MEMORY
14197 #  include <memory.h>
14198 #endif
14199 #ifdef I_STDLIB
14200 #  include <stdlib.h>
14201 #endif
14202 #ifdef I_STRING
14203 #  include <string.h>
14204 #else
14205 #  include <strings.h>
14206 #endif
14207 #ifdef I_UNISTD
14208 #  include <unistd.h>  /* Needed for NetBSD */
14209 #endif
14210 int main()
14211 {
14212 char buf[128], abc[128];
14213 char *b;
14214 int len;
14215 int off;
14216 int align;
14217
14218 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14219    try to store the string in read-only memory. */
14220 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14221
14222 for (align = 7; align >= 0; align--) {
14223         for (len = 36; len; len--) {
14224                 b = buf+align;
14225                 memcpy(b, abc, len);
14226                 for (off = 1; off <= len; off++) {
14227                         memcpy(b+off, b, len);
14228                         memcpy(b, b+off, len);
14229                         if (memcmp(b, abc, len))
14230                                 exit(1);
14231                 }
14232         }
14233 }
14234 exit(0);
14235 }
14236 EOCP
14237                 set try
14238                 if eval $compile_ok; then
14239                         if ./try 2>/dev/null; then
14240                                 echo "Yes, it can."
14241                                 val="$define"
14242                         else
14243                                 echo "It can't, sorry."
14244                         fi
14245                 else
14246                         echo "(I can't compile the test program, so we'll assume not...)"
14247                 fi
14248                 ;;
14249         esac
14250         $rm -f try.* try core
14251         ;;
14252 esac
14253 set d_safemcpy
14254 eval $setvar
14255
14256 : can memcmp be trusted to compare relative magnitude?
14257 val="$undef"
14258 case "$d_memcmp" in
14259 "$define")
14260         echo " "
14261         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14262         $cat >try.c <<EOCP
14263 #$i_memory I_MEMORY
14264 #$i_stdlib I_STDLIB
14265 #$i_string I_STRING
14266 #$i_unistd I_UNISTD
14267 EOCP
14268         $cat >>try.c <<'EOCP'
14269 #include <stdio.h>
14270 #ifdef I_MEMORY
14271 #  include <memory.h>
14272 #endif
14273 #ifdef I_STDLIB
14274 #  include <stdlib.h>
14275 #endif
14276 #ifdef I_STRING
14277 #  include <string.h>
14278 #else
14279 #  include <strings.h>
14280 #endif
14281 #ifdef I_UNISTD
14282 #  include <unistd.h>  /* Needed for NetBSD */
14283 #endif
14284 int main()
14285 {
14286 char a = -1;
14287 char b = 0;
14288 if ((a < b) && memcmp(&a, &b, 1) < 0)
14289         exit(1);
14290 exit(0);
14291 }
14292 EOCP
14293         set try
14294         if eval $compile_ok; then
14295                 if $run ./try 2>/dev/null; then
14296                         echo "Yes, it can."
14297                         val="$define"
14298                 else
14299                         echo "No, it can't (it uses signed chars)."
14300                 fi
14301         else
14302                 echo "(I can't compile the test program, so we'll assume not...)"
14303         fi
14304         ;;
14305 esac
14306 $rm -f try.* try core
14307 set d_sanemcmp
14308 eval $setvar
14309
14310 : see if prototype for sbrk is available
14311 echo " "
14312 set d_sbrkproto sbrk $i_unistd unistd.h
14313 eval $hasproto
14314
14315 : see if select exists
14316 set select d_select
14317 eval $inlibc
14318
14319 : see if semctl exists
14320 set semctl d_semctl
14321 eval $inlibc
14322
14323 : see if semget exists
14324 set semget d_semget
14325 eval $inlibc
14326
14327 : see if semop exists
14328 set semop d_semop
14329 eval $inlibc
14330
14331 : see how much of the 'sem*(2)' library is present.
14332 h_sem=true
14333 echo " "
14334 case "$d_semctl$d_semget$d_semop" in
14335 *"$undef"*) h_sem=false;;
14336 esac
14337 case "$osname" in
14338 freebsd)
14339     case "`ipcs 2>&1`" in
14340     "SVID messages"*"not configured"*)
14341         echo "Your $osname does not have the sem*(2) configured." >&4
14342         h_sem=false
14343         val="$undef"
14344         set semctl d_semctl
14345         eval $setvar
14346         set semget d_semget
14347         eval $setvar
14348         set semop d_semop
14349         eval $setvar
14350         ;;
14351     esac
14352     ;;
14353 esac
14354 : we could also check for sys/ipc.h ...
14355 if $h_sem && $test `./findhdr sys/sem.h`; then
14356         echo "You have the full sem*(2) library." >&4
14357         val="$define"
14358 else
14359         echo "You don't have the full sem*(2) library." >&4
14360         val="$undef"
14361 fi
14362 set d_sem
14363 eval $setvar
14364
14365 : see whether sys/sem.h defines union semun
14366 echo " "
14367 $cat > try.c <<'END'
14368 #include <sys/types.h>
14369 #include <sys/ipc.h>
14370 #include <sys/sem.h>
14371 int main () { union semun semun; semun.buf = 0; }
14372 END
14373 set try
14374 if eval $compile; then
14375     echo "You have union semun in <sys/sem.h>." >&4
14376     val="$define"
14377 else
14378     echo "You do not have union semun in <sys/sem.h>." >&4
14379     val="$undef"
14380 fi
14381 $rm -f try try.c try.h
14382 set d_union_semun
14383 eval $setvar
14384
14385 : see how to do semctl IPC_STAT
14386 case "$d_sem" in
14387 $define)
14388     : see whether semctl IPC_STAT can use union semun
14389     echo " "
14390     $cat > try.h <<END
14391 #ifndef S_IRUSR
14392 #   ifdef S_IREAD
14393 #       define S_IRUSR S_IREAD
14394 #       define S_IWUSR S_IWRITE
14395 #       define S_IXUSR S_IEXEC
14396 #   else
14397 #       define S_IRUSR 0400
14398 #       define S_IWUSR 0200
14399 #       define S_IXUSR 0100
14400 #   endif
14401 #   define S_IRGRP (S_IRUSR>>3)
14402 #   define S_IWGRP (S_IWUSR>>3)
14403 #   define S_IXGRP (S_IXUSR>>3)
14404 #   define S_IROTH (S_IRUSR>>6)
14405 #   define S_IWOTH (S_IWUSR>>6)
14406 #   define S_IXOTH (S_IXUSR>>6)
14407 #endif
14408 #ifndef S_IRWXU
14409 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14410 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14411 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14412 #endif
14413 END
14414
14415     $cat > try.c <<END
14416 #include <sys/types.h>
14417 #include <sys/ipc.h>
14418 #include <sys/sem.h>
14419 #include <sys/stat.h>
14420 #include <stdio.h>
14421 #include <errno.h>
14422 #include "try.h"
14423 #ifndef errno
14424 extern int errno;
14425 #endif
14426 #$d_union_semun HAS_UNION_SEMUN
14427 int main() {
14428     union semun
14429 #ifndef HAS_UNION_SEMUN
14430     {
14431         int val;
14432         struct semid_ds *buf;
14433         unsigned short *array;
14434     }
14435 #endif
14436     arg;
14437     int sem, st;
14438
14439 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14440     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14441     if (sem > -1) {
14442         struct semid_ds argbuf;
14443         arg.buf = &argbuf;
14444 #       ifdef IPC_STAT
14445         st = semctl(sem, 0, IPC_STAT, arg);
14446         if (st == 0)
14447             printf("semun\n");
14448         else
14449 #       endif /* IPC_STAT */
14450             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14451 #       ifdef IPC_RMID
14452         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14453 #       endif /* IPC_RMID */
14454             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14455     } else
14456 #endif /* IPC_PRIVATE && ... */
14457         printf("semget failed: errno = %d\n", errno);
14458   return 0;
14459 }
14460 END
14461     val="$undef"
14462     set try
14463     if eval $compile; then
14464         xxx=`$run ./try`
14465         case "$xxx" in
14466         semun) val="$define" ;;
14467         esac
14468     fi
14469     $rm -f try try.c
14470     set d_semctl_semun
14471     eval $setvar
14472     case "$d_semctl_semun" in
14473     $define)
14474         echo "You can use union semun for semctl IPC_STAT." >&4
14475         also='also'
14476         ;;
14477     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14478         also=''
14479         ;;
14480     esac
14481
14482     : see whether semctl IPC_STAT can use struct semid_ds pointer
14483     $cat > try.c <<'END'
14484 #include <sys/types.h>
14485 #include <sys/ipc.h>
14486 #include <sys/sem.h>
14487 #include <sys/stat.h>
14488 #include "try.h"
14489 #include <stdio.h>
14490 #include <errno.h>
14491 #ifndef errno
14492 extern int errno;
14493 #endif
14494 int main() {
14495     struct semid_ds arg;
14496     int sem, st;
14497
14498 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14499     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14500     if (sem > -1) {
14501 #       ifdef IPC_STAT
14502         st = semctl(sem, 0, IPC_STAT, &arg);
14503         if (st == 0)
14504             printf("semid_ds\n");
14505         else
14506 #       endif /* IPC_STAT */
14507             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14508 #       ifdef IPC_RMID
14509         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14510 #       endif /* IPC_RMID */
14511             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14512     } else
14513 #endif /* IPC_PRIVATE && ... */
14514         printf("semget failed: errno = %d\n", errno);
14515
14516     return 0;
14517 }
14518 END
14519     val="$undef"
14520     set try
14521     if eval $compile; then
14522         xxx=`$run ./try`
14523         case "$xxx" in
14524         semid_ds) val="$define" ;;
14525         esac
14526     fi
14527     $rm -f try try.c
14528     set d_semctl_semid_ds
14529     eval $setvar
14530     case "$d_semctl_semid_ds" in
14531     $define)
14532         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14533         ;;
14534     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14535         ;;
14536     esac
14537     $rm -f try.h
14538     ;;
14539 *)  val="$undef"
14540
14541     # We do not have the full sem*(2) library, so assume we can not
14542     # use either.
14543
14544     set d_semctl_semun
14545     eval $setvar
14546
14547     set d_semctl_semid_ds
14548     eval $setvar
14549     ;;
14550 esac
14551
14552 : see if sendmsg exists
14553 set sendmsg d_sendmsg
14554 eval $inlibc
14555
14556 : see if setegid exists
14557 set setegid d_setegid
14558 eval $inlibc
14559
14560 : see if seteuid exists
14561 set seteuid d_seteuid
14562 eval $inlibc
14563
14564 : see if setgrent exists
14565 set setgrent d_setgrent
14566 eval $inlibc
14567
14568 : see if setgrent_r exists
14569 set setgrent_r d_setgrent_r
14570 eval $inlibc
14571 case "$d_setgrent_r" in
14572 "$define")
14573         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14574         case "$d_setgrent_r_proto:$usethreads" in
14575         ":define")      d_setgrent_r_proto=define
14576                 set d_setgrent_r_proto setgrent_r $hdrs
14577                 eval $hasproto ;;
14578         *)      ;;
14579         esac
14580         case "$d_setgrent_r_proto" in
14581         define)
14582         case "$setgrent_r_proto" in
14583         ''|0) try='int setgrent_r(FILE**);'
14584         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14585         esac
14586         case "$setgrent_r_proto" in
14587         ''|0) try='void setgrent_r(FILE**);'
14588         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14589         esac
14590         case "$setgrent_r_proto" in
14591         ''|0)   d_setgrent_r=undef
14592                 setgrent_r_proto=0
14593                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14594         * )     case "$setgrent_r_proto" in
14595                 REENTRANT_PROTO*) ;;
14596                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14597                 esac
14598                 echo "Prototype: $try" ;;
14599         esac
14600         ;;
14601         *)      case "$usethreads" in
14602                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14603                 esac
14604                 d_setgrent_r=undef
14605                 setgrent_r_proto=0
14606                 ;;
14607         esac
14608         ;;
14609 *)      setgrent_r_proto=0
14610         ;;
14611 esac
14612
14613 : see if sethostent exists
14614 set sethostent d_sethent
14615 eval $inlibc
14616
14617 : see if sethostent_r exists
14618 set sethostent_r d_sethostent_r
14619 eval $inlibc
14620 case "$d_sethostent_r" in
14621 "$define")
14622         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14623         case "$d_sethostent_r_proto:$usethreads" in
14624         ":define")      d_sethostent_r_proto=define
14625                 set d_sethostent_r_proto sethostent_r $hdrs
14626                 eval $hasproto ;;
14627         *)      ;;
14628         esac
14629         case "$d_sethostent_r_proto" in
14630         define)
14631         case "$sethostent_r_proto" in
14632         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14633         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14634         esac
14635         case "$sethostent_r_proto" in
14636         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14637         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14638         esac
14639         case "$sethostent_r_proto" in
14640         ''|0)   d_sethostent_r=undef
14641                 sethostent_r_proto=0
14642                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14643         * )     case "$sethostent_r_proto" in
14644                 REENTRANT_PROTO*) ;;
14645                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14646                 esac
14647                 echo "Prototype: $try" ;;
14648         esac
14649         ;;
14650         *)      case "$usethreads" in
14651                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14652                 esac
14653                 d_sethostent_r=undef
14654                 sethostent_r_proto=0
14655                 ;;
14656         esac
14657         ;;
14658 *)      sethostent_r_proto=0
14659         ;;
14660 esac
14661
14662 : see if setitimer exists
14663 set setitimer d_setitimer
14664 eval $inlibc
14665
14666 : see if setlinebuf exists
14667 set setlinebuf d_setlinebuf
14668 eval $inlibc
14669
14670 : see if setlocale exists
14671 set setlocale d_setlocale
14672 eval $inlibc
14673
14674 : see if locale.h is available
14675 set locale.h i_locale
14676 eval $inhdr
14677
14678 : see if setlocale_r exists
14679 set setlocale_r d_setlocale_r
14680 eval $inlibc
14681 case "$d_setlocale_r" in
14682 "$define")
14683         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14684         case "$d_setlocale_r_proto:$usethreads" in
14685         ":define")      d_setlocale_r_proto=define
14686                 set d_setlocale_r_proto setlocale_r $hdrs
14687                 eval $hasproto ;;
14688         *)      ;;
14689         esac
14690         case "$d_setlocale_r_proto" in
14691         define)
14692         case "$setlocale_r_proto" in
14693         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14694         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14695         esac
14696         case "$setlocale_r_proto" in
14697         ''|0)   d_setlocale_r=undef
14698                 setlocale_r_proto=0
14699                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14700         * )     case "$setlocale_r_proto" in
14701                 REENTRANT_PROTO*) ;;
14702                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14703                 esac
14704                 echo "Prototype: $try" ;;
14705         esac
14706         ;;
14707         *)      case "$usethreads" in
14708                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14709                 esac
14710                 d_setlocale_r=undef
14711                 setlocale_r_proto=0
14712                 ;;
14713         esac
14714         ;;
14715 *)      setlocale_r_proto=0
14716         ;;
14717 esac
14718
14719 : see if setnetent exists
14720 set setnetent d_setnent
14721 eval $inlibc
14722
14723 : see if setnetent_r exists
14724 set setnetent_r d_setnetent_r
14725 eval $inlibc
14726 case "$d_setnetent_r" in
14727 "$define")
14728         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14729         case "$d_setnetent_r_proto:$usethreads" in
14730         ":define")      d_setnetent_r_proto=define
14731                 set d_setnetent_r_proto setnetent_r $hdrs
14732                 eval $hasproto ;;
14733         *)      ;;
14734         esac
14735         case "$d_setnetent_r_proto" in
14736         define)
14737         case "$setnetent_r_proto" in
14738         ''|0) try='int setnetent_r(int, struct netent_data*);'
14739         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14740         esac
14741         case "$setnetent_r_proto" in
14742         ''|0) try='void setnetent_r(int, struct netent_data*);'
14743         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14744         esac
14745         case "$setnetent_r_proto" in
14746         ''|0)   d_setnetent_r=undef
14747                 setnetent_r_proto=0
14748                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14749         * )     case "$setnetent_r_proto" in
14750                 REENTRANT_PROTO*) ;;
14751                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14752                 esac
14753                 echo "Prototype: $try" ;;
14754         esac
14755         ;;
14756         *)      case "$usethreads" in
14757                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14758                 esac
14759                 d_setnetent_r=undef
14760                 setnetent_r_proto=0
14761                 ;;
14762         esac
14763         ;;
14764 *)      setnetent_r_proto=0
14765         ;;
14766 esac
14767
14768 : see if setprotoent exists
14769 set setprotoent d_setpent
14770 eval $inlibc
14771
14772 : see if setpgid exists
14773 set setpgid d_setpgid
14774 eval $inlibc
14775
14776 : see if setpgrp2 exists
14777 set setpgrp2 d_setpgrp2
14778 eval $inlibc
14779
14780 : see if setpriority exists
14781 set setpriority d_setprior
14782 eval $inlibc
14783
14784 : see if setproctitle exists
14785 set setproctitle d_setproctitle
14786 eval $inlibc
14787
14788 : see if setprotoent_r exists
14789 set setprotoent_r d_setprotoent_r
14790 eval $inlibc
14791 case "$d_setprotoent_r" in
14792 "$define")
14793         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14794         case "$d_setprotoent_r_proto:$usethreads" in
14795         ":define")      d_setprotoent_r_proto=define
14796                 set d_setprotoent_r_proto setprotoent_r $hdrs
14797                 eval $hasproto ;;
14798         *)      ;;
14799         esac
14800         case "$d_setprotoent_r_proto" in
14801         define)
14802         case "$setprotoent_r_proto" in
14803         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14804         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14805         esac
14806         case "$setprotoent_r_proto" in
14807         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14808         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14809         esac
14810         case "$setprotoent_r_proto" in
14811         ''|0)   d_setprotoent_r=undef
14812                 setprotoent_r_proto=0
14813                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14814         * )     case "$setprotoent_r_proto" in
14815                 REENTRANT_PROTO*) ;;
14816                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14817                 esac
14818                 echo "Prototype: $try" ;;
14819         esac
14820         ;;
14821         *)      case "$usethreads" in
14822                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14823                 esac
14824                 d_setprotoent_r=undef
14825                 setprotoent_r_proto=0
14826                 ;;
14827         esac
14828         ;;
14829 *)      setprotoent_r_proto=0
14830         ;;
14831 esac
14832
14833 : see if setpwent exists
14834 set setpwent d_setpwent
14835 eval $inlibc
14836
14837 : see if setpwent_r exists
14838 set setpwent_r d_setpwent_r
14839 eval $inlibc
14840 case "$d_setpwent_r" in
14841 "$define")
14842         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14843         case "$d_setpwent_r_proto:$usethreads" in
14844         ":define")      d_setpwent_r_proto=define
14845                 set d_setpwent_r_proto setpwent_r $hdrs
14846                 eval $hasproto ;;
14847         *)      ;;
14848         esac
14849         case "$d_setpwent_r_proto" in
14850         define)
14851         case "$setpwent_r_proto" in
14852         ''|0) try='int setpwent_r(FILE**);'
14853         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14854         esac
14855         case "$setpwent_r_proto" in
14856         ''|0) try='void setpwent_r(FILE**);'
14857         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14858         esac
14859         case "$setpwent_r_proto" in
14860         ''|0)   d_setpwent_r=undef
14861                 setpwent_r_proto=0
14862                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14863         * )     case "$setpwent_r_proto" in
14864                 REENTRANT_PROTO*) ;;
14865                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14866                 esac
14867                 echo "Prototype: $try" ;;
14868         esac
14869         ;;
14870         *)      case "$usethreads" in
14871                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14872                 esac
14873                 d_setpwent_r=undef
14874                 setpwent_r_proto=0
14875                 ;;
14876         esac
14877         ;;
14878 *)      setpwent_r_proto=0
14879         ;;
14880 esac
14881
14882 : see if setregid exists
14883 set setregid d_setregid
14884 eval $inlibc
14885 set setresgid d_setresgid
14886 eval $inlibc
14887
14888 : see if setreuid exists
14889 set setreuid d_setreuid
14890 eval $inlibc
14891 set setresuid d_setresuid
14892 eval $inlibc
14893
14894 : see if setrgid exists
14895 set setrgid d_setrgid
14896 eval $inlibc
14897
14898 : see if setruid exists
14899 set setruid d_setruid
14900 eval $inlibc
14901
14902 : see if setservent exists
14903 set setservent d_setsent
14904 eval $inlibc
14905
14906 : see if setservent_r exists
14907 set setservent_r d_setservent_r
14908 eval $inlibc
14909 case "$d_setservent_r" in
14910 "$define")
14911         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14912         case "$d_setservent_r_proto:$usethreads" in
14913         ":define")      d_setservent_r_proto=define
14914                 set d_setservent_r_proto setservent_r $hdrs
14915                 eval $hasproto ;;
14916         *)      ;;
14917         esac
14918         case "$d_setservent_r_proto" in
14919         define)
14920         case "$setservent_r_proto" in
14921         ''|0) try='int setservent_r(int, struct servent_data*);'
14922         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14923         esac
14924         case "$setservent_r_proto" in
14925         ''|0) try='void setservent_r(int, struct servent_data*);'
14926         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14927         esac
14928         case "$setservent_r_proto" in
14929         ''|0)   d_setservent_r=undef
14930                 setservent_r_proto=0
14931                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14932         * )     case "$setservent_r_proto" in
14933                 REENTRANT_PROTO*) ;;
14934                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14935                 esac
14936                 echo "Prototype: $try" ;;
14937         esac
14938         ;;
14939         *)      case "$usethreads" in
14940                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14941                 esac
14942                 d_setservent_r=undef
14943                 setservent_r_proto=0
14944                 ;;
14945         esac
14946         ;;
14947 *)      setservent_r_proto=0
14948         ;;
14949 esac
14950
14951 : see if setsid exists
14952 set setsid d_setsid
14953 eval $inlibc
14954
14955 : see if setvbuf exists
14956 set setvbuf d_setvbuf
14957 eval $inlibc
14958
14959 : see if sfio.h is available
14960 set sfio.h i_sfio
14961 eval $inhdr
14962
14963
14964 : see if sfio library is available
14965 case "$i_sfio" in
14966 $define)
14967         val=''
14968         set sfreserve val
14969         eval $inlibc
14970         ;;
14971 *)
14972         val="$undef"
14973         ;;
14974 esac
14975 : Ok, but do we want to use it.
14976 case "$val" in
14977 $define)
14978         case "$usesfio" in
14979         true|$define|[yY]*) dflt='y';;
14980         *) dflt='n';;
14981         esac
14982         echo "$package can use the sfio library, but it is experimental."
14983         case "$useperlio" in
14984         "$undef")
14985             echo "For sfio also the PerlIO abstraction layer is needed."
14986             echo "Earlier you said you wouldn't want that."
14987             ;;
14988         esac
14989         rp="You seem to have sfio available, do you want to try using it?"
14990         . ./myread
14991         case "$ans" in
14992         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14993                 useperlio="$define"
14994                 val="$define"
14995                 ;;
14996         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14997                 val="$undef"
14998                 ;;
14999         esac
15000         ;;
15001 *)      case "$usesfio" in
15002         true|$define|[yY]*)
15003                 echo "Sorry, cannot find sfio on this machine." >&4
15004                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15005                 val="$undef"
15006                 ;;
15007         esac
15008         ;;
15009 esac
15010 set d_sfio
15011 eval $setvar
15012 case "$d_sfio" in
15013 $define) usesfio='true';;
15014 *) usesfio='false';;
15015 esac
15016 case "$d_sfio" in
15017 $define) ;;
15018 *)      : Remove sfio from list of libraries to use
15019         case "$libs" in
15020         *-lsfio*)
15021                 echo "Removing unneeded -lsfio from library list" >&4
15022                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15023                 shift
15024                 libs="$*"
15025                 echo "libs = $libs" >&4
15026                 ;;
15027         esac
15028 ;;
15029 esac
15030
15031
15032 : see if shmctl exists
15033 set shmctl d_shmctl
15034 eval $inlibc
15035
15036 : see if shmget exists
15037 set shmget d_shmget
15038 eval $inlibc
15039
15040 : see if shmat exists
15041 set shmat d_shmat
15042 eval $inlibc
15043 : see what shmat returns
15044 case "$d_shmat" in
15045 "$define")
15046         $cat >shmat.c <<'END'
15047 #include <sys/shm.h>
15048 void *shmat();
15049 END
15050         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15051                 shmattype='void *'
15052         else
15053                 shmattype='char *'
15054         fi
15055         echo "and it returns ($shmattype)." >&4
15056         : see if a prototype for shmat is available
15057         xxx=`./findhdr sys/shm.h`
15058         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15059         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15060                 val="$define"
15061         else
15062                 val="$undef"
15063         fi
15064         $rm -f shmat.[co]
15065         ;;
15066 *)
15067         val="$undef"
15068         ;;
15069 esac
15070 set d_shmatprototype
15071 eval $setvar
15072
15073 : see if shmdt exists
15074 set shmdt d_shmdt
15075 eval $inlibc
15076
15077 : see how much of the 'shm*(2)' library is present.
15078 h_shm=true
15079 echo " "
15080 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15081 *"$undef"*) h_shm=false;;
15082 esac
15083 case "$osname" in
15084 freebsd)
15085     case "`ipcs 2>&1`" in
15086     "SVID shared memory"*"not configured"*)
15087         echo "Your $osname does not have the shm*(2) configured." >&4
15088         h_shm=false
15089         val="$undef"
15090         set shmctl d_shmctl
15091         evat $setvar
15092         set shmget d_shmget
15093         evat $setvar
15094         set shmat d_shmat
15095         evat $setvar
15096         set shmdt d_shmdt
15097         evat $setvar
15098         ;;
15099     esac
15100     ;;
15101 esac
15102 : we could also check for sys/ipc.h ...
15103 if $h_shm && $test `./findhdr sys/shm.h`; then
15104         echo "You have the full shm*(2) library." >&4
15105         val="$define"
15106 else
15107         echo "You don't have the full shm*(2) library." >&4
15108         val="$undef"
15109 fi
15110 set d_shm
15111 eval $setvar
15112
15113 echo " "
15114 : see if we have sigaction
15115 if set sigaction val -f d_sigaction; eval $csym; $val; then
15116         echo 'sigaction() found.' >&4
15117         $cat > try.c <<'EOP'
15118 #include <stdio.h>
15119 #include <sys/types.h>
15120 #include <signal.h>
15121 int main()
15122 {
15123     struct sigaction act, oact;
15124     act.sa_flags = 0;
15125     oact.sa_handler = 0;
15126     /* so that act and oact are used */
15127     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15128 }
15129 EOP
15130         set try
15131         if eval $compile_ok; then
15132                 val="$define"
15133         else
15134                 echo "But you don't seem to have a useable struct sigaction." >&4
15135                 val="$undef"
15136         fi
15137 else
15138         echo 'sigaction NOT found.' >&4
15139         val="$undef"
15140 fi
15141 set d_sigaction; eval $setvar
15142 $rm -f try try$_o try.c
15143
15144 : see if sigprocmask exists
15145 set sigprocmask d_sigprocmask
15146 eval $inlibc
15147
15148 : see if sigsetjmp exists
15149 echo " "
15150 case "$d_sigsetjmp" in
15151 '')
15152         $cat >try.c <<'EOP'
15153 #include <setjmp.h>
15154 sigjmp_buf env;
15155 int set = 1;
15156 int main()
15157 {
15158         if (sigsetjmp(env,1))
15159                 exit(set);
15160         set = 0;
15161         siglongjmp(env, 1);
15162         exit(1);
15163 }
15164 EOP
15165         set try
15166         if eval $compile; then
15167                 if $run ./try >/dev/null 2>&1; then
15168                         echo "POSIX sigsetjmp found." >&4
15169                         val="$define"
15170                 else
15171                         $cat >&4 <<EOM
15172 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15173 I'll ignore them.
15174 EOM
15175                         val="$undef"
15176                 fi
15177         else
15178                 echo "sigsetjmp not found." >&4
15179                 val="$undef"
15180         fi
15181         ;;
15182 *) val="$d_sigsetjmp"
15183         case "$d_sigsetjmp" in
15184         $define) echo "POSIX sigsetjmp found." >&4;;
15185         $undef) echo "sigsetjmp not found." >&4;;
15186         esac
15187         ;;
15188 esac
15189 set d_sigsetjmp
15190 eval $setvar
15191 $rm -f try.c try
15192
15193 : see if sockatmark exists
15194 set sockatmark d_sockatmark
15195 eval $inlibc
15196
15197 : see if prototype for sockatmark is available
15198 echo " "
15199 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15200 eval $hasproto
15201
15202 : see if socks5_init exists
15203 set socks5_init d_socks5_init
15204 eval $inlibc
15205
15206 : see if srand48_r exists
15207 set srand48_r d_srand48_r
15208 eval $inlibc
15209 case "$d_srand48_r" in
15210 "$define")
15211         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15212         case "$d_srand48_r_proto:$usethreads" in
15213         ":define")      d_srand48_r_proto=define
15214                 set d_srand48_r_proto srand48_r $hdrs
15215                 eval $hasproto ;;
15216         *)      ;;
15217         esac
15218         case "$d_srand48_r_proto" in
15219         define)
15220         case "$srand48_r_proto" in
15221         ''|0) try='int srand48_r(long, struct drand48_data*);'
15222         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15223         esac
15224         case "$srand48_r_proto" in
15225         ''|0)   d_srand48_r=undef
15226                 srand48_r_proto=0
15227                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15228         * )     case "$srand48_r_proto" in
15229                 REENTRANT_PROTO*) ;;
15230                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15231                 esac
15232                 echo "Prototype: $try" ;;
15233         esac
15234         ;;
15235         *)      case "$usethreads" in
15236                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15237                 esac
15238                 d_srand48_r=undef
15239                 srand48_r_proto=0
15240                 ;;
15241         esac
15242         ;;
15243 *)      srand48_r_proto=0
15244         ;;
15245 esac
15246
15247 : see if srandom_r exists
15248 set srandom_r d_srandom_r
15249 eval $inlibc
15250 case "$d_srandom_r" in
15251 "$define")
15252         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15253         case "$d_srandom_r_proto:$usethreads" in
15254         ":define")      d_srandom_r_proto=define
15255                 set d_srandom_r_proto srandom_r $hdrs
15256                 eval $hasproto ;;
15257         *)      ;;
15258         esac
15259         case "$d_srandom_r_proto" in
15260         define)
15261         case "$srandom_r_proto" in
15262         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15263         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15264         esac
15265         case "$srandom_r_proto" in
15266         ''|0)   d_srandom_r=undef
15267                 srandom_r_proto=0
15268                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15269         * )     case "$srandom_r_proto" in
15270                 REENTRANT_PROTO*) ;;
15271                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15272                 esac
15273                 echo "Prototype: $try" ;;
15274         esac
15275         ;;
15276         *)      case "$usethreads" in
15277                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15278                 esac
15279                 d_srandom_r=undef
15280                 srandom_r_proto=0
15281                 ;;
15282         esac
15283         ;;
15284 *)      srandom_r_proto=0
15285         ;;
15286 esac
15287
15288 : see if prototype for setresgid is available
15289 echo " "
15290 set d_sresgproto setresgid $i_unistd unistd.h
15291 eval $hasproto
15292
15293 : see if prototype for setresuid is available
15294 echo " "
15295 set d_sresuproto setresuid $i_unistd unistd.h
15296 eval $hasproto
15297
15298 : see if sys/stat.h is available
15299 set sys/stat.h i_sysstat
15300 eval $inhdr
15301
15302
15303 : see if stat knows about block sizes
15304 echo " "
15305 echo "Checking to see if your struct stat has st_blocks field..." >&4
15306 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15307 eval $hasfield
15308
15309
15310 : see if this is a sys/vfs.h system
15311 set sys/vfs.h i_sysvfs
15312 eval $inhdr
15313
15314
15315 : see if this is a sys/statfs.h system
15316 set sys/statfs.h i_sysstatfs
15317 eval $inhdr
15318
15319
15320 echo " "
15321 echo "Checking to see if your system supports struct statfs..." >&4
15322 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
15323 eval $hasstruct
15324 case "$d_statfs_s" in
15325 "$define")      echo "Yes, it does."   ;;
15326 *)              echo "No, it doesn't." ;;
15327 esac
15328
15329
15330
15331 : see if struct statfs knows about f_flags
15332 case "$d_statfs_s" in
15333 define) 
15334         echo " "
15335         echo "Checking to see if your struct statfs has f_flags field..." >&4
15336         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
15337         eval $hasfield
15338         ;;
15339 *)      val="$undef"
15340         set d_statfs_f_flags
15341         eval $setvar
15342         ;;
15343 esac
15344 case "$d_statfs_f_flags" in
15345 "$define")      echo "Yes, it does."   ;;
15346 *)              echo "No, it doesn't." ;;
15347 esac
15348
15349 : see if _ptr and _cnt from stdio act std
15350 echo " "
15351
15352 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15353         echo "(Looks like you have stdio.h from BSD.)"
15354         case "$stdio_ptr" in
15355         '') stdio_ptr='((fp)->_p)'
15356                 ptr_lval=$define
15357                 ;;
15358         *)      ptr_lval=$d_stdio_ptr_lval;;
15359         esac
15360         case "$stdio_cnt" in
15361         '') stdio_cnt='((fp)->_r)'
15362                 cnt_lval=$define
15363                 ;;
15364         *)      cnt_lval=$d_stdio_cnt_lval;;
15365         esac
15366         case "$stdio_base" in
15367         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15368         esac
15369         case "$stdio_bufsiz" in
15370         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15371         esac
15372 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15373         echo "(Looks like you have stdio.h from Linux.)"
15374         case "$stdio_ptr" in
15375         '') stdio_ptr='((fp)->_IO_read_ptr)'
15376                 ptr_lval=$define
15377                 ;;
15378         *)      ptr_lval=$d_stdio_ptr_lval;;
15379         esac
15380         case "$stdio_cnt" in
15381         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15382                 cnt_lval=$undef
15383                 ;;
15384         *)      cnt_lval=$d_stdio_cnt_lval;;
15385         esac
15386         case "$stdio_base" in
15387         '') stdio_base='((fp)->_IO_read_base)';;
15388         esac
15389         case "$stdio_bufsiz" in
15390         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15391         esac
15392 else
15393         case "$stdio_ptr" in
15394         '') stdio_ptr='((fp)->_ptr)'
15395                 ptr_lval=$define
15396                 ;;
15397         *)      ptr_lval=$d_stdio_ptr_lval;;
15398         esac
15399         case "$stdio_cnt" in
15400         '') stdio_cnt='((fp)->_cnt)'
15401                 cnt_lval=$define
15402                 ;;
15403         *)      cnt_lval=$d_stdio_cnt_lval;;
15404         esac
15405         case "$stdio_base" in
15406         '') stdio_base='((fp)->_base)';;
15407         esac
15408         case "$stdio_bufsiz" in
15409         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15410         esac
15411 fi
15412
15413 : test whether _ptr and _cnt really work
15414 echo "Checking how std your stdio is..." >&4
15415 $cat >try.c <<EOP
15416 #include <stdio.h>
15417 #define FILE_ptr(fp)    $stdio_ptr
15418 #define FILE_cnt(fp)    $stdio_cnt
15419 int main() {
15420         FILE *fp = fopen("try.c", "r");
15421         char c = getc(fp);
15422         if (
15423                 18 <= FILE_cnt(fp) &&
15424                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15425         )
15426                 exit(0);
15427         exit(1);
15428 }
15429 EOP
15430 val="$undef"
15431 set try
15432 if eval $compile && $to try.c; then
15433         if $run ./try; then
15434                 echo "Your stdio acts pretty std."
15435                 val="$define"
15436         else
15437                 echo "Your stdio isn't very std."
15438         fi
15439 else
15440         echo "Your stdio doesn't appear very std."
15441 fi
15442 $rm -f try.c try
15443
15444 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15445 # direct buffer manipulation no longer works.  The Configure tests
15446 # should be changed to correctly detect this, but until then,
15447 # the following check should at least let perl compile and run.
15448 # (This quick fix should be updated before 5.8.1.)
15449 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15450 # A. Dougherty, June 3, 2002.
15451 case "$d_gnulibc" in
15452 $define)
15453         case "$gnulibc_version" in
15454         2.[01]*)  ;;
15455         2.2) ;;
15456         2.2.[0-9]) ;;
15457         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15458                 val="$undef"
15459                 ;;
15460         esac
15461         ;;
15462 esac
15463 set d_stdstdio
15464 eval $setvar
15465
15466 : Can _ptr be used as an lvalue?
15467 case "$d_stdstdio$ptr_lval" in
15468 $define$define) val=$define ;;
15469 *) val=$undef ;;
15470 esac
15471 set d_stdio_ptr_lval
15472 eval $setvar
15473
15474 : Can _cnt be used as an lvalue?
15475 case "$d_stdstdio$cnt_lval" in
15476 $define$define) val=$define ;;
15477 *) val=$undef ;;
15478 esac
15479 set d_stdio_cnt_lval
15480 eval $setvar
15481
15482
15483 : test whether setting _ptr sets _cnt as a side effect
15484 d_stdio_ptr_lval_sets_cnt="$undef"
15485 d_stdio_ptr_lval_nochange_cnt="$undef"
15486 case "$d_stdio_ptr_lval$d_stdstdio" in
15487 $define$define)
15488         echo "Checking to see what happens if we set the stdio ptr..." >&4
15489 $cat >try.c <<EOP
15490 #include <stdio.h>
15491 /* Can we scream? */
15492 /* Eat dust sed :-) */
15493 /* In the buffer space, no one can hear you scream. */
15494 #define FILE_ptr(fp)    $stdio_ptr
15495 #define FILE_cnt(fp)    $stdio_cnt
15496 #include <sys/types.h>
15497 int main() {
15498         FILE *fp = fopen("try.c", "r");
15499         int c;
15500         char *ptr;
15501         size_t cnt;
15502         if (!fp) {
15503             puts("Fail even to read");
15504             exit(1);
15505         }
15506         c = getc(fp); /* Read away the first # */
15507         if (c == EOF) {
15508             puts("Fail even to read");
15509             exit(1);
15510         }
15511         if (!(
15512                 18 <= FILE_cnt(fp) &&
15513                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15514         )) {
15515                 puts("Fail even to read");
15516                 exit (1);
15517         }
15518         ptr = (char*) FILE_ptr(fp);
15519         cnt = (size_t)FILE_cnt(fp);
15520
15521         FILE_ptr(fp) += 42;
15522
15523         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15524                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15525                 exit (1);
15526         }
15527         if (FILE_cnt(fp) <= 20) {
15528                 printf ("Fail (<20 chars to test)");
15529                 exit (1);
15530         }
15531         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15532                 puts("Fail compare");
15533                 exit (1);
15534         }
15535         if (cnt == FILE_cnt(fp)) {
15536                 puts("Pass_unchanged");
15537                 exit (0);
15538         }       
15539         if (FILE_cnt(fp) == (cnt - 42)) {
15540                 puts("Pass_changed");
15541                 exit (0);
15542         }
15543         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15544         return 1;
15545
15546 }
15547 EOP
15548         set try
15549         if eval $compile && $to try.c; then
15550                 case `$run ./try` in
15551                 Pass_changed)
15552                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15553                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15554                 Pass_unchanged)
15555                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15556                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15557                 Fail*)
15558                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15559                 *)
15560                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15561         esac
15562         else
15563                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15564         fi
15565         $rm -f try.c try
15566         ;;
15567 esac
15568
15569 : see if _base is also standard
15570 val="$undef"
15571 case "$d_stdstdio" in
15572 $define)
15573         $cat >try.c <<EOP
15574 #include <stdio.h>
15575 #define FILE_base(fp)   $stdio_base
15576 #define FILE_bufsiz(fp) $stdio_bufsiz
15577 int main() {
15578         FILE *fp = fopen("try.c", "r");
15579         char c = getc(fp);
15580         if (
15581                 19 <= FILE_bufsiz(fp) &&
15582                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15583         )
15584                 exit(0);
15585         exit(1);
15586 }
15587 EOP
15588         set try
15589         if eval $compile && $to try.c; then
15590                 if $run ./try; then
15591                         echo "And its _base field acts std."
15592                         val="$define"
15593                 else
15594                         echo "But its _base field isn't std."
15595                 fi
15596         else
15597                 echo "However, it seems to be lacking the _base field."
15598         fi
15599         $rm -f try.c try
15600         ;;
15601 esac
15602 set d_stdiobase
15603 eval $setvar
15604
15605 $cat >&4 <<EOM
15606 Checking how to access stdio streams by file descriptor number...
15607 EOM
15608 case "$stdio_stream_array" in
15609 '')     $cat >try.c <<EOCP
15610 #include <stdio.h>
15611 int main() {
15612   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15613     printf("yes\n");
15614 }
15615 EOCP
15616         for s in _iob __iob __sF
15617         do
15618                 set try -DSTDIO_STREAM_ARRAY=$s
15619                 if eval $compile; then
15620                         case "`$run ./try`" in
15621                         yes)    stdio_stream_array=$s; break ;;
15622                         esac
15623                 fi
15624         done
15625         $rm -f try.* try$exe_ext
15626 esac
15627 case "$stdio_stream_array" in
15628 '')     $cat >&4 <<EOM
15629 I can't figure out how to access stdio streams by file descriptor number.
15630 EOM
15631         d_stdio_stream_array="$undef"
15632         ;;
15633 *)      $cat >&4 <<EOM
15634 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15635 EOM
15636         d_stdio_stream_array="$define"
15637         ;;
15638 esac
15639
15640 : see if strcoll exists
15641 set strcoll d_strcoll
15642 eval $inlibc
15643
15644 : check for structure copying
15645 echo " "
15646 echo "Checking to see if your C compiler can copy structs..." >&4
15647 $cat >try.c <<'EOCP'
15648 main()
15649 {
15650         struct blurfl {
15651                 int dyick;
15652         } foo, bar;
15653
15654         foo = bar;
15655 }
15656 EOCP
15657 if $cc -c try.c >/dev/null 2>&1 ; then
15658         val="$define"
15659         echo "Yup, it can."
15660 else
15661         val="$undef"
15662         echo "Nope, it can't."
15663 fi
15664 set d_strctcpy
15665 eval $setvar
15666 $rm -f try.*
15667
15668 : see if strerror and/or sys_errlist[] exist
15669 echo " "
15670 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15671     if set strerror val -f d_strerror; eval $csym; $val; then
15672                 echo 'strerror() found.' >&4
15673                 d_strerror="$define"
15674                 d_strerrm='strerror(e)'
15675                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15676                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15677                         d_syserrlst="$define"
15678                 else
15679                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15680                         d_syserrlst="$undef"
15681                 fi
15682     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15683                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15684                 echo 'strerror() found in string header.' >&4
15685                 d_strerror="$define"
15686                 d_strerrm='strerror(e)'
15687                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15688                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15689                                 d_syserrlst="$define"
15690                 else
15691                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15692                         d_syserrlst="$undef"
15693                 fi
15694     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15695                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15696                 d_strerror="$undef"
15697                 d_syserrlst="$define"
15698                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15699     else
15700                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15701                 d_strerror="$undef"
15702                 d_syserrlst="$undef"
15703                 d_strerrm='"unknown"'
15704     fi
15705 fi
15706
15707 : see if strerror_r exists
15708 set strerror_r d_strerror_r
15709 eval $inlibc
15710 case "$d_strerror_r" in
15711 "$define")
15712         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15713         case "$d_strerror_r_proto:$usethreads" in
15714         ":define")      d_strerror_r_proto=define
15715                 set d_strerror_r_proto strerror_r $hdrs
15716                 eval $hasproto ;;
15717         *)      ;;
15718         esac
15719         case "$d_strerror_r_proto" in
15720         define)
15721         case "$strerror_r_proto" in
15722         ''|0) try='int strerror_r(int, char*, size_t);'
15723         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15724         esac
15725         case "$strerror_r_proto" in
15726         ''|0) try='int strerror_r(int, char*, int);'
15727         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15728         esac
15729         case "$strerror_r_proto" in
15730         ''|0) try='char* strerror_r(int, char*, size_t);'
15731         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15732         esac
15733         case "$strerror_r_proto" in
15734         ''|0)   d_strerror_r=undef
15735                 strerror_r_proto=0
15736                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15737         * )     case "$strerror_r_proto" in
15738                 REENTRANT_PROTO*) ;;
15739                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15740                 esac
15741                 echo "Prototype: $try" ;;
15742         esac
15743         ;;
15744         *)      case "$usethreads" in
15745                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15746                 esac
15747                 d_strerror_r=undef
15748                 strerror_r_proto=0
15749                 ;;
15750         esac
15751         ;;
15752 *)      strerror_r_proto=0
15753         ;;
15754 esac
15755
15756 : see if strftime exists
15757 set strftime d_strftime
15758 eval $inlibc
15759
15760 : see if strtod exists
15761 set strtod d_strtod
15762 eval $inlibc
15763
15764 : see if strtol exists
15765 set strtol d_strtol
15766 eval $inlibc
15767
15768 : see if strtold exists
15769 set strtold d_strtold
15770 eval $inlibc
15771
15772 : see if strtoll exists
15773 set strtoll d_strtoll
15774 eval $inlibc
15775
15776 case "$d_longlong-$d_strtoll" in
15777 "$define-$define")
15778         $cat <<EOM
15779 Checking whether your strtoll() works okay...
15780 EOM
15781         $cat >try.c <<'EOCP'
15782 #include <errno.h>
15783 #ifdef __hpux
15784 #define strtoll __strtoll
15785 #endif
15786 #ifdef __EMX__
15787 #define strtoll _strtoll
15788 #endif
15789 #include <stdio.h>
15790 extern long long int strtoll(char *s, char **, int); 
15791 static int bad = 0;
15792 int check(char *s, long long ell, int een) {
15793         long long gll;
15794         errno = 0;
15795         gll = strtoll(s, 0, 10);
15796         if (!((gll == ell) && (errno == een)))
15797                 bad++;
15798 }
15799 int main() {
15800         check(" 1",                                      1LL, 0);
15801         check(" 0",                                      0LL, 0);
15802         check("-1",                                     -1LL, 0);
15803         check("-9223372036854775808", -9223372036854775808LL, 0);
15804         check("-9223372036854775808", -9223372036854775808LL, 0);
15805         check(" 9223372036854775807",  9223372036854775807LL, 0);
15806         check("-9223372036854775808", -9223372036854775808LL, 0);
15807         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15808         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15809         if (!bad)
15810                 printf("ok\n");
15811 }
15812 EOCP
15813         set try
15814         if eval $compile; then
15815                 yyy=`$run ./try`
15816                 case "$yyy" in
15817                 ok) echo "Your strtoll() seems to be working okay." ;;
15818                 *) cat <<EOM >&4
15819 Your strtoll() doesn't seem to be working okay.
15820 EOM
15821                    d_strtoll="$undef"
15822                    ;;
15823                 esac
15824         else
15825                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15826                 d_strtoll="$undef"
15827         fi
15828         ;;
15829 esac
15830
15831 : see if strtoq exists
15832 set strtoq d_strtoq
15833 eval $inlibc
15834
15835 : see if strtoul exists
15836 set strtoul d_strtoul
15837 eval $inlibc
15838
15839 case "$d_strtoul" in
15840 "$define")
15841         $cat <<EOM
15842 Checking whether your strtoul() works okay...
15843 EOM
15844         $cat >try.c <<'EOCP'
15845 #include <errno.h>
15846 #include <stdio.h>
15847 extern unsigned long int strtoul(char *s, char **, int); 
15848 static int bad = 0;
15849 void check(char *s, unsigned long eul, int een) {
15850         unsigned long gul;
15851         errno = 0;
15852         gul = strtoul(s, 0, 10);
15853         if (!((gul == eul) && (errno == een)))
15854                 bad++;
15855 }
15856 int main() {
15857         check(" 1", 1L, 0);
15858         check(" 0", 0L, 0);
15859 EOCP
15860         case "$longsize" in
15861         8)
15862             $cat >>try.c <<'EOCP'
15863         check("18446744073709551615", 18446744073709551615UL, 0);
15864         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15865 #if 0 /* strtoul() for /^-/ strings is undefined. */
15866         check("-1", 18446744073709551615UL, 0);
15867         check("-18446744073709551614", 2, 0);
15868         check("-18446744073709551615", 1, 0);
15869         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15870         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15871 #endif
15872 EOCP
15873                 ;;
15874         4)
15875                     $cat >>try.c <<'EOCP'
15876         check("4294967295", 4294967295UL, 0);
15877         check("4294967296", 4294967295UL, ERANGE);
15878 #if 0 /* strtoul() for /^-/ strings is undefined. */
15879         check("-1", 4294967295UL, 0);
15880         check("-4294967294", 2, 0);
15881         check("-4294967295", 1, 0);
15882         check("-4294967296", 4294967295UL, ERANGE);
15883         check("-4294967297", 4294967295UL, ERANGE);
15884 #endif
15885 EOCP
15886                 ;;
15887         *)
15888 : Should we write these tests to be more portable by sprintf-ing
15889 : ~0 and then manipulating that char string as input for strtol?
15890                 ;;
15891         esac
15892         $cat >>try.c <<'EOCP'
15893         if (!bad)
15894                 printf("ok\n");
15895         return 0;
15896 }
15897 EOCP
15898         set try
15899         if eval $compile; then
15900                 case "`$run ./try`" in
15901                 ok) echo "Your strtoul() seems to be working okay." ;;
15902                 *) cat <<EOM >&4
15903 Your strtoul() doesn't seem to be working okay.
15904 EOM
15905                    d_strtoul="$undef"
15906                    ;;
15907                 esac
15908         fi
15909         ;;
15910 esac
15911
15912 : see if strtoull exists
15913 set strtoull d_strtoull
15914 eval $inlibc
15915
15916 case "$d_longlong-$d_strtoull" in
15917 "$define-$define")
15918         $cat <<EOM
15919 Checking whether your strtoull() works okay...
15920 EOM
15921         $cat >try.c <<'EOCP'
15922 #include <errno.h>
15923 #ifdef __hpux
15924 #define strtoull __strtoull
15925 #endif
15926 #include <stdio.h>
15927 extern unsigned long long int strtoull(char *s, char **, int); 
15928 static int bad = 0;
15929 int check(char *s, long long eull, int een) {
15930         long long gull;
15931         errno = 0;
15932         gull = strtoull(s, 0, 10);
15933         if (!((gull == eull) && (errno == een)))
15934                 bad++;
15935 }
15936 int main() {
15937         check(" 1",                                        1LL, 0);
15938         check(" 0",                                        0LL, 0);
15939         check("18446744073709551615",  18446744073709551615ULL, 0);
15940         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15941 #if 0 /* strtoull() for /^-/ strings is undefined. */
15942         check("-1",                    18446744073709551615ULL, 0);
15943         check("-18446744073709551614",                     2LL, 0);
15944         check("-18446744073709551615",                     1LL, 0);
15945         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15946         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15947 #endif
15948         if (!bad)
15949                 printf("ok\n");
15950 }
15951 EOCP
15952         set try
15953         if eval $compile; then
15954                 case "`$run ./try`" in
15955                 ok) echo "Your strtoull() seems to be working okay." ;;
15956                 *) cat <<EOM >&4
15957 Your strtoull() doesn't seem to be working okay.
15958 EOM
15959                    d_strtoull="$undef"
15960                    ;;
15961                 esac
15962         fi
15963         ;;
15964 esac
15965
15966 : see if strtouq exists
15967 set strtouq d_strtouq
15968 eval $inlibc
15969
15970 case "$d_strtouq" in
15971 "$define")
15972         $cat <<EOM
15973 Checking whether your strtouq() works okay...
15974 EOM
15975         $cat >try.c <<'EOCP'
15976 #include <errno.h>
15977 #include <stdio.h>
15978 extern unsigned long long int strtouq(char *s, char **, int); 
15979 static int bad = 0;
15980 void check(char *s, unsigned long long eull, int een) {
15981         unsigned long long gull;
15982         errno = 0;
15983         gull = strtouq(s, 0, 10);
15984         if (!((gull == eull) && (errno == een)))
15985                 bad++;
15986 }
15987 int main() {
15988         check(" 1",                                        1LL, 0);
15989         check(" 0",                                        0LL, 0);
15990         check("18446744073709551615",  18446744073709551615ULL, 0);
15991         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15992 #if 0 /* strtouq() for /^-/ strings is undefined. */
15993         check("-1",                    18446744073709551615ULL, 0);
15994         check("-18446744073709551614",                     2LL, 0);
15995         check("-18446744073709551615",                     1LL, 0);
15996         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15997         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15998 #endif
15999         if (!bad)
16000                 printf("ok\n");
16001         return 0;
16002 }
16003 EOCP
16004         set try
16005         if eval $compile; then
16006                 case "`$run ./try`" in
16007                 ok) echo "Your strtouq() seems to be working okay." ;;
16008                 *) cat <<EOM >&4
16009 Your strtouq() doesn't seem to be working okay.
16010 EOM
16011                    d_strtouq="$undef"
16012                    ;;
16013                 esac
16014         fi
16015         ;;
16016 esac
16017
16018 : see if strxfrm exists
16019 set strxfrm d_strxfrm
16020 eval $inlibc
16021
16022 : see if symlink exists
16023 set symlink d_symlink
16024 eval $inlibc
16025
16026 : see if syscall exists
16027 set syscall d_syscall
16028 eval $inlibc
16029
16030 : see if prototype for syscall is available
16031 echo " "
16032 set d_syscallproto syscall $i_unistd unistd.h
16033 eval $hasproto
16034
16035 : see if sysconf exists
16036 set sysconf d_sysconf
16037 eval $inlibc
16038
16039 : see if system exists
16040 set system d_system
16041 eval $inlibc
16042
16043 : see if tcgetpgrp exists
16044 set tcgetpgrp d_tcgetpgrp
16045 eval $inlibc
16046
16047 : see if tcsetpgrp exists
16048 set tcsetpgrp d_tcsetpgrp
16049 eval $inlibc
16050
16051 : see if prototype for telldir is available
16052 echo " "
16053 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16054 eval $hasproto
16055
16056 : see if time exists
16057 echo " "
16058 if test "X$d_time" = X -o X"$timetype" = X; then
16059     if set time val -f d_time; eval $csym; $val; then
16060                 echo 'time() found.' >&4
16061                 val="$define"
16062                 rp="What is the type returned by time() on this system?"
16063                 set time_t timetype long stdio.h sys/types.h
16064                 eval $typedef_ask
16065     else
16066                 echo 'time() not found, hope that will do.' >&4
16067                 val="$undef"
16068                 timetype='int';
16069     fi
16070     set d_time
16071     eval $setvar
16072 fi
16073
16074 : see if this is a sys/times.h system
16075 set sys/times.h i_systimes
16076 eval $inhdr
16077
16078 : see if times exists
16079 echo " "
16080 if set times val -f d_times; eval $csym; $val; then
16081         echo 'times() found.' >&4
16082         d_times="$define"
16083         inc=''
16084         case "$i_systimes" in
16085         "$define") inc='sys/times.h';;
16086         esac
16087         rp="What is the type returned by times() on this system?"
16088         set clock_t clocktype long stdio.h sys/types.h $inc
16089         eval $typedef_ask
16090 else
16091         echo 'times() NOT found, hope that will do.' >&4
16092         d_times="$undef"
16093         clocktype='int'
16094 fi
16095
16096 : see if tmpnam_r exists
16097 set tmpnam_r d_tmpnam_r
16098 eval $inlibc
16099 case "$d_tmpnam_r" in
16100 "$define")
16101         hdrs="$i_systypes sys/types.h define stdio.h "
16102         case "$d_tmpnam_r_proto:$usethreads" in
16103         ":define")      d_tmpnam_r_proto=define
16104                 set d_tmpnam_r_proto tmpnam_r $hdrs
16105                 eval $hasproto ;;
16106         *)      ;;
16107         esac
16108         case "$d_tmpnam_r_proto" in
16109         define)
16110         case "$tmpnam_r_proto" in
16111         ''|0) try='char* tmpnam_r(char*);'
16112         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16113         esac
16114         case "$tmpnam_r_proto" in
16115         ''|0)   d_tmpnam_r=undef
16116                 tmpnam_r_proto=0
16117                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16118         * )     case "$tmpnam_r_proto" in
16119                 REENTRANT_PROTO*) ;;
16120                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16121                 esac
16122                 echo "Prototype: $try" ;;
16123         esac
16124         ;;
16125         *)      case "$usethreads" in
16126                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16127                 esac
16128                 d_tmpnam_r=undef
16129                 tmpnam_r_proto=0
16130                 ;;
16131         esac
16132         ;;
16133 *)      tmpnam_r_proto=0
16134         ;;
16135 esac
16136
16137 : see if truncate exists
16138 set truncate d_truncate
16139 eval $inlibc
16140
16141 : see if ttyname_r exists
16142 set ttyname_r d_ttyname_r
16143 eval $inlibc
16144 case "$d_ttyname_r" in
16145 "$define")
16146         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16147         case "$d_ttyname_r_proto:$usethreads" in
16148         ":define")      d_ttyname_r_proto=define
16149                 set d_ttyname_r_proto ttyname_r $hdrs
16150                 eval $hasproto ;;
16151         *)      ;;
16152         esac
16153         case "$d_ttyname_r_proto" in
16154         define)
16155         case "$ttyname_r_proto" in
16156         ''|0) try='int ttyname_r(int, char*, size_t);'
16157         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16158         esac
16159         case "$ttyname_r_proto" in
16160         ''|0) try='int ttyname_r(int, char*, int);'
16161         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16162         esac
16163         case "$ttyname_r_proto" in
16164         ''|0) try='char* ttyname_r(int, char*, int);'
16165         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16166         esac
16167         case "$ttyname_r_proto" in
16168         ''|0)   d_ttyname_r=undef
16169                 ttyname_r_proto=0
16170                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16171         * )     case "$ttyname_r_proto" in
16172                 REENTRANT_PROTO*) ;;
16173                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16174                 esac
16175                 echo "Prototype: $try" ;;
16176         esac
16177         ;;
16178         *)      case "$usethreads" in
16179                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16180                 esac
16181                 d_ttyname_r=undef
16182                 ttyname_r_proto=0
16183                 ;;
16184         esac
16185         ;;
16186 *)      ttyname_r_proto=0
16187         ;;
16188 esac
16189
16190 : see if tzname[] exists
16191 echo " "
16192 if set tzname val -a d_tzname; eval $csym; $val; then
16193         val="$define"
16194         echo 'tzname[] found.' >&4
16195 else
16196         val="$undef"
16197         echo 'tzname[] NOT found.' >&4
16198 fi
16199 set d_tzname
16200 eval $setvar
16201
16202 case "$osname" in
16203 next|rhapsody|darwin) multiarch="$define" ;;
16204 esac
16205 case "$multiarch" in
16206 ''|[nN]*) multiarch="$undef" ;;
16207 esac
16208
16209 : check for ordering of bytes in a UV
16210 echo " "
16211 case "$usecrosscompile$multiarch" in
16212 *$define*)
16213         $cat <<EOM
16214 You seem to be either cross-compiling or doing a multiarchitecture build,
16215 skipping the byteorder check.
16216
16217 EOM
16218         byteorder='ffff'
16219         ;;
16220 *)
16221         case "$byteorder" in
16222         '')
16223                 $cat <<'EOM'
16224 In the following, larger digits indicate more significance.  A big-endian
16225 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16226 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16227 machines may have weird orders like 3412.  A Cray will report 87654321,
16228 an Alpha will report 12345678. If the test program works the default is
16229 probably right.
16230 I'm now running the test program...
16231 EOM
16232                 $cat >try.c <<EOCP
16233 #include <stdio.h>
16234 #include <sys/types.h>
16235 typedef $uvtype UV;
16236 int main()
16237 {
16238         int i;
16239         union {
16240                 UV l;
16241                 char c[$uvsize];
16242         } u;
16243
16244         if ($uvsize > 4)
16245                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16246         else
16247                 u.l = (UV)0x04030201;
16248         for (i = 0; i < $uvsize; i++)
16249                 printf("%c", u.c[i]+'0');
16250         printf("\n");
16251         exit(0);
16252 }
16253 EOCP
16254                 xxx_prompt=y
16255                 set try
16256                 if eval $compile && ./try > /dev/null; then
16257                         dflt=`$run ./try`
16258                         case "$dflt" in
16259                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16260                                 echo "(The test program ran ok.)"
16261                                 echo "byteorder=$dflt"
16262                                 xxx_prompt=n
16263                         ;;
16264                         ????|????????) echo "(The test program ran ok.)" ;;
16265                         *) echo "(The test program didn't run right for some reason.)" ;;
16266                         esac
16267                 else
16268                         dflt='4321'
16269                         cat <<'EOM'
16270 (I can't seem to compile the test program.  Guessing big-endian...)
16271 EOM
16272                 fi
16273                 case "$xxx_prompt" in
16274                 y)
16275                         rp="What is the order of bytes in $uvtype?"
16276                         . ./myread
16277                         byteorder="$ans"
16278                         ;;
16279                 *)      byteorder=$dflt
16280                         ;;
16281                 esac
16282                 ;;
16283         esac
16284         $rm -f try.c try
16285         ;;
16286 esac
16287
16288
16289 $cat <<EOM
16290
16291 Checking to see whether you can access character data unalignedly...
16292 EOM
16293 case "$d_u32align" in
16294 '')   $cat >try.c <<EOCP
16295 #include <stdio.h>
16296 #define U32 $u32type
16297 #define BYTEORDER 0x$byteorder
16298 #define U8 $u8type
16299 #include <signal.h>
16300 #ifdef SIGBUS
16301 $signal_t bletch(s) int s; { exit(4); }
16302 #endif
16303 int main() {
16304 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16305     U8 buf[8];
16306     U32 *up;
16307     int i;
16308
16309     if (sizeof(U32) != 4) {
16310         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16311         exit(1);
16312     }
16313
16314     fflush(stdout);
16315
16316 #ifdef SIGBUS
16317     signal(SIGBUS, bletch);
16318 #endif
16319
16320     buf[0] = 0;
16321     buf[1] = 0;
16322     buf[2] = 0;
16323     buf[3] = 1;
16324     buf[5] = 0;
16325     buf[6] = 0;
16326     buf[7] = 0;
16327     buf[8] = 1;
16328
16329     for (i = 0; i < 4; i++) {
16330         up = (U32*)(buf + i);
16331         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16332                (*up == 1 << (8*(3-i)))  /* little-endian */
16333               )
16334            )
16335         {
16336             printf("read failed (%x)\n", *up);
16337             exit(2);
16338         }
16339     }
16340
16341     /* write test */
16342     for (i = 0; i < 4; i++) {
16343         up = (U32*)(buf + i);
16344         *up = 0xBeef;
16345         if (*up != 0xBeef) {
16346             printf("write failed (%x)\n", *up);
16347             exit(3);
16348         }
16349     }
16350
16351     exit(0);
16352 #else
16353     printf("1\n");
16354     exit(1);
16355 #endif
16356     return 0;
16357 }
16358 EOCP
16359 set try
16360 if eval $compile_ok; then
16361         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16362         $run ./try 2>&1 >/dev/null
16363         case "$?" in
16364         0)      cat >&4 <<EOM
16365 You can access character data pretty unalignedly.
16366 EOM
16367                 d_u32align="$undef"
16368                 ;;
16369         *)      cat >&4 <<EOM
16370 It seems that you must access character data in an aligned manner.
16371 EOM
16372                 d_u32align="$define"
16373                 ;;
16374         esac
16375 else
16376         rp='Can you access character data at unaligned addresses?'
16377         dflt='n'
16378         . ./myread
16379         case "$ans" in
16380         [yY]*)  d_u32align="$undef"  ;;
16381         *)      d_u32align="$define" ;;
16382         esac
16383 fi
16384 $rm -f core core.try.* try.core
16385 ;;
16386 esac
16387
16388 : see if ualarm exists
16389 set ualarm d_ualarm
16390 eval $inlibc
16391
16392 : see if umask exists
16393 set umask d_umask
16394 eval $inlibc
16395
16396 : see if unordered exists
16397 set unordered d_unordered
16398 eval $inlibc
16399
16400 : see if usleep exists
16401 set usleep d_usleep
16402 eval $inlibc
16403
16404 : see if prototype for usleep is available
16405 echo " "
16406 set d_usleepproto usleep $i_unistd unistd.h
16407 eval $hasproto
16408
16409 : see if ustat exists
16410 set ustat d_ustat
16411 eval $inlibc
16412
16413 : backward compatibility for d_hvfork
16414 if test X$d_hvfork != X; then
16415         d_vfork="$d_hvfork"
16416         d_hvfork=''
16417 fi
16418 : see if there is a vfork
16419 val=''
16420 set vfork val
16421 eval $inlibc
16422
16423 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16424 : perl on Solaris 2.x, and probably elsewhere.
16425 case "$val" in
16426 $define)
16427         echo " "
16428         case "$usevfork" in
16429         false) dflt='n';;
16430         *) dflt='y';;
16431         esac
16432         cat <<'EOM'
16433  
16434 Perl can only use a vfork() that doesn't suffer from strict
16435 restrictions on calling functions or modifying global data in
16436 the child.  For example, glibc-2.1 contains such a vfork()
16437 that is unsuitable.  If your system provides a proper fork()
16438 call, chances are that you do NOT want perl to use vfork().
16439
16440 EOM
16441         rp="Do you still want to use vfork()?"
16442         . ./myread
16443         case "$ans" in
16444         y|Y) ;;
16445         *)
16446                 echo "Ok, we won't use vfork()."
16447                 val="$undef"
16448                 ;;
16449         esac
16450         ;;
16451 esac
16452 set d_vfork
16453 eval $setvar
16454 case "$d_vfork" in
16455 $define) usevfork='true';;
16456 *) usevfork='false';;
16457 esac
16458
16459 : see if closedir exists
16460 set closedir d_closedir
16461 eval $inlibc
16462
16463 case "$d_closedir" in
16464 "$define")
16465         echo " "
16466         echo "Checking whether closedir() returns a status..." >&4
16467         cat > try.c <<EOM
16468 #$i_dirent I_DIRENT             /**/
16469 #$i_sysdir I_SYS_DIR            /**/
16470 #$i_sysndir I_SYS_NDIR          /**/
16471 #$i_systypes I_SYS_TYPES        /**/
16472
16473 #if defined(I_SYS_TYPES)
16474 #include <sys/types.h>
16475 #endif
16476 #if defined(I_DIRENT)
16477 #include <dirent.h>
16478 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16479 #include <sys/dir.h>
16480 #endif
16481 #else
16482 #ifdef I_SYS_NDIR
16483 #include <sys/ndir.h>
16484 #else
16485 #ifdef I_SYS_DIR
16486 #ifdef hp9000s500
16487 #include <ndir.h>       /* may be wrong in the future */
16488 #else
16489 #include <sys/dir.h>
16490 #endif
16491 #endif
16492 #endif
16493 #endif 
16494 int main() { return closedir(opendir(".")); }
16495 EOM
16496         set try
16497         if eval $compile_ok; then
16498                 if $run ./try > /dev/null 2>&1 ; then
16499                         echo "Yes, it does."
16500                         val="$undef"
16501                 else
16502                         echo "No, it doesn't."
16503                         val="$define"
16504                 fi
16505         else
16506                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16507                 val="$define"
16508         fi
16509         ;;
16510 *)
16511         val="$undef";
16512         ;;
16513 esac
16514 set d_void_closedir
16515 eval $setvar
16516 $rm -f try try.*
16517 : see if there is a wait4
16518 set wait4 d_wait4
16519 eval $inlibc
16520
16521 : see if waitpid exists
16522 set waitpid d_waitpid
16523 eval $inlibc
16524
16525 : see if wcstombs exists
16526 set wcstombs d_wcstombs
16527 eval $inlibc
16528
16529 : see if wctomb exists
16530 set wctomb d_wctomb
16531 eval $inlibc
16532
16533 : see if writev exists
16534 set writev d_writev
16535 eval $inlibc
16536
16537 : preserve RCS keywords in files with variable substitution, grrr
16538 Date='$Date'
16539 Id='$Id'
16540 Log='$Log'
16541 RCSfile='$RCSfile'
16542 Revision='$Revision'
16543
16544 : check for alignment requirements
16545 echo " "
16546 case "$usecrosscompile$multiarch" in
16547 *$define*)
16548         $cat <<EOM
16549 You seem to be either cross-compiling or doing a multiarchitecture build,
16550 skipping the memory alignment check.
16551
16552 EOM
16553         case "$alignbytes" in
16554         '') alignbytes=8 ;;
16555         esac
16556         ;;
16557 *)
16558         case "$alignbytes" in
16559         '') echo "Checking alignment constraints..." >&4
16560                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16561                         $cat >try.c <<'EOCP'
16562 typedef long double NV;
16563 EOCP
16564                 else
16565                         $cat >try.c <<'EOCP'
16566 typedef double NV;
16567 EOCP
16568                 fi
16569                 $cat >>try.c <<'EOCP'
16570 #include <stdio.h>
16571 struct foobar {
16572         char foo;
16573         NV bar;
16574 } try_algn;
16575 int main()
16576 {
16577     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16578     return(0);
16579 }
16580 EOCP
16581                 set try
16582                 if eval $compile_ok; then
16583                         dflt=`$run ./try`
16584                 else
16585                         dflt='8'
16586                         echo "(I can't seem to compile the test program...)"
16587                 fi
16588                 ;;
16589         *) dflt="$alignbytes"
16590                 ;;
16591         esac
16592         rp="Doubles must be aligned on a how-many-byte boundary?"
16593         . ./myread
16594         alignbytes="$ans"
16595         $rm -f try.c try
16596         ;;
16597 esac
16598
16599
16600 : set the base revision
16601 baserev=5.0
16602
16603 : how do we catenate cpp tokens here?
16604 echo " "
16605 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16606 $cat >cpp_stuff.c <<'EOCP'
16607 #define RCAT(a,b)a/**/b
16608 #define ACAT(a,b)a ## b
16609 RCAT(Rei,ser)
16610 ACAT(Cir,cus)
16611 EOCP
16612 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16613 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16614         echo "Oh!  Smells like ANSI's been here." >&4
16615         echo "We can catify or stringify, separately or together!"
16616         cpp_stuff=42
16617 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16618         echo "Ah, yes!  The good old days!" >&4
16619         echo "However, in the good old days we don't know how to stringify and"
16620         echo "catify at the same time."
16621         cpp_stuff=1
16622 else
16623         $cat >&4 <<EOM
16624 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16625 to have to edit the values of CAT[2-5] in config.h...
16626 EOM
16627         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16628 fi
16629 $rm -f cpp_stuff.*
16630
16631 : see if this is a db.h system
16632 set db.h i_db
16633 eval $inhdr
16634
16635 case "$i_db" in
16636 $define)
16637         : Check db version.
16638         echo " "
16639         echo "Checking Berkeley DB version ..." >&4
16640         $cat >try.c <<EOCP
16641 #$d_const HASCONST
16642 #ifndef HASCONST
16643 #define const
16644 #endif
16645 #include <sys/types.h>
16646 #include <stdio.h>
16647 #include <db.h>
16648 int main(int argc, char *argv[])
16649 {
16650 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16651     int Major, Minor, Patch ;
16652     unsigned long Version ;
16653     (void)db_version(&Major, &Minor, &Patch) ;
16654     if (argc == 2) {
16655         printf("%d %d %d %d %d %d\n",
16656                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16657                Major, Minor, Patch);
16658         exit(0);
16659     }
16660     printf("You have Berkeley DB Version 2 or greater.\n");
16661
16662     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16663                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16664     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16665                 Major, Minor, Patch) ;
16666
16667     /* check that db.h & libdb are compatible */
16668     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16669         printf("db.h and libdb are incompatible.\n") ;
16670         exit(3);        
16671     }
16672
16673     printf("db.h and libdb are compatible.\n") ;
16674
16675     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16676                 + DB_VERSION_PATCH ;
16677
16678     /* needs to be >= 2.3.4 */
16679     if (Version < 2003004) {
16680     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16681         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16682         exit(2);        
16683     }
16684
16685     exit(0);
16686 #else
16687 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16688     if (argc == 2) {
16689         printf("1 0 0\n");
16690         exit(0);
16691     }
16692     printf("You have Berkeley DB Version 1.\n");
16693     exit(0);    /* DB version < 2: the coast is clear. */
16694 #else
16695     exit(1);    /* <db.h> not Berkeley DB? */
16696 #endif
16697 #endif
16698 }
16699 EOCP
16700         set try
16701         if eval $compile_ok && $run ./try; then
16702                 echo 'Looks OK.' >&4
16703                 set `$run ./try 1`
16704                 db_version_major=$1
16705                 db_version_minor=$2
16706                 db_version_patch=$3
16707         else
16708                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16709                 i_db=$undef
16710                 case " $libs " in
16711                 *"-ldb "*)
16712                         : Remove db from list of libraries to use
16713                         echo "Removing unusable -ldb from library list" >&4
16714                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16715                         shift
16716                         libs="$*"
16717                         echo "libs = $libs" >&4
16718                         ;;
16719                 esac
16720         fi
16721         $rm -f try.*
16722         ;;
16723 esac
16724
16725 case "$i_db" in
16726 define)
16727         : Check the return type needed for hash 
16728         echo " "
16729         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16730         $cat >try.c <<EOCP
16731 #$d_const HASCONST
16732 #ifndef HASCONST
16733 #define const
16734 #endif
16735 #include <sys/types.h>
16736 #include <db.h>
16737
16738 #ifndef DB_VERSION_MAJOR
16739 u_int32_t hash_cb (ptr, size)
16740 const void *ptr;
16741 size_t size;
16742 {
16743 }
16744 HASHINFO info;
16745 int main()
16746 {
16747         info.hash = hash_cb;
16748 }
16749 #endif
16750 EOCP
16751         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16752                 if $contains warning try.out >>/dev/null 2>&1 ; then
16753                         db_hashtype='int'
16754                 else
16755                         db_hashtype='u_int32_t'
16756                 fi
16757         else
16758                 : XXX Maybe we should just give up here.
16759                 db_hashtype=u_int32_t
16760                 $cat try.out >&4
16761                 echo "Help:  I can't seem to compile the db test program." >&4
16762                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16763         fi
16764         $rm -f try.*
16765         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16766         ;;
16767 *)      db_hashtype=u_int32_t
16768         ;;
16769 esac
16770 case "$i_db" in
16771 define)
16772         : Check the return type needed for prefix 
16773         echo " "
16774         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16775         cat >try.c <<EOCP
16776 #$d_const HASCONST
16777 #ifndef HASCONST
16778 #define const
16779 #endif
16780 #include <sys/types.h>
16781 #include <db.h>
16782
16783 #ifndef DB_VERSION_MAJOR
16784 size_t prefix_cb (key1, key2)
16785 const DBT *key1;
16786 const DBT *key2;
16787 {
16788 }
16789 BTREEINFO info;
16790 int main()
16791 {
16792         info.prefix = prefix_cb;
16793 }
16794 #endif
16795 EOCP
16796         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16797                 if $contains warning try.out >>/dev/null 2>&1 ; then
16798                         db_prefixtype='int'
16799                 else
16800                         db_prefixtype='size_t'
16801                 fi
16802         else
16803                 db_prefixtype='size_t'
16804                 : XXX Maybe we should just give up here.
16805                 $cat try.out >&4
16806                 echo "Help:  I can't seem to compile the db test program." >&4
16807                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16808         fi
16809         $rm -f try.*
16810         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16811         ;;
16812 *)      db_prefixtype='size_t'
16813         ;;
16814 esac
16815
16816
16817 : How can we generate normalized random numbers ?
16818 echo " "
16819 echo "Looking for a random number function..." >&4
16820 case "$randfunc" in
16821 '')
16822         if set drand48 val -f; eval $csym; $val; then
16823                 dflt="drand48"
16824                 echo "Good, found drand48()." >&4
16825         elif set random val -f; eval $csym; $val; then
16826                 dflt="random"
16827                 echo "OK, found random()." >&4
16828         else
16829                 dflt="rand"
16830                 echo "Yick, looks like I have to use rand()." >&4
16831         fi
16832         echo " "
16833         ;;
16834 *)
16835         dflt="$randfunc"
16836         ;;
16837 esac
16838 cont=true
16839
16840 case "$ccflags" in
16841 *-Dmy_rand=*|*-Dmy_srand=*)
16842         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16843         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16844         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16845         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16846         ;;
16847 esac
16848
16849 while $test "$cont"; do
16850         rp="Use which function to generate random numbers?"
16851         . ./myread
16852         if $test "$ans" = "$dflt"; then
16853                 : null
16854         else
16855                 randbits=''
16856         fi
16857         randfunc="$ans"
16858         if set $ans val -f; eval $csym; $val; then
16859                 cont=''
16860         else
16861                 dflt=y
16862                 rp="I cannot find function $ans. Use that name anyway?"
16863                 . ./myread
16864                 dflt=rand
16865                 case "$ans" in
16866                         [yY]*) cont='';;
16867                 esac
16868         fi
16869         case "$cont" in
16870         '')
16871                 case "$randfunc" in
16872                 drand48)
16873                         drand01="drand48()"
16874                         seedfunc="srand48"
16875                         randbits=48
16876                         randseedtype=long
16877                         ;;
16878                 rand|random)
16879                         case "$randbits" in
16880                         '')
16881 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16882                                 $cat >try.c <<EOCP
16883 #$i_unistd I_UNISTD
16884 #$i_stdlib I_STDLIB
16885 #include <stdio.h>
16886 #ifdef I_UNISTD
16887 #  include <unistd.h>
16888 #endif
16889 #ifdef I_STDLIB
16890 #  include <stdlib.h>
16891 #endif
16892 int main()
16893 {
16894         register int i;
16895         register unsigned long tmp;
16896         register unsigned long max = 0L;
16897
16898         for (i = 1000; i; i--) {
16899                 tmp = (unsigned long) $randfunc();
16900                 if (tmp > max) max = tmp;
16901         }
16902         for (i = 0; max; i++)
16903                 max /= 2;
16904         printf("%d\n",i);
16905 }
16906 EOCP
16907                                 set try
16908                                 if eval $compile_ok; then
16909                                         dflt=`try`
16910                                 else
16911                                         dflt='?'
16912                                         echo "(I can't seem to compile the test program...)"
16913                                 fi
16914                                 ;;
16915                         *)
16916                                 dflt="$randbits"
16917                                 ;;
16918                         esac
16919                         rp="How many bits does your $randfunc() function produce?"
16920                         . ./myread
16921                         randbits="$ans"
16922                         $rm -f try.c try
16923                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16924                         seedfunc="s$randfunc"
16925                         randseedtype=unsigned
16926                         ;;
16927                 *)
16928                         dflt="31"
16929                         rp="How many bits does your $randfunc() function produce?"
16930                         . ./myread
16931                         randbits="$ans"
16932                         seedfunc="s$randfunc"
16933                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16934                         if set $seedfunc val -f; eval $csym; $val; then
16935                                 echo "(Using $seedfunc() to seed random generator)"
16936                         else
16937                                 echo "(Warning: no $seedfunc() to seed random generator)"
16938                                 seedfunc=rand
16939                         fi
16940                         randseedtype=unsigned
16941                         ;;
16942                 esac
16943                 ;;
16944         esac
16945 done
16946
16947 echo " "
16948 echo "Determining whether or not we are on an EBCDIC system..." >&4
16949 $cat >try.c <<'EOM'
16950 int main()
16951 {
16952   if ('M'==0xd4) return 0;
16953   return 1;
16954 }
16955 EOM
16956
16957 val=$undef
16958 set try
16959 if eval $compile_ok; then
16960         if $run ./try; then
16961                 echo "You seem to speak EBCDIC." >&4
16962                 val="$define"
16963         else
16964                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16965         fi
16966 else
16967         echo "I'm unable to compile the test program." >&4
16968         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16969 fi
16970 $rm -f try try.*
16971 set ebcdic
16972 eval $setvar
16973
16974 echo " "
16975 $cat >&4 <<EOM
16976 Checking how to flush all pending stdio output...
16977 EOM
16978 # I only know how to find the first 32 possibly open files on SunOS.
16979 # See also hints/sunos_4_1.sh and util.c  --AD
16980 case "$osname" in
16981 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16982 esac
16983 $cat >>try.c <<EOCP
16984 #include <stdio.h>
16985 #$i_unistd I_UNISTD
16986 #ifdef I_UNISTD
16987 # include <unistd.h>
16988 #endif
16989 #$d_sysconf HAS_SYSCONF
16990 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16991 #ifdef HAS_STDIO_STREAM_ARRAY
16992 # define STDIO_STREAM_ARRAY $stdio_stream_array
16993 #endif
16994 int main() {
16995   FILE* p;
16996   unlink("try.out");
16997   p = fopen("try.out", "w");
16998 #ifdef TRY_FPUTC
16999   fputc('x', p);
17000 #else
17001 # ifdef TRY_FPRINTF
17002   fprintf(p, "x");
17003 # endif
17004 #endif
17005 #ifdef TRY_FFLUSH_NULL
17006   fflush(NULL);
17007 #endif
17008 #ifdef TRY_FFLUSH_ALL
17009   {
17010     long open_max = -1;
17011 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17012     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17013 # else
17014 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17015     open_max = sysconf(_SC_OPEN_MAX);
17016 #  else
17017 #   ifdef FOPEN_MAX
17018     open_max = FOPEN_MAX;
17019 #   else
17020 #    ifdef OPEN_MAX
17021     open_max = OPEN_MAX;
17022 #    else
17023 #     ifdef _NFILE
17024     open_max = _NFILE;
17025 #     endif
17026 #    endif
17027 #   endif
17028 #  endif
17029 # endif 
17030 # ifdef HAS_STDIO_STREAM_ARRAY
17031     if (open_max > 0) {
17032       long i;
17033       for (i = 0; i < open_max; i++)
17034             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17035                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17036                 STDIO_STREAM_ARRAY[i]._flag)
17037                 fflush(&STDIO_STREAM_ARRAY[i]);
17038     }   
17039   }
17040 # endif
17041 #endif
17042   _exit(42);
17043 }
17044 EOCP
17045 : first we have to find out how _not_ to flush
17046 $to try.c
17047 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17048     output=''
17049     set try -DTRY_FPUTC
17050     if eval $compile; then
17051             $run ./try 2>/dev/null
17052             code="$?"
17053             $from try.out
17054             if $test ! -s try.out -a "X$code" = X42; then
17055                 output=-DTRY_FPUTC
17056             fi
17057     fi
17058     case "$output" in
17059     '')
17060             set try -DTRY_FPRINTF
17061             if eval $compile; then
17062                     $run ./try 2>/dev/null
17063                     code="$?"
17064                     $from try.out
17065                     if $test ! -s try.out -a "X$code" = X42; then
17066                         output=-DTRY_FPRINTF
17067                     fi
17068             fi
17069         ;;
17070     esac
17071 fi
17072 : check for fflush NULL behaviour
17073 case "$fflushNULL" in
17074 '')     set try -DTRY_FFLUSH_NULL $output
17075         if eval $compile; then
17076                 $run ./try 2>/dev/null
17077                 code="$?"
17078                 $from try.out
17079                 if $test -s try.out -a "X$code" = X42; then
17080                         fflushNULL="`$cat try.out`"
17081                 else
17082                         if $test "X$code" != X42; then
17083                                 $cat >&4 <<EOM
17084 (If this test failed, don't worry, we'll try another method shortly.)
17085 EOM
17086                         fi
17087                 fi
17088         fi
17089         $rm -f core try.core core.try.*
17090         case "$fflushNULL" in
17091         x)      $cat >&4 <<EOM
17092 Your fflush(NULL) works okay for output streams.
17093 Let's see if it clobbers input pipes...
17094 EOM
17095 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17096 # bug that improperly flushes the input end of pipes.  So we avoid the
17097 # autoflush on fork/system/exec support for now. :-(
17098 $cat >tryp.c <<EOCP
17099 #include <stdio.h>
17100 int
17101 main(int argc, char **argv)
17102 {
17103     char buf[1024];
17104     int i;
17105     char *bp = buf;
17106     while (1) {
17107         while ((i = getc(stdin)) != -1
17108                && (*bp++ = i) != '\n'
17109                && bp < &buf[1024])
17110         /* DO NOTHING */ ;
17111         *bp = '\0';
17112         fprintf(stdout, "%s", buf);
17113         fflush(NULL);
17114         if (i == -1)
17115             return 0;
17116         bp = buf;
17117     }
17118 }
17119 EOCP
17120                 fflushNULL="$define"
17121                 set tryp
17122                 if eval $compile; then
17123                     $rm -f tryp.out
17124                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17125                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17126                        $cat >&4 <<EOM
17127 fflush(NULL) seems to behave okay with input streams.
17128 EOM
17129                         fflushNULL="$define"
17130                     else
17131                         $cat >&4 <<EOM
17132 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17133 EOM
17134                         fflushNULL="$undef"
17135                     fi
17136                 fi
17137                 $rm -f core tryp.c tryp.core core.tryp.*
17138                 ;;
17139         '')     $cat >&4 <<EOM
17140 Your fflush(NULL) isn't working (contrary to ANSI C).
17141 EOM
17142                 fflushNULL="$undef"
17143                 ;;
17144         *)      $cat >&4 <<EOM
17145 Cannot figure out whether your fflush(NULL) works or not.
17146 I'm assuming it doesn't (contrary to ANSI C).
17147 EOM
17148                 fflushNULL="$undef"
17149                 ;;
17150         esac
17151         ;;
17152 $define|true|[yY]*)
17153         fflushNULL="$define"
17154         ;;
17155 *)
17156         fflushNULL="$undef"
17157         ;;
17158 esac
17159 : check explicit looping only if NULL did not work, and if the pipe
17160 : bug does not show up on an explicit flush too
17161 case "$fflushNULL" in
17162 "$undef")
17163         $cat >tryp.c <<EOCP
17164 #include <stdio.h>
17165 int
17166 main(int argc, char **argv)
17167 {
17168     char buf[1024];
17169     int i;
17170     char *bp = buf;
17171     while (1) {
17172         while ((i = getc(stdin)) != -1
17173                && (*bp++ = i) != '\n'
17174                && bp < &buf[1024])
17175         /* DO NOTHING */ ;
17176         *bp = '\0';
17177         fprintf(stdout, "%s", buf);
17178         fflush(stdin);
17179         if (i == -1)
17180             return 0;
17181         bp = buf;
17182     }
17183 }
17184 EOCP
17185         set tryp
17186         if eval $compile; then
17187             $rm -f tryp.out
17188             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17189             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17190                $cat >&4 <<EOM
17191 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17192 EOM
17193                 : now check for fflushall behaviour
17194                 case "$fflushall" in
17195                 '')     set try -DTRY_FFLUSH_ALL $output
17196                         if eval $compile; then
17197                                 $cat >&4 <<EOM
17198 (Now testing the other method--but note that this also may fail.)
17199 EOM
17200                                 $run ./try 2>/dev/null
17201                                 code=$?
17202                                 $from try.out
17203                                 if $test -s try.out -a "X$code" = X42; then
17204                                         fflushall="`$cat try.out`"
17205                                 fi
17206                         fi
17207                         $rm -f core try.core core.try.*
17208                         case "$fflushall" in
17209                         x)      $cat >&4 <<EOM
17210 Whew. Flushing explicitly all the stdio streams works.
17211 EOM
17212                                 fflushall="$define"
17213                                 ;;
17214                         '')     $cat >&4 <<EOM
17215 Sigh. Flushing explicitly all the stdio streams doesn't work.
17216 EOM
17217                                 fflushall="$undef"
17218                                 ;;
17219                         *)      $cat >&4 <<EOM
17220 Cannot figure out whether flushing stdio streams explicitly works or not.
17221 I'm assuming it doesn't.
17222 EOM
17223                                 fflushall="$undef"
17224                                 ;;
17225                         esac
17226                         ;;
17227                 "$define"|true|[yY]*)
17228                         fflushall="$define"
17229                         ;;
17230                 *)
17231                         fflushall="$undef"
17232                         ;;
17233                 esac
17234             else
17235                 $cat >&4 <<EOM
17236 All is futile.  Even fflush(stdin) clobbers input pipes!
17237 EOM
17238                 fflushall="$undef"
17239             fi
17240         else
17241             fflushall="$undef"
17242         fi
17243         $rm -f core tryp.c tryp.core core.tryp.*
17244         ;;
17245 *)      fflushall="$undef"
17246         ;;
17247 esac
17248
17249 case "$fflushNULL$fflushall" in
17250 undefundef)
17251         $cat <<EOM
17252 OK, I give up.  I cannot figure out how to flush pending stdio output.
17253 We won't be flushing handles at all before fork/exec/popen.
17254 EOM
17255         ;;
17256 esac
17257 $rm -f try.* try$exe_ext
17258
17259 : Store the full pathname to the ar program for use in the C program
17260 : Respect a hint or command line value for full_ar.
17261 case "$full_ar" in
17262 '') full_ar=$ar ;;
17263 esac
17264
17265 : Store the full pathname to the sed program for use in the C program
17266 full_sed=$sed
17267
17268 : see what type gids are declared as in the kernel
17269 echo " "
17270 echo "Looking for the type for group ids returned by getgid()."
17271 set gid_t gidtype xxx stdio.h sys/types.h
17272 eval $typedef
17273 case "$gidtype" in
17274 xxx)
17275         xxx=`./findhdr sys/user.h`
17276         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17277         case $1 in
17278         unsigned) dflt="$1 $2" ;;
17279         *) dflt="$1" ;;
17280         esac
17281         ;;
17282 *) dflt="$gidtype";;
17283 esac
17284 case "$gidtype" in
17285 gid_t) echo "gid_t found." ;;
17286 *)      rp="What is the type for group ids returned by getgid()?"
17287         . ./myread
17288         gidtype="$ans"
17289         ;;
17290 esac
17291
17292 echo " "
17293 case "$gidtype" in
17294 *_t) zzz="$gidtype"     ;;
17295 *)   zzz="gid"          ;;
17296 esac
17297 echo "Checking the size of $zzz..." >&4 
17298 cat > try.c <<EOCP
17299 #include <sys/types.h>
17300 #include <stdio.h>
17301 int main() {
17302     printf("%d\n", (int)sizeof($gidtype));
17303     exit(0);
17304 }
17305 EOCP
17306 set try
17307 if eval $compile_ok; then
17308         yyy=`$run ./try`
17309         case "$yyy" in
17310         '')     gidsize=4
17311                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17312                 ;;
17313         *)      gidsize=$yyy
17314                 echo "Your $zzz is $gidsize bytes long."
17315                 ;;
17316         esac
17317 else
17318         gidsize=4
17319         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17320 fi
17321
17322
17323 echo " "
17324 case "$gidtype" in
17325 *_t) zzz="$gidtype"     ;;
17326 *)   zzz="gid"          ;;
17327 esac
17328 echo "Checking the sign of $zzz..." >&4 
17329 cat > try.c <<EOCP
17330 #include <sys/types.h>
17331 #include <stdio.h>
17332 int main() {
17333         $gidtype foo = -1;
17334         if (foo < 0)
17335                 printf("-1\n");
17336         else
17337                 printf("1\n");
17338 }
17339 EOCP
17340 set try
17341 if eval $compile; then
17342         yyy=`$run ./try`
17343         case "$yyy" in
17344         '')     gidsign=1
17345                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17346                 ;;
17347         *)      gidsign=$yyy
17348                 case "$gidsign" in
17349                  1) echo "Your $zzz is unsigned." ;;
17350                 -1) echo "Your $zzz is signed."   ;;
17351                 esac
17352                 ;;
17353         esac
17354 else
17355         gidsign=1
17356         echo "(I can't compile the test program--guessing unsigned.)" >&4
17357 fi
17358
17359
17360 echo " "
17361
17362 if $test X"$quadtype" != X; then
17363
17364 echo "Checking how to print 64-bit integers..." >&4
17365
17366 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17367         $cat >try.c <<'EOCP'
17368 #include <sys/types.h>
17369 #include <stdio.h>
17370 int main() {
17371   int q = 12345678901;
17372   printf("%ld\n", q);
17373 }
17374 EOCP
17375         set try
17376         if eval $compile; then
17377                 yyy=`$run ./try`
17378                 case "$yyy" in
17379                 12345678901)
17380                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17381                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17382                         echo "We will use %d."
17383                         ;;
17384                 esac
17385         fi
17386 fi
17387
17388 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17389         $cat >try.c <<'EOCP'
17390 #include <sys/types.h>
17391 #include <stdio.h>
17392 int main() {
17393   long q = 12345678901;
17394   printf("%ld\n", q);
17395 }
17396 EOCP
17397         set try
17398         if eval $compile; then
17399                 yyy=`$run ./try`
17400                 case "$yyy" in
17401                 12345678901)
17402                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17403                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17404                         echo "We will use %ld."
17405                         ;;
17406                 esac
17407         fi
17408 fi
17409
17410 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17411         $cat >try.c <<'EOCP'
17412 #include <sys/types.h>
17413 #include <inttypes.h>
17414 #include <stdio.h>
17415 int main() {
17416   int64_t q = 12345678901;
17417   printf("%" PRId64 "\n", q);
17418 }
17419 EOCP
17420         set try
17421         if eval $compile; then
17422                 yyy=`$run ./try`
17423                 case "$yyy" in
17424                 12345678901)
17425                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17426                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17427                         echo "We will use the C9X style."
17428                         ;;
17429                 esac
17430         fi
17431 fi
17432
17433 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17434         $cat >try.c <<EOCP
17435 #include <sys/types.h>
17436 #include <stdio.h>
17437 int main() {
17438   $quadtype q = 12345678901;
17439   printf("%Ld\n", q);
17440 }
17441 EOCP
17442         set try
17443         if eval $compile; then
17444                 yyy=`$run ./try`
17445                 case "$yyy" in
17446                 12345678901)
17447                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17448                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17449                         echo "We will use %Ld."
17450                         ;;
17451                 esac
17452         fi
17453 fi
17454
17455 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17456         $cat >try.c <<'EOCP'
17457 #include <sys/types.h>
17458 #include <stdio.h>
17459 int main() {
17460   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17461   printf("%lld\n", q);
17462 }
17463 EOCP
17464         set try
17465         if eval $compile; then
17466                 yyy=`$run ./try`
17467                 case "$yyy" in
17468                 12345678901)
17469                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17470                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17471                         echo "We will use the %lld style."
17472                         ;;
17473                 esac
17474         fi
17475 fi
17476
17477 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17478         $cat >try.c <<EOCP
17479 #include <sys/types.h>
17480 #include <stdio.h>
17481 int main() {
17482   $quadtype q = 12345678901;
17483   printf("%qd\n", q);
17484 }
17485 EOCP
17486         set try
17487         if eval $compile; then
17488                 yyy=`$run ./try`
17489                 case "$yyy" in
17490                 12345678901)
17491                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17492                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17493                         echo "We will use %qd."
17494                         ;;
17495                 esac
17496         fi
17497 fi
17498
17499 if $test X"$sPRId64" = X; then
17500         echo "Cannot figure out how to print 64-bit integers." >&4
17501 fi
17502
17503 $rm -f try try.*
17504
17505 fi
17506
17507 case "$sPRId64" in
17508 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17509         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17510         ;;
17511 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17512         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17513         ;;
17514 esac
17515
17516
17517 echo " "
17518 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17519
17520 if $test X"$ivsize" = X8; then
17521         ivdformat="$sPRId64"
17522         uvuformat="$sPRIu64"
17523         uvoformat="$sPRIo64"
17524         uvxformat="$sPRIx64"
17525         uvXUformat="$sPRIXU64"
17526 else
17527         if $test X"$ivsize" = X"$longsize"; then
17528                 ivdformat='"ld"'
17529                 uvuformat='"lu"'
17530                 uvoformat='"lo"'
17531                 uvxformat='"lx"'
17532                 uvXUformat='"lX"'
17533         else
17534                 if $test X"$ivsize" = X"$intsize"; then
17535                         ivdformat='"d"'
17536                         uvuformat='"u"'
17537                         uvoformat='"o"'
17538                         uvxformat='"x"'
17539                         uvXUformat='"X"'
17540                 else
17541                         : far out
17542                         if $test X"$ivsize" = X"$shortsize"; then
17543                                 ivdformat='"hd"'
17544                                 uvuformat='"hu"'
17545                                 uvoformat='"ho"'
17546                                 uvxformat='"hx"'
17547                                 uvXUformat='"hX"'
17548                         fi
17549                 fi
17550         fi
17551 fi
17552
17553 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17554         nveformat="$sPRIeldbl"
17555         nvfformat="$sPRIfldbl"
17556         nvgformat="$sPRIgldbl"
17557         nvEUformat="$sPRIEUldbl"
17558         nvFUformat="$sPRIFUldbl"
17559         nvGUformat="$sPRIGUldbl"
17560 else
17561         nveformat='"e"'
17562         nvfformat='"f"'
17563         nvgformat='"g"'
17564         nvEUformat='"E"'
17565         nvFUformat='"F"'
17566         nvGUformat='"G"'
17567 fi
17568
17569 case "$ivdformat" in
17570 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17571     exit 1
17572     ;;
17573 esac
17574
17575
17576 echo " "
17577 $echo "Checking the format string to be used for gids..." >&4
17578
17579 case "$gidsign" in
17580 -1)     if $test X"$gidsize" = X"$ivsize"; then
17581                 gidformat="$ivdformat"
17582         else
17583                 if $test X"$gidsize" = X"$longsize"; then
17584                         gidformat='"ld"'
17585                 else
17586                         if $test X"$gidsize" = X"$intsize"; then
17587                                 gidformat='"d"'
17588                         else
17589                                 if $test X"$gidsize" = X"$shortsize"; then
17590                                         gidformat='"hd"'
17591                                 fi
17592                         fi
17593                 fi
17594         fi
17595         ;;
17596 *)      if $test X"$gidsize" = X"$uvsize"; then
17597                 gidformat="$uvuformat"
17598         else
17599                 if $test X"$gidsize" = X"$longsize"; then
17600                         gidformat='"lu"'
17601                 else
17602                         if $test X"$gidsize" = X"$intsize"; then
17603                                 gidformat='"u"'
17604                         else
17605                                 if $test X"$gidsize" = X"$shortsize"; then
17606                                         gidformat='"hu"'
17607                                 fi
17608                         fi
17609                 fi
17610         fi
17611         ;;
17612 esac
17613
17614 : see if getgroups exists
17615 set getgroups d_getgrps
17616 eval $inlibc
17617
17618 : see if setgroups exists
17619 set setgroups d_setgrps
17620 eval $inlibc
17621
17622
17623 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17624 echo " "
17625 case "$d_getgrps$d_setgrps" in
17626 *define*)
17627         case "$groupstype" in
17628         '') dflt="$gidtype" ;;
17629         *)  dflt="$groupstype" ;;
17630         esac
17631         $cat <<EOM
17632 What type of pointer is the second argument to getgroups() and setgroups()?
17633 Usually this is the same as group ids, $gidtype, but not always.
17634
17635 EOM
17636         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17637         . ./myread
17638         groupstype="$ans"
17639         ;;
17640 *)  groupstype="$gidtype";;
17641 esac
17642
17643 echo " "
17644 echo "Checking if your $make program sets \$(MAKE)..." >&4
17645 case "$make_set_make" in
17646 '')
17647         $sed 's/^X //' > testmake.mak << 'EOF'
17648 Xall:
17649 X       @echo 'maketemp="$(MAKE)"'
17650 EOF
17651         case "`$make -f testmake.mak 2>/dev/null`" in
17652         *maketemp=*) make_set_make='#' ;;
17653         *)      make_set_make="MAKE=$make" ;;
17654         esac
17655         $rm -f testmake.mak
17656         ;;
17657 esac
17658 case "$make_set_make" in
17659 '#') echo "Yup, it does.";;
17660 *) echo "Nope, it doesn't.";;
17661 esac
17662
17663 : see what type is used for mode_t
17664 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17665 set mode_t modetype int stdio.h sys/types.h
17666 eval $typedef_ask
17667
17668 : see if stdarg is available
17669 echo " "
17670 if $test `./findhdr stdarg.h`; then
17671         echo "<stdarg.h> found." >&4
17672         valstd="$define"
17673 else
17674         echo "<stdarg.h> NOT found." >&4
17675         valstd="$undef"
17676 fi
17677
17678 : see if varags is available
17679 echo " "
17680 if $test `./findhdr varargs.h`; then
17681         echo "<varargs.h> found." >&4
17682 else
17683         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17684 fi
17685
17686 : set up the varargs testing programs
17687 $cat > varargs.c <<EOP
17688 #ifdef I_STDARG
17689 #include <stdarg.h>
17690 #endif
17691 #ifdef I_VARARGS
17692 #include <varargs.h>
17693 #endif
17694
17695 #ifdef I_STDARG
17696 int f(char *p, ...)
17697 #else
17698 int f(va_alist)
17699 va_dcl
17700 #endif
17701 {
17702         va_list ap;
17703 #ifndef I_STDARG
17704         char *p;
17705 #endif
17706 #ifdef I_STDARG
17707         va_start(ap,p);
17708 #else
17709         va_start(ap);
17710         p = va_arg(ap, char *);
17711 #endif
17712         va_end(ap);
17713 }
17714 EOP
17715 $cat > varargs <<EOP
17716 $startsh
17717 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17718         echo "true"
17719 else
17720         echo "false"
17721 fi
17722 $rm -f varargs$_o
17723 EOP
17724 chmod +x varargs
17725
17726 : now check which varargs header should be included
17727 echo " "
17728 i_varhdr=''
17729 case "$valstd" in
17730 "$define")
17731         if `./varargs I_STDARG`; then
17732                 val='stdarg.h'
17733         elif `./varargs I_VARARGS`; then
17734                 val='varargs.h'
17735         fi
17736         ;;
17737 *)
17738         if `./varargs I_VARARGS`; then
17739                 val='varargs.h'
17740         fi
17741         ;;
17742 esac
17743 case "$val" in
17744 '')
17745 echo "I could not find the definition for va_dcl... You have problems..." >&4
17746         val="$undef"; set i_stdarg; eval $setvar
17747         val="$undef"; set i_varargs; eval $setvar
17748         ;;
17749 *) 
17750         set i_varhdr
17751         eval $setvar
17752         case "$i_varhdr" in
17753         stdarg.h)
17754                 val="$define"; set i_stdarg; eval $setvar
17755                 val="$undef"; set i_varargs; eval $setvar
17756                 ;;
17757         varargs.h)
17758                 val="$undef"; set i_stdarg; eval $setvar
17759                 val="$define"; set i_varargs; eval $setvar
17760                 ;;
17761         esac
17762         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17763 esac
17764 $rm -f varargs*
17765
17766 : see if we need va_copy
17767 echo " "
17768 case "$i_stdarg" in
17769 "$define")
17770         $cat >try.c <<EOCP
17771 #include <stdarg.h>
17772 #include <stdio.h>
17773 #$i_stdlib I_STDLIB
17774 #ifdef I_STDLIB
17775 #include <stdlib.h>
17776 #endif
17777 #include <signal.h>
17778
17779 int
17780 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17781 {
17782   return vfprintf(f, fmt, *valp);
17783 }
17784  
17785 int    
17786 myvfprintf(FILE *f, const  char *fmt, va_list val)
17787 {
17788   return ivfprintf(f, fmt, &val);
17789 }
17790       
17791 int
17792 myprintf(char *fmt, ...) 
17793 {
17794   va_list val;
17795   va_start(val, fmt);
17796   return myvfprintf(stdout, fmt, val); 
17797 }         
17798
17799 int
17800 main(int ac, char **av)
17801 {
17802   signal(SIGSEGV, exit);
17803
17804   myprintf("%s%cs all right, then\n", "that", '\'');                            
17805   exit(0);      
17806 }
17807 EOCP
17808         set try
17809         if eval $compile && $run ./try 2>&1 >/dev/null; then
17810                 case "`$run ./try`" in
17811                 "that's all right, then")
17812                         okay=yes
17813                         ;;
17814                 esac
17815         fi
17816         case "$okay" in
17817         yes)    echo "It seems that you don't need va_copy()." >&4
17818                 need_va_copy="$undef"
17819                 ;;
17820         *)      echo "It seems that va_copy() or similar will be needed." >&4
17821                 need_va_copy="$define"
17822                 ;;
17823         esac
17824         $rm -f try.* core core.* *.core *.core.*
17825         ;;
17826 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17827         ;;
17828 esac
17829
17830 : see what type is used for size_t
17831 rp="What is the type used for the length parameter for string functions?"
17832 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17833 eval $typedef_ask
17834
17835 : check for type of arguments to gethostbyaddr. 
17836 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17837         case "$d_gethbyaddr" in
17838         $define)
17839                 $cat <<EOM
17840
17841 Checking to see what type of arguments are accepted by gethostbyaddr().
17842 EOM
17843                 hdrs="$define sys/types.h
17844                         $d_socket sys/socket.h 
17845                         $i_niin netinet/in.h 
17846                         $i_netdb netdb.h
17847                         $i_unistd unistd.h"
17848                 : The first arg can 'char *' or 'void *'
17849                 : The second arg is some of integral type
17850                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17851                         for yyy in size_t long int; do
17852                                 case "$netdb_host_type" in
17853                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17854                                         if ./protochk "$try" $hdrs; then
17855                                                 echo "Your system accepts $xxx for the first arg."
17856                                                 echo "...and $yyy for the second arg."
17857                                                 netdb_host_type="$xxx"
17858                                                 netdb_hlen_type="$yyy"
17859                                         fi
17860                                         ;;
17861                                 esac
17862                         done
17863                 done
17864                 : In case none of those worked, prompt the user.
17865                 case "$netdb_host_type" in
17866                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17867                         dflt='char *'
17868                         . ./myread
17869                         netdb_host_type=$ans
17870                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17871                         dflt="$sizetype"
17872                         . ./myread
17873                         netdb_hlen_type=$ans
17874                         ;;
17875                 esac
17876                 ;;
17877         *)      : no gethostbyaddr, so pick harmless defaults
17878                 netdb_host_type='char *'
17879                 netdb_hlen_type="$sizetype"
17880                 ;;
17881         esac
17882         # Remove the "const" if needed. -- but then we'll have a 
17883         # prototype clash!
17884         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17885 fi
17886
17887 : check for type of argument to gethostbyname. 
17888 if test "X$netdb_name_type" = X ; then
17889         case "$d_gethbyname" in
17890         $define)
17891                 $cat <<EOM
17892
17893 Checking to see what type of argument is accepted by gethostbyname().
17894 EOM
17895                 hdrs="$define sys/types.h
17896                         $d_socket sys/socket.h 
17897                         $i_niin netinet/in.h 
17898                         $i_netdb netdb.h
17899                         $i_unistd unistd.h"
17900                 for xxx in "const char *" "char *"; do
17901                         case "$netdb_name_type" in
17902                         '')     try="extern struct hostent *gethostbyname($xxx);"
17903                                 if ./protochk "$try" $hdrs; then
17904                                         echo "Your system accepts $xxx."
17905                                         netdb_name_type="$xxx"
17906                                 fi
17907                                 ;;
17908                         esac
17909                 done
17910                 : In case none of those worked, prompt the user.
17911                 case "$netdb_name_type" in
17912                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17913                         dflt='char *'
17914                         . ./myread
17915                         netdb_name_type=$ans
17916                         ;;
17917                 esac
17918                 ;;
17919         *)      : no gethostbyname, so pick harmless default
17920                 netdb_name_type='char *'
17921                 ;;
17922         esac
17923 fi
17924
17925 : check for type of 1st argument to getnetbyaddr. 
17926 if test "X$netdb_net_type" = X ; then
17927         case "$d_getnbyaddr" in
17928         $define)
17929                 $cat <<EOM
17930
17931 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17932 EOM
17933                 hdrs="$define sys/types.h
17934                         $d_socket sys/socket.h 
17935                         $i_niin netinet/in.h 
17936                         $i_netdb netdb.h
17937                         $i_unistd unistd.h"
17938                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17939                         case "$netdb_net_type" in
17940                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17941                                 if ./protochk "$try" $hdrs; then
17942                                         echo "Your system accepts $xxx."
17943                                         netdb_net_type="$xxx"
17944                                 fi
17945                                 ;;
17946                         esac
17947                 done
17948                 : In case none of those worked, prompt the user.
17949                 case "$netdb_net_type" in
17950                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17951                         dflt='long'
17952                         . ./myread
17953                         netdb_net_type=$ans
17954                         ;;
17955                 esac
17956                 ;;
17957         *)      : no getnetbyaddr, so pick harmless default
17958                 netdb_net_type='long'
17959                 ;;
17960         esac
17961 fi
17962 : locate the preferred pager for this system
17963 fn=f/
17964 case "$pager" in
17965 '')
17966         dflt=''
17967         case "$pg" in
17968         /*) dflt=$pg;;
17969         [a-zA-Z]:/*) dflt=$pg;;
17970         esac
17971         case "$more" in
17972         /*) dflt=$more;;
17973         [a-zA-Z]:/*) dflt=$more;;
17974         esac
17975         case "$less" in
17976         /*) dflt=$less;;
17977         [a-zA-Z]:/*) dflt=$less;;
17978         esac
17979         case "$dflt" in
17980         '') dflt=/usr/ucb/more;;
17981         esac
17982         ;;
17983 *)      dflt="$pager"
17984         : Instruct ./getfile to trust the hinted or previous pager value,
17985         : even if it does not begin with a slash.  For example, on os2,
17986         : pager might be cmd /c more.  See comments in UU/getfile.
17987         fn="f/($pager)"
17988         ;;
17989 esac
17990 echo " "
17991 rp='What pager is used on your system?'
17992 . ./getfile
17993 pager="$ans"
17994
17995 : see what type pids are declared as in the kernel
17996 rp="What is the type of process ids on this system?"
17997 set pid_t pidtype int stdio.h sys/types.h
17998 eval $typedef_ask
17999
18000 : Find earliest binary compatible site_perl subdirectory perl can use.
18001 xs_apiversion=$version # The current site_perl version.
18002 : Find earliest pure perl site_perl subdirectory perl can use.
18003 : The versioned directories started at 5.005.
18004 pm_apiversion='5.005'
18005
18006 : see if ar generates random libraries by itself
18007 echo " "
18008 echo "Checking how to generate random libraries on your machine..." >&4
18009 echo 'int bar1() { return bar2(); }' > bar1.c
18010 echo 'int bar2() { return 2; }' > bar2.c
18011 $cat > foo.c <<'EOP'
18012 int main() { printf("%d\n", bar1()); exit(0); }
18013 EOP
18014 $cc $ccflags -c bar1.c >/dev/null 2>&1
18015 $cc $ccflags -c bar2.c >/dev/null 2>&1
18016 $cc $ccflags -c foo.c >/dev/null 2>&1
18017 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18018 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18019         $run ./foobar >/dev/null 2>&1; then
18020         echo "$ar appears to generate random libraries itself."
18021         orderlib=false
18022         ranlib=":"
18023 elif $ar ts bar$_a >/dev/null 2>&1 &&
18024         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18025         $run ./foobar >/dev/null 2>&1; then
18026                 echo "a table of contents needs to be added with '$ar ts'."
18027                 orderlib=false
18028                 ranlib="$ar ts"
18029 else
18030         case "$ranlib" in
18031         :) ranlib='';;
18032         '')
18033                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18034                 $test -f $ranlib || ranlib=''
18035                 ;;
18036         esac
18037         if $test -n "$ranlib"; then
18038                 echo "your system has '$ranlib'; we'll use that."
18039                 orderlib=false
18040         else
18041                 echo "your system doesn't seem to support random libraries"
18042                 echo "so we'll use lorder and tsort to order the libraries."
18043                 orderlib=true
18044                 ranlib=":"
18045         fi
18046 fi
18047 $rm -f foo* bar* 
18048
18049 : check for type of arguments to select. 
18050 case "$selecttype" in
18051 '') case "$d_select" in
18052         $define)
18053                 echo " "
18054                 $cat <<EOM
18055 Checking to see what type of arguments are accepted by select().
18056 EOM
18057                 hdrs="$define sys/types.h
18058                         $i_systime sys/time.h 
18059                         $i_sysselct sys/select.h
18060                         $d_socket sys/socket.h"
18061                 : The first arg can be int, unsigned, or size_t
18062                 : The last arg may or may not be 'const'
18063                 val=''
18064                 : void pointer has been seen but using that
18065                 : breaks the selectminbits test
18066                 for xxx in 'fd_set *' 'int *'; do
18067                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18068                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18069                                         case "$val" in
18070                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18071                                                 if ./protochk "$try" $hdrs; then
18072                                                         echo "Your system accepts $xxx."
18073                                                         val="$xxx"
18074                                                 fi
18075                                                 ;;
18076                                         esac
18077                                 done
18078                         done
18079                 done
18080                 case "$val" in
18081                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18082                         case "$d_fd_set" in
18083                                 $define) dflt="fd_set *" ;;
18084                                 *)              dflt="int *" ;;
18085                         esac
18086                         . ./myread
18087                         val=$ans
18088                         ;;
18089                 esac
18090                 selecttype="$val"
18091                 ;;
18092         *)      : no select, so pick a harmless default
18093                 selecttype='int *'
18094                 ;;
18095         esac
18096         ;;
18097 esac
18098
18099 : check for the select 'width'
18100 case "$selectminbits" in
18101 '') case "$d_select" in
18102         $define)
18103                 $cat <<EOM
18104
18105 Checking to see on how many bits at a time your select() operates...
18106 EOM
18107                 $cat >try.c <<EOCP
18108 #include <sys/types.h>
18109 #$i_time I_TIME
18110 #$i_systime I_SYS_TIME
18111 #$i_systimek I_SYS_TIME_KERNEL
18112 #ifdef I_TIME
18113 #   include <time.h>
18114 #endif
18115 #ifdef I_SYS_TIME
18116 #   ifdef I_SYS_TIME_KERNEL
18117 #       define KERNEL
18118 #   endif
18119 #   include <sys/time.h>
18120 #   ifdef I_SYS_TIME_KERNEL
18121 #       undef KERNEL
18122 #   endif
18123 #endif
18124 #$i_sysselct I_SYS_SELECT
18125 #ifdef I_SYS_SELECT
18126 #include <sys/select.h>
18127 #endif
18128 #$d_socket HAS_SOCKET
18129 #ifdef HAS_SOCKET
18130 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18131 #endif
18132 #include <stdio.h>
18133 $selecttype b;
18134 #define S sizeof(*(b))
18135 #define MINBITS 64
18136 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18137 #define NBITS  (NBYTES * 8)
18138 int main() {
18139     char s[NBYTES];
18140     struct timeval t;
18141     int i;
18142     FILE* fp;
18143     int fd;
18144
18145     fclose(stdin);
18146     fp = fopen("try.c", "r");
18147     if (fp == 0)
18148       exit(1);
18149     fd = fileno(fp);
18150     if (fd < 0)
18151       exit(2);
18152     b = ($selecttype)s;
18153     for (i = 0; i < NBITS; i++)
18154         FD_SET(i, b);
18155     t.tv_sec  = 0;
18156     t.tv_usec = 0;
18157     select(fd + 1, b, 0, 0, &t);
18158     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18159     printf("%d\n", i + 1);
18160     return 0;
18161 }
18162 EOCP
18163                 set try
18164                 if eval $compile_ok; then
18165                         selectminbits=`$run ./try`
18166                         case "$selectminbits" in
18167                         '')     cat >&4 <<EOM
18168 Cannot figure out on how many bits at a time your select() operates.
18169 I'll play safe and guess it is 32 bits.
18170 EOM
18171                                 selectminbits=32
18172                                 bits="32 bits"
18173                                 ;;
18174                         1)      bits="1 bit" ;;
18175                         *)      bits="$selectminbits bits" ;;
18176                         esac
18177                         echo "Your select() operates on $bits at a time." >&4
18178                 else
18179                         rp='What is the minimum number of bits your select() operates on?'
18180                         case "$byteorder" in
18181                         1234|12345678)  dflt=32 ;;
18182                         *)              dflt=1  ;;
18183                         esac
18184                         . ./myread
18185                         val=$ans
18186                         selectminbits="$val"
18187                 fi
18188                 $rm -f try.* try
18189                 ;;
18190         *)      : no select, so pick a harmless default
18191                 selectminbits='32'
18192                 ;;
18193         esac
18194         ;;
18195 esac
18196
18197 : Trace out the files included by signal.h, then look for SIGxxx names.
18198 : Remove SIGARRAYSIZE used by HPUX.
18199 : Remove SIGSTKSIZE used by Linux.
18200 : Remove SIGSTKSZ used by Posix.
18201 : Remove SIGTYP void lines used by OS2.
18202 : Some cpps, like os390, dont give the file name anywhere
18203 if [ "X$fieldn" = X ]; then
18204         : Just make some guesses.  We check them later.
18205         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18206 else
18207         xxx=`echo '#include <signal.h>' |
18208         $cppstdin $cppminus $cppflags 2>/dev/null |
18209         $grep '^[       ]*#.*include' | 
18210         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18211 fi
18212 : Check this list of files to be sure we have parsed the cpp output ok.
18213 : This will also avoid potentially non-existent files, such 
18214 : as ../foo/bar.h
18215 xxxfiles=''
18216 for xx in $xxx /dev/null ; do
18217         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18218 done
18219 : If we have found no files, at least try signal.h
18220 case "$xxxfiles" in
18221 '')     xxxfiles=`./findhdr signal.h` ;;
18222 esac
18223 xxx=`awk '
18224 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18225         print substr($2, 4, 20)
18226 }
18227 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18228         print substr($3, 4, 20)
18229 }' $xxxfiles`
18230 : Append some common names just in case the awk scan failed.
18231 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18232 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18233 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18234 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18235 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18236
18237 : generate a few handy files for later
18238 $cat > signal.c <<'EOCP'
18239 #include <sys/types.h>
18240 #include <signal.h>
18241 #include <stdio.h>
18242 int main() {
18243
18244 /* Strange style to avoid deeply-nested #if/#else/#endif */
18245 #ifndef NSIG
18246 #  ifdef _NSIG
18247 #    define NSIG (_NSIG)
18248 #  endif
18249 #endif
18250
18251 #ifndef NSIG
18252 #  ifdef SIGMAX
18253 #    define NSIG (SIGMAX+1)
18254 #  endif
18255 #endif
18256
18257 #ifndef NSIG
18258 #  ifdef SIG_MAX
18259 #    define NSIG (SIG_MAX+1)
18260 #  endif
18261 #endif
18262
18263 #ifndef NSIG
18264 #  ifdef MAXSIG
18265 #    define NSIG (MAXSIG+1)
18266 #  endif
18267 #endif
18268
18269 #ifndef NSIG
18270 #  ifdef MAX_SIG
18271 #    define NSIG (MAX_SIG+1)
18272 #  endif
18273 #endif
18274
18275 #ifndef NSIG
18276 #  ifdef SIGARRAYSIZE
18277 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18278 #  endif
18279 #endif
18280
18281 #ifndef NSIG
18282 #  ifdef _sys_nsig
18283 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18284 #  endif
18285 #endif
18286
18287 /* Default to some arbitrary number that's big enough to get most
18288    of the common signals.
18289 */
18290 #ifndef NSIG
18291 #    define NSIG 50
18292 #endif
18293
18294 printf("NSIG %d\n", NSIG);
18295
18296 #ifndef JUST_NSIG
18297
18298 EOCP
18299
18300 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18301 {
18302         printf "#ifdef SIG"; printf $1; printf "\n"
18303         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18304         printf $1; printf ");\n"
18305         printf "#endif\n"
18306 }
18307 END {
18308         printf "#endif /* JUST_NSIG */\n";
18309         printf "exit(0);\n}\n";
18310 }
18311 ' >>signal.c
18312 $cat >signal.awk <<'EOP'
18313 BEGIN { ndups = 0 }
18314 $1 ~ /^NSIG$/ { nsig = $2 }
18315 ($1 !~ /^NSIG$/) && (NF == 2) {
18316     if ($2 > maxsig) { maxsig = $2 }
18317     if (sig_name[$2]) {
18318         dup_name[ndups] = $1
18319         dup_num[ndups] = $2
18320         ndups++ 
18321     }
18322     else {
18323         sig_name[$2] = $1
18324         sig_num[$2] = $2
18325     }
18326 }
18327 END { 
18328     if (nsig == 0) {
18329         nsig = maxsig + 1
18330     }
18331     printf("NSIG %d\n", nsig);
18332     for (n = 1; n < nsig; n++) {
18333         if (sig_name[n]) {
18334             printf("%s %d\n", sig_name[n], sig_num[n])
18335         }
18336         else {
18337             printf("NUM%d %d\n", n, n) 
18338         }
18339     }
18340     for (n = 0; n < ndups; n++) {
18341         printf("%s %d\n", dup_name[n], dup_num[n])
18342     }
18343 }
18344 EOP
18345 $cat >signal_cmd <<EOS
18346 $startsh
18347 if $test -s signal.lst; then
18348     echo "Using your existing signal.lst file"
18349         exit 0
18350 fi
18351 xxx="$xxx"
18352 EOS
18353 $cat >>signal_cmd <<'EOS'
18354
18355 set signal
18356 if eval $compile_ok; then
18357         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18358 else
18359         echo "(I can't seem be able to compile the whole test program)" >&4
18360         echo "(I'll try it in little pieces.)" >&4
18361         set signal -DJUST_NSIG
18362         if eval $compile_ok; then
18363                 $run ./signal$_exe > signal.nsg
18364                 $cat signal.nsg
18365         else
18366                 echo "I can't seem to figure out how many signals you have." >&4
18367                 echo "Guessing 50." >&4
18368                 echo 'NSIG 50' > signal.nsg
18369         fi
18370         : Now look at all the signal names, one at a time.
18371         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18372                 $cat > signal.c <<EOCP
18373 #include <sys/types.h>
18374 #include <signal.h>
18375 #include <stdio.h>
18376 int main() {
18377 printf("$xx %d\n", SIG${xx});
18378 return 0;
18379 }
18380 EOCP
18381                 set signal
18382                 if eval $compile; then
18383                         echo "SIG${xx} found."
18384                         $run ./signal$_exe  >> signal.ls1
18385                 else
18386                         echo "SIG${xx} NOT found."
18387                 fi
18388         done
18389         if $test -s signal.ls1; then
18390                 $cat signal.nsg signal.ls1 |
18391                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18392         fi
18393
18394 fi
18395 if $test -s signal.lst; then
18396         :
18397 else
18398         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18399         echo 'kill -l' >signal
18400         set X `csh -f <signal`
18401         $rm -f signal
18402         shift
18403         case $# in
18404         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18405         esac
18406         echo $@ | $tr ' ' $trnl | \
18407             $awk '{ printf "%s %d\n", $1, ++s; }
18408                   END { printf "NSIG %d\n", ++s }' >signal.lst
18409 fi
18410 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18411 EOS
18412 chmod a+x signal_cmd
18413 $eunicefix signal_cmd
18414
18415 : generate list of signal names
18416 echo " "
18417 case "$sig_name_init" in
18418 '') doinit=yes ;;
18419 *)  case "$sig_num_init" in
18420     ''|*,*) doinit=yes ;;
18421     esac ;;
18422 esac
18423 case "$doinit" in
18424 yes)
18425         echo "Generating a list of signal names and numbers..." >&4
18426         . ./signal_cmd
18427         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18428         sig_name=`$awk 'BEGIN { printf "ZERO " }
18429                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18430         sig_num=`$awk  'BEGIN { printf "0 " }
18431                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18432         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18433                              !/^NSIG/   { printf "\"%s\", ", $1 }
18434                              END        { printf "0\n" }' signal.lst`
18435         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18436                              !/^NSIG/   { printf "%d, ", $2}
18437                              END        { printf "0\n"}' signal.lst`
18438         ;;
18439 esac
18440 echo "The following $sig_count signals are available:"
18441 echo " "
18442 echo $sig_name | $awk \
18443 'BEGIN { linelen = 0 }
18444 {
18445         for (i = 1; i <= NF; i++) {
18446                 name = "SIG" $i " "
18447                 linelen = linelen + length(name)
18448                 if (linelen > 70) {
18449                         printf "\n"
18450                         linelen = length(name)
18451                 }
18452                 printf "%s", name
18453         }
18454         printf "\n"
18455 }'
18456 sig_size=`echo $sig_name | awk '{print NF}'`
18457 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18458
18459 echo " "
18460 case "$sizetype" in
18461 *_t) zzz="$sizetype"    ;;
18462 *)   zzz="filesize"     ;;
18463 esac
18464 echo "Checking the size of $zzz..." >&4 
18465 cat > try.c <<EOCP
18466 #include <sys/types.h>
18467 #include <stdio.h>
18468 int main() {
18469     printf("%d\n", (int)sizeof($sizetype));
18470     exit(0);
18471 }
18472 EOCP
18473 set try
18474 if eval $compile_ok; then
18475         yyy=`$run ./try`
18476         case "$yyy" in
18477         '')     sizesize=4
18478                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18479                 ;;
18480         *)      sizesize=$yyy
18481                 echo "Your $zzz size is $sizesize bytes."
18482                 ;;
18483         esac
18484 else
18485         sizesize=4
18486         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18487 fi
18488
18489
18490 : check for socklen_t
18491 echo " "
18492 echo "Checking to see if you have socklen_t..." >&4
18493 $cat >try.c <<EOCP
18494 #include <sys/types.h>
18495 #$d_socket HAS_SOCKET
18496 #ifdef HAS_SOCKET
18497 #include <sys/socket.h>
18498 #endif
18499 int main() { socklen_t x = 16; }
18500 EOCP
18501 set try
18502 if eval $compile; then
18503         val="$define"
18504         echo "You have socklen_t."
18505 else
18506         val="$undef"
18507         echo "You do not have socklen_t."
18508         case "$sizetype" in
18509         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18510         esac
18511 fi
18512 $rm -f try try.*
18513 set d_socklen_t
18514 eval $setvar
18515
18516 : see if this is a socks.h system
18517 set socks.h i_socks
18518 eval $inhdr
18519
18520 : check for type of the size argument to socket calls
18521 case "$d_socket" in
18522 "$define")
18523         $cat <<EOM
18524
18525 Checking to see what type is the last argument of accept().
18526 EOM
18527         yyy=''
18528         case "$d_socklen_t" in
18529         "$define") yyy="$yyy socklen_t"
18530         esac
18531         yyy="$yyy $sizetype int long unsigned"
18532         for xxx in $yyy; do
18533                 case "$socksizetype" in
18534                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18535                         case "$usesocks" in
18536                         "$define")
18537                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18538                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18539                                         socksizetype="$xxx"
18540                                 fi
18541                                 ;;
18542                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18543                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18544                                         socksizetype="$xxx"
18545                                 fi
18546                                 ;;
18547                         esac
18548                         ;;
18549                 esac
18550         done
18551 : In case none of those worked, prompt the user.
18552         case "$socksizetype" in
18553         '')     rp='What is the type for socket address structure sizes?'
18554                 dflt='int'
18555                 . ./myread
18556                 socksizetype=$ans
18557                 ;;
18558         esac
18559         ;;
18560 *)      : no sockets, so pick relatively harmless default
18561         socksizetype='int'
18562         ;;
18563 esac
18564
18565 : see what type is used for signed size_t
18566 set ssize_t ssizetype int stdio.h sys/types.h
18567 eval $typedef
18568 dflt="$ssizetype"
18569 $cat > try.c <<EOM
18570 #include <stdio.h>
18571 #include <sys/types.h>
18572 #define Size_t $sizetype
18573 #define SSize_t $dflt
18574 int main()
18575 {
18576         if (sizeof(Size_t) == sizeof(SSize_t))
18577                 printf("$dflt\n");
18578         else if (sizeof(Size_t) == sizeof(int))
18579                 printf("int\n");
18580         else 
18581                 printf("long\n");
18582         exit(0);
18583 }
18584 EOM
18585 echo " "
18586 set try
18587 if eval $compile_ok && $run ./try > /dev/null; then
18588         ssizetype=`$run ./try`
18589         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18590 else
18591         $cat >&4 <<EOM
18592 Help! I can't compile and run the ssize_t test program: please enlighten me!
18593 (This is probably a misconfiguration in your system or libraries, and
18594 you really ought to fix it.  Still, I'll try anyway.)
18595
18596 I need a type that is the same size as $sizetype, but is guaranteed to
18597 be signed.  Common values are ssize_t, int and long.
18598
18599 EOM
18600         rp="What signed type is the same size as $sizetype?"
18601         . ./myread
18602         ssizetype="$ans"
18603 fi
18604 $rm -f try try.*
18605
18606 : see what type of char stdio uses.
18607 echo " "
18608 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18609 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18610         echo "Your stdio uses unsigned chars." >&4
18611         stdchar="unsigned char"
18612 else
18613         echo "Your stdio uses signed chars." >&4
18614         stdchar="char"
18615 fi
18616 $rm -f stdioh
18617
18618
18619
18620 : see what type uids are declared as in the kernel
18621 echo " "
18622 echo "Looking for the type for user ids returned by getuid()."
18623 set uid_t uidtype xxx stdio.h sys/types.h
18624 eval $typedef
18625 case "$uidtype" in
18626 xxx)
18627         xxx=`./findhdr sys/user.h`
18628         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18629         case $1 in
18630         unsigned) dflt="$1 $2" ;;
18631         *) dflt="$1" ;;
18632         esac
18633         ;;
18634 *) dflt="$uidtype";;
18635 esac
18636 case "$uidtype" in
18637 uid_t)  echo "uid_t found." ;;
18638 *)      rp="What is the type for user ids returned by getuid()?"
18639         . ./myread
18640         uidtype="$ans"
18641         ;;
18642 esac
18643
18644 echo " "
18645 case "$uidtype" in
18646 *_t) zzz="$uidtype"     ;;
18647 *)   zzz="uid"          ;;
18648 esac
18649 echo "Checking the size of $zzz..." >&4 
18650 cat > try.c <<EOCP
18651 #include <sys/types.h>
18652 #include <stdio.h>
18653 int main() {
18654     printf("%d\n", (int)sizeof($uidtype));
18655     exit(0);
18656 }
18657 EOCP
18658 set try
18659 if eval $compile_ok; then
18660         yyy=`$run ./try`
18661         case "$yyy" in
18662         '')     uidsize=4
18663                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18664                 ;;
18665         *)      uidsize=$yyy
18666                 echo "Your $zzz is $uidsize bytes long."
18667                 ;;
18668         esac
18669 else
18670         uidsize=4
18671         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18672 fi
18673
18674 echo " "
18675 case "$uidtype" in
18676 *_t) zzz="$uidtype"     ;;
18677 *)   zzz="uid"          ;;
18678 esac
18679 echo "Checking the sign of $zzz..." >&4
18680 cat > try.c <<EOCP
18681 #include <sys/types.h>
18682 #include <stdio.h>
18683 int main() {
18684         $uidtype foo = -1;
18685         if (foo < 0)
18686                 printf("-1\n");
18687         else
18688                 printf("1\n");
18689 }
18690 EOCP
18691 set try
18692 if eval $compile; then
18693         yyy=`$run ./try`
18694         case "$yyy" in
18695         '')     uidsign=1
18696                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18697                 ;;
18698         *)      uidsign=$yyy
18699                 case "$uidsign" in
18700                  1) echo "Your $zzz is unsigned." ;;
18701                 -1) echo "Your $zzz is signed."   ;;
18702                 esac
18703                 ;;
18704         esac
18705 else
18706         uidsign=1
18707         echo "(I can't compile the test program--guessing unsigned.)" >&4
18708 fi
18709
18710
18711
18712 echo " "
18713 $echo "Checking the format string to be used for uids..." >&4
18714
18715 case "$uidsign" in
18716 -1)     if $test X"$uidsize" = X"$ivsize"; then
18717                 uidformat="$ivdformat"
18718         else
18719                 if $test X"$uidsize" = X"$longsize"; then
18720                         uidformat='"ld"'
18721                 else
18722                         if $test X"$uidsize" = X"$intsize"; then
18723                                 uidformat='"d"'
18724                         else
18725                                 if $test X"$uidsize" = X"$shortsize"; then
18726                                         uidformat='"hd"'
18727                                 fi
18728                         fi
18729                 fi
18730         fi
18731         ;;
18732 *)      if $test X"$uidsize" = X"$uvsize"; then
18733                 uidformat="$uvuformat"
18734         else
18735                 if $test X"$uidsize" = X"$longsize"; then
18736                         uidformat='"lu"'
18737                 else
18738                         if $test X"$uidsize" = X"$intsize"; then
18739                                 uidformat='"u"'
18740                         else
18741                                 if $test X"$uidsize" = X"$shortsize"; then
18742                                         uidformat='"hu"'
18743                                 fi
18744                         fi
18745                 fi
18746         fi
18747         ;;
18748 esac
18749
18750 : determine compiler compiler
18751 case "$yacc" in
18752 '')
18753         dflt=yacc;;
18754 *)
18755         dflt="$yacc";;
18756 esac
18757 echo " "
18758 comp='yacc'
18759 if $test -f "$byacc$_exe"; then
18760         dflt="$byacc"
18761         comp="byacc or $comp"
18762 fi
18763 if $test -f "$bison$_exe"; then
18764         comp="$comp or bison -y"
18765 fi
18766 rp="Which compiler compiler ($comp) shall I use?"
18767 . ./myread
18768 yacc="$ans"
18769 case "$yacc" in
18770 *bis*)
18771         case "$yacc" in
18772         *-y*) ;;
18773         *)
18774                 yacc="$yacc -y"
18775                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18776                 ;;
18777         esac
18778         ;;
18779 esac
18780
18781 : see if this is a fp.h system
18782 set fp.h i_fp
18783 eval $inhdr
18784
18785 : see if this is a fp_class.h system
18786 set fp_class.h i_fp_class
18787 eval $inhdr
18788
18789 : see if this is a ieeefp.h system
18790 case "$i_ieeefp" in
18791 '' ) set ieeefp.h i_ieeefp
18792      eval $inhdr
18793      ;;
18794 esac
18795
18796 : see if this is a libutil.h system
18797 set libutil.h i_libutil
18798 eval $inhdr
18799
18800 : see if mach cthreads are available
18801 if test "X$usethreads" = "X$define"; then
18802         set mach/cthreads.h i_machcthr
18803         eval $inhdr
18804 else
18805         i_machcthr="$undef"
18806 fi
18807
18808
18809
18810 : see if this is a math.h system
18811 set math.h i_math
18812 eval $inhdr
18813
18814 : see if this is a mntent.h system
18815 set mntent.h i_mntent
18816 eval $inhdr
18817
18818 : see if ndbm.h is available
18819 set ndbm.h t_ndbm
18820 eval $inhdr
18821
18822 case "$t_ndbm" in
18823 $undef)
18824     # Some Linux distributions such as RedHat 7.1 put the
18825     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18826     if $test -f /usr/include/gdbm/ndbm.h; then
18827         echo '<gdbm/ndbm.h> found.'
18828         ccflags="$ccflags -I/usr/include/gdbm"
18829         cppflags="$cppflags -I/usr/include/gdbm"
18830         t_ndbm=$define
18831     fi
18832     ;;
18833 esac
18834
18835 case "$t_ndbm" in
18836 $define)
18837         : see if dbm_open exists
18838         set dbm_open d_dbm_open
18839         eval $inlibc
18840         case "$d_dbm_open" in
18841         $undef)
18842                 t_ndbm="$undef"
18843                 echo "We won't be including <ndbm.h>"
18844                 ;;
18845         esac
18846         ;;
18847 esac
18848 val="$t_ndbm"
18849 set i_ndbm
18850 eval $setvar
18851
18852 : see if net/errno.h is available
18853 val=''
18854 set net/errno.h val
18855 eval $inhdr
18856
18857 : Unfortunately, it causes problems on some systems.  Arrgh.
18858 case "$val" in
18859 $define)
18860         cat > try.c <<'EOM'
18861 #include <stdio.h>
18862 #include <errno.h>
18863 #include <net/errno.h>
18864 int func()
18865 {
18866         return ENOTSOCK;
18867 }
18868 EOM
18869         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18870                 echo "We'll be including <net/errno.h>." >&4
18871         else
18872                 echo "We won't be including <net/errno.h>." >&4
18873                 val="$undef"
18874         fi
18875         $rm -f try.* try
18876         ;;
18877 esac
18878 set i_neterrno
18879 eval $setvar
18880
18881 : see if netinet/tcp.h is available
18882 set netinet/tcp.h i_netinettcp
18883 eval $inhdr
18884
18885 : see if this is a poll.h system
18886 set poll.h i_poll
18887 eval $inhdr
18888
18889 : see if this is a prot.h system
18890 set prot.h i_prot
18891 eval $inhdr
18892
18893 echo " "
18894 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18895 $cat <<'EOSH' > Cppsym.know
18896 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18897 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18898 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18899 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18900 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18901 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18902 bull c cadmus clipper CMU COFF COMPILER_VERSION
18903 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18904 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18905 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18906 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18907 GLIBC GLIBC_MINOR
18908 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18909 H3050R H3050RX hbullx20 hcx host_mips
18910 hp200 hp300 hp700 HP700 hp800 hp9000
18911 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18912 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18913 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18914 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18915 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18916 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18917 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18918 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18919 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18920 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18921 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18922 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18923 MATH_HAS_NO_SIDE_EFFECTS
18924 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18925 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18926 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18927 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18928 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18929 NetBSD news1500 news1700 news1800 news1900 news3700
18930 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18931 ns32016 ns32332 ns32k nsc32000
18932 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18933 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18934 pc532 pdp11 PGC PIC plexus PORTAR posix
18935 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18936 POSIX_C_SOURCE POSIX_SOURCE POWER
18937 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18938 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18939 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18940 sony sony_news sonyrisc sparc sparclite spectrum
18941 stardent stdc STDC_EXT stratos sun sun3 sun386
18942 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18943 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18944 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18945 sysV68 sysV88 Tek4132 Tek4300 titan
18946 TM3200 TM5400 TM5600
18947 tower tower32 tower32_200 tower32_600 tower32_700
18948 tower32_800 tower32_850 tss
18949 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18950 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18951 unix UNIX95 UNIX99 unixpc unos
18952 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18953 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18954 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18955 USGr4 USGr4_2
18956 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18957 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18958 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18959 z8000
18960 EOSH
18961 # Maybe put other stuff here too.
18962 cat <<EOSH >>Cppsym.know
18963 $osname
18964 EOSH
18965 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18966 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18967 $cat Cppsym.know > Cppsym.c
18968 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18969 $rm -f Cppsym.a Cppsym.b Cppsym.c
18970 cat <<EOSH > Cppsym
18971 $startsh
18972 if $test \$# -gt 0; then
18973     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18974     if $test -s Cppsym.got; then
18975         $rm -f Cppsym.got
18976         exit 0
18977     fi
18978     $rm -f Cppsym.got
18979     exit 1
18980 else
18981     $tr " " "$trnl" | ./Cppsym.try
18982     exit 0
18983 fi
18984 EOSH
18985 chmod +x Cppsym
18986 $eunicefix Cppsym
18987 cat <<EOSH > Cppsym.try
18988 $startsh
18989 cat <<'EOCP' > try.c
18990 #include <stdio.h>
18991 int main() {
18992 EOCP
18993 $awk \\
18994 EOSH
18995 cat <<'EOSH' >> Cppsym.try
18996 'length($1) > 0 {
18997     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
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 }'       >> try.c
19002 echo 'return 0;}' >> try.c
19003 EOSH
19004 cat <<EOSH >> Cppsym.try
19005 ccflags="$ccflags"
19006 case "$osname-$gccversion" in
19007 irix-) ccflags="\$ccflags -woff 1178" ;;
19008 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19009 esac
19010 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19011 EOSH
19012 chmod +x Cppsym.try
19013 $eunicefix Cppsym.try
19014 ./Cppsym < Cppsym.know > Cppsym.true
19015 : now check the C compiler for additional symbols
19016 postprocess_cc_v=''
19017 case "$osname" in
19018 aix) postprocess_cc_v="|$tr , ' '" ;;
19019 esac
19020 $cat >ccsym <<EOS
19021 $startsh
19022 $cat >tmp.c <<EOF
19023 extern int foo;
19024 EOF
19025 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19026 do
19027         case "\$i" in
19028         -D*) echo "\$i" | $sed 's/^-D//';;
19029         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19030         esac
19031 done
19032 $rm -f try.c
19033 EOS
19034 postprocess_cc_v=''
19035 chmod +x ccsym
19036 $eunicefix ccsym
19037 ./ccsym > ccsym1.raw
19038 if $test -s ccsym1.raw; then
19039        $sort ccsym1.raw | $uniq >ccsym.raw
19040 else
19041        mv ccsym1.raw ccsym.raw
19042 fi
19043
19044 $awk '/\=/ { print $0; next }
19045         { print $0"=1" }' ccsym.raw >ccsym.list
19046 $awk '/\=/ { print $0; next }
19047         { print $0"=1" }' Cppsym.true >ccsym.true
19048 $comm -13 ccsym.true ccsym.list >ccsym.own
19049 $comm -12 ccsym.true ccsym.list >ccsym.com
19050 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19051 also=''
19052 if $test -z ccsym.raw; then
19053         echo "Your C compiler doesn't seem to define any symbols!" >&4
19054         echo " "
19055         echo "However, your C preprocessor defines the following symbols:"
19056         $cat Cppsym.true
19057         ccsymbols=''
19058         cppsymbols=`$cat Cppsym.true`
19059         cppsymbols=`echo $cppsymbols`
19060         cppccsymbols="$cppsymbols"
19061 else
19062         if $test -s ccsym.com; then
19063                 echo "Your C compiler and pre-processor define these symbols:"
19064                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19065                 also='also '
19066                 symbols='ones'
19067                 cppccsymbols=`$cat ccsym.com`
19068                 cppccsymbols=`echo $cppccsymbols`
19069                 $test "$silent" || sleep 1
19070         fi
19071         if $test -s ccsym.cpp; then
19072                 $test "$also" && echo " "
19073                 echo "Your C pre-processor ${also}defines the following symbols:"
19074                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19075                 also='further '
19076                 cppsymbols=`$cat ccsym.cpp`
19077                 cppsymbols=`echo $cppsymbols`
19078                 $test "$silent" || sleep 1
19079         fi
19080         if $test -s ccsym.own; then
19081                 $test "$also" && echo " "
19082                 echo "Your C compiler ${also}defines the following cpp symbols:"
19083                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19084                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19085                 ccsymbols=`$cat ccsym.own`
19086                 ccsymbols=`echo $ccsymbols`
19087                 $test "$silent" || sleep 1
19088         fi
19089 fi
19090
19091 : see if this is a termio system
19092 val="$undef"
19093 val2="$undef"
19094 val3="$undef"
19095 if $test `./findhdr termios.h`; then
19096         set tcsetattr i_termios
19097         eval $inlibc
19098         val3="$i_termios"
19099 fi
19100 echo " "
19101 case "$val3" in
19102 "$define") echo "You have POSIX termios.h... good!" >&4;;
19103 *) if ./Cppsym pyr; then
19104                 case "`/bin/universe`" in
19105                 ucb) if $test `./findhdr sgtty.h`; then
19106                                 val2="$define"
19107                                 echo "<sgtty.h> found." >&4
19108                         else
19109                                 echo "System is pyramid with BSD universe."
19110                                 echo "<sgtty.h> not found--you could have problems." >&4
19111                         fi;;
19112                 *) if $test `./findhdr termio.h`; then
19113                                 val="$define"
19114                                 echo "<termio.h> found." >&4
19115                         else
19116                                 echo "System is pyramid with USG universe."
19117                                 echo "<termio.h> not found--you could have problems." >&4
19118                         fi;;
19119                 esac
19120         elif ./usg; then
19121                 if $test `./findhdr termio.h`; then
19122                         echo "<termio.h> found." >&4
19123                         val="$define"
19124                 elif $test `./findhdr sgtty.h`; then
19125                         echo "<sgtty.h> found." >&4
19126                         val2="$define"
19127                 else
19128 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19129                 fi
19130         else
19131                 if $test `./findhdr sgtty.h`; then
19132                         echo "<sgtty.h> found." >&4
19133                         val2="$define"
19134                 elif $test `./findhdr termio.h`; then
19135                         echo "<termio.h> found." >&4
19136                         val="$define"
19137                 else
19138 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19139                 fi
19140         fi;;
19141 esac
19142 set i_termio; eval $setvar
19143 val=$val2; set i_sgtty; eval $setvar
19144 val=$val3; set i_termios; eval $setvar
19145
19146 : see if stddef is available
19147 set stddef.h i_stddef
19148 eval $inhdr
19149
19150 : see if this is a sunmath.h system
19151 set sunmath.h i_sunmath
19152 eval $inhdr
19153
19154 : see if sys/access.h is available
19155 set sys/access.h i_sysaccess
19156 eval $inhdr
19157
19158 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19159 set sys/filio.h i_sysfilio
19160 eval $inhdr
19161 echo " "
19162 if $test `./findhdr sys/ioctl.h`; then
19163         val="$define"
19164         echo '<sys/ioctl.h> found.' >&4
19165 else
19166         val="$undef"
19167         if $test $i_sysfilio = "$define"; then
19168             echo '<sys/ioctl.h> NOT found.' >&4
19169         else
19170                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19171                 $test $i_termio = "$define" && xxx="termio.h"
19172                 $test $i_termios = "$define" && xxx="termios.h"
19173 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19174         fi
19175 fi
19176 set i_sysioctl
19177 eval $setvar
19178
19179 : see if socket ioctl defs are in sys/sockio.h
19180 echo " "
19181 xxx=`./findhdr sys/sockio.h`
19182 if $test "$xxx"; then
19183         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19184                 val="$define"
19185                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19186         else
19187                 val="$undef"
19188                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19189         fi
19190 else
19191         val="$undef"
19192         $cat <<EOM
19193 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19194 EOM
19195 fi
19196 set i_syssockio
19197 eval $setvar
19198
19199
19200 : see if this is a syslog.h system
19201 set syslog.h i_syslog
19202 eval $inhdr
19203
19204
19205 : see if this is a sys/mode.h system
19206 set sys/mode.h i_sysmode
19207 eval $inhdr
19208
19209 : see if sys/resource.h has to be included
19210 set sys/resource.h i_sysresrc
19211 eval $inhdr
19212
19213 : see if sys/security.h is available
19214 set sys/security.h i_syssecrt
19215 eval $inhdr
19216
19217 : see if this is a sys/statvfs.h system
19218 set sys/statvfs.h i_sysstatvfs
19219 eval $inhdr
19220
19221 : see if this is a sys/un.h system
19222 set sys/un.h i_sysun
19223 eval $inhdr
19224
19225
19226 : see if this is a sys/utsname.h system
19227 set sys/utsname.h i_sysutsname
19228 eval $inhdr
19229
19230 : see if this is a syswait system
19231 set sys/wait.h i_syswait
19232 eval $inhdr
19233
19234 : see if this is a ustat.h system
19235 set ustat.h i_ustat
19236 eval $inhdr
19237
19238 : see if this is an utime system
19239 set utime.h i_utime
19240 eval $inhdr
19241
19242 : see if this is a values.h system
19243 set values.h i_values
19244 eval $inhdr
19245
19246 : see if this is a vfork system
19247 case "$d_vfork" in
19248 "$define")
19249         set vfork.h i_vfork
19250         eval $inhdr
19251         ;;
19252 *)
19253         i_vfork="$undef"
19254         ;;
19255 esac
19256
19257 : see if gdbm.h is available
19258 set gdbm.h t_gdbm
19259 eval $inhdr
19260 case "$t_gdbm" in
19261 $define)
19262         : see if gdbm_open exists
19263         set gdbm_open d_gdbm_open
19264         eval $inlibc
19265         case "$d_gdbm_open" in
19266         $undef)
19267                 t_gdbm="$undef"
19268                 echo "We won't be including <gdbm.h>"
19269                 ;;
19270         esac
19271         ;;
19272 esac
19273 val="$t_gdbm"
19274 set i_gdbm
19275 eval $setvar
19276
19277 echo " "
19278 echo "Looking for extensions..." >&4
19279 : If we are using the old config.sh, known_extensions may contain
19280 : old or inaccurate or duplicate values.
19281 known_extensions=''
19282 nonxs_extensions=''
19283 : We do not use find because it might not be available.
19284 : We do not just use MANIFEST because the user may have dropped
19285 : some additional extensions into the source tree and expect them
19286 : to be built.
19287
19288 : Function to recursively find available extensions, ignoring DynaLoader
19289 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19290 find_extensions='
19291     for xxx in *; do
19292        case "$xxx" in
19293            DynaLoader|dynaload) ;;
19294            *)
19295            if $test -f $xxx/$xxx.xs; then
19296                known_extensions="$known_extensions $1$xxx";
19297            elif $test -f $xxx/Makefile.PL; then
19298                nonxs_extensions="$nonxs_extensions $1$xxx";
19299            else
19300                if $test -d $xxx -a $# -lt 10; then
19301                    set $1$xxx/ $*;
19302                    cd "$xxx";
19303                    eval $find_extensions;
19304                    cd ..;
19305                    shift;
19306                fi;
19307            fi
19308            ;;
19309        esac;
19310     done'
19311 tdir=`pwd`
19312 cd "$rsrc/ext"
19313 set X
19314 shift
19315 eval $find_extensions
19316 # Special case:  Add in threads/shared since it is not picked up by the
19317 # recursive find above (and adding in general recursive finding breaks
19318 # SDBM_File/sdbm).  A.D.  10/25/2001.
19319 known_extensions="$known_extensions threads/shared"
19320 set X $nonxs_extensions
19321 shift
19322 nonxs_extensions="$*"
19323 set X $known_extensions
19324 shift
19325 known_extensions="$*"
19326 cd "$tdir"
19327
19328 : Now see which are supported on this system.
19329 avail_ext=''
19330 for xxx in $known_extensions ; do
19331         case "$xxx" in
19332         DB_File|db_file)
19333                 case "$i_db" in
19334                 $define) avail_ext="$avail_ext $xxx" ;;
19335                 esac
19336                 ;;
19337         GDBM_File|gdbm_fil)
19338                 case "$i_gdbm" in 
19339                 $define) avail_ext="$avail_ext $xxx" ;;
19340                 esac
19341                 ;;
19342         I18N/Langinfo|i18n_lan)
19343                 case "$i_langinfo$d_nl_langinfo" in 
19344                 $define$define) avail_ext="$avail_ext $xxx" ;;
19345                 esac
19346                 ;;
19347         NDBM_File|ndbm_fil)
19348                 case "$i_ndbm" in
19349                 $define)
19350                     case "$osname-$use64bitint" in
19351                     hpux-define)
19352                         case "$libs" in
19353                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19354                         esac
19355                         ;;
19356                     *) avail_ext="$avail_ext $xxx" ;;
19357                     esac
19358                     ;;
19359                 esac
19360                 ;;
19361         ODBM_File|odbm_fil) 
19362                 case "${i_dbm}${i_rpcsvcdbm}" in
19363                 *"${define}"*)
19364                     case "$osname-$use64bitint" in
19365                     hpux-define)
19366                         case "$libs" in
19367                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19368                         esac
19369                         ;;
19370                     *) avail_ext="$avail_ext $xxx" ;;
19371                     esac
19372                     ;;
19373                 esac
19374                 ;;
19375         POSIX|posix)
19376                 case "$useposix" in
19377                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19378                 esac
19379                 ;;
19380         Opcode|opcode)
19381                 case "$useopcode" in
19382                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19383                 esac
19384                 ;;
19385         Socket|socket)
19386                 case "$d_socket" in 
19387                 true|$define|y)
19388                     case "$osname" in
19389                     beos) ;; # not unless BONE
19390                     *) avail_ext="$avail_ext $xxx" ;;
19391                     esac
19392                     ;;
19393                 esac
19394                 ;;
19395         Sys/Syslog|sys/syslog)
19396                 : XXX syslog requires socket
19397                 case "$d_socket" in 
19398                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19399                 esac
19400                 ;;
19401         Thread|thread)
19402                 case "$usethreads" in
19403                 true|$define|y)
19404                         case "$useithreads" in
19405                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19406                         esac
19407                 esac
19408                 ;;
19409         XS/APItest|xs/apitest)
19410                 # This is just for testing.  Skip it unless we have dynamic loading.
19411
19412                 case "$usedl" in
19413                 $define) avail_ext="$avail_ext $xxx" ;;
19414                 esac
19415                 ;;
19416         XS/Typemap|xs/typemap)
19417                 # This is just for testing.  Skip it unless we have dynamic loading.
19418                 case "$usedl" in
19419                 $define) avail_ext="$avail_ext $xxx" ;;
19420                 esac
19421                 ;;
19422         threads|threads/shared)
19423                 # threads and threads::shared are special cases.
19424                 # To stop people from asking "Perl 5.8.0 was supposed
19425                 # to have this new fancy threads implementation but my
19426                 # perl doesn't have it" and from people trying to
19427                 # (re)install the threads module using CPAN.pm and
19428                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19429                 # the threads.pm and threads/shared.pm will always be
19430                 # there, croaking informatively ("you need to rebuild
19431                 # all of Perl with threads, sorry") when threads haven't
19432                 # been compiled in.
19433                 # --jhi
19434                 avail_ext="$avail_ext $xxx"
19435                 ;;
19436         IPC/SysV|ipc/sysv)
19437                 : XXX Do we need a useipcsysv variable here
19438                 case "${d_msg}${d_sem}${d_shm}" in 
19439                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19440                 esac
19441                 ;;
19442         *)      avail_ext="$avail_ext $xxx"
19443                 ;;
19444         esac
19445 done
19446
19447 set X $avail_ext
19448 shift
19449 avail_ext="$*"
19450
19451 : Now see which nonxs extensions are supported on this system.
19452 : For now assume all are.
19453 nonxs_ext=''
19454 for xxx in $nonxs_extensions ; do
19455         case "$xxx" in
19456         *)      nonxs_ext="$nonxs_ext $xxx"
19457                 ;;
19458         esac
19459 done
19460
19461 set X $nonxs_ext
19462 shift
19463 nonxs_ext="$*"
19464
19465 case $usedl in
19466 $define)
19467         $cat <<EOM
19468 A number of extensions are supplied with $package.  You may choose to
19469 compile these extensions for dynamic loading (the default), compile
19470 them into the $package executable (static loading), or not include
19471 them at all.  Answer "none" to include no extensions.
19472 Note that DynaLoader is always built and need not be mentioned here.
19473
19474 EOM
19475         case "$dynamic_ext" in
19476         '')
19477                 : Exclude those listed in static_ext
19478                 dflt=''
19479                 for xxx in $avail_ext; do
19480                         case " $static_ext " in
19481                         *" $xxx "*) ;;
19482                         *) dflt="$dflt $xxx" ;;
19483                         esac
19484                 done
19485                 set X $dflt
19486                 shift
19487                 dflt="$*"
19488                 ;;
19489         *)      dflt="$dynamic_ext"
19490                 # Perhaps we are reusing an old out-of-date config.sh.
19491                 case "$hint" in
19492                 previous)
19493                         if test X"$dynamic_ext" != X"$avail_ext"; then
19494                                 $cat <<EOM
19495 NOTICE:  Your previous config.sh list may be incorrect. 
19496 The extensions now available to you are 
19497         ${avail_ext}
19498 but the default list from your previous config.sh is
19499         ${dynamic_ext} 
19500
19501 EOM
19502                         fi
19503                         ;;
19504                 esac
19505                 ;;
19506         esac
19507         case "$dflt" in
19508         '')     dflt=none;;
19509         esac
19510         rp="What extensions do you wish to load dynamically?"
19511         . ./myread
19512         case "$ans" in
19513         none) dynamic_ext=' ' ;;
19514         *) dynamic_ext="$ans" ;;
19515         esac
19516
19517         case "$static_ext" in
19518         '')
19519                 : Exclude those already listed in dynamic linking
19520                 dflt=''
19521                 for xxx in $avail_ext; do
19522                         case " $dynamic_ext " in
19523                         *" $xxx "*) ;;
19524                         *) dflt="$dflt $xxx" ;;
19525                         esac
19526                 done
19527                 set X $dflt
19528                 shift
19529                 dflt="$*"
19530                 ;;
19531         *)  dflt="$static_ext" 
19532                 ;;
19533         esac
19534
19535         case "$dflt" in
19536         '')     dflt=none;;
19537         esac
19538         rp="What extensions do you wish to load statically?"
19539         . ./myread
19540         case "$ans" in
19541         none) static_ext=' ' ;;
19542         *) static_ext="$ans" ;;
19543         esac
19544         ;;
19545 *)
19546         $cat <<EOM
19547 A number of extensions are supplied with $package.  Answer "none" 
19548 to include no extensions. 
19549 Note that DynaLoader is always built and need not be mentioned here.
19550
19551 EOM
19552         case "$static_ext" in
19553         '') dflt="$avail_ext" ;;
19554         *)      dflt="$static_ext"
19555                 # Perhaps we are reusing an old out-of-date config.sh.
19556                 case "$hint" in
19557                 previous)
19558                         if test X"$static_ext" != X"$avail_ext"; then
19559                                 $cat <<EOM
19560 NOTICE:  Your previous config.sh list may be incorrect. 
19561 The extensions now available to you are 
19562         ${avail_ext}
19563 but the default list from your previous config.sh is
19564         ${static_ext} 
19565
19566 EOM
19567                         fi
19568                         ;;
19569                 esac
19570                 ;;
19571         esac
19572         : Exclude those that are not xs extensions
19573         case "$dflt" in
19574         '')     dflt=none;;
19575         esac
19576         rp="What extensions do you wish to include?"
19577         . ./myread
19578         case "$ans" in
19579         none) static_ext=' ' ;;
19580         *) static_ext="$ans" ;;
19581         esac
19582         ;;
19583 esac
19584 #        
19585 # Encode is a special case.  If we are building Encode as a static
19586 # extension, we need to explicitly list its subextensions as well.
19587 # For other nested extensions, this is handled automatically by
19588 # the appropriate Makefile.PL.
19589 case " $static_ext " in
19590         *" Encode "*) # Add the subextensions of Encode
19591         cd "$rsrc/ext"
19592         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19593                 static_ext="$static_ext Encode/$xxx"
19594         done
19595         cd "$tdir"
19596         ;;
19597 esac
19598
19599 set X $dynamic_ext $static_ext $nonxs_ext
19600 shift
19601 extensions="$*"
19602
19603 : Remove libraries needed only for extensions
19604 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19605 : The exception is SunOS 4.x, which needs them.
19606 case "${osname}X${osvers}" in
19607 sunos*X4*)
19608     perllibs="$libs"
19609     ;;
19610 *) case "$usedl" in
19611     $define|true|[yY]*)
19612             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19613             shift
19614             perllibs="$*"
19615             ;;
19616     *)  perllibs="$libs"
19617             ;;
19618     esac
19619     ;;
19620 esac
19621
19622 : Remove build directory name from cppstdin so it can be used from
19623 : either the present location or the final installed location.
19624 echo " "
19625 : Get out of the UU directory to get correct path name.
19626 cd ..
19627 case "$cppstdin" in
19628 `pwd`/cppstdin)
19629         echo "Stripping down cppstdin path name"
19630         cppstdin=cppstdin
19631         ;;
19632 esac
19633 cd UU
19634
19635 : end of configuration questions
19636 echo " "
19637 echo "End of configuration questions."
19638 echo " "
19639
19640 : back to where it started
19641 if test -d ../UU; then
19642         cd ..
19643 fi
19644
19645 : configuration may be patched via a 'config.arch' file
19646 if $test -f config.arch; then
19647         echo "I see a config.arch file, loading it."
19648         . ./config.arch
19649 fi
19650
19651 : configuration may be patched via a 'config.over' file
19652 if $test -f config.over; then
19653         echo " "
19654         dflt=y
19655         rp='I see a config.over file.  Do you wish to load it?'
19656         . UU/myread
19657         case "$ans" in
19658         n*) echo "OK, I'll ignore it.";;
19659         *)      . ./config.over
19660                 echo "Configuration override changes have been loaded."
19661                 ;;
19662         esac
19663 fi
19664
19665 : in case they want portability, strip down executable paths
19666 case "$d_portable" in
19667 "$define")
19668         echo " "
19669         echo "Stripping down executable paths..." >&4
19670         for file in $loclist $trylist; do
19671                 eval temp=\$$file
19672                 eval $file=`basename $temp`
19673         done
19674         ;;
19675 esac
19676
19677 : create config.sh file
19678 echo " "
19679 echo "Creating config.sh..." >&4
19680 $spitshell <<EOT >config.sh
19681 $startsh
19682 #
19683 # This file was produced by running the Configure script. It holds all the
19684 # definitions figured out by Configure. Should you modify one of these values,
19685 # do not forget to propagate your changes by running "Configure -der". You may
19686 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19687 #
19688
19689 # Package name      : $package
19690 # Source directory  : $src
19691 # Configuration time: $cf_time
19692 # Configured by     : $cf_by
19693 # Target system     : $myuname
19694
19695 Author='$Author'
19696 Date='$Date'
19697 Header='$Header'
19698 Id='$Id'
19699 Locker='$Locker'
19700 Log='$Log'
19701 Mcc='$Mcc'
19702 RCSfile='$RCSfile'
19703 Revision='$Revision'
19704 Source='$Source'
19705 State='$State'
19706 _a='$_a'
19707 _exe='$_exe'
19708 _o='$_o'
19709 afs='$afs'
19710 afsroot='$afsroot'
19711 alignbytes='$alignbytes'
19712 ansi2knr='$ansi2knr'
19713 aphostname='$aphostname'
19714 api_revision='$api_revision'
19715 api_subversion='$api_subversion'
19716 api_version='$api_version'
19717 api_versionstring='$api_versionstring'
19718 ar='$ar'
19719 archlib='$archlib'
19720 archlibexp='$archlibexp'
19721 archname64='$archname64'
19722 archname='$archname'
19723 archobjs='$archobjs'
19724 asctime_r_proto='$asctime_r_proto'
19725 awk='$awk'
19726 baserev='$baserev'
19727 bash='$bash'
19728 bin='$bin'
19729 binexp='$binexp'
19730 bison='$bison'
19731 byacc='$byacc'
19732 byteorder='$byteorder'
19733 c='$c'
19734 castflags='$castflags'
19735 cat='$cat'
19736 cc='$cc'
19737 cccdlflags='$cccdlflags'
19738 ccdlflags='$ccdlflags'
19739 ccflags='$ccflags'
19740 ccflags_uselargefiles='$ccflags_uselargefiles'
19741 ccname='$ccname'
19742 ccsymbols='$ccsymbols'
19743 ccversion='$ccversion'
19744 cf_by='$cf_by'
19745 cf_email='$cf_email'
19746 cf_time='$cf_time'
19747 charsize='$charsize'
19748 chgrp='$chgrp'
19749 chmod='$chmod'
19750 chown='$chown'
19751 clocktype='$clocktype'
19752 comm='$comm'
19753 compress='$compress'
19754 contains='$contains'
19755 cp='$cp'
19756 cpio='$cpio'
19757 cpp='$cpp'
19758 cpp_stuff='$cpp_stuff'
19759 cppccsymbols='$cppccsymbols'
19760 cppflags='$cppflags'
19761 cpplast='$cpplast'
19762 cppminus='$cppminus'
19763 cpprun='$cpprun'
19764 cppstdin='$cppstdin'
19765 cppsymbols='$cppsymbols'
19766 crypt_r_proto='$crypt_r_proto'
19767 cryptlib='$cryptlib'
19768 csh='$csh'
19769 ctermid_r_proto='$ctermid_r_proto'
19770 ctime_r_proto='$ctime_r_proto'
19771 d_Gconvert='$d_Gconvert'
19772 d_PRIEUldbl='$d_PRIEUldbl'
19773 d_PRIFUldbl='$d_PRIFUldbl'
19774 d_PRIGUldbl='$d_PRIGUldbl'
19775 d_PRIXU64='$d_PRIXU64'
19776 d_PRId64='$d_PRId64'
19777 d_PRIeldbl='$d_PRIeldbl'
19778 d_PRIfldbl='$d_PRIfldbl'
19779 d_PRIgldbl='$d_PRIgldbl'
19780 d_PRIi64='$d_PRIi64'
19781 d_PRIo64='$d_PRIo64'
19782 d_PRIu64='$d_PRIu64'
19783 d_PRIx64='$d_PRIx64'
19784 d_SCNfldbl='$d_SCNfldbl'
19785 d__fwalk='$d__fwalk'
19786 d_access='$d_access'
19787 d_accessx='$d_accessx'
19788 d_alarm='$d_alarm'
19789 d_archlib='$d_archlib'
19790 d_asctime_r='$d_asctime_r'
19791 d_atolf='$d_atolf'
19792 d_atoll='$d_atoll'
19793 d_attribut='$d_attribut'
19794 d_bcmp='$d_bcmp'
19795 d_bcopy='$d_bcopy'
19796 d_bsd='$d_bsd'
19797 d_bsdgetpgrp='$d_bsdgetpgrp'
19798 d_bsdsetpgrp='$d_bsdsetpgrp'
19799 d_bzero='$d_bzero'
19800 d_casti32='$d_casti32'
19801 d_castneg='$d_castneg'
19802 d_charvspr='$d_charvspr'
19803 d_chown='$d_chown'
19804 d_chroot='$d_chroot'
19805 d_chsize='$d_chsize'
19806 d_class='$d_class'
19807 d_closedir='$d_closedir'
19808 d_cmsghdr_s='$d_cmsghdr_s'
19809 d_const='$d_const'
19810 d_crypt='$d_crypt'
19811 d_crypt_r='$d_crypt_r'
19812 d_csh='$d_csh'
19813 d_ctermid_r='$d_ctermid_r'
19814 d_ctime_r='$d_ctime_r'
19815 d_cuserid='$d_cuserid'
19816 d_dbl_dig='$d_dbl_dig'
19817 d_dbminitproto='$d_dbminitproto'
19818 d_difftime='$d_difftime'
19819 d_dirfd='$d_dirfd'
19820 d_dirnamlen='$d_dirnamlen'
19821 d_dlerror='$d_dlerror'
19822 d_dlopen='$d_dlopen'
19823 d_dlsymun='$d_dlsymun'
19824 d_dosuid='$d_dosuid'
19825 d_drand48_r='$d_drand48_r'
19826 d_drand48proto='$d_drand48proto'
19827 d_dup2='$d_dup2'
19828 d_eaccess='$d_eaccess'
19829 d_endgrent='$d_endgrent'
19830 d_endgrent_r='$d_endgrent_r'
19831 d_endhent='$d_endhent'
19832 d_endhostent_r='$d_endhostent_r'
19833 d_endnent='$d_endnent'
19834 d_endnetent_r='$d_endnetent_r'
19835 d_endpent='$d_endpent'
19836 d_endprotoent_r='$d_endprotoent_r'
19837 d_endpwent='$d_endpwent'
19838 d_endpwent_r='$d_endpwent_r'
19839 d_endsent='$d_endsent'
19840 d_endservent_r='$d_endservent_r'
19841 d_eofnblk='$d_eofnblk'
19842 d_eunice='$d_eunice'
19843 d_fchdir='$d_fchdir'
19844 d_fchmod='$d_fchmod'
19845 d_fchown='$d_fchown'
19846 d_fcntl='$d_fcntl'
19847 d_fcntl_can_lock='$d_fcntl_can_lock'
19848 d_fd_macros='$d_fd_macros'
19849 d_fd_set='$d_fd_set'
19850 d_fds_bits='$d_fds_bits'
19851 d_fgetpos='$d_fgetpos'
19852 d_finite='$d_finite'
19853 d_finitel='$d_finitel'
19854 d_flexfnam='$d_flexfnam'
19855 d_flock='$d_flock'
19856 d_flockproto='$d_flockproto'
19857 d_fork='$d_fork'
19858 d_fp_class='$d_fp_class'
19859 d_fpathconf='$d_fpathconf'
19860 d_fpclass='$d_fpclass'
19861 d_fpclassify='$d_fpclassify'
19862 d_fpclassl='$d_fpclassl'
19863 d_fpos64_t='$d_fpos64_t'
19864 d_frexpl='$d_frexpl'
19865 d_fs_data_s='$d_fs_data_s'
19866 d_fseeko='$d_fseeko'
19867 d_fsetpos='$d_fsetpos'
19868 d_fstatfs='$d_fstatfs'
19869 d_fstatvfs='$d_fstatvfs'
19870 d_fsync='$d_fsync'
19871 d_ftello='$d_ftello'
19872 d_ftime='$d_ftime'
19873 d_getcwd='$d_getcwd'
19874 d_getespwnam='$d_getespwnam'
19875 d_getfsstat='$d_getfsstat'
19876 d_getgrent='$d_getgrent'
19877 d_getgrent_r='$d_getgrent_r'
19878 d_getgrgid_r='$d_getgrgid_r'
19879 d_getgrnam_r='$d_getgrnam_r'
19880 d_getgrps='$d_getgrps'
19881 d_gethbyaddr='$d_gethbyaddr'
19882 d_gethbyname='$d_gethbyname'
19883 d_gethent='$d_gethent'
19884 d_gethname='$d_gethname'
19885 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19886 d_gethostbyname_r='$d_gethostbyname_r'
19887 d_gethostent_r='$d_gethostent_r'
19888 d_gethostprotos='$d_gethostprotos'
19889 d_getitimer='$d_getitimer'
19890 d_getlogin='$d_getlogin'
19891 d_getlogin_r='$d_getlogin_r'
19892 d_getmnt='$d_getmnt'
19893 d_getmntent='$d_getmntent'
19894 d_getnbyaddr='$d_getnbyaddr'
19895 d_getnbyname='$d_getnbyname'
19896 d_getnent='$d_getnent'
19897 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19898 d_getnetbyname_r='$d_getnetbyname_r'
19899 d_getnetent_r='$d_getnetent_r'
19900 d_getnetprotos='$d_getnetprotos'
19901 d_getpagsz='$d_getpagsz'
19902 d_getpbyname='$d_getpbyname'
19903 d_getpbynumber='$d_getpbynumber'
19904 d_getpent='$d_getpent'
19905 d_getpgid='$d_getpgid'
19906 d_getpgrp2='$d_getpgrp2'
19907 d_getpgrp='$d_getpgrp'
19908 d_getppid='$d_getppid'
19909 d_getprior='$d_getprior'
19910 d_getprotobyname_r='$d_getprotobyname_r'
19911 d_getprotobynumber_r='$d_getprotobynumber_r'
19912 d_getprotoent_r='$d_getprotoent_r'
19913 d_getprotoprotos='$d_getprotoprotos'
19914 d_getprpwnam='$d_getprpwnam'
19915 d_getpwent='$d_getpwent'
19916 d_getpwent_r='$d_getpwent_r'
19917 d_getpwnam_r='$d_getpwnam_r'
19918 d_getpwuid_r='$d_getpwuid_r'
19919 d_getsbyname='$d_getsbyname'
19920 d_getsbyport='$d_getsbyport'
19921 d_getsent='$d_getsent'
19922 d_getservbyname_r='$d_getservbyname_r'
19923 d_getservbyport_r='$d_getservbyport_r'
19924 d_getservent_r='$d_getservent_r'
19925 d_getservprotos='$d_getservprotos'
19926 d_getspnam='$d_getspnam'
19927 d_getspnam_r='$d_getspnam_r'
19928 d_gettimeod='$d_gettimeod'
19929 d_gmtime_r='$d_gmtime_r'
19930 d_gnulibc='$d_gnulibc'
19931 d_grpasswd='$d_grpasswd'
19932 d_hasmntopt='$d_hasmntopt'
19933 d_htonl='$d_htonl'
19934 d_index='$d_index'
19935 d_inetaton='$d_inetaton'
19936 d_int64_t='$d_int64_t'
19937 d_isascii='$d_isascii'
19938 d_isfinite='$d_isfinite'
19939 d_isinf='$d_isinf'
19940 d_isnan='$d_isnan'
19941 d_isnanl='$d_isnanl'
19942 d_killpg='$d_killpg'
19943 d_lchown='$d_lchown'
19944 d_ldbl_dig='$d_ldbl_dig'
19945 d_link='$d_link'
19946 d_localtime_r='$d_localtime_r'
19947 d_locconv='$d_locconv'
19948 d_lockf='$d_lockf'
19949 d_longdbl='$d_longdbl'
19950 d_longlong='$d_longlong'
19951 d_lseekproto='$d_lseekproto'
19952 d_lstat='$d_lstat'
19953 d_madvise='$d_madvise'
19954 d_mblen='$d_mblen'
19955 d_mbstowcs='$d_mbstowcs'
19956 d_mbtowc='$d_mbtowc'
19957 d_memchr='$d_memchr'
19958 d_memcmp='$d_memcmp'
19959 d_memcpy='$d_memcpy'
19960 d_memmove='$d_memmove'
19961 d_memset='$d_memset'
19962 d_mkdir='$d_mkdir'
19963 d_mkdtemp='$d_mkdtemp'
19964 d_mkfifo='$d_mkfifo'
19965 d_mkstemp='$d_mkstemp'
19966 d_mkstemps='$d_mkstemps'
19967 d_mktime='$d_mktime'
19968 d_mmap='$d_mmap'
19969 d_modfl='$d_modfl'
19970 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19971 d_modflproto='$d_modflproto'
19972 d_mprotect='$d_mprotect'
19973 d_msg='$d_msg'
19974 d_msg_ctrunc='$d_msg_ctrunc'
19975 d_msg_dontroute='$d_msg_dontroute'
19976 d_msg_oob='$d_msg_oob'
19977 d_msg_peek='$d_msg_peek'
19978 d_msg_proxy='$d_msg_proxy'
19979 d_msgctl='$d_msgctl'
19980 d_msgget='$d_msgget'
19981 d_msghdr_s='$d_msghdr_s'
19982 d_msgrcv='$d_msgrcv'
19983 d_msgsnd='$d_msgsnd'
19984 d_msync='$d_msync'
19985 d_munmap='$d_munmap'
19986 d_mymalloc='$d_mymalloc'
19987 d_nice='$d_nice'
19988 d_nl_langinfo='$d_nl_langinfo'
19989 d_nv_preserves_uv='$d_nv_preserves_uv'
19990 d_off64_t='$d_off64_t'
19991 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19992 d_oldpthreads='$d_oldpthreads'
19993 d_oldsock='$d_oldsock'
19994 d_open3='$d_open3'
19995 d_pathconf='$d_pathconf'
19996 d_pause='$d_pause'
19997 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19998 d_phostname='$d_phostname'
19999 d_pipe='$d_pipe'
20000 d_poll='$d_poll'
20001 d_portable='$d_portable'
20002 d_procselfexe='$d_procselfexe'
20003 d_pthread_atfork='$d_pthread_atfork'
20004 d_pthread_yield='$d_pthread_yield'
20005 d_pwage='$d_pwage'
20006 d_pwchange='$d_pwchange'
20007 d_pwclass='$d_pwclass'
20008 d_pwcomment='$d_pwcomment'
20009 d_pwexpire='$d_pwexpire'
20010 d_pwgecos='$d_pwgecos'
20011 d_pwpasswd='$d_pwpasswd'
20012 d_pwquota='$d_pwquota'
20013 d_qgcvt='$d_qgcvt'
20014 d_quad='$d_quad'
20015 d_random_r='$d_random_r'
20016 d_readdir64_r='$d_readdir64_r'
20017 d_readdir='$d_readdir'
20018 d_readdir_r='$d_readdir_r'
20019 d_readlink='$d_readlink'
20020 d_readv='$d_readv'
20021 d_recvmsg='$d_recvmsg'
20022 d_rename='$d_rename'
20023 d_rewinddir='$d_rewinddir'
20024 d_rmdir='$d_rmdir'
20025 d_safebcpy='$d_safebcpy'
20026 d_safemcpy='$d_safemcpy'
20027 d_sanemcmp='$d_sanemcmp'
20028 d_sbrkproto='$d_sbrkproto'
20029 d_sched_yield='$d_sched_yield'
20030 d_scm_rights='$d_scm_rights'
20031 d_seekdir='$d_seekdir'
20032 d_select='$d_select'
20033 d_sem='$d_sem'
20034 d_semctl='$d_semctl'
20035 d_semctl_semid_ds='$d_semctl_semid_ds'
20036 d_semctl_semun='$d_semctl_semun'
20037 d_semget='$d_semget'
20038 d_semop='$d_semop'
20039 d_sendmsg='$d_sendmsg'
20040 d_setegid='$d_setegid'
20041 d_seteuid='$d_seteuid'
20042 d_setgrent='$d_setgrent'
20043 d_setgrent_r='$d_setgrent_r'
20044 d_setgrps='$d_setgrps'
20045 d_sethent='$d_sethent'
20046 d_sethostent_r='$d_sethostent_r'
20047 d_setitimer='$d_setitimer'
20048 d_setlinebuf='$d_setlinebuf'
20049 d_setlocale='$d_setlocale'
20050 d_setlocale_r='$d_setlocale_r'
20051 d_setnent='$d_setnent'
20052 d_setnetent_r='$d_setnetent_r'
20053 d_setpent='$d_setpent'
20054 d_setpgid='$d_setpgid'
20055 d_setpgrp2='$d_setpgrp2'
20056 d_setpgrp='$d_setpgrp'
20057 d_setprior='$d_setprior'
20058 d_setproctitle='$d_setproctitle'
20059 d_setprotoent_r='$d_setprotoent_r'
20060 d_setpwent='$d_setpwent'
20061 d_setpwent_r='$d_setpwent_r'
20062 d_setregid='$d_setregid'
20063 d_setresgid='$d_setresgid'
20064 d_setresuid='$d_setresuid'
20065 d_setreuid='$d_setreuid'
20066 d_setrgid='$d_setrgid'
20067 d_setruid='$d_setruid'
20068 d_setsent='$d_setsent'
20069 d_setservent_r='$d_setservent_r'
20070 d_setsid='$d_setsid'
20071 d_setvbuf='$d_setvbuf'
20072 d_sfio='$d_sfio'
20073 d_shm='$d_shm'
20074 d_shmat='$d_shmat'
20075 d_shmatprototype='$d_shmatprototype'
20076 d_shmctl='$d_shmctl'
20077 d_shmdt='$d_shmdt'
20078 d_shmget='$d_shmget'
20079 d_sigaction='$d_sigaction'
20080 d_sigprocmask='$d_sigprocmask'
20081 d_sigsetjmp='$d_sigsetjmp'
20082 d_sockatmark='$d_sockatmark'
20083 d_sockatmarkproto='$d_sockatmarkproto'
20084 d_socket='$d_socket'
20085 d_socklen_t='$d_socklen_t'
20086 d_sockpair='$d_sockpair'
20087 d_socks5_init='$d_socks5_init'
20088 d_sqrtl='$d_sqrtl'
20089 d_srand48_r='$d_srand48_r'
20090 d_srandom_r='$d_srandom_r'
20091 d_sresgproto='$d_sresgproto'
20092 d_sresuproto='$d_sresuproto'
20093 d_statblks='$d_statblks'
20094 d_statfs_f_flags='$d_statfs_f_flags'
20095 d_statfs_s='$d_statfs_s'
20096 d_statvfs='$d_statvfs'
20097 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20098 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20099 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20100 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20101 d_stdio_stream_array='$d_stdio_stream_array'
20102 d_stdiobase='$d_stdiobase'
20103 d_stdstdio='$d_stdstdio'
20104 d_strchr='$d_strchr'
20105 d_strcoll='$d_strcoll'
20106 d_strctcpy='$d_strctcpy'
20107 d_strerrm='$d_strerrm'
20108 d_strerror='$d_strerror'
20109 d_strerror_r='$d_strerror_r'
20110 d_strftime='$d_strftime'
20111 d_strtod='$d_strtod'
20112 d_strtol='$d_strtol'
20113 d_strtold='$d_strtold'
20114 d_strtoll='$d_strtoll'
20115 d_strtoq='$d_strtoq'
20116 d_strtoul='$d_strtoul'
20117 d_strtoull='$d_strtoull'
20118 d_strtouq='$d_strtouq'
20119 d_strxfrm='$d_strxfrm'
20120 d_suidsafe='$d_suidsafe'
20121 d_symlink='$d_symlink'
20122 d_syscall='$d_syscall'
20123 d_syscallproto='$d_syscallproto'
20124 d_sysconf='$d_sysconf'
20125 d_sysernlst='$d_sysernlst'
20126 d_syserrlst='$d_syserrlst'
20127 d_system='$d_system'
20128 d_tcgetpgrp='$d_tcgetpgrp'
20129 d_tcsetpgrp='$d_tcsetpgrp'
20130 d_telldir='$d_telldir'
20131 d_telldirproto='$d_telldirproto'
20132 d_time='$d_time'
20133 d_times='$d_times'
20134 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20135 d_tm_tm_zone='$d_tm_tm_zone'
20136 d_tmpnam_r='$d_tmpnam_r'
20137 d_truncate='$d_truncate'
20138 d_ttyname_r='$d_ttyname_r'
20139 d_tzname='$d_tzname'
20140 d_u32align='$d_u32align'
20141 d_ualarm='$d_ualarm'
20142 d_umask='$d_umask'
20143 d_uname='$d_uname'
20144 d_union_semun='$d_union_semun'
20145 d_unordered='$d_unordered'
20146 d_usleep='$d_usleep'
20147 d_usleepproto='$d_usleepproto'
20148 d_ustat='$d_ustat'
20149 d_vendorarch='$d_vendorarch'
20150 d_vendorbin='$d_vendorbin'
20151 d_vendorlib='$d_vendorlib'
20152 d_vfork='$d_vfork'
20153 d_void_closedir='$d_void_closedir'
20154 d_voidsig='$d_voidsig'
20155 d_voidtty='$d_voidtty'
20156 d_volatile='$d_volatile'
20157 d_vprintf='$d_vprintf'
20158 d_wait4='$d_wait4'
20159 d_waitpid='$d_waitpid'
20160 d_wcstombs='$d_wcstombs'
20161 d_wctomb='$d_wctomb'
20162 d_writev='$d_writev'
20163 d_xenix='$d_xenix'
20164 date='$date'
20165 db_hashtype='$db_hashtype'
20166 db_prefixtype='$db_prefixtype'
20167 db_version_major='$db_version_major'
20168 db_version_minor='$db_version_minor'
20169 db_version_patch='$db_version_patch'
20170 defvoidused='$defvoidused'
20171 direntrytype='$direntrytype'
20172 dlext='$dlext'
20173 dlsrc='$dlsrc'
20174 doublesize='$doublesize'
20175 drand01='$drand01'
20176 drand48_r_proto='$drand48_r_proto'
20177 dynamic_ext='$dynamic_ext'
20178 eagain='$eagain'
20179 ebcdic='$ebcdic'
20180 echo='$echo'
20181 egrep='$egrep'
20182 emacs='$emacs'
20183 endgrent_r_proto='$endgrent_r_proto'
20184 endhostent_r_proto='$endhostent_r_proto'
20185 endnetent_r_proto='$endnetent_r_proto'
20186 endprotoent_r_proto='$endprotoent_r_proto'
20187 endpwent_r_proto='$endpwent_r_proto'
20188 endservent_r_proto='$endservent_r_proto'
20189 eunicefix='$eunicefix'
20190 exe_ext='$exe_ext'
20191 expr='$expr'
20192 extensions='$extensions'
20193 extras='$extras'
20194 fflushNULL='$fflushNULL'
20195 fflushall='$fflushall'
20196 find='$find'
20197 firstmakefile='$firstmakefile'
20198 flex='$flex'
20199 fpossize='$fpossize'
20200 fpostype='$fpostype'
20201 freetype='$freetype'
20202 from='$from'
20203 full_ar='$full_ar'
20204 full_csh='$full_csh'
20205 full_sed='$full_sed'
20206 gccosandvers='$gccosandvers'
20207 gccversion='$gccversion'
20208 getgrent_r_proto='$getgrent_r_proto'
20209 getgrgid_r_proto='$getgrgid_r_proto'
20210 getgrnam_r_proto='$getgrnam_r_proto'
20211 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20212 gethostbyname_r_proto='$gethostbyname_r_proto'
20213 gethostent_r_proto='$gethostent_r_proto'
20214 getlogin_r_proto='$getlogin_r_proto'
20215 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20216 getnetbyname_r_proto='$getnetbyname_r_proto'
20217 getnetent_r_proto='$getnetent_r_proto'
20218 getprotobyname_r_proto='$getprotobyname_r_proto'
20219 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20220 getprotoent_r_proto='$getprotoent_r_proto'
20221 getpwent_r_proto='$getpwent_r_proto'
20222 getpwnam_r_proto='$getpwnam_r_proto'
20223 getpwuid_r_proto='$getpwuid_r_proto'
20224 getservbyname_r_proto='$getservbyname_r_proto'
20225 getservbyport_r_proto='$getservbyport_r_proto'
20226 getservent_r_proto='$getservent_r_proto'
20227 getspnam_r_proto='$getspnam_r_proto'
20228 gidformat='$gidformat'
20229 gidsign='$gidsign'
20230 gidsize='$gidsize'
20231 gidtype='$gidtype'
20232 glibpth='$glibpth'
20233 gmake='$gmake'
20234 gmtime_r_proto='$gmtime_r_proto'
20235 gnulibc_version='$gnulibc_version'
20236 grep='$grep'
20237 groupcat='$groupcat'
20238 groupstype='$groupstype'
20239 gzip='$gzip'
20240 h_fcntl='$h_fcntl'
20241 h_sysfile='$h_sysfile'
20242 hint='$hint'
20243 hostcat='$hostcat'
20244 i16size='$i16size'
20245 i16type='$i16type'
20246 i32size='$i32size'
20247 i32type='$i32type'
20248 i64size='$i64size'
20249 i64type='$i64type'
20250 i8size='$i8size'
20251 i8type='$i8type'
20252 i_arpainet='$i_arpainet'
20253 i_bsdioctl='$i_bsdioctl'
20254 i_crypt='$i_crypt'
20255 i_db='$i_db'
20256 i_dbm='$i_dbm'
20257 i_dirent='$i_dirent'
20258 i_dld='$i_dld'
20259 i_dlfcn='$i_dlfcn'
20260 i_fcntl='$i_fcntl'
20261 i_float='$i_float'
20262 i_fp='$i_fp'
20263 i_fp_class='$i_fp_class'
20264 i_gdbm='$i_gdbm'
20265 i_grp='$i_grp'
20266 i_ieeefp='$i_ieeefp'
20267 i_inttypes='$i_inttypes'
20268 i_langinfo='$i_langinfo'
20269 i_libutil='$i_libutil'
20270 i_limits='$i_limits'
20271 i_locale='$i_locale'
20272 i_machcthr='$i_machcthr'
20273 i_malloc='$i_malloc'
20274 i_math='$i_math'
20275 i_memory='$i_memory'
20276 i_mntent='$i_mntent'
20277 i_ndbm='$i_ndbm'
20278 i_netdb='$i_netdb'
20279 i_neterrno='$i_neterrno'
20280 i_netinettcp='$i_netinettcp'
20281 i_niin='$i_niin'
20282 i_poll='$i_poll'
20283 i_prot='$i_prot'
20284 i_pthread='$i_pthread'
20285 i_pwd='$i_pwd'
20286 i_rpcsvcdbm='$i_rpcsvcdbm'
20287 i_sfio='$i_sfio'
20288 i_sgtty='$i_sgtty'
20289 i_shadow='$i_shadow'
20290 i_socks='$i_socks'
20291 i_stdarg='$i_stdarg'
20292 i_stddef='$i_stddef'
20293 i_stdlib='$i_stdlib'
20294 i_string='$i_string'
20295 i_sunmath='$i_sunmath'
20296 i_sysaccess='$i_sysaccess'
20297 i_sysdir='$i_sysdir'
20298 i_sysfile='$i_sysfile'
20299 i_sysfilio='$i_sysfilio'
20300 i_sysin='$i_sysin'
20301 i_sysioctl='$i_sysioctl'
20302 i_syslog='$i_syslog'
20303 i_sysmman='$i_sysmman'
20304 i_sysmode='$i_sysmode'
20305 i_sysmount='$i_sysmount'
20306 i_sysndir='$i_sysndir'
20307 i_sysparam='$i_sysparam'
20308 i_sysresrc='$i_sysresrc'
20309 i_syssecrt='$i_syssecrt'
20310 i_sysselct='$i_sysselct'
20311 i_syssockio='$i_syssockio'
20312 i_sysstat='$i_sysstat'
20313 i_sysstatfs='$i_sysstatfs'
20314 i_sysstatvfs='$i_sysstatvfs'
20315 i_systime='$i_systime'
20316 i_systimek='$i_systimek'
20317 i_systimes='$i_systimes'
20318 i_systypes='$i_systypes'
20319 i_sysuio='$i_sysuio'
20320 i_sysun='$i_sysun'
20321 i_sysutsname='$i_sysutsname'
20322 i_sysvfs='$i_sysvfs'
20323 i_syswait='$i_syswait'
20324 i_termio='$i_termio'
20325 i_termios='$i_termios'
20326 i_time='$i_time'
20327 i_unistd='$i_unistd'
20328 i_ustat='$i_ustat'
20329 i_utime='$i_utime'
20330 i_values='$i_values'
20331 i_varargs='$i_varargs'
20332 i_varhdr='$i_varhdr'
20333 i_vfork='$i_vfork'
20334 ignore_versioned_solibs='$ignore_versioned_solibs'
20335 inc_version_list='$inc_version_list'
20336 inc_version_list_init='$inc_version_list_init'
20337 incpath='$incpath'
20338 inews='$inews'
20339 installarchlib='$installarchlib'
20340 installbin='$installbin'
20341 installman1dir='$installman1dir'
20342 installman3dir='$installman3dir'
20343 installprefix='$installprefix'
20344 installprefixexp='$installprefixexp'
20345 installprivlib='$installprivlib'
20346 installscript='$installscript'
20347 installsitearch='$installsitearch'
20348 installsitebin='$installsitebin'
20349 installsitelib='$installsitelib'
20350 installstyle='$installstyle'
20351 installusrbinperl='$installusrbinperl'
20352 installvendorarch='$installvendorarch'
20353 installvendorbin='$installvendorbin'
20354 installvendorlib='$installvendorlib'
20355 intsize='$intsize'
20356 issymlink='$issymlink'
20357 ivdformat='$ivdformat'
20358 ivsize='$ivsize'
20359 ivtype='$ivtype'
20360 known_extensions='$known_extensions'
20361 ksh='$ksh'
20362 ld='$ld'
20363 lddlflags='$lddlflags'
20364 ldflags='$ldflags'
20365 ldflags_uselargefiles='$ldflags_uselargefiles'
20366 ldlibpthname='$ldlibpthname'
20367 less='$less'
20368 lib_ext='$lib_ext'
20369 libc='$libc'
20370 libperl='$libperl'
20371 libpth='$libpth'
20372 libs='$libs'
20373 libsdirs='$libsdirs'
20374 libsfiles='$libsfiles'
20375 libsfound='$libsfound'
20376 libspath='$libspath'
20377 libswanted='$libswanted'
20378 libswanted_uselargefiles='$libswanted_uselargefiles'
20379 line='$line'
20380 lint='$lint'
20381 lkflags='$lkflags'
20382 ln='$ln'
20383 lns='$lns'
20384 localtime_r_proto='$localtime_r_proto'
20385 locincpth='$locincpth'
20386 loclibpth='$loclibpth'
20387 longdblsize='$longdblsize'
20388 longlongsize='$longlongsize'
20389 longsize='$longsize'
20390 lp='$lp'
20391 lpr='$lpr'
20392 ls='$ls'
20393 lseeksize='$lseeksize'
20394 lseektype='$lseektype'
20395 mail='$mail'
20396 mailx='$mailx'
20397 make='$make'
20398 make_set_make='$make_set_make'
20399 mallocobj='$mallocobj'
20400 mallocsrc='$mallocsrc'
20401 malloctype='$malloctype'
20402 man1dir='$man1dir'
20403 man1direxp='$man1direxp'
20404 man1ext='$man1ext'
20405 man3dir='$man3dir'
20406 man3direxp='$man3direxp'
20407 man3ext='$man3ext'
20408 mips_type='$mips_type'
20409 mkdir='$mkdir'
20410 mmaptype='$mmaptype'
20411 modetype='$modetype'
20412 more='$more'
20413 multiarch='$multiarch'
20414 mv='$mv'
20415 myarchname='$myarchname'
20416 mydomain='$mydomain'
20417 myhostname='$myhostname'
20418 myuname='$myuname'
20419 n='$n'
20420 need_va_copy='$need_va_copy'
20421 netdb_hlen_type='$netdb_hlen_type'
20422 netdb_host_type='$netdb_host_type'
20423 netdb_name_type='$netdb_name_type'
20424 netdb_net_type='$netdb_net_type'
20425 nm='$nm'
20426 nm_opt='$nm_opt'
20427 nm_so_opt='$nm_so_opt'
20428 nonxs_ext='$nonxs_ext'
20429 nroff='$nroff'
20430 nvEUformat='$nvEUformat'
20431 nvFUformat='$nvFUformat'
20432 nvGUformat='$nvGUformat'
20433 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20434 nveformat='$nveformat'
20435 nvfformat='$nvfformat'
20436 nvgformat='$nvgformat'
20437 nvsize='$nvsize'
20438 nvtype='$nvtype'
20439 o_nonblock='$o_nonblock'
20440 obj_ext='$obj_ext'
20441 old_pthread_create_joinable='$old_pthread_create_joinable'
20442 optimize='$optimize'
20443 orderlib='$orderlib'
20444 osname='$osname'
20445 osvers='$osvers'
20446 otherlibdirs='$otherlibdirs'
20447 package='$package'
20448 pager='$pager'
20449 passcat='$passcat'
20450 patchlevel='$patchlevel'
20451 path_sep='$path_sep'
20452 perl5='$perl5'
20453 perl='$perl'
20454 perl_patchlevel='$perl_patchlevel'
20455 perladmin='$perladmin'
20456 perllibs='$perllibs'
20457 perlpath='$perlpath'
20458 pg='$pg'
20459 phostname='$phostname'
20460 pidtype='$pidtype'
20461 plibpth='$plibpth'
20462 pm_apiversion='$pm_apiversion'
20463 pmake='$pmake'
20464 pr='$pr'
20465 prefix='$prefix'
20466 prefixexp='$prefixexp'
20467 privlib='$privlib'
20468 privlibexp='$privlibexp'
20469 procselfexe='$procselfexe'
20470 prototype='$prototype'
20471 ptrsize='$ptrsize'
20472 quadkind='$quadkind'
20473 quadtype='$quadtype'
20474 randbits='$randbits'
20475 randfunc='$randfunc'
20476 random_r_proto='$random_r_proto'
20477 randseedtype='$randseedtype'
20478 ranlib='$ranlib'
20479 rd_nodata='$rd_nodata'
20480 readdir64_r_proto='$readdir64_r_proto'
20481 readdir_r_proto='$readdir_r_proto'
20482 revision='$revision'
20483 rm='$rm'
20484 rmail='$rmail'
20485 run='$run'
20486 runnm='$runnm'
20487 sPRIEUldbl='$sPRIEUldbl'
20488 sPRIFUldbl='$sPRIFUldbl'
20489 sPRIGUldbl='$sPRIGUldbl'
20490 sPRIXU64='$sPRIXU64'
20491 sPRId64='$sPRId64'
20492 sPRIeldbl='$sPRIeldbl'
20493 sPRIfldbl='$sPRIfldbl'
20494 sPRIgldbl='$sPRIgldbl'
20495 sPRIi64='$sPRIi64'
20496 sPRIo64='$sPRIo64'
20497 sPRIu64='$sPRIu64'
20498 sPRIx64='$sPRIx64'
20499 sSCNfldbl='$sSCNfldbl'
20500 sched_yield='$sched_yield'
20501 scriptdir='$scriptdir'
20502 scriptdirexp='$scriptdirexp'
20503 sed='$sed'
20504 seedfunc='$seedfunc'
20505 selectminbits='$selectminbits'
20506 selecttype='$selecttype'
20507 sendmail='$sendmail'
20508 setgrent_r_proto='$setgrent_r_proto'
20509 sethostent_r_proto='$sethostent_r_proto'
20510 setlocale_r_proto='$setlocale_r_proto'
20511 setnetent_r_proto='$setnetent_r_proto'
20512 setprotoent_r_proto='$setprotoent_r_proto'
20513 setpwent_r_proto='$setpwent_r_proto'
20514 setservent_r_proto='$setservent_r_proto'
20515 sh='$sh'
20516 shar='$shar'
20517 sharpbang='$sharpbang'
20518 shmattype='$shmattype'
20519 shortsize='$shortsize'
20520 shrpenv='$shrpenv'
20521 shsharp='$shsharp'
20522 sig_count='$sig_count'
20523 sig_name='$sig_name'
20524 sig_name_init='$sig_name_init'
20525 sig_num='$sig_num'
20526 sig_num_init='$sig_num_init'
20527 sig_size='$sig_size'
20528 signal_t='$signal_t'
20529 sitearch='$sitearch'
20530 sitearchexp='$sitearchexp'
20531 sitebin='$sitebin'
20532 sitebinexp='$sitebinexp'
20533 sitelib='$sitelib'
20534 sitelib_stem='$sitelib_stem'
20535 sitelibexp='$sitelibexp'
20536 siteprefix='$siteprefix'
20537 siteprefixexp='$siteprefixexp'
20538 sizesize='$sizesize'
20539 sizetype='$sizetype'
20540 sleep='$sleep'
20541 smail='$smail'
20542 so='$so'
20543 sockethdr='$sockethdr'
20544 socketlib='$socketlib'
20545 socksizetype='$socksizetype'
20546 sort='$sort'
20547 spackage='$spackage'
20548 spitshell='$spitshell'
20549 srand48_r_proto='$srand48_r_proto'
20550 srandom_r_proto='$srandom_r_proto'
20551 src='$src'
20552 ssizetype='$ssizetype'
20553 startperl='$startperl'
20554 startsh='$startsh'
20555 static_ext='$static_ext'
20556 stdchar='$stdchar'
20557 stdio_base='$stdio_base'
20558 stdio_bufsiz='$stdio_bufsiz'
20559 stdio_cnt='$stdio_cnt'
20560 stdio_filbuf='$stdio_filbuf'
20561 stdio_ptr='$stdio_ptr'
20562 stdio_stream_array='$stdio_stream_array'
20563 strerror_r_proto='$strerror_r_proto'
20564 strings='$strings'
20565 submit='$submit'
20566 subversion='$subversion'
20567 sysman='$sysman'
20568 tail='$tail'
20569 tar='$tar'
20570 targetarch='$targetarch'
20571 tbl='$tbl'
20572 tee='$tee'
20573 test='$test'
20574 timeincl='$timeincl'
20575 timetype='$timetype'
20576 tmpnam_r_proto='$tmpnam_r_proto'
20577 to='$to'
20578 touch='$touch'
20579 tr='$tr'
20580 trnl='$trnl'
20581 troff='$troff'
20582 ttyname_r_proto='$ttyname_r_proto'
20583 u16size='$u16size'
20584 u16type='$u16type'
20585 u32size='$u32size'
20586 u32type='$u32type'
20587 u64size='$u64size'
20588 u64type='$u64type'
20589 u8size='$u8size'
20590 u8type='$u8type'
20591 uidformat='$uidformat'
20592 uidsign='$uidsign'
20593 uidsize='$uidsize'
20594 uidtype='$uidtype'
20595 uname='$uname'
20596 uniq='$uniq'
20597 uquadtype='$uquadtype'
20598 use5005threads='$use5005threads'
20599 use64bitall='$use64bitall'
20600 use64bitint='$use64bitint'
20601 usecrosscompile='$usecrosscompile'
20602 usedl='$usedl'
20603 useithreads='$useithreads'
20604 uselargefiles='$uselargefiles'
20605 uselongdouble='$uselongdouble'
20606 usemorebits='$usemorebits'
20607 usemultiplicity='$usemultiplicity'
20608 usemymalloc='$usemymalloc'
20609 usenm='$usenm'
20610 useopcode='$useopcode'
20611 useperlio='$useperlio'
20612 useposix='$useposix'
20613 usereentrant='$usereentrant'
20614 usesfio='$usesfio'
20615 useshrplib='$useshrplib'
20616 usesocks='$usesocks'
20617 usethreads='$usethreads'
20618 usevendorprefix='$usevendorprefix'
20619 usevfork='$usevfork'
20620 usrinc='$usrinc'
20621 uuname='$uuname'
20622 uvXUformat='$uvXUformat'
20623 uvoformat='$uvoformat'
20624 uvsize='$uvsize'
20625 uvtype='$uvtype'
20626 uvuformat='$uvuformat'
20627 uvxformat='$uvxformat'
20628 vendorarch='$vendorarch'
20629 vendorarchexp='$vendorarchexp'
20630 vendorbin='$vendorbin'
20631 vendorbinexp='$vendorbinexp'
20632 vendorlib='$vendorlib'
20633 vendorlib_stem='$vendorlib_stem'
20634 vendorlibexp='$vendorlibexp'
20635 vendorprefix='$vendorprefix'
20636 vendorprefixexp='$vendorprefixexp'
20637 version='$version'
20638 version_patchlevel_string='$version_patchlevel_string'
20639 versiononly='$versiononly'
20640 vi='$vi'
20641 voidflags='$voidflags'
20642 xlibpth='$xlibpth'
20643 xs_apiversion='$xs_apiversion'
20644 gccansipedantic='$gccansipedantic'
20645 yacc='$yacc'
20646 yaccflags='$yaccflags'
20647 zcat='$zcat'
20648 zip='$zip'
20649 EOT
20650
20651 : Add in command line options if available
20652 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20653
20654 : add special variables
20655 $test -f $src/patchlevel.h && \
20656 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20657 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20658 echo "PERL_CONFIG_SH=true" >>config.sh
20659
20660 : propagate old symbols
20661 if $test -f UU/config.sh; then
20662         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20663         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20664         $sort | $uniq -u >UU/oldsyms
20665         set X `cat UU/oldsyms`
20666         shift
20667         case $# in
20668         0) ;;
20669         *)
20670                 cat <<EOM
20671 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20672 EOM
20673                 echo "# Variables propagated from previous config.sh file." >>config.sh
20674                 for sym in `cat UU/oldsyms`; do
20675                         echo "    Propagating $hint variable "'$'"$sym..."
20676                         eval 'tmp="$'"${sym}"'"'
20677                         echo "$tmp" | \
20678                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20679                 done
20680                 ;;
20681         esac
20682 fi
20683
20684 : Finish up by extracting the .SH files
20685 case "$alldone" in
20686 exit)
20687         $rm -rf UU
20688         echo "Extraction done."
20689         exit 0
20690         ;;
20691 cont)
20692         ;;
20693 '')
20694         dflt=''
20695         nostick=true
20696         $cat <<EOM
20697
20698 If you'd like to make any changes to the config.sh file before I begin
20699 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20700
20701 EOM
20702         rp="Press return or use a shell escape to edit config.sh:"
20703         . UU/myread
20704         nostick=''
20705         case "$ans" in
20706         '') ;;
20707         *) : in case they cannot read
20708                 sh 1>&4 -c "$ans";;
20709         esac
20710         ;;
20711 esac
20712
20713 : if this fails, just run all the .SH files by hand
20714 . ./config.sh
20715
20716 echo " "
20717 exec 1>&4
20718 pwd=`pwd`
20719 . ./UU/extract
20720 cd "$pwd"
20721
20722 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20723         dflt=y
20724         case "$silent" in
20725         true) ;;
20726         *)
20727                 $cat <<EOM
20728
20729 Now you need to generate make dependencies by running "$make depend".
20730 You might prefer to run it in background: "$make depend > makedepend.out &"
20731 It can take a while, so you might not want to run it right now.
20732
20733 EOM
20734                 ;;
20735         esac
20736         rp="Run $make depend now?"
20737         . UU/myread
20738         case "$ans" in
20739         y*)
20740                 $make depend && echo "Now you must run '$make'."
20741                 ;;
20742         *)
20743                 echo "You must run '$make depend' then '$make'."
20744                 ;;
20745         esac
20746 elif test -f [Mm]akefile; then
20747         echo " "
20748         echo "Now you must run a $make."
20749 else
20750         echo "Configure done."
20751 fi
20752
20753 if $test -f Policy.sh; then
20754     $cat <<EOM
20755
20756 If you compile $package on a different machine or from a different object
20757 directory, copy the Policy.sh file from this object directory to the
20758 new one before you run Configure -- this will help you with most of
20759 the policy defaults.
20760
20761 EOM
20762 fi
20763 if $test -f config.msg; then
20764     echo "Hmm.  I also noted the following information while running:"
20765     echo " "
20766     $cat config.msg >&4
20767     $rm -f config.msg
20768 fi
20769 $rm -f kit*isdone ark*isdone
20770 $rm -rf UU
20771
20772 : End of Configure
20773