a421b8429373f3c205a18c8bd5d6816243c1e207
[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 Mon Feb  8 01:45:46 EET 1999 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/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 >/tmp/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 /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/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                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 case "$inksh/$needksh" in
112 /[a-z]*)
113                 ENV=''
114                 changesh=true
115                 reason="$needksh"
116         ;;
117 esac
118 case "$inksh/$avoidksh" in
119 true/[a-z]*)
120         changesh=true
121         reason="$avoidksh"
122         ;;
123 esac
124 case "$inksh/$needksh-$avoidksh-" in
125 true/--)
126                 cat <<EOM
127 (I see you are using the Korn shell.  Some ksh's blow up on $me,
128 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
129 EOM
130         ;;
131 esac
132 case "$changesh" in
133 true)
134         echo "(Feeding myself to $newsh $reason.)"
135         case "$0" in
136         Configure|*/Configure) exec $newsh $0 "$@";;
137         *) exec $newsh Configure "$@";;
138         esac
139         ;;
140 esac
141
142 : if needed set CDPATH to a harmless value that is not chatty
143 : avoid bash 2.02 problems with empty CDPATH.
144 case "$CDPATH" in
145 '')     ;;
146 *)      case "$SHELL" in
147         *bash*) CDPATH='.' ;;
148         *)              CDPATH='' ;;
149         esac
150         ;;
151 esac
152 : Configure runs within the UU subdirectory
153 test -d UU || mkdir UU
154 cd UU && rm -f ./*
155
156 ccsymbols=''
157 cppccsymbols=''
158 cppsymbols=''
159 dynamic_ext=''
160 extensions=''
161 known_extensions=''
162 nonxs_ext=''
163 static_ext=''
164 useopcode=''
165 useposix=''
166 d_bsd=''
167 d_eunice=''
168 d_xenix=''
169 eunicefix=''
170 Mcc=''
171 ar=''
172 awk=''
173 bash=''
174 bison=''
175 byacc=''
176 cat=''
177 chgrp=''
178 chmod=''
179 chown=''
180 comm=''
181 compress=''
182 cp=''
183 cpio=''
184 cpp=''
185 csh=''
186 date=''
187 echo=''
188 egrep=''
189 emacs=''
190 expr=''
191 find=''
192 flex=''
193 grep=''
194 gzip=''
195 inews=''
196 ksh=''
197 less=''
198 line=''
199 lint=''
200 ln=''
201 lp=''
202 lpr=''
203 ls=''
204 mail=''
205 mailx=''
206 make=''
207 mkdir=''
208 more=''
209 mv=''
210 nm=''
211 nroff=''
212 perl=''
213 pg=''
214 pmake=''
215 pr=''
216 rm=''
217 rmail=''
218 sed=''
219 sendmail=''
220 shar=''
221 sleep=''
222 smail=''
223 sort=''
224 submit=''
225 tail=''
226 tar=''
227 tbl=''
228 tee=''
229 test=''
230 touch=''
231 tr=''
232 troff=''
233 uname=''
234 uniq=''
235 uuname=''
236 vi=''
237 zcat=''
238 zip=''
239 full_sed=''
240 libswanted=''
241 hint=''
242 myuname=''
243 osname=''
244 osvers=''
245 Author=''
246 Date=''
247 Header=''
248 Id=''
249 Locker=''
250 Log=''
251 RCSfile=''
252 Revision=''
253 Source=''
254 State=''
255 _a=''
256 _exe=''
257 _o=''
258 archobjs=''
259 exe_ext=''
260 firstmakefile=''
261 lib_ext=''
262 obj_ext=''
263 path_sep=''
264 afs=''
265 alignbytes=''
266 ansi2knr=''
267 archlib=''
268 archlibexp=''
269 d_archlib=''
270 installarchlib=''
271 archname=''
272 myarchname=''
273 baserev=''
274 bin=''
275 binexp=''
276 installbin=''
277 byteorder=''
278 cc=''
279 gccversion=''
280 ccflags=''
281 cppflags=''
282 ldflags=''
283 lkflags=''
284 locincpth=''
285 optimize=''
286 cf_email=''
287 cf_by=''
288 cf_time=''
289 contains=''
290 cpp_stuff=''
291 cpplast=''
292 cppminus=''
293 cpprun=''
294 cppstdin=''
295 d_access=''
296 d_accessx=''
297 d_alarm=''
298 d_attribut=''
299 d_bcmp=''
300 d_bcopy=''
301 d_bzero=''
302 d_casti32=''
303 castflags=''
304 d_castneg=''
305 d_chown=''
306 d_chroot=''
307 d_chsize=''
308 d_closedir=''
309 d_void_closedir=''
310 d_const=''
311 cryptlib=''
312 d_crypt=''
313 d_csh=''
314 full_csh=''
315 d_cuserid=''
316 d_dbl_dig=''
317 d_difftime=''
318 d_dlerror=''
319 d_dlopen=''
320 d_dlsymun=''
321 d_dosuid=''
322 d_suidsafe=''
323 d_drand48proto=''
324 d_dup2=''
325 d_eaccess=''
326 d_endgrent=''
327 d_endhent=''
328 d_endnent=''
329 d_endpent=''
330 d_endpwent=''
331 d_endsent=''
332 d_fchmod=''
333 d_fchown=''
334 d_fcntl=''
335 d_fd_macros=''
336 d_fd_set=''
337 d_fds_bits=''
338 d_fgetpos=''
339 d_flexfnam=''
340 d_flock=''
341 d_fork=''
342 d_fseeko=''
343 d_fsetpos=''
344 d_ftello=''
345 d_ftime=''
346 d_gettimeod=''
347 d_Gconvert=''
348 d_getgrent=''
349 d_getgrps=''
350 d_gethbyaddr=''
351 d_gethbyname=''
352 d_gethent=''
353 aphostname=''
354 d_gethname=''
355 d_phostname=''
356 d_uname=''
357 d_gethostprotos=''
358 d_getlogin=''
359 d_getnbyaddr=''
360 d_getnbyname=''
361 d_getnent=''
362 d_getnetprotos=''
363 d_getpent=''
364 d_getpgid=''
365 d_getpgrp2=''
366 d_bsdgetpgrp=''
367 d_getpgrp=''
368 d_getppid=''
369 d_getprior=''
370 d_getpbyname=''
371 d_getpbynumber=''
372 d_getprotoprotos=''
373 d_getpwent=''
374 d_getsent=''
375 d_getservprotos=''
376 d_getsbyname=''
377 d_getsbyport=''
378 d_gnulibc=''
379 d_htonl=''
380 d_inetaton=''
381 d_isascii=''
382 d_killpg=''
383 d_lchown=''
384 d_link=''
385 d_locconv=''
386 d_lockf=''
387 d_longdbl=''
388 longdblsize=''
389 d_longlong=''
390 longlongsize=''
391 d_lstat=''
392 d_madvise=''
393 d_mblen=''
394 d_mbstowcs=''
395 d_mbtowc=''
396 d_memcmp=''
397 d_memcpy=''
398 d_memmove=''
399 d_memset=''
400 d_mkdir=''
401 d_mkfifo=''
402 d_mktime=''
403 d_mmap=''
404 mmaptype=''
405 d_mprotect=''
406 d_msg=''
407 d_msgctl=''
408 d_msgget=''
409 d_msgrcv=''
410 d_msgsnd=''
411 d_msync=''
412 d_munmap=''
413 d_nice=''
414 d_open3=''
415 d_fpathconf=''
416 d_pathconf=''
417 d_pause=''
418 d_pipe=''
419 d_poll=''
420 d_portable=''
421 d_old_pthread_create_joinable=''
422 old_pthread_create_joinable=''
423 d_pthread_yield=''
424 d_sched_yield=''
425 sched_yield=''
426 d_readdir=''
427 d_rewinddir=''
428 d_seekdir=''
429 d_telldir=''
430 d_readlink=''
431 d_readv=''
432 d_rename=''
433 d_rmdir=''
434 d_safebcpy=''
435 d_safemcpy=''
436 d_sanemcmp=''
437 d_select=''
438 d_sem=''
439 d_semctl=''
440 d_semget=''
441 d_semop=''
442 d_setegid=''
443 d_seteuid=''
444 d_setgrent=''
445 d_setgrps=''
446 d_sethent=''
447 d_setlinebuf=''
448 d_setlocale=''
449 d_setnent=''
450 d_setpent=''
451 d_setpgid=''
452 d_setpgrp2=''
453 d_bsdsetpgrp=''
454 d_setpgrp=''
455 d_setprior=''
456 d_setpwent=''
457 d_setregid=''
458 d_setresgid=''
459 d_setresuid=''
460 d_setreuid=''
461 d_setrgid=''
462 d_setruid=''
463 d_setsent=''
464 d_setsid=''
465 d_setvbuf=''
466 d_sfio=''
467 usesfio=''
468 d_shm=''
469 d_shmat=''
470 d_shmatprototype=''
471 shmattype=''
472 d_shmctl=''
473 d_shmdt=''
474 d_shmget=''
475 d_sigaction=''
476 d_sigsetjmp=''
477 d_cmsghdr_s=''
478 d_msg_ctrunc=''
479 d_msg_dontroute=''
480 d_msg_oob=''
481 d_msg_peek=''
482 d_msg_proxy=''
483 d_msghdr_s=''
484 d_oldsock=''
485 d_recvmsg=''
486 d_scm_rights=''
487 d_sendmsg=''
488 d_socket=''
489 d_sockpair=''
490 sockethdr=''
491 socketlib=''
492 d_statblks=''
493 d_fstatfs=''
494 d_statfs=''
495 d_statfsflags=''
496 d_fstatvfs=''
497 d_statvfs=''
498 d_stdio_cnt_lval=''
499 d_stdio_ptr_lval=''
500 d_stdiobase=''
501 d_stdstdio=''
502 stdio_base=''
503 stdio_bufsiz=''
504 stdio_cnt=''
505 stdio_filbuf=''
506 stdio_ptr=''
507 d_index=''
508 d_strchr=''
509 d_strcoll=''
510 d_strctcpy=''
511 d_strerrm=''
512 d_strerror=''
513 d_sysernlst=''
514 d_syserrlst=''
515 d_strtod=''
516 d_strtol=''
517 d_strtoul=''
518 d_strxfrm=''
519 d_symlink=''
520 d_syscall=''
521 d_sysconf=''
522 d_system=''
523 d_tcgetpgrp=''
524 d_tcsetpgrp=''
525 d_telldirproto=''
526 d_time=''
527 timetype=''
528 clocktype=''
529 d_times=''
530 d_truncate=''
531 d_tzname=''
532 d_umask=''
533 d_semctl_semid_ds=''
534 d_semctl_semun=''
535 d_union_semun=''
536 d_vfork=''
537 usevfork=''
538 d_voidsig=''
539 signal_t=''
540 d_volatile=''
541 d_charvspr=''
542 d_vprintf=''
543 d_wait4=''
544 d_waitpid=''
545 d_wcstombs=''
546 d_wctomb=''
547 d_writev=''
548 d_dbmclose64=''
549 d_dbminit64=''
550 d_delete64=''
551 d_fetch64=''
552 d_firstkey64=''
553 d_nextkey64=''
554 d_store64=''
555 dlext=''
556 cccdlflags=''
557 ccdlflags=''
558 dlsrc=''
559 ld=''
560 lddlflags=''
561 usedl=''
562 doublesize=''
563 ebcdic=''
564 fpostype=''
565 gidtype=''
566 groupstype=''
567 h_fcntl=''
568 h_sysfile=''
569 i_arpainet=''
570 db_hashtype=''
571 db_prefixtype=''
572 i_db=''
573 i_dbm=''
574 i_rpcsvcdbm=''
575 d_dirnamlen=''
576 direntrytype=''
577 i_dirent=''
578 i_dld=''
579 i_dlfcn=''
580 i_fcntl=''
581 i_float=''
582 i_gdbm=''
583 d_grpasswd=''
584 i_grp=''
585 d_int64t=''
586 i_inttypes=''
587 i_limits=''
588 i_locale=''
589 i_machcthr=''
590 i_malloc=''
591 i_math=''
592 i_memory=''
593 i_mntent=''
594 i_ndbm=''
595 i_netdb=''
596 i_neterrno=''
597 i_niin=''
598 i_sysin=''
599 i_poll=''
600 d_pwage=''
601 d_pwchange=''
602 d_pwclass=''
603 d_pwcomment=''
604 d_pwexpire=''
605 d_pwgecos=''
606 d_pwpasswd=''
607 d_pwquota=''
608 i_pwd=''
609 i_sfio=''
610 i_stddef=''
611 i_stdlib=''
612 i_string=''
613 strings=''
614 i_sysaccess=''
615 i_sysdir=''
616 i_sysfile=''
617 d_voidtty=''
618 i_bsdioctl=''
619 i_sysfilio=''
620 i_sysioctl=''
621 i_syssockio=''
622 i_sysmman=''
623 i_sysmount=''
624 i_sysndir=''
625 i_sysparam=''
626 i_sysresrc=''
627 i_syssecrt=''
628 i_sysselct=''
629 i_sysstat=''
630 i_sysstatvfs=''
631 i_systimes=''
632 i_systypes=''
633 d_iovec_s=''
634 i_sysuio=''
635 i_sysun=''
636 i_syswait=''
637 i_sgtty=''
638 i_termio=''
639 i_termios=''
640 i_systime=''
641 i_systimek=''
642 i_time=''
643 timeincl=''
644 i_unistd=''
645 i_utime=''
646 i_values=''
647 i_stdarg=''
648 i_varargs=''
649 i_varhdr=''
650 i_vfork=''
651 installusrbinperl=''
652 intsize=''
653 longsize=''
654 shortsize=''
655 d_dirent64_s=''
656 d_flock64_s=''
657 d_fstat64=''
658 d_ftruncate64=''
659 d_ino64t=''
660 d_lockf64=''
661 d_lseek64=''
662 d_lstat64=''
663 d_off64t=''
664 d_open64=''
665 d_opendir64=''
666 d_readdir64=''
667 d_seekdir64=''
668 d_stat64=''
669 d_telldir64=''
670 d_truncate64=''
671 libc=''
672 libperl=''
673 shrpenv=''
674 useshrplib=''
675 glibpth=''
676 libpth=''
677 loclibpth=''
678 plibpth=''
679 xlibpth=''
680 ignore_versioned_solibs=''
681 libs=''
682 lns=''
683 lseeksize=''
684 lseektype=''
685 make_set_make=''
686 d_mymalloc=''
687 freetype=''
688 mallocobj=''
689 mallocsrc=''
690 malloctype=''
691 usemymalloc=''
692 installman1dir=''
693 man1dir=''
694 man1direxp=''
695 man1ext=''
696 installman3dir=''
697 man3dir=''
698 man3direxp=''
699 man3ext=''
700 huge=''
701 large=''
702 medium=''
703 models=''
704 small=''
705 split=''
706 modetype=''
707 mydomain=''
708 myhostname=''
709 phostname=''
710 c=''
711 n=''
712 d_eofnblk=''
713 eagain=''
714 o_nonblock=''
715 rd_nodata=''
716 netdb_hlen_type=''
717 netdb_host_type=''
718 netdb_name_type=''
719 netdb_net_type=''
720 groupcat=''
721 hostcat=''
722 passcat=''
723 orderlib=''
724 ranlib=''
725 package=''
726 spackage=''
727 pager=''
728 apiversion=''
729 patchlevel=''
730 subversion=''
731 version=''
732 perladmin=''
733 perlpath=''
734 pidtype=''
735 prefix=''
736 prefixexp=''
737 installprivlib=''
738 privlib=''
739 privlibexp=''
740 prototype=''
741 ptrsize=''
742 drand01=''
743 randbits=''
744 randfunc=''
745 randseedtype=''
746 seedfunc=''
747 installscript=''
748 scriptdir=''
749 scriptdirexp=''
750 selectminbits=''
751 selecttype=''
752 sh=''
753 sig_name=''
754 sig_name_init=''
755 sig_num=''
756 sig_num_init=''
757 installsitearch=''
758 sitearch=''
759 sitearchexp=''
760 installsitelib=''
761 sitelib=''
762 sitelibexp=''
763 sizetype=''
764 so=''
765 sharpbang=''
766 shsharp=''
767 spitshell=''
768 src=''
769 ssizetype=''
770 startperl=''
771 startsh=''
772 stdchar=''
773 d_fgetpos64=''
774 d_fopen64=''
775 d_freopen64=''
776 d_fseek64=''
777 d_fseeko64=''
778 d_fsetpos64=''
779 d_ftell64=''
780 d_ftello64=''
781 d_tmpfile64=''
782 sysman=''
783 trnl=''
784 uidtype=''
785 archname64=''
786 use64bits=''
787 usemultiplicity=''
788 nm_opt=''
789 nm_so_opt=''
790 runnm=''
791 usenm=''
792 useperlio=''
793 d_oldpthreads=''
794 usethreads=''
795 incpath=''
796 mips=''
797 mips_type=''
798 usrinc=''
799 defvoidused=''
800 voidflags=''
801 CONFIG=''
802
803 define='define'
804 undef='undef'
805 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
806 rmlist=''
807
808 : We must find out about Eunice early
809 eunicefix=':'
810 if test -f /etc/unixtovms; then
811         eunicefix=/etc/unixtovms
812 fi
813 if test -f /etc/unixtovms.exe; then
814         eunicefix=/etc/unixtovms.exe
815 fi
816
817 i_whoami=''
818 : change the next line if compiling for Xenix/286 on Xenix/386
819 xlibpth='/usr/lib/386 /lib/386'
820
821 : Possible local library directories to search.
822 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
823 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
824
825 : general looking path for locating libraries
826 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
827 glibpth="$glibpth /lib /usr/lib $xlibpth"
828 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
829 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
830
831 : Private path used by Configure to find libraries.  Its value
832 : is prepended to libpth. This variable takes care of special
833 : machines, like the mips.  Usually, it should be empty.
834 plibpth=''
835
836 : Possible local include directories to search.
837 : Set locincpth to "" in a hint file to defeat local include searches.
838 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
839 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
840 :
841 : no include file wanted by default
842 inclwanted=''
843
844 : list of known cpp symbols, sorted alphabetically
845 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
846 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
847 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
848 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
849 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
850 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
851 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
852 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
853 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
854 al="$al VMS Xenix286"
855 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
856 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
857 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
858 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
859 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
860 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
861 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
862 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
863 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
864 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
865 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
866 al="$al __SVR4_2__ __UMAXV__"
867 al="$al ____386BSD____ __alpha __alpha__ __amiga"
868 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
869 al="$al __host_mips__"
870 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
871 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
872 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
873 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
874 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
875 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
876 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
877 al="$al __mc88100 __mc88100__ __mips __mips__"
878 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
879 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
880 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
881 al="$al _host_mips _mips _unix"
882 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
883 al="$al apollo ardent att386 att3b"
884 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
885 al="$al cadmus clipper concurrent convex cray ctix"
886 al="$al dmert encore gcos gcx gimpel gould"
887 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
888 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
889 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
890 al="$al i186 i286 i386 i486 i8086"
891 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
892 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
893 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
894 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
895 al="$al mc88000 mc88100 merlin mert mips mvs n16"
896 al="$al ncl_el ncl_mr"
897 al="$al news1500 news1700 news1800 news1900 news3700"
898 al="$al news700 news800 news900 ns16000 ns32000"
899 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
900 al="$al parisc pc532 pdp11 plexus posix pyr"
901 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
902 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
903 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
904 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
905 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
906 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
907 al="$al xenix z8000"
908
909 : Trailing extension.  Override this in a hint file, if needed.
910 _exe=''
911 : Extra object files, if any, needed on this platform.
912 archobjs=''
913 groupstype=''
914 : default library list
915 libswanted=''
916 : some systems want to use only the non-versioned libso:s
917 ignore_versioned_solibs=''
918 : full support for void wanted by default
919 defvoidused=15
920
921 : set useposix=false in your hint file to disable the POSIX extension.
922 useposix=true
923 : set useopcode=false in your hint file to disable the Opcode extension.
924 useopcode=true
925 : set usemultiplicity on the Configure command line to enable multiplicity.
926 : set usethreads on the Configure command line to enable threads.
927 : List of libraries we want.
928 : If anyone needs -lnet, put it in a hint file.
929 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
930 libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
931 libswanted="$libswanted ucb bsd BSD PW x"
932 : We probably want to search /usr/shlib before most other libraries.
933 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
934 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
935 glibpth="/usr/shlib $glibpth"
936 : Do not use vfork unless overridden by a hint file.
937 usevfork=false
938
939 : Find the basic shell for Bourne shell scripts
940 case "$sh" in
941 '')
942         case "$SYSTYPE" in
943         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
944         *) xxx='/bin/sh';;
945         esac
946         if test -f "$xxx"; then
947                 sh="$xxx"
948         else
949                 : Build up a list and do a single loop so we can 'break' out.
950                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
951                 for xxx in sh bash ksh pdksh ash; do
952                         for p in $pth; do
953                                 try="$try ${p}/${xxx}"
954                         done
955                 done
956                 for xxx in $try; do
957                         if test -f "$xxx"; then
958                                 sh="$xxx";
959                                 break
960                         elif test -f "$xxx.exe"; then
961                                 sh="$xxx";
962                                 break
963                         fi
964                 done
965         fi
966         ;;
967 esac
968
969 case "$sh" in
970 '')     cat <<EOM >&2
971 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
972
973 Usually it's in /bin/sh.  How did you even get this far?
974 Please contact me (Perl Maintainers) at perlbug@perl.com and 
975 we'll try to straighten this all out.
976 EOM
977         exit 1
978         ;;
979 esac
980
981 : see if sh knows # comments
982 if `$sh -c '#' >/dev/null 2>&1`; then
983         shsharp=true
984         spitshell=cat
985         xcat=/bin/cat
986         test -f $xcat || xcat=/usr/bin/cat
987         echo "#!$xcat" >try
988         $eunicefix try
989         chmod +x try
990         ./try > today
991         if test -s today; then
992                 sharpbang='#!'
993         else
994                 echo "#! $xcat" > try
995                 $eunicefix try
996                 chmod +x try
997                 ./try > today
998                 if test -s today; then
999                         sharpbang='#! '
1000                 else
1001                         sharpbang=': use '
1002                 fi
1003         fi
1004 else
1005         echo " "
1006         echo "Your $sh doesn't grok # comments--I will strip them later on."
1007         shsharp=false
1008         cd ..
1009         echo "exec grep -v '^[  ]*#'" >spitshell
1010         chmod +x spitshell
1011         $eunicefix spitshell
1012         spitshell=`pwd`/spitshell
1013         cd UU
1014         echo "I presume that if # doesn't work, #! won't work either!"
1015         sharpbang=': use '
1016 fi
1017 rm -f try today
1018
1019 : figure out how to guarantee sh startup
1020 case "$startsh" in
1021 '') startsh=${sharpbang}${sh} ;;
1022 *)
1023 esac
1024 cat >try <<EOSS
1025 $startsh
1026 set abc
1027 test "$?abc" != 1
1028 EOSS
1029
1030 chmod +x try
1031 $eunicefix try
1032 if ./try; then
1033         : echo "Yup, it does."
1034 else
1035         echo "Hmm... '$startsh' does not guarantee sh startup..."
1036         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1037 fi
1038 rm -f try
1039
1040
1041 : Save command line options in file UU/cmdline.opt for later use in
1042 : generating config.sh.
1043 cat > cmdline.opt <<EOSH
1044 # Configure command line arguments.
1045 config_arg0='$0'
1046 config_args='$*'
1047 config_argc=$#
1048 EOSH
1049 argn=1
1050 for arg in "$@"; do
1051         cat >>cmdline.opt <<EOSH
1052 config_arg$argn='$arg'
1053 EOSH
1054         argn=`expr $argn + 1`
1055 done
1056
1057 : produce awk script to parse command line options
1058 cat >options.awk <<'EOF'
1059 BEGIN {
1060         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
1061
1062         len = length(optstr);
1063         for (i = 1; i <= len; i++) {
1064                 c = substr(optstr, i, 1);
1065                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1066                 if (a == ":") {
1067                         arg[c] = 1;
1068                         i++;
1069                 }
1070                 opt[c] = 1;
1071         }
1072 }
1073 {
1074         expect = 0;
1075         str = $0;
1076         if (substr(str, 1, 1) != "-") {
1077                 printf("'%s'\n", str);
1078                 next;
1079         }
1080         len = length($0);
1081         for (i = 2; i <= len; i++) {
1082                 c = substr(str, i, 1);
1083                 if (!opt[c]) {
1084                         printf("-%s\n", substr(str, i));
1085                         next;
1086                 }
1087                 printf("-%s\n", c);
1088                 if (arg[c]) {
1089                         if (i < len)
1090                                 printf("'%s'\n", substr(str, i + 1));
1091                         else
1092                                 expect = 1;
1093                         next;
1094                 }
1095         }
1096 }
1097 END {
1098         if (expect)
1099                 print "?";
1100 }
1101 EOF
1102
1103 : process the command line options
1104 set X `for arg in "$@"; do echo "X$arg"; done |
1105         sed -e s/X// | awk -f options.awk`
1106 eval "set $*"
1107 shift
1108 rm -f options.awk
1109
1110 : set up default values
1111 fastread=''
1112 reuseval=false
1113 config_sh=''
1114 alldone=''
1115 error=''
1116 silent=''
1117 extractsh=''
1118 override=''
1119 knowitall=''
1120 rm -f optdef.sh
1121 cat >optdef.sh <<EOS
1122 $startsh
1123 EOS
1124
1125
1126 : option parsing
1127 while test $# -gt 0; do
1128         case "$1" in
1129         -d) shift; fastread=yes;;
1130         -e) shift; alldone=cont;;
1131         -f)
1132                 shift
1133                 cd ..
1134                 if test -r "$1"; then
1135                         config_sh="$1"
1136                 else
1137                         echo "$me: cannot read config file $1." >&2
1138                         error=true
1139                 fi
1140                 cd UU
1141                 shift;;
1142         -h) shift; error=true;;
1143         -r) shift; reuseval=true;;
1144         -s) shift; silent=true; realsilent=true;;
1145         -E) shift; alldone=exit;;
1146         -K) shift; knowitall=true;;
1147         -O) shift; override=true;;
1148         -S) shift; silent=true; extractsh=true;;
1149         -D)
1150                 shift
1151                 case "$1" in
1152                 *=)
1153                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1154                         echo "$me: ignoring -D $1" >&2
1155                         ;;
1156                 *=*) echo "$1" | \
1157                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1158                 *) echo "$1='define'" >> optdef.sh;;
1159                 esac
1160                 shift
1161                 ;;
1162         -U)
1163                 shift
1164                 case "$1" in
1165                 *=) echo "$1" >> optdef.sh;;
1166                 *=*)
1167                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1168                         echo "$me: ignoring -U $1" >&2
1169                         ;;
1170                 *) echo "$1='undef'" >> optdef.sh;;
1171                 esac
1172                 shift
1173                 ;;
1174         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1175                 exit 0;;
1176         --) break;;
1177         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1178         *) break;;
1179         esac
1180 done
1181
1182 case "$error" in
1183 true)
1184         cat >&2 <<EOM
1185 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1186                  [-U symbol] [-U symbol=]
1187   -d : use defaults for all answers.
1188   -e : go on without questioning past the production of config.sh.
1189   -f : specify an alternate default configuration file.
1190   -h : print this help message and exit (with an error status).
1191   -r : reuse C symbols value if possible (skips costly nm extraction).
1192   -s : silent mode, only echoes questions and essential information.
1193   -D : define symbol to have some value:
1194          -D symbol         symbol gets the value 'define'
1195          -D symbol=value   symbol gets the value 'value'
1196   -E : stop at the end of questions, after having produced config.sh.
1197   -K : do not use unless you know what you are doing.
1198   -O : let -D and -U override definitions from loaded configuration file.
1199   -S : perform variable substitutions on all .SH files (can mix with -f)
1200   -U : undefine symbol:
1201          -U symbol    symbol gets the value 'undef'
1202          -U symbol=   symbol gets completely empty
1203   -V : print version number and exit (with a zero status).
1204 EOM
1205         exit 1
1206         ;;
1207 esac
1208
1209 : Sanity checks
1210 case "$fastread$alldone" in
1211 yescont|yesexit) ;;
1212 *)
1213         if test ! -t 0; then
1214                 echo "Say 'sh Configure', not 'sh <Configure'"
1215                 exit 1
1216         fi
1217         ;;
1218 esac
1219
1220 exec 4>&1
1221 case "$silent" in
1222 true) exec 1>/dev/null;;
1223 esac
1224
1225 : run the defines and the undefines, if any, but leave the file out there...
1226 touch optdef.sh
1227 . ./optdef.sh
1228
1229 : set package name
1230 package=perl5
1231 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1232 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1233 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1234 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1235 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1236 esac
1237
1238 : Some greps do not return status, grrr.
1239 echo "grimblepritz" >grimble
1240 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1241         contains=contains
1242 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1243         contains=grep
1244 else
1245         contains=contains
1246 fi
1247 rm -f grimble
1248 : the following should work in any shell
1249 case "$contains" in
1250 contains*)
1251         echo " "
1252         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1253         cat >contains <<'EOSS'
1254 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1255 EOSS
1256 chmod +x contains
1257 esac
1258
1259 : Find the path to the source tree
1260 case "$src" in
1261 '') case "$0" in
1262     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1263     *)   src='.';;
1264     esac;;
1265 esac
1266 case "$src" in
1267 '')     src=/
1268         rsrc=/
1269         ;;
1270 /*) rsrc="$src";;
1271 *) rsrc="../$src";;
1272 esac
1273 if test -f $rsrc/Configure && \
1274         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1275 then
1276    : found it, so we are ok.
1277 else
1278         rsrc=''
1279         for src in . .. ../.. ../../.. ../../../..; do
1280                 if test -f ../$src/Configure && \
1281                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1282                 then
1283                         rsrc=../$src
1284                         break
1285                 fi
1286         done
1287 fi
1288 case "$rsrc" in
1289 '')
1290         cat <<EOM >&4
1291
1292 Sorry, I can't seem to locate the source dir for $package.  Please start
1293 Configure with an explicit path -- i.e. /some/path/Configure.
1294
1295 EOM
1296         exit 1
1297         ;;
1298 ../.)   rsrc='..';;
1299 *)
1300         echo " "
1301         echo "Sources for $package found in \"$src\"." >&4
1302         ;;
1303 esac
1304
1305 : script used to extract .SH files with variable substitutions
1306 cat >extract <<'EOS'
1307 CONFIG=true
1308 echo "Doing variable substitutions on .SH files..."
1309 if test -f $src/MANIFEST; then
1310         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1311 else
1312         echo "(Looking for .SH files under the source directory.)"
1313         set x `(cd $src; find . -name "*.SH" -print)`
1314 fi
1315 shift
1316 case $# in
1317 0) set x `(cd $src; echo *.SH)`; shift;;
1318 esac
1319 if test ! -f $src/$1; then
1320         shift
1321 fi
1322 mkdir_p='
1323 name=$1;
1324 create="";
1325 while test $name; do
1326         if test ! -d "$name"; then
1327                 create="$name $create";
1328                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1329                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1330         else
1331                 name="";
1332         fi;
1333 done;
1334 for file in $create; do
1335         mkdir $file;
1336 done
1337 '
1338 for file in $*; do
1339         case "$src" in
1340         ".")
1341                 case "$file" in
1342                 */*)
1343                         dir=`expr X$file : 'X\(.*\)/'`
1344                         file=`expr X$file : 'X.*/\(.*\)'`
1345                         (cd $dir && . ./$file)
1346                         ;;
1347                 *)
1348                         . ./$file
1349                         ;;
1350                 esac
1351                 ;;
1352         *)
1353                 case "$file" in
1354                 */*)
1355                         dir=`expr X$file : 'X\(.*\)/'`
1356                         file=`expr X$file : 'X.*/\(.*\)'`
1357                         (set x $dir; shift; eval $mkdir_p)
1358                         sh <$src/$dir/$file
1359                         ;;
1360                 *)
1361                         sh <$src/$file
1362                         ;;
1363                 esac
1364                 ;;
1365         esac
1366 done
1367 if test -f $src/config_h.SH; then
1368         if test ! -f config.h; then
1369         : oops, they left it out of MANIFEST, probably, so do it anyway.
1370         . $src/config_h.SH
1371         fi
1372 fi
1373 EOS
1374
1375 : extract files and exit if asked to do so
1376 case "$extractsh" in
1377 true)
1378         case "$realsilent" in
1379         true) ;;
1380         *) exec 1>&4;;
1381         esac
1382         case "$config_sh" in
1383         '') config_sh='config.sh';;
1384         esac
1385         echo " "
1386         echo "Fetching answers from $config_sh..."
1387         cd ..
1388         . $config_sh
1389         test "$override" && . ./optdef.sh
1390         echo " "
1391         . UU/extract
1392         rm -rf UU
1393         echo "Done."
1394         exit 0
1395         ;;
1396 esac
1397
1398 : Eunice requires " " instead of "", can you believe it
1399 echo " "
1400 : Here we go...
1401 echo "Beginning of configuration questions for $package."
1402
1403 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1404
1405 : first determine how to suppress newline on echo command
1406 echo " "
1407 echo "Checking echo to see how to suppress newlines..."
1408 (echo "hi there\c" ; echo " ") >.echotmp
1409 if $contains c .echotmp >/dev/null 2>&1 ; then
1410         echo "...using -n."
1411         n='-n'
1412         c=''
1413 else
1414         cat <<'EOM'
1415 ...using \c
1416 EOM
1417         n=''
1418         c='\c'
1419 fi
1420 echo $n "The star should be here-->$c"
1421 echo '*'
1422 rm -f .echotmp
1423
1424 : Now test for existence of everything in MANIFEST
1425 echo " "
1426 if test -f $rsrc/MANIFEST; then
1427         echo "First let's make sure your kit is complete.  Checking..." >&4
1428         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1429         rm -f missing
1430         tmppwd=`pwd`
1431         for filelist in x??; do
1432                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1433         done
1434         if test -s missing; then
1435                 cat missing >&4
1436                 cat >&4 <<'EOM'
1437
1438 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1439
1440 You have the option of continuing the configuration process, despite the
1441 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1442 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1443 and contact the author (perlbug@perl.com).
1444
1445 EOM
1446                 echo $n "Continue? [n] $c" >&4
1447                 read ans
1448                 case "$ans" in
1449                 y*)
1450                         echo "Continuing..." >&4
1451                         rm -f missing
1452                         ;;
1453                 *)
1454                         echo "ABORTING..." >&4
1455                         kill $$
1456                         ;;
1457                 esac
1458         else
1459                 echo "Looks good..."
1460         fi
1461 else
1462         echo "There is no MANIFEST file.  I hope your kit is complete !"
1463 fi
1464 rm -f missing x??
1465
1466 echo " "
1467 : Find the appropriate value for a newline for tr
1468 if test -n "$DJGPP"; then
1469        trnl='\012'
1470 fi
1471 if test X"$trnl" = X; then
1472         case "`echo foo|tr '\n' x 2>/dev/null`" in
1473         foox) trnl='\n' ;;
1474         esac
1475 fi
1476 if test X"$trnl" = X; then
1477         case "`echo foo|tr '\012' x 2>/dev/null`" in
1478         foox) trnl='\012' ;;
1479         esac
1480 fi
1481 if test X"$trnl" = X; then
1482         cat <<EOM >&2
1483
1484 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1485
1486 EOM
1487         exit 1
1488 fi
1489
1490 : compute the number of columns on the terminal for proper question formatting
1491 case "$COLUMNS" in
1492 '') COLUMNS='80';;
1493 esac
1494
1495 : set up the echo used in my read
1496 myecho="case \"\$xxxm\" in
1497 '') echo $n \"\$rp $c\" >&4;;
1498 *) case \"\$rp\" in
1499         '') echo $n \"[\$xxxm] $c\";;
1500         *)
1501                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1502                         echo \"\$rp\" >&4
1503                         echo $n \"[\$xxxm] $c\" >&4
1504                 else
1505                         echo $n \"\$rp [\$xxxm] $c\" >&4
1506                 fi
1507                 ;;
1508         esac;;
1509 esac"
1510
1511 : now set up to do reads with possible shell escape and default assignment
1512 cat <<EOSC >myread
1513 $startsh
1514 xxxm=\$dflt
1515 $myecho
1516 ans='!'
1517 case "\$fastread" in
1518 yes) case "\$dflt" in
1519         '') ;;
1520         *) ans='';
1521                 case "\$silent-\$rp" in
1522                 true-) ;;
1523                 *) echo " " >&4;;
1524                 esac;;
1525         esac;;
1526 *) case "\$silent" in
1527         true) case "\$rp" in
1528                 '') ans='';;
1529                 esac;;
1530         esac;;
1531 esac
1532 while expr "X\$ans" : "X!" >/dev/null; do
1533         read answ
1534         set x \$xxxm
1535         shift
1536         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1537         case  "\$answ" in
1538         "!")
1539                 sh 1>&4
1540                 echo " "
1541                 $myecho
1542                 ;;
1543         !*)
1544                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1545                 shift
1546                 sh 1>&4 -c "\$*"
1547                 echo " "
1548                 $myecho
1549                 ;;
1550         "\$ans")
1551                 case "\$ans" in
1552                 \\&*)
1553                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1554                         shift
1555                         case "\$1" in
1556                         -d)
1557                                 fastread=yes
1558                                 echo "(OK, I'll run with -d after this question.)" >&4
1559                                 ;;
1560                         -*)
1561                                 echo "*** Sorry, \$1 not supported yet." >&4
1562                                 ;;
1563                         esac
1564                         $myecho
1565                         ans=!
1566                         ;;
1567                 esac;;
1568         *)
1569                 case "\$aok" in
1570                 y)
1571                         echo "*** Substitution done -- please confirm."
1572                         xxxm="\$ans"
1573                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1574                         xxxm="\$ans"
1575                         ans=!
1576                         ;;
1577                 *)
1578                         echo "*** Error -- try again."
1579                         ans=!
1580                         ;;
1581                 esac
1582                 $myecho
1583                 ;;
1584         esac
1585         case "\$ans\$xxxm\$nostick" in
1586         '')
1587                 ans=!
1588                 $myecho
1589                 ;;
1590         esac
1591 done
1592 case "\$ans" in
1593 '') ans="\$xxxm";;
1594 esac
1595 EOSC
1596
1597 : create .config dir to save info across Configure sessions
1598 test -d ../.config || mkdir ../.config
1599 cat >../.config/README <<EOF
1600 This directory created by Configure to save information that should
1601 persist across sessions for $package.
1602
1603 You may safely delete it if you wish.
1604 EOF
1605
1606 : general instructions
1607 needman=true
1608 firsttime=true
1609 user=`(logname) 2>/dev/null`
1610 case "$user" in
1611 '') user=`whoami 2>&1`;;
1612 esac
1613 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1614         firsttime=false
1615         echo " "
1616         rp='Would you like to see the instructions?'
1617         dflt=n
1618         . ./myread
1619         case "$ans" in
1620         [yY]*) ;;
1621         *) needman=false;;
1622         esac
1623 fi
1624 if $needman; then
1625         cat <<EOH
1626
1627 This installation shell script will examine your system and ask you questions
1628 to determine how the perl5 package should be installed. If you get
1629 stuck on a question, you may use a ! shell escape to start a subshell or
1630 execute a command.  Many of the questions will have default answers in square
1631 brackets; typing carriage return will give you the default.
1632
1633 On some of the questions which ask for file or directory names you are allowed
1634 to use the ~name construct to specify the login directory belonging to "name",
1635 even if you don't have a shell which knows about that.  Questions where this is
1636 allowed will be marked "(~name ok)".
1637
1638 EOH
1639         rp=''
1640         dflt='Type carriage return to continue'
1641         . ./myread
1642         cat <<'EOH'
1643
1644 The prompter used in this script allows you to use shell variables and
1645 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1646 in the default answer, as if the default line was a set of arguments given to a
1647 script shell.  This means you may also use $* to repeat the whole default line,
1648 so you do not have to re-type everything to add something to the default.
1649
1650 Everytime there is a substitution, you will have to confirm.  If there is an
1651 error (e.g. an unmatched backtick), the default answer will remain unchanged
1652 and you will be prompted again.
1653
1654 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1655 the questions and use the computed defaults (or the previous answers if there
1656 was already a config.sh file). Type 'Configure -h' for a list of options.
1657 You may also start interactively and then answer '& -d' at any prompt to turn
1658 on the non-interactive behaviour for the remainder of the execution.
1659
1660 EOH
1661         . ./myread
1662         cat <<EOH
1663
1664 Much effort has been expended to ensure that this shell script will run on any
1665 Unix system.  If despite that it blows up on yours, your best bet is to edit
1666 Configure and run it again.  If you can't run Configure for some reason,
1667 you'll have to generate a config.sh file by hand.  Whatever problems you
1668 have, let me (perlbug@perl.com) know how I blew it.
1669
1670 This installation script affects things in two ways:
1671
1672 1) it may do direct variable substitutions on some of the files included
1673    in this kit.
1674 2) it builds a config.h file for inclusion in C programs.  You may edit
1675    any of these files as the need arises after running this script.
1676
1677 If you make a mistake on a question, there is no easy way to back up to it
1678 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1679 files.  Configure will offer to let you do this before it runs the SH files.
1680
1681 EOH
1682         dflt='Type carriage return to continue'
1683         . ./myread
1684         case "$firsttime" in
1685         true) echo $user >>../.config/instruct;;
1686         esac
1687 fi
1688
1689 : find out where common programs are
1690 echo " "
1691 echo "Locating common programs..." >&4
1692 cat <<EOSC >loc
1693 $startsh
1694 case \$# in
1695 0) exit 1;;
1696 esac
1697 thing=\$1
1698 shift
1699 dflt=\$1
1700 shift
1701 for dir in \$*; do
1702         case "\$thing" in
1703         .)
1704         if test -d \$dir/\$thing; then
1705                 echo \$dir
1706                 exit 0
1707         fi
1708         ;;
1709         *)
1710         for thisthing in \$dir/\$thing; do
1711                 : just loop through to pick last item
1712         done
1713         if test -f \$thisthing; then
1714                 echo \$thisthing
1715                 exit 0
1716         elif test -f \$dir/\$thing.exe; then
1717                 if test -n "$DJGPP"; then
1718                         echo \$dir/\$thing.exe
1719                 else
1720                         : on Eunice apparently
1721                         echo \$dir/\$thing
1722                 fi
1723                 exit 0
1724         fi
1725         ;;
1726         esac
1727 done
1728 echo \$dflt
1729 exit 1
1730 EOSC
1731 chmod +x loc
1732 $eunicefix loc
1733 loclist="
1734 awk
1735 cat
1736 comm
1737 cp
1738 echo
1739 expr
1740 grep
1741 ls
1742 make
1743 mkdir
1744 rm
1745 sed
1746 sort
1747 touch
1748 tr
1749 uniq
1750 "
1751 trylist="
1752 Mcc
1753 ar
1754 byacc
1755 cpp
1756 csh
1757 date
1758 egrep
1759 gzip
1760 less
1761 ln
1762 more
1763 nm
1764 nroff
1765 pg
1766 tee
1767 test
1768 uname
1769 zip
1770 "
1771 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1772 pth="$pth /lib /usr/lib"
1773 for file in $loclist; do
1774         eval xxx=\$$file
1775         case "$xxx" in
1776         /*|?:[\\/]*)
1777                 if test -f "$xxx"; then
1778                         : ok
1779                 else
1780                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1781                         xxx=`./loc $file $file $pth`
1782                 fi
1783                 ;;
1784         '') xxx=`./loc $file $file $pth`;;
1785         *) xxx=`./loc $xxx $xxx $pth`;;
1786         esac
1787         eval $file=$xxx
1788         eval _$file=$xxx
1789         case "$xxx" in
1790         /*)
1791                 echo $file is in $xxx.
1792                 ;;
1793         ?:[\\/]*)
1794                 echo $file is in $xxx.
1795                 ;;
1796         *)
1797                 echo "I don't know where '$file' is, and my life depends on it." >&4
1798                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1799                 exit 1
1800                 ;;
1801         esac
1802 done
1803 echo " "
1804 echo "Don't worry if any of the following aren't found..."
1805 say=offhand
1806 for file in $trylist; do
1807         eval xxx=\$$file
1808         case "$xxx" in
1809         /*|?:[\\/]*)
1810                 if test -f "$xxx"; then
1811                         : ok
1812                 else
1813                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1814                         xxx=`./loc $file $file $pth`
1815                 fi
1816                 ;;
1817         '') xxx=`./loc $file $file $pth`;;
1818         *) xxx=`./loc $xxx $xxx $pth`;;
1819         esac
1820         eval $file=$xxx
1821         eval _$file=$xxx
1822         case "$xxx" in
1823         /*)
1824                 echo $file is in $xxx.
1825                 ;;
1826         ?:[\\/]*)
1827                 echo $file is in $xxx.
1828                 ;;
1829         *)
1830                 echo "I don't see $file out there, $say."
1831                 say=either
1832                 ;;
1833         esac
1834 done
1835 case "$egrep" in
1836 egrep)
1837         echo "Substituting grep for egrep."
1838         egrep=$grep
1839         ;;
1840 esac
1841 case "$ln" in
1842 ln)
1843         echo "Substituting cp for ln."
1844         ln=$cp
1845         ;;
1846 esac
1847 case "$test" in
1848 test)
1849         echo "Hopefully test is built into your sh."
1850         ;;
1851 *)
1852         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1853                 echo "Using the test built into your sh."
1854                 test=test
1855                 _test=test
1856         fi
1857         ;;
1858 esac
1859 case "$echo" in
1860 echo)
1861         echo "Hopefully echo is built into your sh."
1862         ;;
1863 '') ;;
1864 *)
1865         echo " "
1866 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1867         $echo $n "hi there$c" >foo1
1868         echo $n "hi there$c" >foo2
1869         if cmp foo1 foo2 >/dev/null 2>&1; then
1870                 echo "They are compatible.  In fact, they may be identical."
1871         else
1872                 case "$n" in
1873                 '-n') n='' c='\c';;
1874                 *) n='-n' c='';;
1875                 esac
1876                 cat <<FOO
1877 They are not compatible!  You are probably running ksh on a non-USG system.
1878 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1879 have echo built in and we may have to run some Bourne shell scripts.  That
1880 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1881
1882 FOO
1883                 $echo $n "The star should be here-->$c"
1884                 $echo "*"
1885         fi
1886         $rm -f foo1 foo2
1887         ;;
1888 esac
1889
1890 : determine whether symbolic links are supported
1891 echo " "
1892 $touch blurfl
1893 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1894         echo "Symbolic links are supported." >&4
1895         lns="$ln -s"
1896 else
1897         echo "Symbolic links are NOT supported." >&4
1898         lns="$ln"
1899 fi
1900 $rm -f blurfl sym
1901
1902 : see whether [:lower:] and [:upper:] are supported character classes
1903 echo " "
1904 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1905 ABYZ)
1906         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1907         up='[:upper:]'
1908         low='[:lower:]'
1909         ;;
1910 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1911         # (0xc9 and 0xd1), therefore that is a nice testing point.
1912         if test "X$up" = X -o "X$low" = X; then
1913             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1914             ij) up='[A-Z]'
1915                 low='[a-z]'
1916                 ;;
1917             esac
1918         fi
1919         if test "X$up" = X -o "X$low" = X; then
1920             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1921             ij) up='A-Z'
1922                 low='a-z'
1923                 ;;
1924             esac
1925         fi
1926         if test "X$up" = X -o "X$low" = X; then
1927             case "`echo IJ | od -x 2>/dev/null`" in
1928             *C9D1*|*c9d1*)
1929                 echo "Hey, this might be EBCDIC." >&4
1930                 if test "X$up" = X -o "X$low" = X; then
1931                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1932                     ij) up='[A-IJ-RS-Z]'
1933                         low='[a-ij-rs-z]'
1934                         ;;
1935                     esac
1936                 fi
1937                 if test "X$up" = X -o "X$low" = X; then
1938                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1939                     ij) up='A-IJ-RS-Z'
1940                         low='a-ij-rs-z'
1941                         ;;
1942                     esac
1943                 fi
1944                 ;;
1945             esac
1946         fi
1947 esac
1948 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
1949 ij)
1950     echo "Using $up and $low to convert case." >&4
1951     ;;
1952 *)
1953     echo "I don't know how to translate letters from upper to lower case." >&4
1954     echo "Your tr is not acting any way I know of." >&4
1955     exit 1
1956     ;;
1957 esac
1958 : set up the translation script tr, must be called with ./tr of course
1959 cat >tr <<EOSC
1960 $startsh
1961 case "\$1\$2" in
1962 '[A-Z][a-z]') exec $tr '$up' '$low';;
1963 '[a-z][A-Z]') exec $tr '$low' '$up';;
1964 esac
1965 exec $tr "\$@"
1966 EOSC
1967 chmod +x tr
1968 $eunicefix tr
1969
1970 : Try to determine whether config.sh was made on this system
1971 case "$config_sh" in
1972 '')
1973 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1974 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
1975 # because the A-Z/a-z are not consecutive.
1976 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1977         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1978 newmyuname="$myuname"
1979 dflt=n
1980 case "$knowitall" in
1981 '')
1982         if test -f ../config.sh; then
1983                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1984                         eval "`grep myuname= ../config.sh`"
1985                 fi
1986                 if test "X$myuname" = "X$newmyuname"; then
1987                         dflt=y
1988                 fi
1989         fi
1990         ;;
1991 *) dflt=y;;
1992 esac
1993
1994 : Get old answers from old config file if Configure was run on the
1995 : same system, otherwise use the hints.
1996 hint=default
1997 cd ..
1998 if test -f config.sh; then
1999         echo " "
2000         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2001         . UU/myread
2002         case "$ans" in
2003         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2004         *)  echo "Fetching default answers from your old config.sh file..." >&4
2005                 tmp_n="$n"
2006                 tmp_c="$c"
2007                 tmp_sh="$sh"
2008                 . ./config.sh
2009                 cp config.sh UU
2010                 n="$tmp_n"
2011                 c="$tmp_c"
2012                 : Older versions did not always set $sh.  Catch re-use of such
2013                 : an old config.sh.
2014                 case "$sh" in
2015                 '') sh="$tmp_sh" ;;
2016                 esac
2017                 hint=previous
2018                 ;;
2019         esac
2020 fi
2021 if test ! -f config.sh; then
2022         $cat <<EOM
2023
2024 First time through, eh?  I have some defaults handy for some systems
2025 that need some extra help getting the Configure answers right:
2026
2027 EOM
2028         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2029         dflt=''
2030         : Half the following guesses are probably wrong... If you have better
2031         : tests or hints, please send them to perlbug@perl.com
2032         : The metaconfig authors would also appreciate a copy...
2033         $test -f /irix && osname=irix
2034         $test -f /xenix && osname=sco_xenix
2035         $test -f /dynix && osname=dynix
2036         $test -f /dnix && osname=dnix
2037         $test -f /lynx.os && osname=lynxos
2038         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2039         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2040         $test -f /bin/mips && /bin/mips && osname=mips
2041         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2042                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2043         $test -d /usr/apollo/bin && osname=apollo
2044         $test -f /etc/saf/_sactab && osname=svr4
2045         $test -d /usr/include/minix && osname=minix
2046         if $test -d /MachTen -o -d /MachTen_Folder; then
2047                 osname=machten
2048                 if $test -x /sbin/version; then
2049                         osvers=`/sbin/version | $awk '{print $2}' |
2050                         $sed -e 's/[A-Za-z]$//'`
2051                 elif $test -x /usr/etc/version; then
2052                         osvers=`/usr/etc/version | $awk '{print $2}' |
2053                         $sed -e 's/[A-Za-z]$//'`
2054                 else
2055                         osvers="$2.$3"
2056                 fi
2057         fi
2058        $test -f /sys/posix.dll &&
2059                $test -f /usr/bin/what &&
2060                set X `/usr/bin/what /sys/posix.dll` &&
2061                $test "$3" = UWIN &&
2062                osname=uwin &&
2063                osvers="$5"
2064         if $test -f $uname; then
2065                 set X $myuname
2066                 shift
2067
2068                 case "$5" in
2069                 fps*) osname=fps ;;
2070                 mips*)
2071                         case "$4" in
2072                         umips) osname=umips ;;
2073                         *) osname=mips ;;
2074                         esac;;
2075                 [23]100) osname=mips ;;
2076                 next*) osname=next ;;
2077                 i386*)
2078                         if $test -f /etc/kconfig; then
2079                                 osname=isc
2080                                 if test "$lns" = "ln -s"; then
2081                                         osvers=4
2082                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2083                                         osvers=3
2084                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2085                                         osvers=2
2086                                 fi
2087                         fi
2088                         ;;
2089                 pc*)
2090                         if test -n "$DJGPP"; then
2091                                 osname=dos
2092                                 osvers=djgpp
2093                         fi
2094                         ;;
2095                 esac
2096
2097                 case "$1" in
2098                 aix) osname=aix
2099                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2100                         case "$tmp" in
2101                         'not found') osvers="$4"."$3" ;;
2102                         '<3240'|'<>3240') osvers=3.2.0 ;;
2103                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2104                         '=3250'|'>3250') osvers=3.2.5 ;;
2105                         *) osvers=$tmp;;
2106                         esac
2107                         ;;
2108                 *dc.osx) osname=dcosx
2109                         osvers="$3"
2110                         ;;
2111                 dnix) osname=dnix
2112                         osvers="$3"
2113                         ;;
2114                 domainos) osname=apollo
2115                         osvers="$3"
2116                         ;;
2117                 dgux) osname=dgux 
2118                         osvers="$3"
2119                         ;;
2120                 dynixptx*) osname=dynixptx
2121                         osvers=`echo "$4"|sed 's/^v//'`
2122                         ;;
2123                 freebsd) osname=freebsd 
2124                         osvers="$3" ;;
2125                 genix) osname=genix ;;
2126                 hp*) osname=hpux 
2127                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2128                         ;;
2129                 irix*) osname=irix
2130                         case "$3" in
2131                         4*) osvers=4 ;;
2132                         5*) osvers=5 ;;
2133                         *)      osvers="$3" ;;
2134                         esac
2135                         ;;
2136                 linux) osname=linux
2137                         case "$3" in
2138                         *)      osvers="$3" ;;
2139                         esac
2140                         ;;
2141                 MiNT) osname=mint
2142                         ;;
2143                 netbsd*) osname=netbsd
2144                         osvers="$3"
2145                         ;;
2146                 news-os) osvers="$3"
2147                         case "$3" in
2148                         4*) osname=newsos4 ;;
2149                         *) osname=newsos ;;
2150                         esac
2151                         ;;
2152                 bsd386) osname=bsd386
2153                         osvers=`$uname -r`
2154                         ;;
2155                 POSIX-BC | posix-bc ) osname=posix-bc
2156                         osvers="$3"
2157                         ;;
2158                 powerux | power_ux | powermax_os | powermaxos | \
2159                 powerunix | power_unix) osname=powerux
2160                         osvers="$3"
2161                         ;;
2162                 next*) osname=next ;;
2163                 solaris) osname=solaris
2164                         case "$3" in
2165                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2166                         *)      osvers="$3" ;;
2167                         esac
2168                         ;;
2169                 sunos) osname=sunos
2170                         case "$3" in
2171                         5*) osname=solaris
2172                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2173                         *)      osvers="$3" ;;
2174                         esac
2175                         ;;
2176                 titanos) osname=titanos
2177                         case "$3" in
2178                         1*) osvers=1 ;;
2179                         2*) osvers=2 ;;
2180                         3*) osvers=3 ;;
2181                         4*) osvers=4 ;;
2182                         *)      osvers="$3" ;;
2183                         esac
2184                         ;;
2185                 ultrix) osname=ultrix
2186                         osvers="$3"
2187                         ;;
2188                 osf1|mls+)      case "$5" in
2189                                 alpha)
2190                                         osname=dec_osf
2191                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2192                                         ;;
2193                         hp*)    osname=hp_osf1  ;;
2194                         mips)   osname=mips_osf1 ;;
2195                         esac
2196                         ;;
2197                 uts) osname=uts 
2198                         osvers="$3"
2199                         ;;
2200                 qnx) osname=qnx
2201                         osvers="$4"
2202                         ;;
2203                 $2) case "$osname" in
2204                         *isc*) ;;
2205                         *freebsd*) ;;
2206                         svr*)
2207                                 : svr4.x or possibly later
2208                                 case "svr$3" in 
2209                                 ${osname}*)
2210                                         osname=svr$3
2211                                         osvers=$4
2212                                         ;;
2213                                 esac
2214                                 case "$osname" in
2215                                 svr4.0)
2216                                         : Check for ESIX
2217                                         if test -f /stand/boot ; then
2218                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2219                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2220                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2221                                                         if test -n "$isesix"; then
2222                                                                 osname=esix4
2223                                                         fi
2224                                                 fi
2225                                         fi
2226                                         ;;
2227                                 esac
2228                                 ;;
2229                         *)      if test -f /etc/systemid; then
2230                                         osname=sco
2231                                         set `echo $3 | $sed 's/\./ /g'` $4
2232                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2233                                                 osvers=$1.$2.$3
2234                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2235                                                 osvers=$1.$2
2236                                         elif $test -f $src/hints/sco_$1.sh; then
2237                                                 osvers=$1
2238                                         fi
2239                                 else
2240                                         case "$osname" in
2241                                         '') : Still unknown.  Probably a generic Sys V.
2242                                                 osname="sysv"
2243                                                 osvers="$3"
2244                                                 ;;
2245                                         esac
2246                                 fi
2247                                 ;;
2248                         esac
2249                         ;;
2250                 *)      case "$osname" in
2251                         '') : Still unknown.  Probably a generic BSD.
2252                                 osname="$1"
2253                                 osvers="$3"
2254                                 ;;
2255                         esac
2256                         ;;
2257                 esac
2258         else
2259                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2260                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2261                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2262                                 osname=news_os
2263                         fi
2264                         $rm -f UU/kernel.what
2265                 elif test -d c:/.; then
2266                         set X $myuname
2267                         osname=os2
2268                         osvers="$5"
2269                 fi
2270         fi
2271         
2272         : Now look for a hint file osname_osvers, unless one has been
2273         : specified already.
2274         case "$hintfile" in
2275         ''|' ')
2276                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2277                 : Also try without trailing minor version numbers.
2278                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2279                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2280                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2281                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2282                 case "$file" in
2283                 '') dflt=none ;;
2284                 *)  case "$osvers" in
2285                         '') dflt=$file
2286                                 ;;
2287                         *)  if $test -f $src/hints/$file.sh ; then
2288                                         dflt=$file
2289                                 elif $test -f $src/hints/$xfile.sh ; then
2290                                         dflt=$xfile
2291                                 elif $test -f $src/hints/$xxfile.sh ; then
2292                                         dflt=$xxfile
2293                                 elif $test -f $src/hints/$xxxfile.sh ; then
2294                                         dflt=$xxxfile
2295                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2296                                         dflt=$xxxxfile
2297                                 elif $test -f "$src/hints/${osname}.sh" ; then
2298                                         dflt="${osname}"
2299                                 else
2300                                         dflt=none
2301                                 fi
2302                                 ;;
2303                         esac
2304                         ;;
2305                 esac
2306                 if $test -f Policy.sh ; then
2307                         case "$dflt" in
2308                         *Policy*) ;;
2309                         none) dflt="Policy" ;;
2310                         *) dflt="Policy $dflt" ;;
2311                         esac
2312                 fi
2313                 ;;
2314         *)
2315                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2316                 ;;
2317         esac
2318
2319         if $test -f Policy.sh ; then
2320                 $cat <<EOM
2321
2322 There's also a Policy hint file available, which should make the
2323 site-specific (policy) questions easier to answer.
2324 EOM
2325
2326         fi
2327
2328         $cat <<EOM
2329
2330 You may give one or more space-separated answers, or "none" if appropriate.
2331 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2332 is a good thing.  DO NOT give a wrong version.
2333
2334 EOM
2335
2336         rp="Which of these apply, if any?"
2337         . UU/myread
2338         tans=$ans
2339         for file in $tans; do
2340                 if $test X$file = XPolicy -a -f Policy.sh; then
2341                         . Policy.sh
2342                         $cat Policy.sh >> UU/config.sh
2343                 elif $test -f $src/hints/$file.sh; then
2344                         . $src/hints/$file.sh
2345                         $cat $src/hints/$file.sh >> UU/config.sh
2346                 elif $test X$tans = X -o X$tans = Xnone ; then
2347                         : nothing
2348                 else
2349                         : Give one chance to correct a possible typo.
2350                         echo "$file.sh does not exist"
2351                         dflt=$file
2352                         rp="hint to use instead?"
2353                         . UU/myread
2354                         for file in $ans; do
2355                                 if $test -f "$src/hints/$file.sh"; then
2356                                         . $src/hints/$file.sh
2357                                         $cat $src/hints/$file.sh >> UU/config.sh
2358                                 elif $test X$ans = X -o X$ans = Xnone ; then
2359                                         : nothing
2360                                 else
2361                                         echo "$file.sh does not exist -- ignored."
2362                                 fi
2363                         done
2364                 fi
2365         done
2366
2367         hint=recommended
2368         : Remember our hint file for later.
2369         if $test -f "$src/hints/$file.sh" ; then
2370                 hintfile="$file"
2371         else
2372                 hintfile=''
2373         fi
2374 fi
2375 cd UU
2376 ;;
2377 *)
2378         echo " "
2379         echo "Fetching default answers from $config_sh..." >&4
2380         tmp_n="$n"
2381         tmp_c="$c"
2382         cd ..
2383         cp $config_sh config.sh 2>/dev/null
2384         chmod +w config.sh
2385         . ./config.sh
2386         cd UU
2387         cp ../config.sh .
2388         n="$tmp_n"
2389         c="$tmp_c"
2390         hint=previous
2391         ;;
2392 esac
2393 test "$override" && . ./optdef.sh
2394 myuname="$newmyuname"
2395
2396 : Restore computed paths
2397 for file in $loclist $trylist; do
2398         eval $file="\$_$file"
2399 done
2400
2401 cat << EOM
2402
2403 Configure uses the operating system name and version to set some defaults.
2404 The default value is probably right if the name rings a bell. Otherwise,
2405 since spelling matters for me, either accept the default or answer "none"
2406 to leave it blank.
2407
2408 EOM
2409 case "$osname" in
2410         ''|' ')
2411                 case "$hintfile" in
2412                 ''|' '|none) dflt=none ;;
2413                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2414                 esac
2415                 ;;
2416         *) dflt="$osname" ;;
2417 esac
2418 rp="Operating system name?"
2419 . ./myread
2420 case "$ans" in
2421 none)  osname='' ;;
2422 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2423 esac
2424 echo " "
2425 case "$osvers" in
2426         ''|' ')
2427                 case "$hintfile" in
2428                 ''|' '|none) dflt=none ;;
2429                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2430                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2431                         case "$dflt" in
2432                         ''|' ') dflt=none ;;
2433                         esac
2434                         ;;
2435                 esac
2436                 ;;
2437         *) dflt="$osvers" ;;
2438 esac
2439 rp="Operating system version?"
2440 . ./myread
2441 case "$ans" in
2442 none)  osvers='' ;;
2443 *) osvers="$ans" ;;
2444 esac
2445
2446 : who configured the system
2447 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2448 cf_by=`(logname) 2>/dev/null`
2449 case "$cf_by" in
2450 "")
2451         cf_by=`(whoami) 2>/dev/null`
2452         case "$cf_by" in
2453         "") cf_by=unknown ;;
2454         esac ;;
2455 esac
2456
2457 : set up the script used to warn in case of inconsistency
2458 cat <<EOS >whoa
2459 $startsh
2460 EOS
2461 cat <<'EOSC' >>whoa
2462 dflt=y
2463 echo " "
2464 echo "*** WHOA THERE!!! ***" >&4
2465 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2466 rp="    Keep the $hint value?"
2467 . ./myread
2468 case "$ans" in
2469 y) td=$was; tu=$was;;
2470 esac
2471 EOSC
2472
2473 : function used to set $1 to $val
2474 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2475 case "$val$was" in
2476 $define$undef) . ./whoa; eval "$var=\$td";;
2477 $undef$define) . ./whoa; eval "$var=\$tu";;
2478 *) eval "$var=$val";;
2479 esac'
2480
2481 cat <<EOM
2482
2483 Perl can be built to take advantage of threads, on some systems.
2484 To do so, Configure must be run with -Dusethreads.
2485 (See README.threads for details.)
2486 EOM
2487 case "$usethreads" in
2488 $define|true|[yY]*)     dflt='y';;
2489 *) dflt='n';;
2490 esac
2491 rp='Build a threading Perl?'
2492 . ./myread
2493 case "$ans" in
2494 y|Y)    val="$define" ;;     
2495 *)      val="$undef" ;;
2496 esac
2497 set usethreads
2498 eval $setvar 
2499
2500 case "$d_oldpthreads" in
2501 '')     : Configure tests would be welcome here.  For now, assume undef.
2502         val="$undef" ;;
2503 *)      val="$d_oldpthreads" ;;
2504 esac
2505 set d_oldpthreads
2506 eval $setvar
2507
2508
2509 case "$usethreads" in
2510 "$define"|true|[yY]*)
2511 : Look for a hint-file generated 'call-back-unit'.  If the
2512 : user has specified that a threading perl is to be built,
2513 : we may need to set or change some other defaults.
2514         if $test -f usethreads.cbu; then
2515                 . ./usethreads.cbu
2516         fi
2517         case "$osname" in
2518         aix|dec_osf|dos_djgpp|freebsd|hpux|irix|linux|os2|solaris|vmesa)
2519                 # Known thread-capable platforms.
2520                 ;;
2521         *)
2522                 cat >&4 <<EOM
2523 $osname is not known to support threads.
2524 Please let perlbug@perl.com know how to do that.
2525
2526 Cannot continue, aborting.
2527 EOM
2528                 exit 1
2529         ;;
2530         esac # $osname
2531     ;;
2532 esac # $usethreads
2533
2534 cat <<EOM
2535
2536 Perl can be built so that multiple Perl interpreters can coexist
2537 within the same Perl executable.  To do so, Configure must be run with
2538 -Dusemultiplicity.
2539
2540 Normally you do not need this and you should answer no.
2541
2542 EOM
2543 case "$usemultiplicity" in
2544 $define|true|[yY]*)     dflt='y';;
2545 *) dflt='n';;
2546 esac
2547 rp='Build Perl for multiplicity?'
2548 . ./myread
2549 case "$ans" in
2550 y|Y)    val="$define" ;;     
2551 *)      val="$undef" ;;
2552 esac
2553 set usemultiplicity
2554 eval $setvar 
2555
2556 cat <<EOM
2557
2558 Perl can be built to take advantage of explicit 64-bit interfaces,
2559 on some systems.  To do so, Configure must be run with -Duse64bits.
2560
2561 If this doesn't make any sense to you, just accept the default 'n'.
2562 EOM
2563 case "$use64bits" in
2564 $define|true|[yY]*)     dflt='y';;
2565 *) dflt='n';;
2566 esac
2567 rp='Try to use explicit 64-bit interfaces, if available?'
2568 . ./myread
2569 case "$ans" in
2570 y|Y) 
2571         val="$define"
2572         ;;     
2573 *)      
2574         val="$undef"
2575         ;;
2576 esac
2577 set use64bits
2578 eval $setvar
2579
2580 case "$archname64" in
2581 '') archname64='' ;;    # not a typo
2582 esac
2583
2584 case "$use64bits" in
2585 "$define"|true|[yY]*)
2586 : Look for a hint-file generated 'call-back-unit'.  If the
2587 : user has specified that a threading perl is to be built,
2588 : we may need to set or change some other defaults.
2589         if $test -f use64bits.cbu; then
2590                 . ./use64bits.cbu
2591         fi
2592         case "$osname" in
2593         dec_osf|hpux|irix|solaris|unicos)
2594                 # Known 64-bit capable platforms.
2595                 ;;
2596         *)
2597                 cat >&4 <<EOM
2598 $osname is not known to support 64-bit interfaces.
2599 Please let perlbug@perl.com know how to do that.
2600
2601 Cannot continue, aborting.
2602 EOM
2603                 exit 1
2604                 ;;
2605         esac
2606         ;;
2607 esac
2608
2609 : determine the architecture name
2610 echo " "
2611 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2612         tarch=`arch`"-$osname"
2613 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2614         if uname -m > tmparch 2>&1 ; then
2615                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
2616                         -e 's/$/'"-$osname/" tmparch`
2617         else
2618                 tarch="$osname"
2619         fi
2620         $rm -f tmparch
2621 else
2622         tarch="$osname"
2623 fi
2624 case "$myarchname" in
2625 ''|"$tarch") ;;
2626 *)
2627         echo "(Your architecture name used to be $myarchname.)"
2628         archname=''
2629         ;;
2630 esac
2631 myarchname="$tarch"
2632 case "$archname" in
2633 '') dflt="$tarch";;
2634 *) dflt="$archname";;
2635 esac
2636 rp='What is your architecture name'
2637 . ./myread
2638 archname="$ans"
2639 case "$usethreads" in
2640 $define)
2641         echo "Threads selected." >&4
2642         case "$archname" in
2643         *-thread*) echo "...and architecture name already has -thread." >&4
2644                 ;;
2645         *)      archname="$archname-thread"
2646                 echo "...setting architecture name to $archname." >&4
2647                 ;;
2648         esac
2649         ;;
2650 esac
2651 case "$usemultiplicity" in
2652 $define)
2653         echo "Multiplicity selected." >&4
2654         case "$archname" in
2655         *-multi*) echo "...and architecture name already has -multi." >&4
2656                 ;;
2657         *)      archname="$archname-multi"
2658                 echo "...setting architecture name to $archname." >&4
2659                 ;;
2660         esac
2661         ;;
2662 esac
2663 case "$use64bits" in
2664 $define)
2665         echo "Explicit 64-bitness selected." >&4
2666         case "$archname64" in
2667         '')
2668                 ;;
2669         *)
2670                 case "$archname" in
2671                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
2672                         ;;
2673                 *)      archname="$archname-$archname64"
2674                         echo "...setting architecture name to $archname." >&4
2675                         ;;
2676                 esac
2677                 ;;
2678         esac
2679 esac
2680
2681 : is AFS running?
2682 echo " "
2683 case "$afs" in
2684 $define|true)   afs=true ;;
2685 $undef|false)   afs=false ;;
2686 *)      if test -d /afs; then
2687                 afs=true
2688         else
2689                 afs=false
2690         fi
2691         ;;
2692 esac
2693 if $afs; then
2694         echo "AFS may be running... I'll be extra cautious then..." >&4
2695 else
2696         echo "AFS does not seem to be running..." >&4
2697 fi
2698
2699 : decide how portable to be.  Allow command line overrides.
2700 case "$d_portable" in
2701 "$undef") ;;
2702 *)      d_portable="$define" ;;
2703 esac
2704
2705 : set up shell script to do ~ expansion
2706 cat >filexp <<EOSS
2707 $startsh
2708 : expand filename
2709 case "\$1" in
2710  ~/*|~)
2711         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2712         ;;
2713  ~*)
2714         if $test -f /bin/csh; then
2715                 /bin/csh -f -c "glob \$1"
2716                 failed=\$?
2717                 echo ""
2718                 exit \$failed
2719         else
2720                 name=\`$expr x\$1 : '..\([^/]*\)'\`
2721                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2722                 if $test ! -d "\$dir"; then
2723                         me=\`basename \$0\`
2724                         echo "\$me: can't locate home directory for: \$name" >&2
2725                         exit 1
2726                 fi
2727                 case "\$1" in
2728                 */*)
2729                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2730                         ;;
2731                 *)
2732                         echo \$dir
2733                         ;;
2734                 esac
2735         fi
2736         ;;
2737 *)
2738         echo \$1
2739         ;;
2740 esac
2741 EOSS
2742 chmod +x filexp
2743 $eunicefix filexp
2744
2745 : now set up to get a file name
2746 cat <<EOS >getfile
2747 $startsh
2748 EOS
2749 cat <<'EOSC' >>getfile
2750 tilde=''
2751 fullpath=''
2752 already=''
2753 skip=''
2754 none_ok=''
2755 exp_file=''
2756 nopath_ok=''
2757 orig_rp="$rp"
2758 orig_dflt="$dflt"
2759
2760 case "$fn" in
2761 *\(*)
2762         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
2763         fn=`echo $fn | sed 's/(.*)//'`
2764         ;;
2765 esac
2766
2767 case "$fn" in
2768 *:*)
2769         loc_file=`expr $fn : '.*:\(.*\)'`
2770         fn=`expr $fn : '\(.*\):.*'`
2771         ;;
2772 esac
2773
2774 case "$fn" in
2775 *~*) tilde=true;;
2776 esac
2777 case "$fn" in
2778 */*) fullpath=true;;
2779 esac
2780 case "$fn" in
2781 *+*) skip=true;;
2782 esac
2783 case "$fn" in
2784 *n*) none_ok=true;;
2785 esac
2786 case "$fn" in
2787 *e*) exp_file=true;;
2788 esac
2789 case "$fn" in
2790 *p*) nopath_ok=true;;
2791 esac
2792
2793 case "$fn" in
2794 *f*) type='File';;
2795 *d*) type='Directory';;
2796 *l*) type='Locate';;
2797 esac
2798
2799 what="$type"
2800 case "$what" in
2801 Locate) what='File';;
2802 esac
2803
2804 case "$exp_file" in
2805 '')
2806         case "$d_portable" in
2807         "$define") ;;
2808         *) exp_file=true;;
2809         esac
2810         ;;
2811 esac
2812
2813 cd ..
2814 while test "$type"; do
2815         redo=''
2816         rp="$orig_rp"
2817         dflt="$orig_dflt"
2818         case "$tilde" in
2819         true) rp="$rp (~name ok)";;
2820         esac
2821         . UU/myread
2822         if test -f UU/getfile.ok && \
2823                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2824         then
2825                 value="$ans"
2826                 ansexp="$ans"
2827                 break
2828         fi
2829         case "$ans" in
2830         none)
2831                 value=''
2832                 ansexp=''
2833                 case "$none_ok" in
2834                 true) type='';;
2835                 esac
2836                 ;;
2837         *)
2838                 case "$tilde" in
2839                 '') value="$ans"
2840                         ansexp="$ans";;
2841                 *)
2842                         value=`UU/filexp $ans`
2843                         case $? in
2844                         0)
2845                                 if test "$ans" != "$value"; then
2846                                         echo "(That expands to $value on this system.)"
2847                                 fi
2848                                 ;;
2849                         *) value="$ans";;
2850                         esac
2851                         ansexp="$value"
2852                         case "$exp_file" in
2853                         '') value="$ans";;
2854                         esac
2855                         ;;
2856                 esac
2857                 case "$fullpath" in
2858                 true)
2859                         case "$ansexp" in
2860                         /*) value="$ansexp" ;;
2861                         *)
2862                                 redo=true
2863                                 case "$already" in
2864                                 true)
2865                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
2866                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
2867                                         ;;
2868                                 *)
2869                                 echo "Please give a full path name, starting with slash." >&4
2870                                         case "$tilde" in
2871                                         true)
2872                                 echo "Note that using ~name is ok provided it expands well." >&4
2873                                                 already=true
2874                                                 ;;
2875                                         esac
2876                                 esac
2877                                 ;;
2878                         esac
2879                         ;;
2880                 esac
2881                 case "$redo" in
2882                 '')
2883                         case "$type" in
2884                         File)
2885                                 if test -f "$ansexp"; then
2886                                         type=''
2887                                 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2888                                 then
2889                                         echo "($value is not a plain file, but that's ok.)"
2890                                         type=''
2891                                 fi
2892                                 ;;
2893                         Directory)
2894                                 if test -d "$ansexp"; then
2895                                         type=''
2896                                 fi
2897                                 ;;
2898                         Locate)
2899                                 if test -d "$ansexp"; then
2900                                         echo "(Looking for $loc_file in directory $value.)"
2901                                         value="$value/$loc_file"
2902                                         ansexp="$ansexp/$loc_file"
2903                                 fi
2904                                 if test -f "$ansexp"; then
2905                                         type=''
2906                                 fi
2907                                 case "$nopath_ok" in
2908                                 true)   case "$value" in
2909                                         */*) ;;
2910                                         *)      echo "Assuming $value will be in people's path."
2911                                                 type=''
2912                                                 ;;
2913                                         esac
2914                                         ;;
2915                                 esac
2916                                 ;;
2917                         esac
2918
2919                         case "$skip" in
2920                         true) type='';
2921                         esac
2922
2923                         case "$type" in
2924                         '') ;;
2925                         *)
2926                                 if test "$fastread" = yes; then
2927                                         dflt=y
2928                                 else
2929                                         dflt=n
2930                                 fi
2931                                 rp="$what $value doesn't exist.  Use that name anyway?"
2932                                 . UU/myread
2933                                 dflt=''
2934                                 case "$ans" in
2935                                 y*) type='';;
2936                                 *) echo " ";;
2937                                 esac
2938                                 ;;
2939                         esac
2940                         ;;
2941                 esac
2942                 ;;
2943         esac
2944 done
2945 cd UU
2946 ans="$value"
2947 rp="$orig_rp"
2948 dflt="$orig_dflt"
2949 rm -f getfile.ok
2950 EOSC
2951
2952 : determine root of directory hierarchy where package will be installed.
2953 case "$prefix" in
2954 '')
2955         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2956         ;;
2957 *)
2958         dflt="$prefix"
2959         ;;
2960 esac
2961 $cat <<EOM
2962
2963 By default, $package will be installed in $dflt/bin, manual
2964 pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2965 all installation directories. Typically set to /usr/local, but you
2966 may choose /usr if you wish to install $package among your system
2967 binaries. If you wish to have binaries under /bin but manual pages
2968 under /usr/local/man, that's ok: you will be prompted separately
2969 for each of the installation directories, the prefix being only used
2970 to set the defaults.
2971
2972 EOM
2973 fn=d~
2974 rp='Installation prefix to use?'
2975 . ./getfile
2976 oldprefix=''
2977 case "$prefix" in
2978 '') ;;
2979 *)
2980         case "$ans" in
2981         "$prefix") ;;
2982         *) oldprefix="$prefix";;
2983         esac
2984         ;;
2985 esac
2986 prefix="$ans"
2987 prefixexp="$ansexp"
2988
2989 : set the prefixit variable, to compute a suitable default value
2990 prefixit='case "$3" in
2991 ""|none)
2992         case "$oldprefix" in
2993         "") eval "$1=\"\$$2\"";;
2994         *)
2995                 case "$3" in
2996                 "") eval "$1=";;
2997                 none)
2998                         eval "tp=\"\$$2\"";
2999                         case "$tp" in
3000                         ""|" ") eval "$1=\"\$$2\"";;
3001                         *) eval "$1=";;
3002                         esac;;
3003                 esac;;
3004         esac;;
3005 *)
3006         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3007         case "$tp" in
3008         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3009         /*-$oldprefix/*|\~*-$oldprefix/*)
3010                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3011         *) eval "$1=\"\$$2\"";;
3012         esac;;
3013 esac'
3014
3015 : set the base revision
3016 baserev=5.0
3017
3018 : get the patchlevel
3019 echo " "
3020 echo "Getting the current patchlevel..." >&4
3021 if $test -r $rsrc/patchlevel.h;then
3022         patchlevel=`awk '/define[       ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
3023         subversion=`awk '/define[       ]+SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3024 else
3025         patchlevel=0
3026         subversion=0
3027 fi
3028 $echo $n "(You have $package" $c
3029 case "$package" in
3030 "*$baserev")    ;;
3031 *)              $echo $n " $baserev" $c ;;
3032 esac
3033 $echo $n " patchlevel $patchlevel" $c
3034 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3035 echo ".)"
3036
3037 if test 0 -eq "$subversion"; then
3038         version=`LC_ALL=C; export LC_ALL; \
3039                  echo $baserev $patchlevel | \
3040                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3041 else
3042         version=`LC_ALL=C; export LC_ALL; \
3043                  echo $baserev $patchlevel $subversion | \
3044                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3045 fi
3046 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3047 if test "$subversion" -lt 50; then
3048         apiversion=`LC_ALL=C; export LC_ALL; \
3049                  LANGUAGE=C; export LANGUAGE; \
3050                  echo $baserev $patchlevel | \
3051                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3052 else
3053         apiversion="$version"
3054 fi
3055
3056 : determine where private library files go
3057 : Usual default is /usr/local/lib/perl5/$version.
3058 : Also allow things like /opt/perl/lib/$version, since 
3059 : /opt/perl/lib/perl5... would be redundant.
3060 case "$prefix" in
3061 *perl*) set dflt privlib lib/$version ;;
3062 *)       set dflt privlib lib/$package/$version ;;
3063 esac
3064 eval $prefixit
3065 $cat <<EOM
3066
3067 There are some auxiliary files for $package that need to be put into a
3068 private library directory that is accessible by everyone.
3069
3070 EOM
3071 fn=d~+
3072 rp='Pathname where the private library files will reside?'
3073 . ./getfile
3074 if $test "X$privlibexp" != "X$ansexp"; then
3075         installprivlib=''
3076 fi
3077 privlib="$ans"
3078 privlibexp="$ansexp"
3079 if $afs; then
3080         $cat <<EOM
3081
3082 Since you are running AFS, I need to distinguish the directory in which
3083 private files reside from the directory in which they are installed (and from
3084 which they are presumably copied to the former directory by occult means).
3085
3086 EOM
3087         case "$installprivlib" in
3088         '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3089         *) dflt="$installprivlib";;
3090         esac
3091         fn=de~
3092         rp='Where will private files be installed?'
3093         . ./getfile
3094         installprivlib="$ans"
3095 else
3096         installprivlib="$privlibexp"
3097 fi
3098
3099 : set the prefixup variable, to restore leading tilda escape
3100 prefixup='case "$prefixexp" in
3101 "$prefix") ;;
3102 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3103 esac'
3104
3105 : determine where public architecture dependent libraries go
3106 set archlib archlib
3107 eval $prefixit
3108 : privlib default is /usr/local/lib/$package/$version
3109 : archlib default is /usr/local/lib/$package/$version/$archname
3110 : privlib may have an optional trailing /share.
3111 tdflt=`echo $privlib | $sed 's,/share$,,'`
3112 tdflt=$tdflt/$archname
3113 case "$archlib" in
3114 '')     dflt=$tdflt
3115         ;;
3116 *)      dflt="$archlib"
3117     ;;
3118 esac
3119 cat <<EOM
3120
3121 $spackage contains architecture-dependent library files.  If you are
3122 sharing libraries in a heterogeneous environment, you might store
3123 these files in a separate location.  Otherwise, you can just include
3124 them with the rest of the public library files.
3125
3126 EOM
3127 fn=d+~
3128 rp='Where do you want to put the public architecture-dependent libraries?'
3129 . ./getfile
3130 archlib="$ans"
3131 archlibexp="$ansexp"
3132
3133 if $afs; then
3134         $cat <<EOM
3135
3136 Since you are running AFS, I need to distinguish the directory in
3137 which architecture-dependent library files reside from the directory
3138 in which they are installed (and from which they are presumably copied
3139 to the former directory by occult means).
3140
3141 EOM
3142         case "$installarchlib" in
3143         '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3144         *) dflt="$installarchlib";;
3145         esac
3146         fn=de~
3147         rp='Where will architecture-dependent library files be installed?'
3148         . ./getfile
3149         installarchlib="$ans"
3150 else
3151         installarchlib="$archlibexp"
3152 fi
3153 if $test X"$archlib" = X"$privlib"; then
3154         d_archlib="$undef"
3155 else
3156         d_archlib="$define"
3157 fi
3158
3159 : make some quick guesses about what we are up against
3160 echo " "
3161 $echo $n "Hmm...  $c"
3162 echo exit 1 >bsd
3163 echo exit 1 >usg
3164 echo exit 1 >v7
3165 echo exit 1 >osf1
3166 echo exit 1 >eunice
3167 echo exit 1 >xenix
3168 echo exit 1 >venix
3169 echo exit 1 >os2
3170 d_bsd="$undef"
3171 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3172 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3173 then
3174         echo "Looks kind of like an OSF/1 system, but we'll see..."
3175         echo exit 0 >osf1
3176 elif test `echo abc | tr a-z A-Z` = Abc ; then
3177         xxx=`./loc addbib blurfl $pth`
3178         if $test -f $xxx; then
3179         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3180                 echo exit 0 >bsd
3181                 echo exit 0 >usg
3182         else
3183                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3184                         echo "Looks kind of like an extended USG system, but we'll see..."
3185                 else
3186                         echo "Looks kind of like a USG system, but we'll see..."
3187                 fi
3188                 echo exit 0 >usg
3189         fi
3190 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3191         echo "Looks kind of like a BSD system, but we'll see..."
3192         d_bsd="$define"
3193         echo exit 0 >bsd
3194 else
3195         echo "Looks kind of like a Version 7 system, but we'll see..."
3196         echo exit 0 >v7
3197 fi
3198 case "$eunicefix" in
3199 *unixtovms*)
3200         $cat <<'EOI'
3201 There is, however, a strange, musty smell in the air that reminds me of
3202 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3203 EOI
3204         echo exit 0 >eunice
3205         d_eunice="$define"
3206 : it so happens the Eunice I know will not run shell scripts in Unix format
3207         ;;
3208 *)
3209         echo " "
3210         echo "Congratulations.  You aren't running Eunice."
3211         d_eunice="$undef"
3212         ;;
3213 esac
3214 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3215 case "$p_" in
3216 :) ;;
3217 *)
3218         $cat <<'EOI'
3219 I have the feeling something is not exactly right, however...don't tell me...
3220 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3221 EOI
3222         echo exit 0 >os2
3223         ;;
3224 esac
3225 if test -f /xenix; then
3226         echo "Actually, this looks more like a XENIX system..."
3227         echo exit 0 >xenix
3228         d_xenix="$define"
3229 else
3230         echo " "
3231         echo "It's not Xenix..."
3232         d_xenix="$undef"
3233 fi
3234 chmod +x xenix
3235 $eunicefix xenix
3236 if test -f /venix; then
3237         echo "Actually, this looks more like a VENIX system..."
3238         echo exit 0 >venix
3239 else
3240         echo " "
3241         if ./xenix; then
3242                 : null
3243         else
3244                 echo "Nor is it Venix..."
3245         fi
3246 fi
3247 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3248 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3249 $rm -f foo
3250
3251 : see if setuid scripts can be secure
3252 $cat <<EOM
3253
3254 Some kernels have a bug that prevents setuid #! scripts from being
3255 secure.  Some sites have disabled setuid #! scripts because of this.
3256
3257 First let's decide if your kernel supports secure setuid #! scripts.
3258 (If setuid #! scripts would be secure but have been disabled anyway,
3259 don't say that they are secure if asked.)
3260
3261 EOM
3262
3263 val="$undef"
3264 if $test -d /dev/fd; then
3265         echo "#!$ls" >reflect
3266         chmod +x,u+s reflect
3267         ./reflect >flect 2>&1
3268         if $contains "/dev/fd" flect >/dev/null; then
3269                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3270                 val="$define"
3271         else
3272                 $cat <<EOM
3273 If you are not sure if they are secure, I can check but I'll need a
3274 username and password different from the one you are using right now.
3275 If you don't have such a username or don't want me to test, simply
3276 enter 'none'.
3277
3278 EOM
3279                 rp='Other username to test security of setuid scripts with?'
3280                 dflt='none'
3281                 . ./myread
3282                 case "$ans" in
3283                 n|none)
3284                         case "$d_suidsafe" in
3285                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3286                                 dflt=n;;
3287                         "$undef")
3288                                 echo "Well, the $hint value is *not* secure." >&4
3289                                 dflt=n;;
3290                         *)      echo "Well, the $hint value *is* secure." >&4
3291                                 dflt=y;;
3292                         esac
3293                         ;;
3294                 *)
3295                         $rm -f reflect flect
3296                         echo "#!$ls" >reflect
3297                         chmod +x,u+s reflect
3298                         echo >flect
3299                         chmod a+w flect
3300                         echo '"su" will (probably) prompt you for '"$ans's password."
3301                         su $ans -c './reflect >flect'
3302                         if $contains "/dev/fd" flect >/dev/null; then
3303                                 echo "Okay, it looks like setuid scripts are secure." >&4
3304                                 dflt=y
3305                         else
3306                                 echo "I don't think setuid scripts are secure." >&4
3307                                 dflt=n
3308                         fi
3309                         ;;
3310                 esac
3311                 rp='Does your kernel have *secure* setuid scripts?'
3312                 . ./myread
3313                 case "$ans" in
3314                 [yY]*)  val="$define";;
3315                 *)      val="$undef";;
3316                 esac
3317         fi
3318 else
3319         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3320         echo "(That's for file descriptors, not floppy disks.)"
3321         val="$undef"
3322 fi
3323 set d_suidsafe
3324 eval $setvar
3325
3326 $rm -f reflect flect
3327
3328 : now see if they want to do setuid emulation
3329 echo " "
3330 val="$undef"
3331 case "$d_suidsafe" in
3332 "$define")
3333         val="$undef"
3334         echo "No need to emulate SUID scripts since they are secure here." >& 4
3335         ;;
3336 *)
3337         $cat <<EOM
3338 Some systems have disabled setuid scripts, especially systems where
3339 setuid scripts cannot be secure.  On systems where setuid scripts have
3340 been disabled, the setuid/setgid bits on scripts are currently
3341 useless.  It is possible for $package to detect those bits and emulate
3342 setuid/setgid in a secure fashion.  This emulation will only work if
3343 setuid scripts have been disabled in your kernel.
3344
3345 EOM
3346         case "$d_dosuid" in
3347         "$define") dflt=y ;;
3348         *) dflt=n ;;
3349         esac
3350         rp="Do you want to do setuid/setgid emulation?"
3351         . ./myread
3352         case "$ans" in
3353         [yY]*)  val="$define";;
3354         *)      val="$undef";;
3355         esac
3356         ;;
3357 esac
3358 set d_dosuid
3359 eval $setvar
3360
3361 : determine where manual pages are on this system
3362 echo " "
3363 case "$sysman" in
3364 '') 
3365         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3366         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3367         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3368         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3369         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3370         sysman=`./loc . /usr/man/man1 $syspath`
3371         ;;
3372 esac
3373 if $test -d "$sysman"; then
3374         echo "System manual is in $sysman." >&4
3375 else
3376         echo "Could not find manual pages in source form." >&4
3377 fi
3378
3379 : see what memory models we can support
3380 case "$models" in
3381 '')
3382         $cat >pdp11.c <<'EOP'
3383 int main() {
3384 #ifdef pdp11
3385         exit(0);
3386 #else
3387         exit(1);
3388 #endif
3389 }
3390 EOP
3391         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3392         if $test -f pdp11 && ./pdp11 2>/dev/null; then
3393                 dflt='unsplit split'
3394         else
3395                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3396                 case "$tans" in
3397                 X) dflt='none';;
3398                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3399                                 dflt='small'
3400                         else
3401                                 dflt=''
3402                         fi
3403                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
3404                                 dflt="$dflt medium"
3405                         fi
3406                         if $test -d /lib/large || $test -d /usr/lib/large; then
3407                                 dflt="$dflt large"
3408                         fi
3409                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
3410                                 dflt="$dflt huge"
3411                         fi
3412                 esac
3413         fi;;
3414 *) dflt="$models";;
3415 esac
3416 $cat <<EOM
3417  
3418 Some systems have different model sizes.  On most systems they are called
3419 small, medium, large, and huge.  On the PDP11 they are called unsplit and
3420 split.  If your system doesn't support different memory models, say "none".
3421 If you wish to force everything to one memory model, say "none" here and
3422 put the appropriate flags later when it asks you for other cc and ld flags.
3423 Venix systems may wish to put "none" and let the compiler figure things out.
3424 (In the following question multiple model names should be space separated.)
3425
3426 The default for most systems is "none".
3427
3428 EOM
3429 rp="Which memory models are supported?"
3430 . ./myread
3431 models="$ans"
3432
3433 case "$models" in
3434 none)
3435         small=''
3436         medium=''
3437         large=''
3438         huge=''
3439         unsplit=''
3440         split=''
3441         ;;
3442 *split)
3443         case "$split" in
3444         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3445                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3446                         dflt='-i'
3447                 else
3448                         dflt='none'
3449                 fi;;
3450         *) dflt="$split";;
3451         esac
3452         rp="What flag indicates separate I and D space?"
3453         . ./myread
3454         tans="$ans"
3455         case "$tans" in
3456         none) tans='';;
3457         esac
3458         split="$tans"
3459         unsplit='';;
3460 *large*|*small*|*medium*|*huge*)
3461         case "$models" in
3462         *large*)
3463                 case "$large" in
3464                 '') dflt='-Ml';;
3465                 *) dflt="$large";;
3466                 esac
3467         rp="What flag indicates large model?"
3468         . ./myread
3469         tans="$ans"
3470         case "$tans" in
3471         none) tans='';
3472         esac
3473         large="$tans";;
3474         *) large='';;
3475         esac
3476         case "$models" in
3477         *huge*) case "$huge" in
3478                 '') dflt='-Mh';;
3479                 *) dflt="$huge";;
3480                 esac
3481                 rp="What flag indicates huge model?"
3482                 . ./myread
3483                 tans="$ans"
3484                 case "$tans" in
3485                 none) tans='';
3486                 esac
3487                 huge="$tans";;
3488         *) huge="$large";;
3489         esac
3490         case "$models" in
3491         *medium*) case "$medium" in
3492                 '') dflt='-Mm';;
3493                 *) dflt="$medium";;
3494                 esac
3495                 rp="What flag indicates medium model?"
3496                 . ./myread
3497                 tans="$ans"
3498                 case "$tans" in
3499                 none) tans='';
3500                 esac
3501                 medium="$tans";;
3502         *) medium="$large";;
3503         esac
3504         case "$models" in
3505         *small*) case "$small" in
3506                 '') dflt='none';;
3507                 *) dflt="$small";;
3508                 esac
3509                 rp="What flag indicates small model?"
3510                 . ./myread
3511                 tans="$ans"
3512                 case "$tans" in
3513                 none) tans='';
3514                 esac
3515                 small="$tans";;
3516         *) small='';;
3517         esac
3518         ;;
3519 *)
3520         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3521         ;;
3522 esac
3523 $rm -f pdp11.* pdp11
3524
3525 : see if we need a special compiler
3526 echo " "
3527 if ./usg; then
3528         case "$cc" in
3529         '') case "$Mcc" in
3530                 /*) dflt='Mcc';;
3531                 *) case "$large" in
3532                         -M*) dflt='cc';;
3533                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3534                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3535                                                 dflt='cc'
3536                                         else
3537                                                 dflt='cc -M'
3538                                         fi
3539                                 else
3540                                         dflt='cc'
3541                                 fi;;
3542                         esac;;
3543                 esac;;
3544         *)  dflt="$cc";;
3545         esac
3546         case "$dflt" in
3547         *M*)    $cat <<'EOM'
3548 On some older systems the default C compiler will not resolve multiple global
3549 references that happen to have the same name.  On some such systems the "Mcc"
3550 command may be used to force these to be resolved.  On other systems a "cc -M"
3551 command is required.  (Note that the -M flag on other systems indicates a
3552 memory model to use!) If you have the Gnu C compiler, you might wish to use
3553 that instead.
3554
3555 EOM
3556         ;;
3557         esac
3558         rp="Use which C compiler?"
3559         . ./myread
3560         cc="$ans"
3561 else
3562         case "$cc" in
3563         '') dflt=cc;;
3564         *) dflt="$cc";;
3565         esac
3566         rp="Use which C compiler?"
3567         . ./myread
3568         cc="$ans"
3569 fi
3570 : Look for a hint-file generated 'call-back-unit'.  Now that the
3571 : user has specified the compiler, we may need to set or change some
3572 : other defaults.
3573 if $test -f cc.cbu; then
3574     . ./cc.cbu
3575 fi
3576 echo " "
3577 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3578 $cat >gccvers.c <<EOM
3579 #include <stdio.h>
3580 int main() {
3581 #ifdef __GNUC__
3582 #ifdef __VERSION__
3583         printf("%s\n", __VERSION__);
3584 #else
3585         printf("%s\n", "1");
3586 #endif
3587 #endif
3588         exit(0);
3589 }
3590 EOM
3591 if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3592         gccversion=`./gccvers`
3593         case "$gccversion" in
3594         '') echo "You are not using GNU cc." ;;
3595         *)  echo "You are using GNU cc $gccversion." ;;
3596         esac
3597 else
3598         echo " "
3599         echo "*** WHOA THERE!!! ***" >&4
3600         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3601         case "$knowitall" in
3602         '')
3603         echo "    You'd better start hunting for one and let me know about it." >&4
3604                 exit 1
3605                 ;;
3606         esac
3607 fi
3608 $rm -f gccvers*
3609 case "$gccversion" in
3610 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3611 esac
3612
3613 : What should the include directory be ?
3614 echo " "
3615 $echo $n "Hmm...  $c"
3616 dflt='/usr/include'
3617 incpath=''
3618 mips_type=''
3619 if $test -f /bin/mips && /bin/mips; then
3620         echo "Looks like a MIPS system..."
3621         $cat >usr.c <<'EOCP'
3622 #ifdef SYSTYPE_BSD43
3623 /bsd43
3624 #endif
3625 EOCP
3626         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3627                 dflt='/bsd43/usr/include'
3628                 incpath='/bsd43'
3629                 mips_type='BSD 4.3'
3630         else
3631                 mips_type='System V'
3632         fi
3633         $rm -f usr.c usr.out
3634         echo "and you're compiling with the $mips_type compiler and libraries."
3635         xxx_prompt=y
3636         echo "exit 0" >mips
3637 else
3638         echo "Doesn't look like a MIPS system."
3639         xxx_prompt=n
3640         echo "exit 1" >mips
3641 fi
3642 chmod +x mips
3643 $eunicefix mips
3644 case "$usrinc" in
3645 '') ;;
3646 *) dflt="$usrinc";;
3647 esac
3648 case "$xxx_prompt" in
3649 y)      fn=d/
3650         echo " "
3651         rp='Where are the include files you want to use?'
3652         . ./getfile
3653         usrinc="$ans"
3654         ;;
3655 *)      usrinc="$dflt"
3656         ;;
3657 esac
3658
3659 : see how we invoke the C preprocessor
3660 echo " "
3661 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3662 cat <<'EOT' >testcpp.c
3663 #define ABC abc
3664 #define XYZ xyz
3665 ABC.XYZ
3666 EOT
3667 cd ..
3668 if test ! -f cppstdin; then
3669         echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3670 else
3671         echo "Keeping your $hint cppstdin wrapper."
3672 fi
3673 chmod 755 cppstdin
3674 wrapper=`pwd`/cppstdin
3675 ok='false'
3676 cd UU
3677
3678 if $test "X$cppstdin" != "X" && \
3679         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3680         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3681 then
3682         echo "You used to use $cppstdin $cppminus so we'll use that again."
3683         case "$cpprun" in
3684         '') echo "But let's see if we can live without a wrapper..." ;;
3685         *)
3686                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3687                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3688                 then
3689                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3690                         ok='true'
3691                 else
3692                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3693                 fi
3694                 ;;
3695         esac
3696 else
3697         case "$cppstdin" in
3698         '') ;;
3699         *)
3700                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3701                 ;;
3702         esac
3703 fi
3704
3705 if $ok; then
3706         : nothing
3707 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3708         $cc -E <testcpp.c >testcpp.out 2>&1; \
3709         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3710         echo "Yup, it does."
3711         x_cpp="$cc -E"
3712         x_minus='';
3713 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3714         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3715         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3716         echo "Yup, it does."
3717         x_cpp="$cc -E"
3718         x_minus='-';
3719 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3720         $cc -P <testcpp.c >testcpp.out 2>&1; \
3721         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3722         echo "Yipee, that works!"
3723         x_cpp="$cc -P"
3724         x_minus='';
3725 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3726         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3727         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3728         echo "At long last!"
3729         x_cpp="$cc -P"
3730         x_minus='-';
3731 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3732         $cpp <testcpp.c >testcpp.out 2>&1; \
3733         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3734         echo "It works!"
3735         x_cpp="$cpp"
3736         x_minus='';
3737 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3738         $cpp - <testcpp.c >testcpp.out 2>&1; \
3739         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3740         echo "Hooray, it works!  I was beginning to wonder."
3741         x_cpp="$cpp"
3742         x_minus='-';
3743 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3744         $wrapper <testcpp.c >testcpp.out 2>&1; \
3745         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3746         x_cpp="$wrapper"
3747         x_minus=''
3748         echo "Eureka!"
3749 else
3750         dflt=''
3751         rp="No dice.  I can't find a C preprocessor.  Name one:"
3752         . ./myread
3753         x_cpp="$ans"
3754         x_minus=''
3755         $x_cpp <testcpp.c >testcpp.out 2>&1
3756         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3757                 echo "OK, that will do." >&4
3758         else
3759 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3760                 exit 1
3761         fi
3762 fi
3763
3764 case "$ok" in
3765 false)
3766         cppstdin="$x_cpp"
3767         cppminus="$x_minus"
3768         cpprun="$x_cpp"
3769         cpplast="$x_minus"
3770         set X $x_cpp
3771         shift
3772         case "$1" in
3773         "$cpp")
3774                 echo "Perhaps can we force $cc -E using a wrapper..."
3775                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3776                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3777                 then
3778                         echo "Yup, we can."
3779                         cppstdin="$wrapper"
3780                         cppminus='';
3781                 else
3782                         echo "Nope, we'll have to live without it..."
3783                 fi
3784                 ;;
3785         esac
3786         case "$cpprun" in
3787         "$wrapper")
3788                 cpprun=''
3789                 cpplast=''
3790                 ;;
3791         esac
3792         ;;
3793 esac
3794
3795 case "$cppstdin" in
3796 "$wrapper"|'cppstdin') ;;
3797 *) $rm -f $wrapper;;
3798 esac
3799 $rm -f testcpp.c testcpp.out
3800
3801 : Set private lib path
3802 case "$plibpth" in
3803 '') if ./mips; then
3804                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3805         fi;;
3806 esac
3807 case "$libpth" in
3808 ' ') dlist='';;
3809 '') dlist="$loclibpth $plibpth $glibpth";;
3810 *) dlist="$libpth";;
3811 esac
3812
3813 : Now check and see which directories actually exist, avoiding duplicates
3814 libpth=''
3815 for xxx in $dlist
3816 do
3817     if $test -d $xxx; then
3818                 case " $libpth " in
3819                 *" $xxx "*) ;;
3820                 *) libpth="$libpth $xxx";;
3821                 esac
3822     fi
3823 done
3824 $cat <<'EOM'
3825
3826 Some systems have incompatible or broken versions of libraries.  Among
3827 the directories listed in the question below, please remove any you
3828 know not to be holding relevant libraries, and add any that are needed.
3829 Say "none" for none.
3830
3831 EOM
3832 case "$libpth" in
3833 '') dflt='none';;
3834 *)
3835         set X $libpth
3836         shift
3837         dflt=${1+"$@"}
3838         ;;
3839 esac
3840 rp="Directories to use for library searches?"
3841 . ./myread
3842 case "$ans" in
3843 none) libpth=' ';;
3844 *) libpth="$ans";;
3845 esac
3846
3847 : compute shared library extension
3848 case "$so" in
3849 '')
3850         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3851                 dflt='sl'
3852         else
3853                 dflt='so'
3854         fi
3855         ;;
3856 *) dflt="$so";;
3857 esac
3858 $cat <<EOM
3859
3860 On some systems, shared libraries may be available.  Answer 'none' if
3861 you want to suppress searching of shared libraries for the remaining
3862 of this configuration.
3863
3864 EOM
3865 rp='What is the file extension used for shared libraries?'
3866 . ./myread
3867 so="$ans"
3868
3869 : Define several unixisms.
3870 : Hints files or command line option can be used to override them.
3871 : The convoluted testing is in case hints files set either the old
3872 : or the new name.
3873 case "$_exe" in
3874 '')     case "$exe_ext" in
3875     '') ;;
3876         *)      _exe="$exe_ext" ;;
3877         esac
3878         ;;
3879 esac
3880 case "$_a" in
3881 '')     case "$lib_ext" in
3882     '') _a='.a';;
3883         *)      _a="$lib_ext" ;;
3884         esac
3885         ;;
3886 esac
3887 case "$_o" in
3888 '') case "$obj_ext" in
3889         '')     _o='.o';;
3890         *)      _o="$obj_ext";;
3891         esac
3892         ;;
3893 esac
3894 case "$p_" in
3895 '') case "$path_sep" in
3896         '')     p_=':';;
3897         *)      p_="$path_sep";;
3898         esac
3899         ;;
3900 esac
3901 exe_ext=$_exe
3902 lib_ext=$_a
3903 obj_ext=$_o
3904 path_sep=$p_
3905
3906 : Which makefile gets called first.  This is used by make depend.
3907 case "$firstmakefile" in
3908 '') firstmakefile='makefile';;
3909 esac
3910
3911 : Looking for optional libraries
3912 echo " "
3913 echo "Checking for optional libraries..." >&4
3914 case "$libs" in
3915 ' '|'') dflt='';;
3916 *) dflt="$libs";;
3917 esac
3918 case "$libswanted" in
3919 '') libswanted='c_s';;
3920 esac
3921 for thislib in $libswanted; do
3922         
3923         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3924                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3925                 echo "Found -l$thislib (shared)."
3926                 case " $dflt " in
3927                 *"-l$thislib "*);;
3928                 *) dflt="$dflt -l$thislib";;
3929                 esac
3930         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3931                 echo "Found -l$thislib (shared)."
3932                 case " $dflt " in
3933                 *"-l$thislib "*);;
3934                 *) dflt="$dflt -l$thislib";;
3935                 esac
3936         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3937                 echo "Found -l$thislib."
3938                 case " $dflt " in
3939                 *"-l$thislib "*);;
3940                 *) dflt="$dflt -l$thislib";;
3941                 esac
3942         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3943                 echo "Found -l$thislib."
3944                 case " $dflt " in
3945                 *"-l$thislib "*);;
3946                 *) dflt="$dflt -l$thislib";;
3947                 esac
3948         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3949                 echo "Found -l${thislib}_s."
3950                 case " $dflt " in
3951                 *"-l$thislib "*);;
3952                 *) dflt="$dflt -l${thislib}_s";;
3953                 esac
3954         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3955                 echo "Found -l$thislib."
3956                 case " $dflt " in
3957                 *"-l$thislib "*);;
3958                 *) dflt="$dflt -l$thislib";;
3959                 esac
3960         else
3961                 echo "No -l$thislib."
3962         fi
3963 done
3964 set X $dflt
3965 shift
3966 dflt="$*"
3967 case "$libs" in
3968 '') dflt="$dflt";;
3969 *) dflt="$libs";;
3970 esac
3971 case "$dflt" in
3972 ' '|'') dflt='none';;
3973 esac
3974
3975 $cat <<EOM
3976  
3977 Some versions of Unix support shared libraries, which make executables smaller
3978 but make load time slightly longer.
3979
3980 On some systems, mostly System V Release 3's, the shared library is included
3981 by putting the option "-lc_s" as the last thing on the cc command line when
3982 linking.  Other systems use shared libraries by default.  There may be other
3983 libraries needed to compile $package on your machine as well.  If your system
3984 needs the "-lc_s" option, include it here.  Include any other special libraries
3985 here as well.  Say "none" for none.
3986 EOM
3987
3988 echo " "
3989 rp="Any additional libraries?"
3990 . ./myread
3991 case "$ans" in
3992 none) libs=' ';;
3993 *) libs="$ans";;
3994 esac
3995
3996 : determine optimize, if desired, or use for debug flag also
3997 case "$optimize" in
3998 ' '|$undef) dflt='none';;
3999 '') dflt='-O';;
4000 *) dflt="$optimize";;
4001 esac
4002 $cat <<EOH
4003
4004 Some C compilers have problems with their optimizers.  By default, $package
4005 compiles with the -O flag to use the optimizer.  Alternately, you might want
4006 to use the symbolic debugger, which uses the -g flag (on traditional Unix
4007 systems).  Either flag can be specified here.  To use neither flag, specify
4008 the word "none".
4009
4010 EOH
4011 rp="What optimizer/debugger flag should be used?"
4012 . ./myread
4013 optimize="$ans"
4014 case "$optimize" in
4015 'none') optimize=" ";;
4016 esac
4017
4018 dflt=''
4019 : We will not override a previous value, but we might want to
4020 : augment a hint file
4021 case "$hint" in
4022 none|recommended)
4023         case "$gccversion" in
4024         1*) dflt='-fpcc-struct-return' ;;
4025         esac
4026         case "$optimize" in
4027         *-g*) dflt="$dflt -DDEBUGGING";;
4028         esac
4029         case "$gccversion" in
4030         2*) if test -d /etc/conf/kconfig.d &&
4031                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4032                 then
4033                         dflt="$dflt -posix"
4034                 fi
4035                 ;;
4036         esac
4037         ;;
4038 esac
4039
4040 case "$mips_type" in
4041 *BSD*|'') inclwanted="$locincpth $usrinc";;
4042 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4043 esac
4044 for thisincl in $inclwanted; do
4045         if $test -d $thisincl; then
4046                 if $test x$thisincl != x$usrinc; then
4047                         case "$dflt" in
4048                         *$thisincl*);;
4049                         *) dflt="$dflt -I$thisincl";;
4050                         esac
4051                 fi
4052         fi
4053 done
4054
4055 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4056         xxx=true;
4057 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4058         xxx=true;
4059 else
4060         xxx=false;
4061 fi;
4062 if $xxx; then
4063         case "$dflt" in
4064         *$2*);;
4065         *) dflt="$dflt -D$2";;
4066         esac;
4067 fi'
4068
4069 if ./osf1; then
4070         set signal.h __LANGUAGE_C__; eval $inctest
4071 else
4072         set signal.h LANGUAGE_C; eval $inctest
4073 fi
4074
4075 case "$hint" in
4076 none|recommended) dflt="$ccflags $dflt" ;;
4077 *) dflt="$ccflags";;
4078 esac
4079
4080 case "$dflt" in
4081 ''|' ') dflt=none;;
4082 esac
4083 $cat <<EOH
4084
4085 Your C compiler may want other flags.  For this question you should include
4086 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4087 but you should NOT include libraries or ld flags like -lwhatever.  If you
4088 want $package to honor its debug switch, you should include -DDEBUGGING here.
4089 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4090
4091 To use no flags, specify the word "none".
4092
4093 EOH
4094 set X $dflt
4095 shift
4096 dflt=${1+"$@"}
4097 rp="Any additional cc flags?"
4098 . ./myread
4099 case "$ans" in
4100 none) ccflags='';;
4101 *) ccflags="$ans";;
4102 esac
4103
4104 : the following weeds options from ccflags that are of no interest to cpp
4105 cppflags="$ccflags"
4106 case "$gccversion" in
4107 1*) cppflags="$cppflags -D__GNUC__"
4108 esac
4109 case "$mips_type" in
4110 '');;
4111 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4112 esac
4113 case "$cppflags" in
4114 '');;
4115 *)
4116         echo " "
4117         echo "Let me guess what the preprocessor flags are..." >&4
4118         set X $cppflags
4119         shift
4120         cppflags=''
4121         $cat >cpp.c <<'EOM'
4122 #define BLURFL foo
4123
4124 BLURFL xx LFRULB
4125 EOM
4126         previous=''
4127         for flag in $*
4128         do
4129                 case "$flag" in
4130                 -*) ftry="$flag";;
4131                 *) ftry="$previous $flag";;
4132                 esac
4133                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4134                         >cpp1.out 2>/dev/null && \
4135                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4136                         >cpp2.out 2>/dev/null && \
4137                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4138                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4139                 then
4140                         cppflags="$cppflags $ftry"
4141                         previous=''
4142                 else
4143                         previous="$flag"
4144                 fi
4145         done
4146         set X $cppflags
4147         shift
4148         cppflags=${1+"$@"}
4149         case "$cppflags" in
4150         *-*)  echo "They appear to be: $cppflags";;
4151         esac
4152         $rm -f cpp.c cpp?.out
4153         ;;
4154 esac
4155
4156 : flags used in final linking phase
4157 case "$ldflags" in
4158 '') if ./venix; then
4159                 dflt='-i -z'
4160         else
4161                 dflt=''
4162         fi
4163         case "$ccflags" in
4164         *-posix*) dflt="$dflt -posix" ;;
4165         esac
4166         ;;
4167 *) dflt="$ldflags";;
4168 esac
4169
4170 : Try to guess additional flags to pick up local libraries.
4171 for thislibdir in $libpth; do
4172         case " $loclibpth " in
4173         *" $thislibdir "*)
4174                 case "$dflt " in 
4175                 *"-L$thislibdir "*) ;;
4176                 *)  dflt="$dflt -L$thislibdir" ;;
4177                 esac
4178                 ;;
4179         esac
4180 done
4181
4182 case "$dflt" in
4183 '') dflt='none' ;;
4184 esac
4185
4186 $cat <<EOH
4187
4188 Your C linker may need flags.  For this question you should
4189 include -L/whatever and any other flags used by the C linker, but you
4190 should NOT include libraries like -lwhatever.
4191
4192 Make sure you include the appropriate -L/path flags if your C linker
4193 does not normally search all of the directories you specified above,
4194 namely
4195         $libpth
4196 To use no flags, specify the word "none".
4197
4198 EOH
4199
4200 rp="Any additional ld flags (NOT including libraries)?"
4201 . ./myread
4202 case "$ans" in
4203 none) ldflags='';;
4204 *) ldflags="$ans";;
4205 esac
4206 rmlist="$rmlist pdp11"
4207
4208 : coherency check
4209 echo " "
4210 echo "Checking your choice of C compiler and flags for coherency..." >&4
4211 $cat > try.c <<'EOF'
4212 #include <stdio.h>
4213 int main() { printf("Ok\n"); exit(0); }
4214 EOF
4215 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4216 shift
4217 $cat >try.msg <<'EOM'
4218 I've tried to compile and run the following simple program:
4219
4220 EOM
4221 $cat try.c >> try.msg
4222
4223 $cat >> try.msg <<EOM
4224
4225 I used the command:
4226
4227         $*
4228         ./try
4229
4230 and I got the following output:
4231
4232 EOM
4233 dflt=y
4234 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4235         if sh -c './try' >>try.msg 2>&1; then
4236                 xxx=`./try`
4237                 case "$xxx" in
4238                 "Ok") dflt=n ;;
4239                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4240                         case " $libs " in
4241                         *" -lsfio "*)
4242                                 cat >> try.msg <<'EOQS'
4243 If $libs contains -lsfio, and sfio is mis-configured, then it
4244 sometimes (apparently) runs and exits with a 0 status, but with no
4245 output!  It may have to do with sfio's use of _exit vs. exit.
4246
4247 EOQS
4248                                 rp="You have a big problem.  Shall I abort Configure"
4249                                 dflt=y
4250                                 ;;
4251                         esac
4252                         ;;
4253                 esac
4254         else
4255                 echo "The program compiled OK, but exited with status $?." >>try.msg
4256                 rp="You have a problem.  Shall I abort Configure"
4257                 dflt=y
4258         fi
4259 else
4260         echo "I can't compile the test program." >>try.msg
4261         rp="You have a BIG problem.  Shall I abort Configure"
4262         dflt=y
4263 fi
4264 case "$dflt" in
4265 y)
4266         $cat try.msg >&4
4267         case "$knowitall" in
4268         '')
4269                 echo "(The supplied flags or libraries might be incorrect.)"
4270                 ;;
4271         *) dflt=n;;
4272         esac
4273         echo " "
4274         . ./myread
4275         case "$ans" in
4276         n*|N*) ;;
4277         *)      echo "Ok.  Stopping Configure." >&4
4278                 exit 1
4279                 ;;
4280         esac
4281         ;;
4282 n) echo "OK, that should do.";;
4283 esac
4284 $rm -f try try.* core
4285
4286 : determine filename position in cpp output
4287 echo " "
4288 echo "Computing filename position in cpp output for #include directives..." >&4
4289 echo '#include <stdio.h>' > foo.c
4290 $cat >fieldn <<EOF
4291 $startsh
4292 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4293 $grep '^[       ]*#.*stdio\.h' | \
4294 while read cline; do
4295         pos=1
4296         set \$cline
4297         while $test \$# -gt 0; do
4298                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4299                         echo "\$pos"
4300                         exit 0
4301                 fi
4302                 shift
4303                 pos=\`expr \$pos + 1\`
4304         done
4305 done
4306 EOF
4307 chmod +x fieldn
4308 fieldn=`./fieldn`
4309 $rm -f foo.c fieldn
4310 case $fieldn in
4311 '') pos='???';;
4312 1) pos=first;;
4313 2) pos=second;;
4314 3) pos=third;;
4315 *) pos="${fieldn}th";;
4316 esac
4317 echo "Your cpp writes the filename in the $pos field of the line."
4318
4319 : locate header file
4320 $cat >findhdr <<EOF
4321 $startsh
4322 wanted=\$1
4323 name=''
4324 if test -f $usrinc/\$wanted; then
4325         echo "$usrinc/\$wanted"
4326         exit 0
4327 fi
4328 awkprg='{ print \$$fieldn }'
4329 echo "#include <\$wanted>" > foo\$\$.c
4330 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4331 $grep "^[       ]*#.*\$wanted" | \
4332 while read cline; do
4333         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4334         case "\$name" in
4335         */\$wanted) echo "\$name"; exit 0;;
4336         *) name='';;
4337         esac;
4338 done;
4339 $rm -f foo\$\$.c;
4340 case "\$name" in
4341 '') exit 1;;
4342 esac
4343 EOF
4344 chmod +x findhdr
4345
4346 : define an alternate in-header-list? function
4347 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4348 cont=true; xxf="echo \"<\$1> found.\" >&4";
4349 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4350 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4351 esac;
4352 case $# in 4) instead=instead;; *) instead="at last";; esac;
4353 while $test "$cont"; do
4354         xxx=`./findhdr $1`
4355         var=$2; eval "was=\$$2";
4356         if $test "$xxx" && $test -r "$xxx";
4357         then eval $xxf;
4358         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4359                 cont="";
4360         else eval $xxnf;
4361         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4362         set $yyy; shift; shift; yyy=$@;
4363         case $# in 0) cont="";;
4364         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4365                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4366         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4367                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4368         esac;
4369 done;
4370 while $test "$yyy";
4371 do set $yyy; var=$2; eval "was=\$$2";
4372         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4373         set $yyy; shift; shift; yyy=$@;
4374 done'
4375
4376 : see if this is a malloc.h system
4377 set malloc.h i_malloc
4378 eval $inhdr
4379
4380 : see if stdlib is available
4381 set stdlib.h i_stdlib
4382 eval $inhdr
4383
4384 : determine which malloc to compile in
4385 echo " "
4386 case "$usemymalloc" in
4387 ''|[yY]*|true|$define)  dflt='y' ;;
4388 *)      dflt='n' ;;
4389 esac
4390 rp="Do you wish to attempt to use the malloc that comes with $package?"
4391 . ./myread
4392 usemymalloc="$ans"
4393 case "$ans" in
4394 y*|true)
4395         usemymalloc='y'
4396         mallocsrc='malloc.c'
4397         mallocobj="malloc$_o"
4398         d_mymalloc="$define"
4399         case "$libs" in
4400         *-lmalloc*)
4401                 : Remove malloc from list of libraries to use
4402                 echo "Removing unneeded -lmalloc from library list" >&4
4403                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4404                 shift
4405                 libs="$*"
4406                 echo "libs = $libs" >&4
4407                 ;;
4408         esac
4409         ;;
4410 *)
4411         usemymalloc='n'
4412         mallocsrc=''
4413         mallocobj=''
4414         d_mymalloc="$undef"
4415         ;;
4416 esac
4417
4418 : compute the return types of malloc and free
4419 echo " "
4420 $cat >malloc.c <<END
4421 #$i_malloc I_MALLOC
4422 #$i_stdlib I_STDLIB
4423 #include <stdio.h>
4424 #include <sys/types.h>
4425 #ifdef I_MALLOC
4426 #include <malloc.h>
4427 #endif
4428 #ifdef I_STDLIB
4429 #include <stdlib.h>
4430 #endif
4431 #ifdef TRY_MALLOC
4432 void *malloc();
4433 #endif
4434 #ifdef TRY_FREE
4435 void free();
4436 #endif
4437 END
4438 case "$malloctype" in
4439 '')
4440         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4441                 malloctype='void *'
4442         else
4443                 malloctype='char *'
4444         fi
4445         ;;
4446 esac
4447 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4448
4449 case "$freetype" in
4450 '')
4451         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4452                 freetype='void'
4453         else
4454                 freetype='int'
4455         fi
4456         ;;
4457 esac
4458 echo "Your system uses $freetype free(), it would seem." >&4
4459 $rm -f malloc.[co]
4460 : Cruising for prototypes
4461 echo " "
4462 echo "Checking out function prototypes..." >&4
4463 $cat >prototype.c <<'EOCP'
4464 int main(int argc, char *argv[]) {
4465         exit(0);}
4466 EOCP
4467 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4468         echo "Your C compiler appears to support function prototypes."
4469         val="$define"
4470 else
4471         echo "Your C compiler doesn't seem to understand function prototypes."
4472         val="$undef"
4473 fi
4474 set prototype
4475 eval $setvar
4476 $rm -f prototype*
4477
4478 case "$prototype" in
4479 "$define") ;;
4480 *)      ansi2knr='ansi2knr'
4481         echo " "
4482         cat <<EOM >&4
4483
4484 $me:  FATAL ERROR:
4485 This version of $package can only be compiled by a compiler that 
4486 understands function prototypes.  Unfortunately, your C compiler 
4487         $cc $ccflags
4488 doesn't seem to understand them.  Sorry about that.
4489
4490 If GNU cc is available for your system, perhaps you could try that instead.  
4491
4492 Eventually, we hope to support building Perl with pre-ANSI compilers.
4493 If you would like to help in that effort, please contact <perlbug@perl.org>.
4494
4495 Aborting Configure now.
4496 EOM
4497         exit 2
4498         ;;
4499 esac
4500
4501 : determine where public executables go
4502 echo " "
4503 set dflt bin bin
4504 eval $prefixit
4505 fn=d~
4506 rp='Pathname where the public executables will reside?'
4507 . ./getfile
4508 if $test "X$ansexp" != "X$binexp"; then
4509         installbin=''
4510 fi
4511 bin="$ans"
4512 binexp="$ansexp"
4513 if $afs; then
4514         $cat <<EOM
4515
4516 Since you are running AFS, I need to distinguish the directory in which
4517 executables reside from the directory in which they are installed (and from
4518 which they are presumably copied to the former directory by occult means).
4519
4520 EOM
4521         case "$installbin" in
4522         '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4523         *) dflt="$installbin";;
4524         esac
4525         fn=de~
4526         rp='Where will public executables be installed?'
4527         . ./getfile
4528         installbin="$ans"
4529 else
4530         installbin="$binexp"
4531 fi
4532
4533 : determine whether to install perl also as /usr/bin/perl
4534
4535 echo " "
4536 if test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4537         $cat <<EOM
4538 Many scripts expect to perl to be installed as /usr/bin/perl.
4539 I can install the perl you are about to compile also as /usr/bin/perl
4540 (in addition to $installbin/perl).
4541 EOM
4542         case "$installusrbinperl" in
4543         "$undef"|[nN]*) dflt='n';;
4544         *)              dflt='y';;
4545         esac
4546         rp="Do you want to install perl as /usr/bin/perl?"
4547         . ./myread
4548         case "$ans" in
4549         [yY]*)  val="$define";;
4550         *)      val="$undef" ;;
4551         esac
4552 else
4553         val="$undef"
4554 fi
4555 set installusrbinperl
4556 eval $setvar
4557
4558 : define a shorthand compile call
4559 compile='
4560 mc_file=$1;
4561 shift;
4562 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4563 : define a shorthand compile call for compilations that should be ok.
4564 compile_ok='
4565 mc_file=$1;
4566 shift;
4567 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4568
4569 echo " "
4570 echo "Checking for GNU C Library..." >&4
4571 cat >gnulibc.c <<EOM
4572 #include <stdio.h>
4573 int main()
4574 {
4575 #ifdef __GLIBC__
4576     exit(0);
4577 #else
4578     exit(1);
4579 #endif
4580 }
4581 EOM
4582 set gnulibc
4583 if eval $compile_ok && ./gnulibc; then
4584         val="$define"
4585         echo "You are using the GNU C Library"
4586 else
4587         val="$undef"
4588         echo "You are not using the GNU C Library"
4589 fi
4590 $rm -f gnulibc*
4591 set d_gnulibc
4592 eval $setvar
4593
4594 : see if nm is to be used to determine whether a symbol is defined or not
4595 case "$usenm" in
4596 '')
4597         dflt=''
4598         case "$d_gnulibc" in
4599         "$define")
4600                 echo " "
4601                 echo "nm probably won't work on the GNU C Library." >&4
4602                 dflt=n
4603                 ;;
4604         esac
4605         case "$dflt" in
4606         '') 
4607                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4608                         echo " "
4609                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4610                         echo "'nm' won't be sufficient on this sytem." >&4
4611                         dflt=n
4612                 fi
4613                 ;;
4614         esac
4615         case "$dflt" in
4616         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4617                 if $test $dflt -gt 20; then
4618                         dflt=y
4619                 else
4620                         dflt=n
4621                 fi
4622                 ;;
4623         esac
4624         ;;
4625 *)
4626         case "$usenm" in
4627         true|$define) dflt=y;;
4628         *) dflt=n;;
4629         esac
4630         ;;
4631 esac
4632 $cat <<EOM
4633
4634 I can use $nm to extract the symbols from your C libraries. This
4635 is a time consuming task which may generate huge output on the disk (up
4636 to 3 megabytes) but that should make the symbols extraction faster. The
4637 alternative is to skip the 'nm' extraction part and to compile a small
4638 test program instead to determine whether each symbol is present. If
4639 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4640 this may be the best solution.
4641
4642 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4643
4644 EOM
4645 rp="Shall I use $nm to extract C symbols from the libraries?"
4646 . ./myread
4647 case "$ans" in
4648 [Nn]*) usenm=false;;
4649 *) usenm=true;;
4650 esac
4651
4652 runnm=$usenm
4653 case "$reuseval" in
4654 true) runnm=false;;
4655 esac
4656
4657 : nm options which may be necessary
4658 case "$nm_opt" in
4659 '') if $test -f /mach_boot; then
4660                 nm_opt=''       # Mach
4661         elif $test -d /usr/ccs/lib; then
4662                 nm_opt='-p'     # Solaris (and SunOS?)
4663         elif $test -f /dgux; then
4664                 nm_opt='-p'     # DG-UX
4665         elif $test -f /lib64/rld; then
4666                 nm_opt='-p'     # 64-bit Irix
4667         else
4668                 nm_opt=''
4669         fi;;
4670 esac
4671
4672 : nm options which may be necessary for shared libraries but illegal
4673 : for archive libraries.  Thank you, Linux.
4674 case "$nm_so_opt" in
4675 '')     case "$myuname" in
4676         *linux*)
4677                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4678                         nm_so_opt='--dynamic'
4679                 fi
4680                 ;;
4681         esac
4682         ;;
4683 esac
4684
4685 case "$runnm" in
4686 true)
4687 : get list of predefined functions in a handy place
4688 echo " "
4689 case "$libc" in
4690 '') libc=unknown
4691         case "$libs" in
4692         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4693         esac
4694         ;;
4695 esac
4696 libnames='';
4697 case "$libs" in
4698 '') ;;
4699 *)  for thislib in $libs; do
4700         case "$thislib" in
4701         -lc|-lc_s)
4702                 : Handle C library specially below.
4703                 ;;
4704         -l*)
4705                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4706                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4707                         :
4708                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4709                         :
4710                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4711                         :
4712                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4713                         :
4714                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4715                         :
4716                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4717                         :
4718                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4719                         :
4720                 else
4721                         try=''
4722                 fi
4723                 libnames="$libnames $try"
4724                 ;;
4725         *) libnames="$libnames $thislib" ;;
4726         esac
4727         done
4728         ;;
4729 esac
4730 xxx=normal
4731 case "$libc" in
4732 unknown)
4733         set /lib/libc.$so
4734         for xxx in $libpth; do
4735                 $test -r $1 || set $xxx/libc.$so
4736                 : The messy sed command sorts on library version numbers.
4737                 $test -r $1 || \
4738                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4739                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4740                                 h
4741                                 s/[0-9][0-9]*/0000&/g
4742                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4743                                 G
4744                                 s/\n/ /' | \
4745                          sort | $sed -e 's/^.* //'`
4746                 eval set \$$#
4747         done
4748         $test -r $1 || set /usr/ccs/lib/libc.$so
4749         $test -r $1 || set /lib/libsys_s$_a
4750         ;;
4751 *)
4752         set blurfl
4753         ;;
4754 esac
4755 if $test -r "$1"; then
4756         echo "Your (shared) C library seems to be in $1."
4757         libc="$1"
4758 elif $test -r /lib/libc && $test -r /lib/clib; then
4759         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4760         xxx=apollo
4761         libc='/lib/clib /lib/libc'
4762         if $test -r /lib/syslib; then
4763                 echo "(Your math library is in /lib/syslib.)"
4764                 libc="$libc /lib/syslib"
4765         fi
4766 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4767         echo "Your C library seems to be in $libc, as you said before."
4768 elif $test -r $incpath/usr/lib/libc$_a; then
4769         libc=$incpath/usr/lib/libc$_a;
4770         echo "Your C library seems to be in $libc.  That's fine."
4771 elif $test -r /lib/libc$_a; then
4772         libc=/lib/libc$_a;
4773         echo "Your C library seems to be in $libc.  You're normal."
4774 else
4775         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4776                 :
4777         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4778                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4779         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4780                 :
4781         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4782                 :
4783         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4784                 :
4785         else
4786                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4787         fi
4788         if $test -r "$tans"; then
4789                 echo "Your C library seems to be in $tans, of all places."
4790                 libc=$tans
4791         else
4792                 libc='blurfl'
4793         fi
4794 fi
4795 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4796         dflt="$libc"
4797         cat <<EOM
4798
4799 If the guess above is wrong (which it might be if you're using a strange
4800 compiler, or your machine supports multiple models), you can override it here.
4801
4802 EOM
4803 else
4804         dflt=''
4805         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
4806         cat >&4 <<EOM
4807 I can't seem to find your C library.  I've looked in the following places:
4808
4809 EOM
4810         $sed 's/^/      /' libpath
4811         cat <<EOM
4812
4813 None of these seems to contain your C library. I need to get its name...
4814
4815 EOM
4816 fi
4817 fn=f
4818 rp='Where is your C library?'
4819 . ./getfile
4820 libc="$ans"
4821
4822 echo " "
4823 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
4824 set X `cat libnames`
4825 shift
4826 xxx=files
4827 case $# in 1) xxx=file; esac
4828 echo "Extracting names from the following $xxx for later perusal:" >&4
4829 echo " "
4830 $sed 's/^/      /' libnames >&4
4831 echo " "
4832 $echo $n "This may take a while...$c" >&4
4833
4834 for file in $*; do
4835         case $file in
4836         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4837         *) $nm $nm_opt $file 2>/dev/null;;
4838         esac
4839 done >libc.tmp
4840
4841 $echo $n ".$c"
4842 $grep fprintf libc.tmp > libc.ptf
4843 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4844 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4845 xxx='[ADTSIW]'
4846 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4847         eval $xscan;\
4848         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4849                 eval $xrun
4850 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4851         eval $xscan;\
4852         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4853                 eval $xrun
4854 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4855         eval $xscan;\
4856         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4857                 eval $xrun
4858 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4859         eval $xscan;\
4860         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4861                 eval $xrun
4862 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4863         eval $xscan;\
4864         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4865                 eval $xrun
4866 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4867         eval $xscan;\
4868         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4869                 eval $xrun
4870 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4871                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4872         eval $xscan;\
4873         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4874                 eval $xrun
4875 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4876         eval $xscan;\
4877         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4878                 eval $xrun
4879 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4880         eval $xscan;\
4881         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4882                 eval $xrun
4883 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4884         eval $xscan;\
4885         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4886                 eval $xrun
4887 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4888         eval $xscan;\
4889         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4890                 eval $xrun
4891 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4892         eval $xscan;\
4893         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4894                 eval $xrun
4895 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4896         eval $xscan;\
4897         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4898                 eval $xrun
4899 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4900         eval $xscan;\
4901         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4902                 eval $xrun
4903 else
4904         $nm -p $* 2>/dev/null >libc.tmp
4905         $grep fprintf libc.tmp > libc.ptf
4906         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4907                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4908         then
4909                 nm_opt='-p'
4910                 eval $xrun
4911         else
4912                 echo " "
4913                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4914                 com=''
4915                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4916                         for thisname in $libnames $libc; do
4917                                 $ar t $thisname >>libc.tmp
4918                         done
4919                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4920                         echo "Ok." >&4
4921                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4922                         # Repeat libc to extract forwarders to DLL entries too
4923                         for thisname in $libnames $libc; do
4924                                 $ar tv $thisname >>libc.tmp
4925                                 # Revision 50 of EMX has bug in $ar.
4926                                 # it will not extract forwarders to DLL entries
4927                                 # Use emximp which will extract exactly them.
4928                                 emximp -o tmp.imp $thisname \
4929                                     2>/dev/null && \
4930                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4931                                     < tmp.imp >>libc.tmp
4932                                 $rm tmp.imp
4933                         done
4934                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4935                         echo "Ok." >&4
4936                 else
4937                         echo "$ar didn't seem to work right." >&4
4938                         echo "Maybe this is a Cray...trying bld instead..." >&4
4939                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4940                         then
4941                                 for thisname in $libnames; do
4942                                         bld t $libnames | \
4943                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4944                                         $ar t $thisname >>libc.tmp
4945                                 done
4946                                 echo "Ok." >&4
4947                         else
4948                                 echo "That didn't work either.  Giving up." >&4
4949                                 exit 1
4950                         fi
4951                 fi
4952         fi
4953 fi
4954 nm_extract="$com"
4955 if $test -f /lib/syscalls.exp; then
4956         echo " "
4957         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4958         $sed -n 's/^\([^        ]*\)[   ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
4959 fi
4960 ;;
4961 esac
4962 $rm -f libnames libpath
4963
4964 : see if dld is available
4965 set dld.h i_dld
4966 eval $inhdr
4967
4968 : is a C symbol defined?
4969 csym='tlook=$1;
4970 case "$3" in
4971 -v) tf=libc.tmp; tc=""; tdc="";;
4972 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4973 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4974 esac;
4975 tx=yes;
4976 case "$reuseval-$4" in
4977 true-) ;;
4978 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4979 esac;
4980 case "$tx" in
4981 yes)
4982         case "$runnm" in
4983         true)
4984                 if $contains $tlook $tf >/dev/null 2>&1;
4985                 then tval=true;
4986                 else tval=false;
4987                 fi;;
4988         *)
4989                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4990                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
4991                 then tval=true;
4992                 else tval=false;
4993                 fi;
4994                 $rm -f t t.c;;
4995         esac;;
4996 *)
4997         case "$tval" in
4998         $define) tval=true;;
4999         *) tval=false;;
5000         esac;;
5001 esac;
5002 eval "$2=$tval"'
5003
5004 : define an is-in-libc? function
5005 inlibc='echo " "; td=$define; tu=$undef;
5006 sym=$1; var=$2; eval "was=\$$2";
5007 tx=yes;
5008 case "$reuseval$was" in
5009 true) ;;
5010 true*) tx=no;;
5011 esac;
5012 case "$tx" in
5013 yes)
5014         set $sym tres -f;
5015         eval $csym;
5016         case "$tres" in
5017         true)
5018                 echo "$sym() found." >&4;
5019                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5020         *)
5021                 echo "$sym() NOT found." >&4;
5022                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5023         esac;;
5024 *)
5025         case "$was" in
5026         $define) echo "$sym() found." >&4;;
5027         *) echo "$sym() NOT found." >&4;;
5028         esac;;
5029 esac'
5030
5031 : see if dlopen exists
5032 xxx_runnm="$runnm"
5033 runnm=false
5034 set dlopen d_dlopen
5035 eval $inlibc
5036 runnm="$xxx_runnm"
5037
5038 : determine which dynamic loading, if any, to compile in
5039 echo " "
5040 dldir="ext/DynaLoader"
5041 case "$usedl" in
5042 $define|y|true)
5043         dflt='y'
5044         usedl="$define"
5045         ;;
5046 $undef|n|false)
5047         dflt='n'
5048         usedl="$undef"
5049         ;;
5050 *) 
5051         dflt='n'
5052         case "$d_dlopen" in
5053             $define) dflt='y' ;;
5054         esac
5055         case "$i_dld" in
5056             $define) dflt='y' ;;
5057         esac
5058         : Does a dl_xxx.xs file exist for this operating system
5059         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5060         ;;
5061 esac
5062 rp="Do you wish to use dynamic loading?"
5063 . ./myread
5064 usedl="$ans"
5065 case "$ans" in
5066 y*) usedl="$define"
5067         case "$dlsrc" in
5068         '')
5069                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5070                         dflt="$dldir/dl_${osname}.xs"
5071                 elif $test "$d_dlopen" = "$define" ; then
5072                         dflt="$dldir/dl_dlopen.xs"
5073                 elif $test "$i_dld" = "$define" ; then
5074                         dflt="$dldir/dl_dld.xs"
5075                 else
5076                         dflt=''
5077                 fi
5078                 ;;
5079         *)      dflt="$dldir/$dlsrc"
5080                 ;;
5081         esac
5082     echo "The following dynamic loading files are available:"
5083         : Can not go over to $dldir because getfile has path hard-coded in.
5084         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5085         rp="Source file to use for dynamic loading"
5086         fn="fne"
5087         # XXX This getfile call will fail the existence check if you try 
5088         # building away from $src (this is not supported yet).
5089         . ./getfile
5090         usedl="$define"
5091         : emulate basename
5092         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5093
5094         $cat << EOM
5095
5096 Some systems may require passing special flags to $cc -c to
5097 compile modules that will be used to create a shared library.
5098 To use no flags, say "none".
5099
5100 EOM
5101     case "$cccdlflags" in
5102     '') case "$gccversion" in
5103                 '') case "$osname" in
5104                         hpux)   dflt='+z' ;;
5105                         next)   dflt='none' ;;
5106                         irix*)  dflt='-KPIC' ;;
5107                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5108                         sunos)  dflt='-pic' ;;
5109                         *)      dflt='none' ;;
5110                     esac
5111                         ;;
5112                 *)  case "$osname" in
5113                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5114                         *)      dflt='-fpic' ;;
5115                     esac ;;
5116             esac ;;
5117         ' ') dflt='none' ;;
5118     *)  dflt="$cccdlflags" ;;
5119     esac
5120     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5121     . ./myread
5122     case "$ans" in
5123     none) cccdlflags=' ' ;;
5124     *) cccdlflags="$ans" ;;
5125     esac
5126
5127     cat << EOM
5128
5129 Some systems use ld to create libraries that can be dynamically loaded,
5130 while other systems (such as those using ELF) use $cc.
5131
5132 EOM
5133         case "$ld" in
5134         '')     $cat >try.c <<'EOM'
5135 /* Test for whether ELF binaries are produced */
5136 #include <fcntl.h>
5137 #include <stdlib.h>
5138 int main() {
5139         char b[4];
5140         int i = open("a.out",O_RDONLY);
5141         if(i == -1) 
5142                 exit(1); /* fail */
5143         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5144                 exit(0); /* succeed (yes, it's ELF) */
5145         else
5146                 exit(1); /* fail */
5147 }
5148 EOM
5149                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5150                         cat <<EOM
5151 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5152 EOM
5153                         dflt="$cc"
5154                 else
5155                         echo "I'll use ld to build dynamic libraries."
5156                         dflt='ld'
5157                 fi
5158                 rm -f try.c a.out
5159                 ;;
5160         *)      dflt="$ld"
5161                 ;;
5162         esac
5163
5164     rp="What command should be used to create dynamic libraries?"
5165     . ./myread
5166         ld="$ans"
5167
5168     cat << EOM
5169
5170 Some systems may require passing special flags to $ld to create a
5171 library that can be dynamically loaded.  If your ld flags include
5172 -L/other/path options to locate libraries outside your loader's normal
5173 search path, you may need to specify those -L options here as well.  To
5174 use no flags, say "none".
5175
5176 EOM
5177     case "$lddlflags" in
5178     '') case "$osname" in
5179                         beos) dflt='-nostart' ;;
5180                         hpux)  dflt='-b' ;;
5181                         linux|irix*)    dflt='-shared' ;;
5182                         next)  dflt='none' ;;
5183                         solaris) dflt='-G' ;;
5184                         sunos) dflt='-assert nodefinitions' ;;
5185                         svr4*|esix*) dflt="-G $ldflags" ;;
5186                 *)     dflt='none' ;;
5187                         esac
5188                         ;;
5189     *) dflt="$lddlflags" ;;
5190     esac
5191
5192         : Try to guess additional flags to pick up local libraries.
5193         : Be careful not to append to a plain 'none'
5194         case "$dflt" in
5195         none) dflt='' ;;
5196         esac
5197         for thisflag in $ldflags; do
5198                 case "$thisflag" in
5199                 -L*)
5200                         case " $dflt " in
5201                         *" $thisflag "*) ;;
5202                         *) dflt="$dflt $thisflag" ;;
5203                         esac
5204                         ;;
5205                 esac
5206         done
5207
5208         case "$dflt" in
5209         ''|' ') dflt='none' ;;
5210         esac
5211
5212     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5213     . ./myread
5214     case "$ans" in
5215     none) lddlflags=' ' ;;
5216     *) lddlflags="$ans" ;;
5217     esac
5218
5219         cat <<EOM
5220
5221 Some systems may require passing special flags to $cc to indicate that
5222 the resulting executable will use dynamic linking.  To use no flags,
5223 say "none".
5224
5225 EOM
5226     case "$ccdlflags" in
5227     '') case "$osname" in
5228                 hpux)   dflt='-Wl,-E' ;;
5229                 linux)  dflt='-rdynamic' ;;
5230                 next)   dflt='none' ;;
5231                 sunos)  dflt='none' ;;
5232                 *)      dflt='none' ;;
5233             esac ;;
5234     ' ')  dflt='none' ;;
5235     *)  dflt="$ccdlflags" ;;
5236     esac
5237     rp="Any special flags to pass to $cc to use dynamic loading?"
5238     . ./myread
5239     case "$ans" in
5240     none) ccdlflags=' ' ;;
5241     *) ccdlflags="$ans" ;;
5242     esac
5243     ;;
5244 *)  usedl="$undef"
5245         ld='ld'
5246     dlsrc='dl_none.xs'
5247     lddlflags=''
5248     ccdlflags=''
5249     ;;
5250 esac
5251
5252 also=''
5253 case "$usedl" in
5254 $undef)
5255         # No dynamic loading being used, so don't bother even to prompt.
5256         useshrplib='false'
5257         ;;
5258 *)      case "$useshrplib" in
5259         '')     case "$osname" in
5260                 svr4*|dgux|dynixptx|esix|powerux|beos)
5261                         dflt=y
5262                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5263                         ;;
5264                 next*)
5265                         case "$osvers" in
5266                         4*)     dflt=y
5267                                 also='Building a shared libperl is needed for MAB support.'
5268                                 ;;
5269                         *)      dflt=n
5270                                 ;;
5271                         esac
5272                         ;;
5273                 *)      dflt=n
5274                         ;;
5275                 esac
5276                 ;;
5277         $define|true|[Yy]*)
5278                 dflt=y
5279                 ;;
5280         *)      dflt=n
5281                 ;;
5282         esac
5283         $cat << EOM
5284
5285 The perl executable is normally obtained by linking perlmain.c with
5286 libperl${_a}, any static extensions (usually just DynaLoader), and
5287 any other libraries needed on this system (such as -lm, etc.).  Since
5288 your system supports dynamic loading, it is probably possible to build
5289 a shared libperl.$so.  If you will have more than one executable linked
5290 to libperl.$so, this will significantly reduce the size of each
5291 executable, but it may have a noticeable affect on performance.  The
5292 default is probably sensible for your system.
5293 $also
5294
5295 EOM
5296         rp="Build a shared libperl.$so (y/n)"
5297         . ./myread
5298         case "$ans" in
5299         true|$define|[Yy]*)
5300                 useshrplib='true'
5301                 # Why does next4 have to be so different?
5302                 case "${osname}${osvers}" in
5303                 next4*) xxx='DYLD_LIBRARY_PATH' ;;
5304                 os2*)   xxx='' ;; # Nothing special needed.
5305                 beos*)  xxx='' ;;
5306                 *)              xxx='LD_LIBRARY_PATH' ;;
5307                 esac
5308                 if test X"$xxx" != "X"; then
5309                         $cat <<EOM  | $tee -a ../config.msg >&4
5310
5311 To build perl, you must add the current working directory to your
5312 $xxx environment variable before running make.  You can do
5313 this with
5314    $xxx=\`pwd\`:\$$xxx; export $xxx
5315 for Bourne-style shells, or
5316    setenv $xxx \`pwd\`
5317 for Csh-style shells.  You *MUST* do this before running make.
5318
5319 EOM
5320                 fi
5321                 ;;
5322         *)      useshrplib='false' ;;
5323         esac
5324         ;;
5325 esac
5326
5327 case "$useshrplib" in
5328 true)
5329         case "$libperl" in
5330         '')
5331                 # Figure out a good name for libperl.so.  Since it gets stored in
5332                 # a version-specific architecture-dependent library, the version
5333                 # number isn't really that important, except for making cc/ld happy.
5334                 #
5335                 # A name such as libperl.so.3.1
5336                 majmin="libperl.$so.$patchlevel.$subversion"
5337                 # A name such as libperl.so.301
5338                 majonly=`echo $patchlevel $subversion |
5339                         $awk '{printf "%d%02d", $1, $2}'`
5340                 majonly=libperl.$so.$majonly
5341                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5342                 # rely on figuring it out from the naming of libc.
5343                 case "${osname}${osvers}" in
5344                 next4*)
5345                         dflt=libperl.5.$so
5346                         # XXX How handle the --version stuff for MAB?
5347                         ;;
5348                 linux*)  # ld won't link with a bare -lperl otherwise.
5349                         dflt=libperl.$so
5350                         ;;
5351                 *)      # Try to guess based on whether libc has major.minor.
5352                         case "$libc" in
5353                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5354                         *libc.$so.[0-9]*) dflt=$majonly ;;
5355                         *)      dflt=libperl.$so ;;
5356                         esac
5357                         ;;
5358                 esac
5359                 ;;
5360         *)      dflt=$libperl
5361                 ;;
5362         esac
5363         cat << EOM
5364
5365 I need to select a good name for the shared libperl.  If your system uses
5366 library names with major and minor numbers, then you might want something
5367 like $majmin.  Alternatively, if your system uses a single version
5368 number for shared libraries, then you might want to use $majonly.
5369 Or, your system might be quite happy with a simple libperl.$so.
5370
5371 Since the shared libperl will get installed into a version-specific
5372 architecture-dependent directory, the version number of the shared perl
5373 library probably isn't important, so the default should be o.k.
5374
5375 EOM
5376         rp='What name do you want to give to the shared libperl?'
5377         . ./myread
5378         libperl=$ans
5379         echo "Ok, I'll use $libperl"
5380         ;;
5381 *)
5382         libperl="libperl${_a}"
5383         ;;
5384 esac
5385
5386 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5387 case "$shrpdir" in
5388 '') ;;
5389 *)      $cat >&4 <<EOM
5390 WARNING:  Use of the shrpdir variable for the installation location of
5391 the shared $libperl is not supported.  It was never documented and
5392 will not work in this version.  Let me (perlbug@perl.com)
5393 know of any problems this may cause.
5394
5395 EOM
5396         case "$shrpdir" in
5397         "$archlibexp/CORE")
5398                 $cat >&4 <<EOM
5399 But your current setting of $shrpdir is
5400 the default anyway, so it's harmless.
5401 EOM
5402                 ;;
5403         *)
5404                 $cat >&4 <<EOM
5405 Further, your current attempted setting of $shrpdir
5406 conflicts with the value of $archlibexp/CORE
5407 that installperl will use.
5408 EOM
5409                 ;;
5410         esac
5411         ;;
5412 esac
5413
5414 # How will the perl executable find the installed shared $libperl?
5415 # Add $xxx to ccdlflags.
5416 # If we can't figure out a command-line option, use $shrpenv to
5417 # set env LD_RUN_PATH.  The main perl makefile uses this.
5418 shrpdir=$archlibexp/CORE
5419 xxx=''
5420 tmp_shrpenv=''
5421 if "$useshrplib"; then
5422     case "$osname" in 
5423         aix)
5424                 # We'll set it in Makefile.SH...
5425                 ;;
5426         solaris|netbsd)
5427                 xxx="-R $shrpdir"
5428                 ;;
5429         freebsd)
5430                 xxx="-Wl,-R$shrpdir"
5431                 ;;
5432         linux|irix*|dec_osf)
5433                 xxx="-Wl,-rpath,$shrpdir"
5434                 ;;
5435         next)
5436                 # next doesn't like the default...
5437                 ;;
5438         beos)
5439                 # beos doesn't like the default, either.
5440                 ;;
5441         *)
5442                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5443                 ;;
5444         esac
5445         case "$xxx" in
5446         '') ;;
5447         *)      
5448                 # Only add $xxx if it isn't already in ccdlflags.
5449                 case " $ccdlflags " in
5450                 *" $xxx "*)     ;;
5451                 *)      ccdlflags="$ccdlflags $xxx"
5452                         cat <<EOM >&4
5453
5454 Adding $xxx to the flags
5455 passed to $ld so that the perl executable will find the 
5456 installed shared $libperl.
5457
5458 EOM
5459                         ;;
5460                 esac
5461                 ;;
5462         esac
5463 fi
5464 # Respect a hint or command-line value.
5465 case "$shrpenv" in
5466 '') shrpenv="$tmp_shrpenv" ;;
5467 esac
5468
5469 : determine where manual pages go
5470 set man1dir man1dir none
5471 eval $prefixit
5472 $cat <<EOM
5473
5474 $spackage has manual pages available in source form.
5475 EOM
5476 case "$nroff" in
5477 nroff)
5478         echo "However, you don't have nroff, so they're probably useless to you."
5479         case "$man1dir" in
5480         '') man1dir="none";;
5481         esac;;
5482 esac
5483 echo "If you don't want the manual sources installed, answer 'none'."
5484 case "$man1dir" in
5485 ' ') dflt=none
5486         ;;
5487 '')
5488         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5489         lookpath="$lookpath $prefixexp/man/p_man/man1"
5490         lookpath="$lookpath $prefixexp/man/u_man/man1"
5491         lookpath="$lookpath $prefixexp/man/man.1"
5492         case "$sysman" in
5493         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5494         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5495         esac
5496         set dflt
5497         eval $prefixup
5498         ;;
5499 *)  dflt="$man1dir"
5500         ;;
5501 esac
5502 echo " "
5503 fn=dn+~
5504 rp="Where do the main $spackage manual pages (source) go?"
5505 . ./getfile
5506 if $test "X$man1direxp" != "X$ansexp"; then
5507         installman1dir=''
5508 fi
5509 man1dir="$ans"
5510 man1direxp="$ansexp"
5511 case "$man1dir" in
5512 '') man1dir=' '
5513         installman1dir='';;
5514 esac
5515 if $afs; then
5516         $cat <<EOM
5517
5518 Since you are running AFS, I need to distinguish the directory in which
5519 manual pages reside from the directory in which they are installed (and from
5520 which they are presumably copied to the former directory by occult means).
5521
5522 EOM
5523         case "$installman1dir" in
5524         '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
5525         *) dflt="$installman1dir";;
5526         esac
5527         fn=de~
5528         rp='Where will man pages be installed?'
5529         . ./getfile
5530         installman1dir="$ans"
5531 else
5532         installman1dir="$man1direxp"
5533 fi
5534
5535 : What suffix to use on installed man pages
5536
5537 case "$man1dir" in
5538 ' ')
5539         man1ext='0'
5540         ;;
5541 *)
5542         rp="What suffix should be used for the main $spackage man pages?"
5543         case "$man1ext" in
5544         '')     case "$man1dir" in
5545                 *1)  dflt=1 ;;
5546                 *1p) dflt=1p ;;
5547                 *1pm) dflt=1pm ;;
5548                 *l) dflt=l;;
5549                 *n) dflt=n;;
5550                 *o) dflt=o;;
5551                 *p) dflt=p;;
5552                 *C) dflt=C;;
5553                 *L) dflt=L;;
5554                 *L1) dflt=L1;;
5555                 *) dflt=1;;
5556                 esac
5557                 ;;
5558         *)      dflt="$man1ext";;
5559         esac
5560         . ./myread
5561         man1ext="$ans"
5562         ;;
5563 esac
5564
5565 : see if we can have long filenames
5566 echo " "
5567 rmlist="$rmlist /tmp/cf$$"
5568 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5569 first=123456789abcdef
5570 second=/tmp/cf$$/$first
5571 $rm -f $first $second
5572 if (echo hi >$first) 2>/dev/null; then
5573         if $test -f 123456789abcde; then
5574                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5575                 val="$undef"
5576         else
5577                 if (echo hi >$second) 2>/dev/null; then
5578                         if $test -f /tmp/cf$$/123456789abcde; then
5579                                 $cat <<'EOM'
5580 That's peculiar... You can have filenames longer than 14 characters, but only
5581 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5582 I shall consider your system cannot support long filenames at all.
5583 EOM
5584                                 val="$undef"
5585                         else
5586                                 echo 'You can have filenames longer than 14 characters.' >&4
5587                                 val="$define"
5588                         fi
5589                 else
5590                         $cat <<'EOM'
5591 How confusing! Some of your filesystems are sane enough to allow filenames
5592 longer than 14 characters but some others like /tmp can't even think about them.
5593 So, for now on, I shall assume your kernel does not allow them at all.
5594 EOM
5595                         val="$undef"
5596                 fi
5597         fi
5598 else
5599         $cat <<'EOM'
5600 You can't have filenames longer than 14 chars.  You can't even think about them!
5601 EOM
5602         val="$undef"
5603 fi 
5604 set d_flexfnam
5605 eval $setvar
5606 $rm -rf /tmp/cf$$ 123456789abcde*
5607
5608 : determine where library module manual pages go
5609 set man3dir man3dir none
5610 eval $prefixit
5611 $cat <<EOM
5612
5613 $spackage has manual pages for many of the library modules.
5614 EOM
5615
5616 case "$nroff" in
5617 nroff)
5618         $cat <<'EOM'
5619 However, you don't have nroff, so they're probably useless to you.
5620 EOM
5621         case "$man3dir" in
5622         '') man3dir="none";;
5623         esac;;
5624 esac
5625
5626 case "$d_flexfnam" in
5627 undef)
5628         $cat <<'EOM'
5629 However, your system can't handle the long file names like File::Basename.3. 
5630 EOM
5631         case "$man3dir" in
5632         '') man3dir="none";;
5633         esac;;
5634 esac
5635
5636 echo "If you don't want the manual sources installed, answer 'none'."
5637 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5638 case "$man3dir" in
5639 '')     case "$prefix" in 
5640         *$prog*) dflt=`echo $man1dir | 
5641                         $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
5642         *)      dflt="$privlib/man/man3" ;;
5643         esac
5644         ;;
5645 ' ') dflt=none;;
5646 *)      dflt="$man3dir" ;;
5647 esac
5648 echo " "
5649
5650 fn=dn+~
5651 rp="Where do the $package library man pages (source) go?"
5652 . ./getfile
5653 if test "X$man3direxp" != "X$ansexp"; then
5654         installman3dir=''
5655 fi
5656
5657 man3dir="$ans"
5658 man3direxp="$ansexp"
5659 case "$man3dir" in
5660 '') man3dir=' '
5661         installman3dir='';;
5662 esac
5663 if $afs; then
5664         $cat <<EOM
5665
5666 Since you are running AFS, I need to distinguish the directory in which
5667 manual pages reside from the directory in which they are installed (and from
5668 which they are presumably copied to the former directory by occult means).
5669
5670 EOM
5671         case "$installman3dir" in
5672         '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
5673         *) dflt="$installman3dir";;
5674         esac
5675         fn=de~
5676         rp='Where will man pages be installed?'
5677         . ./getfile
5678         installman3dir="$ans"
5679 else
5680         installman3dir="$man3direxp"
5681 fi
5682
5683 : What suffix to use on installed man pages
5684
5685 case "$man3dir" in
5686 ' ')
5687         man3ext='0'
5688         ;;
5689 *)
5690         rp="What suffix should be used for the $package library man pages?"
5691         case "$man3ext" in
5692         '')     case "$man3dir" in
5693                 *3)  dflt=3 ;;
5694                 *3p) dflt=3p ;;
5695                 *3pm) dflt=3pm ;;
5696                 *l) dflt=l;;
5697                 *n) dflt=n;;
5698                 *o) dflt=o;;
5699                 *p) dflt=p;;
5700                 *C) dflt=C;;
5701                 *L) dflt=L;;
5702                 *L3) dflt=L3;;
5703                 *) dflt=3;;
5704                 esac
5705                 ;;
5706         *)      dflt="$man3ext";;
5707         esac
5708         . ./myread
5709         man3ext="$ans"
5710         ;;
5711 esac
5712
5713 : see if we have to deal with yellow pages, now NIS.
5714 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5715         if $test -f /usr/etc/nibindd; then
5716                 echo " "
5717                 echo "I'm fairly confident you're on a NeXT."
5718                 echo " "
5719                 rp='Do you get the hosts file via NetInfo?'
5720                 dflt=y
5721                 case "$hostcat" in
5722                 nidump*) ;;
5723                 '') ;;
5724                 *) dflt=n;;
5725                 esac
5726                 . ./myread
5727                 case "$ans" in
5728                 y*) hostcat='nidump hosts .';;
5729                 *)      case "$hostcat" in
5730                         nidump*) hostcat='';;
5731                         esac
5732                         ;;
5733                 esac
5734         fi
5735         case "$hostcat" in
5736         nidump*) ;;
5737         *)
5738                 case "$hostcat" in
5739                 *ypcat*) dflt=y;;
5740                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5741                                 dflt=y
5742                         else
5743                                 dflt=n
5744                         fi;;
5745                 *) dflt=n;;
5746                 esac
5747                 echo " "
5748                 rp='Are you getting the hosts file via yellow pages?'
5749                 . ./myread
5750                 case "$ans" in
5751                 y*) hostcat='ypcat hosts';;
5752                 *) hostcat='cat /etc/hosts';;
5753                 esac
5754                 ;;
5755         esac
5756 fi
5757 case "$hostcat" in
5758 '') hostcat='cat /etc/hosts';;
5759 esac
5760 case "$groupcat" in
5761 '') groupcat='cat /etc/group';;
5762 esac
5763 case "$passcat" in
5764 '') passcat='cat /etc/passwd';;
5765 esac
5766
5767 : now get the host name
5768 echo " "
5769 echo "Figuring out host name..." >&4
5770 case "$myhostname" in
5771 '') cont=true
5772         echo 'Maybe "hostname" will work...'
5773         if tans=`sh -c hostname 2>&1` ; then
5774                 myhostname=$tans
5775                 phostname=hostname
5776                 cont=''
5777         fi
5778         ;;
5779 *) cont='';;
5780 esac
5781 if $test "$cont"; then
5782         if ./xenix; then
5783                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
5784                 if tans=`cat /etc/systemid 2>&1` ; then
5785                         myhostname=$tans
5786                         phostname='cat /etc/systemid'
5787                         echo "Whadyaknow.  Xenix always was a bit strange..."
5788                         cont=''
5789                 fi
5790         elif $test -r /etc/systemid; then
5791                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5792         fi
5793 fi
5794 if $test "$cont"; then
5795         echo 'No, maybe "uuname -l" will work...'
5796         if tans=`sh -c 'uuname -l' 2>&1` ; then
5797                 myhostname=$tans
5798                 phostname='uuname -l'
5799         else
5800                 echo 'Strange.  Maybe "uname -n" will work...'
5801                 if tans=`sh -c 'uname -n' 2>&1` ; then
5802                         myhostname=$tans
5803                         phostname='uname -n'
5804                 else
5805                         echo 'Oh well, maybe I can mine it out of whoami.h...'
5806                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
5807                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
5808                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
5809                         else
5810                                 case "$myhostname" in
5811                                 '') echo "Does this machine have an identity crisis or something?"
5812                                         phostname='';;
5813                                 *)
5814                                         echo "Well, you said $myhostname before..."
5815                                         phostname='echo $myhostname';;
5816                                 esac
5817                         fi
5818                 fi
5819         fi
5820 fi
5821 : you do not want to know about this
5822 set $myhostname
5823 myhostname=$1
5824
5825 : verify guess
5826 if $test "$myhostname" ; then
5827         dflt=y
5828         rp='Your host name appears to be "'$myhostname'".'" Right?"
5829         . ./myread
5830         case "$ans" in
5831         y*) ;;
5832         *) myhostname='';;
5833         esac
5834 fi
5835
5836 : bad guess or no guess
5837 while $test "X$myhostname" = X ; do
5838         dflt=''
5839         rp="Please type the (one word) name of your host:"
5840         . ./myread
5841         myhostname="$ans"
5842 done
5843
5844 : translate upper to lower if necessary
5845 case "$myhostname" in
5846 *[A-Z]*)
5847         echo "(Normalizing case in your host name)"
5848         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
5849         ;;
5850 esac
5851
5852 case "$myhostname" in
5853 *.*)
5854         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
5855         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
5856         echo "(Trimming domain name from host name--host name is now $myhostname)"
5857         ;;
5858 *) case "$mydomain" in
5859         '')
5860                 {
5861                         test "X$hostcat" = "Xypcat hosts" &&
5862                         ypmatch "$myhostname" hosts 2>/dev/null |\
5863                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
5864                         $test -s hosts
5865                 } || {
5866                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
5867                                         /[       ]$myhostname[  . ]/p" > hosts
5868                 }
5869                 tmp_re="[       . ]"
5870                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
5871                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
5872                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
5873                         hosts | $sort | $uniq | \
5874                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
5875                 case `$echo X$dflt` in
5876                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
5877                         dflt=.
5878                         ;;
5879                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
5880                         ;;
5881                 esac
5882                 case "$dflt" in
5883                 .)
5884                         tans=`./loc resolv.conf X /etc /usr/etc`
5885                         if $test -f "$tans"; then
5886                                 echo "(Attempting domain name extraction from $tans)"
5887                                 dflt=.`$sed -n -e 's/   / /g' \
5888                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
5889                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
5890                                 case "$dflt" in
5891                                 .) dflt=.`$sed -n -e 's/        / /g' \
5892                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
5893                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
5894                                         ;;
5895                                 esac
5896                         fi
5897                         ;;
5898                 esac
5899                 case "$dflt" in
5900                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
5901                         dflt=.`sh -c domainname 2>/dev/null`
5902                         case "$dflt" in
5903                         '') dflt='.';;
5904                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
5905                         esac
5906                         ;;
5907                 esac
5908                 case "$dflt" in
5909                 .) echo "(Lost all hope -- silly guess then)"
5910                         dflt='.uucp'
5911                         ;;
5912                 esac
5913                 $rm -f hosts
5914                 ;;
5915         *) dflt="$mydomain";;
5916         esac;;
5917 esac
5918 echo " "
5919 rp="What is your domain name?"
5920 . ./myread
5921 tans="$ans"
5922 case "$ans" in
5923 '') ;;
5924 .*) ;;
5925 *) tans=".$tans";;
5926 esac
5927 mydomain="$tans"
5928
5929 : translate upper to lower if necessary
5930 case "$mydomain" in
5931 *[A-Z]*)
5932         echo "(Normalizing case in your domain name)"
5933         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
5934         ;;
5935 esac
5936
5937 : a little sanity check here
5938 case "$phostname" in
5939 '') ;;
5940 *)
5941         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
5942         $myhostname$mydomain|$myhostname) ;;
5943         *)
5944                 case "$phostname" in
5945                 sed*)
5946                         echo "(That doesn't agree with your whoami.h file, by the way.)"
5947                         ;;
5948                 *)
5949                         echo "(That doesn't agree with your $phostname command, by the way.)"
5950                         ;;
5951                 esac
5952         ;;
5953         esac
5954         ;;
5955 esac
5956
5957 $cat <<EOM
5958
5959 I need to get your e-mail address in Internet format if possible, i.e.
5960 something like user@host.domain. Please answer accurately since I have
5961 no easy means to double check it. The default value provided below
5962 is most probably close to the reality but may not be valid from outside
5963 your organization...
5964
5965 EOM
5966 cont=x
5967 while test "$cont"; do
5968         case "$cf_email" in
5969         '') dflt="$cf_by@$myhostname$mydomain";;
5970         *) dflt="$cf_email";;
5971         esac
5972         rp='What is your e-mail address?'
5973         . ./myread
5974         cf_email="$ans"
5975         case "$cf_email" in
5976         *@*.*) cont='' ;;
5977         *)
5978                 rp='Address does not look like an Internet one.  Use it anyway?'
5979                 case "$fastread" in
5980                 yes) dflt=y ;;
5981                 *) dflt=n ;;
5982                 esac
5983                 . ./myread
5984                 case "$ans" in
5985                 y*) cont='' ;;
5986                 *) echo " " ;;
5987                 esac
5988                 ;;
5989         esac
5990 done
5991
5992 $cat <<EOM
5993
5994 If you or somebody else will be maintaining perl at your site, please
5995 fill in the correct e-mail address here so that they may be contacted
5996 if necessary. Currently, the "perlbug" program included with perl
5997 will send mail to this address in addition to perlbug@perl.com. You may
5998 enter "none" for no administrator.
5999
6000 EOM
6001 case "$perladmin" in
6002 '') dflt="$cf_email";;
6003 *) dflt="$perladmin";;
6004 esac
6005 rp='Perl administrator e-mail address'
6006 . ./myread
6007 perladmin="$ans"
6008
6009 : figure out how to guarantee perl startup
6010 case "$startperl" in
6011 '')
6012         case "$sharpbang" in
6013         *!)
6014                 $cat <<EOH
6015
6016 I can use the #! construct to start perl on your system. This will
6017 make startup of perl scripts faster, but may cause problems if you
6018 want to share those scripts and perl is not in a standard place
6019 ($binexp/perl) on all your platforms. The alternative is to force
6020 a shell by starting the script with a single ':' character.
6021
6022 EOH
6023                 dflt="$binexp/perl"
6024                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6025                 . ./myread
6026                 case "$ans" in
6027                 none)   startperl=": # use perl";;
6028                 *)      startperl="#!$ans"
6029                         if $test 30 -lt `echo "$ans" | wc -c`; then
6030                                 $cat >&4 <<EOM
6031
6032 WARNING:  Some systems limit the #! command to 32 characters.
6033 If you experience difficulty running Perl scripts with #!, try
6034 installing Perl in a directory with a shorter pathname.
6035
6036 EOM
6037                         fi ;;
6038                 esac
6039                 ;;
6040         *) startperl=": # use perl"
6041                 ;;
6042         esac
6043         ;;
6044 esac
6045 echo "I'll use $startperl to start perl scripts."
6046
6047 : figure best path for perl in scripts
6048 case "$perlpath" in
6049 '')
6050         perlpath="$binexp/perl"
6051         case "$startperl" in
6052         *!*) ;;
6053         *)
6054                 $cat <<EOH
6055
6056 I will use the "eval 'exec'" idiom to start Perl on your system.
6057 I can use the full path of your Perl binary for this purpose, but
6058 doing so may cause problems if you want to share those scripts and
6059 Perl is not always in a standard place ($binexp/perl).
6060
6061 EOH
6062                 dflt="$binexp/perl"
6063                 rp="What path shall I use in \"eval 'exec'\"?"
6064                 . ./myread
6065                 perlpath="$ans"
6066                 ;;
6067         esac
6068         ;;
6069 esac
6070 case "$startperl" in
6071 *!*)    ;;
6072 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6073 esac
6074
6075 : determine where public executable scripts go
6076 set scriptdir scriptdir
6077 eval $prefixit
6078 case "$scriptdir" in
6079 '')
6080         dflt="$bin"
6081         : guess some guesses
6082         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6083         $test -d /usr/share/bin && dflt=/usr/share/bin
6084         $test -d /usr/local/script && dflt=/usr/local/script
6085         $test -d $prefixexp/script && dflt=$prefixexp/script
6086         set dflt
6087         eval $prefixup
6088         ;;
6089 *)  dflt="$scriptdir"
6090         ;;
6091 esac
6092 $cat <<EOM
6093  
6094 Some installations have a separate directory just for executable scripts so
6095 that they can mount it across multiple architectures but keep the scripts in
6096 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6097 Or you might just lump your scripts in with all your other executables.
6098  
6099 EOM
6100 fn=d~
6101 rp='Where do you keep publicly executable scripts?'
6102 . ./getfile
6103 if $test "X$ansexp" != "X$scriptdirexp"; then
6104         installscript=''
6105 fi
6106 scriptdir="$ans"
6107 scriptdirexp="$ansexp"
6108 if $afs; then
6109         $cat <<EOM
6110
6111 Since you are running AFS, I need to distinguish the directory in which
6112 scripts reside from the directory in which they are installed (and from
6113 which they are presumably copied to the former directory by occult means).
6114
6115 EOM
6116         case "$installscript" in
6117         '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
6118         *) dflt="$installscript";;
6119         esac
6120         fn=de~
6121         rp='Where will public scripts be installed?'
6122         . ./getfile
6123         installscript="$ans"
6124 else
6125         installscript="$scriptdirexp"
6126 fi
6127
6128 : determine where site specific libraries go.
6129 : Usual default is /usr/local/lib/perl5/site_perl/$apiversion
6130 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6131 case "$prefix" in
6132 *perl*) set dflt sitelib lib/site_$prog/$apiversion ;;
6133 *)       set dflt sitelib lib/$package/site_$prog/$apiversion ;;
6134 esac
6135 eval $prefixit
6136 $cat <<EOM
6137
6138 The installation process will also create a directory for
6139 site-specific extensions and modules.  Some users find it convenient
6140 to place all local files in this directory rather than in the main
6141 distribution directory.
6142
6143 EOM
6144 fn=d~+
6145 rp='Pathname for the site-specific library files?'
6146 . ./getfile
6147 if $test "X$sitelibexp" != "X$ansexp"; then
6148         installsitelib=''
6149 fi
6150 sitelib="$ans"
6151 sitelibexp="$ansexp"
6152 if $afs; then
6153         $cat <<EOM
6154
6155 Since you are running AFS, I need to distinguish the directory in
6156 which site-specific files reside from the directory in which they are
6157 installed (and from which they are presumably copied to the former
6158 directory by occult means).
6159
6160 EOM
6161         case "$installsitelib" in
6162         '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
6163         *) dflt="$installsitelib";;
6164         esac
6165         fn=de~
6166         rp='Where will site-specific files be installed?'
6167         . ./getfile
6168         installsitelib="$ans"
6169 else
6170         installsitelib="$sitelibexp"
6171 fi
6172
6173 : determine where site specific architecture-dependent libraries go.
6174 : sitelib  default is /usr/local/lib/perl5/site_perl/$apiversion
6175 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6176 : sitelib may have an optional trailing /share.
6177 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6178 tdflt="$tdflt/$archname"
6179 set sitearch sitearch none
6180 eval $prefixit
6181 case "$sitearch" in
6182 '')     dflt="$tdflt" ;;
6183 *)      dflt="$sitearch" ;;
6184 esac
6185 $cat <<EOM
6186
6187 The installation process will also create a directory for
6188 architecture-dependent site-specific extensions and modules.
6189
6190 EOM
6191 fn=nd~+
6192 rp='Pathname for the site-specific architecture-dependent library files?'
6193 . ./getfile
6194 if $test "X$sitearchexp" != "X$ansexp"; then
6195         installsitearch=''
6196 fi
6197 sitearch="$ans"
6198 sitearchexp="$ansexp"
6199 if $afs; then
6200         $cat <<EOM
6201
6202 Since you are running AFS, I need to distinguish the directory in
6203 which site-specific architecture-dependent library files reside from
6204 the directory in which they are installed (and from which they are
6205 presumably copied to the former directory by occult means).
6206
6207 EOM
6208         case "$installsitearch" in
6209         '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
6210         *) dflt="$installsitearch";;
6211         esac
6212         fn=de~
6213         rp='Where will site-specific architecture-dependent files be installed?'
6214         . ./getfile
6215         installsitearch="$ans"
6216 else
6217         installsitearch="$sitearchexp"
6218 fi
6219
6220 cat <<EOM
6221
6222 Previous version of $package used the standard IO mechanisms as defined
6223 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6224 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6225 the default.  This abstraction layer can use AT&T's sfio (if you already
6226 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6227 problems with some extension modules.  Using PerlIO with stdio is safe,
6228 but it is slower than plain stdio and therefore is not the default.
6229
6230 If this doesn't make any sense to you, just accept the default 'n'.
6231 EOM
6232 case "$useperlio" in
6233 $define|true|[yY]*)     dflt='y';;
6234 *) dflt='n';;
6235 esac
6236 rp='Use the experimental PerlIO abstraction layer?'
6237 . ./myread
6238 case "$ans" in
6239 y|Y) 
6240         val="$define"
6241         ;;     
6242 *)      
6243         echo "Ok, doing things the stdio way"
6244         val="$undef"
6245         ;;
6246 esac
6247 set useperlio
6248 eval $setvar 
6249
6250 : Check how to convert floats to strings.
6251 if test "X$d_Gconvert" = X; then
6252         echo " "
6253         echo "Checking for an efficient way to convert floats to strings."
6254         $cat >try.c <<'EOP'
6255 #ifdef TRY_gconvert
6256 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6257 char *myname = "gconvert";
6258 #endif
6259 #ifdef TRY_gcvt
6260 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6261 char *myname = "gcvt";
6262 #endif
6263 #ifdef TRY_sprintf
6264 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6265 char *myname = "sprintf";
6266 #endif
6267
6268 #include <stdio.h>
6269
6270 int
6271 checkit(expect, got)
6272 char *expect;
6273 char *got;
6274 {
6275     if (strcmp(expect, got)) {
6276                 printf("%s oddity:  Expected %s, got %s\n",
6277                         myname, expect, got);
6278                 exit(1);
6279         }
6280 }
6281
6282 int main()
6283
6284         char buf[64]; 
6285         buf[63] = '\0';
6286
6287         /* This must be 1st test on (which?) platform */
6288         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6289         Gconvert(0.1, 8, 0, buf);
6290         checkit("0.1", buf);
6291
6292         Gconvert(1.0, 8, 0, buf); 
6293         checkit("1", buf);
6294
6295         Gconvert(0.0, 8, 0, buf); 
6296         checkit("0", buf);
6297
6298         Gconvert(-1.0, 8, 0, buf); 
6299         checkit("-1", buf);
6300
6301         /* Some Linux gcvt's give 1.e+5 here. */
6302         Gconvert(100000.0, 8, 0, buf); 
6303         checkit("100000", buf);
6304         
6305         /* Some Linux gcvt's give -1.e+5 here. */
6306         Gconvert(-100000.0, 8, 0, buf); 
6307         checkit("-100000", buf);
6308
6309         exit(0);
6310 }
6311 EOP
6312         case "$d_Gconvert" in
6313         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6314         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6315         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6316         *) xxx_list='gconvert gcvt sprintf' ;;
6317         esac
6318
6319         for xxx_convert in $xxx_list; do
6320                 echo "Trying $xxx_convert"
6321                 $rm -f try try$_o
6322                 set try -DTRY_$xxx_convert
6323                 if eval $compile; then
6324                         echo "$xxx_convert" found. >&4
6325                         if ./try; then
6326                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6327                                 break;
6328                         else
6329                                 echo "...But $xxx_convert didn't work as I expected."
6330                         fi
6331                 else
6332                         echo "$xxx_convert NOT found." >&4
6333                 fi
6334         done
6335                 
6336         case "$xxx_convert" in
6337         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6338         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6339         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6340         esac
6341 fi
6342
6343 : Initialize h_fcntl
6344 h_fcntl=false
6345
6346 : Initialize h_sysfile
6347 h_sysfile=false
6348
6349 : access call always available on UNIX
6350 set access d_access
6351 eval $inlibc
6352
6353 : locate the flags for 'access()'
6354 case "$d_access" in
6355 "$define")
6356         echo " "
6357         $cat >access.c <<'EOCP'
6358 #include <sys/types.h>
6359 #ifdef I_FCNTL
6360 #include <fcntl.h>
6361 #endif
6362 #ifdef I_SYS_FILE
6363 #include <sys/file.h>
6364 #endif
6365 #ifdef I_UNISTD
6366 #include <unistd.h>
6367 #endif
6368 int main() {
6369         exit(R_OK);
6370 }
6371 EOCP
6372         : check sys/file.h first, no particular reason here
6373         if $test `./findhdr sys/file.h` && \
6374                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
6375                 h_sysfile=true;
6376                 echo "<sys/file.h> defines the *_OK access constants." >&4
6377         elif $test `./findhdr fcntl.h` && \
6378                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
6379                 h_fcntl=true;
6380                 echo "<fcntl.h> defines the *_OK access constants." >&4
6381         elif $test `./findhdr unistd.h` && \
6382                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
6383                 echo "<unistd.h> defines the *_OK access constants." >&4
6384         else
6385                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
6386         fi
6387         ;;
6388 esac
6389 $rm -f access*
6390
6391 : see if accessx exists
6392 set accessx d_accessx
6393 eval $inlibc
6394
6395 : see if alarm exists
6396 set alarm d_alarm
6397 eval $inlibc
6398
6399 : Look for GNU-cc style attribute checking
6400 echo " "
6401 echo "Checking whether your compiler can handle __attribute__ ..." >&4
6402 $cat >attrib.c <<'EOCP'
6403 #include <stdio.h>
6404 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
6405 EOCP
6406 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
6407         if $contains 'warning' attrib.out >/dev/null 2>&1; then
6408                 echo "Your C compiler doesn't fully support __attribute__."
6409                 val="$undef"
6410         else
6411                 echo "Your C compiler supports __attribute__."
6412                 val="$define"
6413         fi
6414 else
6415         echo "Your C compiler doesn't seem to understand __attribute__ at all."
6416         val="$undef"
6417 fi
6418 set d_attribut
6419 eval $setvar
6420 $rm -f attrib*
6421
6422 : see if bcmp exists
6423 set bcmp d_bcmp
6424 eval $inlibc
6425
6426 : see if bcopy exists
6427 set bcopy d_bcopy
6428 eval $inlibc
6429
6430 : see if this is a unistd.h system
6431 set unistd.h i_unistd
6432 eval $inhdr
6433
6434 : see if getpgrp exists
6435 set getpgrp d_getpgrp
6436 eval $inlibc
6437
6438 case "$d_getpgrp" in
6439 "$define")
6440         echo " "
6441         echo "Checking to see which flavor of getpgrp is in use..."
6442         $cat >set.c <<EOP
6443 #$i_unistd I_UNISTD
6444 #include <sys/types.h>
6445 #ifdef I_UNISTD
6446 #  include <unistd.h>
6447 #endif
6448 int main()
6449 {
6450         if (getuid() == 0) {
6451                 printf("(I see you are running Configure as super-user...)\n");
6452                 setuid(1);
6453         }
6454 #ifdef TRY_BSD_PGRP
6455         if (getpgrp(1) == 0)
6456                 exit(0);
6457 #else
6458         if (getpgrp() > 0)
6459                 exit(0);
6460 #endif
6461         exit(1);
6462 }
6463 EOP
6464         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6465                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
6466                 val="$define"
6467         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6468                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
6469                 val="$undef"
6470         else
6471                 echo "I can't seem to compile and run the test program."
6472                 if ./usg; then
6473                         xxx="a USG one, i.e. you use getpgrp()."
6474                 else
6475                         # SVR4 systems can appear rather BSD-ish.
6476                         case "$i_unistd" in
6477                         $undef)
6478                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
6479                                 val="$define"
6480                                 ;;
6481                         $define)
6482                                 xxx="probably a USG one, i.e. you use getpgrp()."
6483                                 val="$undef"
6484                                 ;;
6485                         esac
6486                 fi
6487                 echo "Assuming your getpgrp is $xxx" >&4
6488         fi
6489         ;;
6490 *) val="$undef";;
6491 esac
6492 set d_bsdgetpgrp
6493 eval $setvar
6494 $rm -f set set.c
6495
6496 : see if setpgrp exists
6497 set setpgrp d_setpgrp
6498 eval $inlibc
6499
6500 case "$d_setpgrp" in
6501 "$define")
6502         echo " "
6503         echo "Checking to see which flavor of setpgrp is in use..."
6504         $cat >set.c <<EOP
6505 #$i_unistd I_UNISTD
6506 #include <sys/types.h>
6507 #ifdef I_UNISTD
6508 #  include <unistd.h>
6509 #endif
6510 int main()
6511 {
6512         if (getuid() == 0) {
6513                 printf("(I see you are running Configure as super-user...)\n");
6514                 setuid(1);
6515         }
6516 #ifdef TRY_BSD_PGRP
6517         if (-1 == setpgrp(1, 1))
6518                 exit(0);
6519 #else
6520         if (setpgrp() != -1)
6521                 exit(0);
6522 #endif
6523         exit(1);
6524 }
6525 EOP
6526         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6527                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
6528                 val="$define"
6529         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6530                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
6531                 val="$undef"
6532         else
6533                 echo "(I can't seem to compile and run the test program.)"
6534                 if ./usg; then
6535                         xxx="a USG one, i.e. you use setpgrp()."
6536                 else
6537                         # SVR4 systems can appear rather BSD-ish.
6538                         case "$i_unistd" in
6539                         $undef)
6540                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
6541                                 val="$define"
6542                                 ;;
6543                         $define)
6544                                 xxx="probably a USG one, i.e. you use setpgrp()."
6545                                 val="$undef"
6546                                 ;;
6547                         esac
6548                 fi
6549                 echo "Assuming your setpgrp is $xxx" >&4
6550         fi
6551         ;;
6552 *) val="$undef";;
6553 esac
6554 set d_bsdsetpgrp
6555 eval $setvar
6556 $rm -f set set.c
6557 : see if bzero exists
6558 set bzero d_bzero
6559 eval $inlibc
6560
6561 : check for lengths of integral types
6562 echo " "
6563 case "$intsize" in
6564 '')
6565         echo "Checking to see how big your integers are..." >&4
6566         $cat >intsize.c <<'EOCP'
6567 #include <stdio.h>
6568 int main()
6569 {
6570         printf("intsize=%d;\n", sizeof(int));
6571         printf("longsize=%d;\n", sizeof(long));
6572         printf("shortsize=%d;\n", sizeof(short));
6573         exit(0);
6574 }
6575 EOCP
6576         set intsize
6577         if eval $compile_ok && ./intsize > /dev/null; then
6578                 eval `./intsize`
6579                 echo "Your integers are $intsize bytes long."
6580                 echo "Your long integers are $longsize bytes long."
6581                 echo "Your short integers are $shortsize bytes long."
6582         else
6583                 $cat >&4 <<EOM
6584 !
6585 Help! I can't compile and run the intsize test program: please enlighten me!
6586 (This is probably a misconfiguration in your system or libraries, and
6587 you really ought to fix it.  Still, I'll try anyway.)
6588 !
6589 EOM
6590                 dflt=4
6591                 rp="What is the size of an integer (in bytes)?"
6592                 . ./myread
6593                 intsize="$ans"
6594                 dflt=$intsize
6595                 rp="What is the size of a long integer (in bytes)?"
6596                 . ./myread
6597                 longsize="$ans"
6598                 dflt=2
6599                 rp="What is the size of a short integer (in bytes)?"
6600                 . ./myread
6601                 shortsize="$ans"
6602         fi
6603         ;;
6604 esac
6605 $rm -f intsize intsize.*
6606
6607 : see if signal is declared as pointer to function returning int or void
6608 echo " "
6609 xxx=`./findhdr signal.h`
6610 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
6611 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
6612         echo "You have int (*signal())() instead of void." >&4
6613         val="$undef"
6614 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
6615         echo "You have void (*signal())()." >&4
6616         val="$define"
6617 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
6618         echo "You have int (*signal())() instead of void." >&4
6619         val="$undef"
6620 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
6621         echo "You have void (*signal())()." >&4
6622         val="$define"
6623 else
6624         case "$d_voidsig" in
6625         '')
6626         echo "I can't determine whether signal handler returns void or int..." >&4
6627                 dflt=void
6628                 rp="What type does your signal handler return?"
6629                 . ./myread
6630                 case "$ans" in
6631                 v*) val="$define";;
6632                 *) val="$undef";;
6633                 esac;;
6634         "$define")
6635                 echo "As you already told me, signal handler returns void." >&4
6636                 val="$define"
6637                 ;;
6638         *)      echo "As you already told me, signal handler returns int." >&4
6639                 val="$undef"
6640                 ;;
6641         esac
6642 fi
6643 set d_voidsig
6644 eval $setvar
6645 case "$d_voidsig" in
6646 "$define") signal_t="void";;
6647 *) signal_t="int";;
6648 esac
6649 $rm -f $$.tmp
6650
6651 : check for ability to cast large floats to 32-bit ints.
6652 echo " "
6653 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
6654 if $test "$intsize" -ge 4; then
6655         xxx=int
6656 else
6657         xxx=long
6658 fi
6659 $cat >try.c <<EOCP
6660 #include <stdio.h>
6661 #include <sys/types.h>
6662 #include <signal.h>
6663 $signal_t blech(s) int s; { exit(3); }
6664 int main()
6665 {
6666         $xxx i32;
6667         double f, g;
6668         int result = 0;
6669         char str[16];
6670         signal(SIGFPE, blech);
6671
6672         /* Don't let compiler optimize the test away.  Store the number 
6673            in a writable string for gcc to pass to sscanf under HP/UX.
6674         */
6675         sprintf(str, "2147483647");
6676         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
6677         g = 10 * f;
6678         i32  = ($xxx) g;
6679
6680         /* x86 processors will probably give 0x8000 0000, which is a
6681        sign change.  We don't want that.  We want to mimic SPARC
6682            behavior here, which is to preserve the sign and give
6683            back 0x7fff ffff.
6684         */
6685         if (i32 != ($xxx) f)
6686                 result |= 1;
6687         exit(result);
6688 }
6689 EOCP
6690 set try
6691 if eval $compile_ok; then
6692         ./try
6693         yyy=$?
6694 else
6695         echo "(I can't seem to compile the test program--assuming it can't)"
6696         yyy=1
6697 fi
6698 case "$yyy" in
6699 0)      val="$define"
6700         echo "Yup, it can."
6701         ;;
6702 *)      val="$undef"
6703         echo "Nope, it can't."
6704         ;;
6705 esac
6706 set d_casti32
6707 eval $setvar
6708 $rm -f try try.*
6709
6710 : check for ability to cast negative floats to unsigned
6711 echo " "
6712 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
6713 $cat >try.c <<EOCP
6714 #include <stdio.h>
6715 #include <sys/types.h>
6716 #include <signal.h>
6717 $signal_t blech(s) int s; { exit(7); }
6718 $signal_t blech_in_list(s) int s; { exit(4); }
6719 unsigned long dummy_long(p) unsigned long p; { return p; }
6720 unsigned int dummy_int(p) unsigned int p; { return p; }
6721 unsigned short dummy_short(p) unsigned short p; { return p; }
6722 int main()
6723 {
6724         double f;
6725         unsigned long along;
6726         unsigned int aint;
6727         unsigned short ashort;
6728         int result = 0;
6729         char str[16];
6730         
6731         /* Frustrate gcc-2.7.2's optimizer which failed this test with
6732            a direct f = -123. assignment.  gcc-2.8.0 reportedly
6733            optimized the whole file away
6734         */
6735         /* Store the number in a writable string for gcc to pass to 
6736            sscanf under HP/UX.
6737         */
6738         sprintf(str, "-123");
6739         sscanf(str, "%lf", &f);  /* f = -123.; */
6740
6741         signal(SIGFPE, blech);
6742         along = (unsigned long)f;
6743         aint = (unsigned int)f;
6744         ashort = (unsigned short)f;
6745         if (along != (unsigned long)-123)
6746                 result |= 1;
6747         if (aint != (unsigned int)-123)
6748                 result |= 1;
6749         if (ashort != (unsigned short)-123)
6750                 result |= 1;
6751         sprintf(str, "1073741824.");
6752         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
6753         f = f + f;
6754         along = 0;
6755         along = (unsigned long)f;
6756         if (along != 0x80000000)
6757                 result |= 2;
6758         f -= 1.;
6759         along = 0;
6760         along = (unsigned long)f;
6761         if (along != 0x7fffffff)
6762                 result |= 1;
6763         f += 2.;
6764         along = 0;
6765         along = (unsigned long)f;
6766         if (along != 0x80000001)
6767                 result |= 2;
6768         if (result)
6769                 exit(result);
6770         signal(SIGFPE, blech_in_list);
6771         sprintf(str, "123.");
6772         sscanf(str, "%lf", &f);  /* f = 123.; */
6773         along = dummy_long((unsigned long)f);
6774         aint = dummy_int((unsigned int)f);
6775         ashort = dummy_short((unsigned short)f);
6776         if (along != (unsigned long)123)
6777                 result |= 4;
6778         if (aint != (unsigned int)123)
6779                 result |= 4;
6780         if (ashort != (unsigned short)123)
6781                 result |= 4;
6782         exit(result);
6783
6784 }
6785 EOCP
6786 set try
6787 if eval $compile_ok; then
6788         ./try
6789         castflags=$?
6790 else
6791         echo "(I can't seem to compile the test program--assuming it can't)"
6792         castflags=7
6793 fi
6794 case "$castflags" in
6795 0)      val="$define"
6796         echo "Yup, it can."
6797         ;;
6798 *)      val="$undef"
6799         echo "Nope, it can't."
6800         ;;
6801 esac
6802 set d_castneg
6803 eval $setvar
6804 $rm -f try.*
6805
6806 : see if vprintf exists
6807 echo " "
6808 if set vprintf val -f d_vprintf; eval $csym; $val; then
6809         echo 'vprintf() found.' >&4
6810         val="$define"
6811         $cat >vprintf.c <<'EOF'
6812 #include <varargs.h>
6813
6814 int main() { xxx("foo"); }
6815
6816 xxx(va_alist)
6817 va_dcl
6818 {
6819         va_list args;
6820         char buf[10];
6821
6822         va_start(args);
6823         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
6824 }
6825 EOF
6826         set vprintf
6827         if eval $compile && ./vprintf; then
6828                 echo "Your vsprintf() returns (int)." >&4
6829                 val2="$undef"
6830         else
6831                 echo "Your vsprintf() returns (char*)." >&4
6832                 val2="$define"
6833         fi
6834 else
6835         echo 'vprintf() NOT found.' >&4
6836                 val="$undef"
6837                 val2="$undef"
6838 fi
6839 set d_vprintf
6840 eval $setvar
6841 val=$val2
6842 set d_charvspr
6843 eval $setvar
6844
6845 : see if chown exists
6846 set chown d_chown
6847 eval $inlibc
6848
6849 : see if chroot exists
6850 set chroot d_chroot
6851 eval $inlibc
6852
6853 : see if chsize exists
6854 set chsize d_chsize
6855 eval $inlibc
6856
6857 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
6858 while $test $# -ge 2; do
6859         case "$1" in
6860         $define) echo "#include <$2>";;
6861         esac ;
6862     shift 2;
6863 done > try.c;
6864 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
6865 if eval $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6866         val="$define";
6867 else
6868         val="$undef";
6869 fi;
6870 set $varname;
6871 eval $setvar;
6872 $rm -f try.c try.o'
6873
6874 : see if this is a sys/uio.h system
6875 set sys/uio.h i_sysuio
6876 eval $inhdr
6877
6878 echo "Checking to see if your system supports struct iovec..." >&4
6879 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
6880 eval $hasfield
6881 case "$d_iovec_s" in
6882 "$define")      echo "Yup, it does." >&4
6883                 ;;
6884 *)              echo "Nope, it doesn't." >&4
6885                 ;;
6886 esac
6887
6888 socketlib=''
6889 sockethdr=''
6890 : see whether socket exists
6891 echo " "
6892 $echo $n "Hmm... $c" >&4
6893 if set socket val -f d_socket; eval $csym; $val; then
6894         echo "Looks like you have Berkeley networking support." >&4
6895         d_socket="$define"
6896         if set setsockopt val -f; eval $csym; $val; then
6897                 d_oldsock="$undef"
6898         else
6899                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
6900                 d_oldsock="$define"
6901         fi
6902 else
6903         if $contains socklib libc.list >/dev/null 2>&1; then
6904                 echo "Looks like you have Berkeley networking support." >&4
6905                 d_socket="$define"
6906                 : we will have to assume that it supports the 4.2 BSD interface
6907                 d_oldsock="$undef"
6908         else
6909                 echo "You don't have Berkeley networking in libc$_a..." >&4
6910                 if test "X$d_socket" = "X$define"; then
6911                    echo "...but you seem to believe that you have sockets." >&4
6912                 else
6913                         for net in net socket
6914                         do
6915                                 if test -f /usr/lib/lib$net$_a; then
6916                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
6917                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
6918                                         if $contains socket libc.list >/dev/null 2>&1; then
6919                                                 d_socket="$define"
6920                                                 socketlib="-l$net"
6921                                                 case "$net" in
6922                                                 net)
6923                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
6924                                                         sockethdr="-I/usr/netinclude"
6925                                                         ;;
6926                                                 esac
6927                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
6928                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
6929                                                         d_oldsock="$undef"
6930                                                 else
6931                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
6932                                                         d_oldsock="$define"
6933                                                 fi
6934                                                 break
6935                                         fi
6936                                 fi
6937                         done
6938                         if test "X$d_socket" != "X$define"; then
6939                            echo "or anywhere else I see." >&4
6940                            d_socket="$undef"
6941                            d_oldsock="$undef"
6942                         fi
6943                 fi
6944         fi
6945 fi
6946
6947 : see if socketpair exists
6948 set socketpair d_sockpair
6949 eval $inlibc
6950
6951
6952 echo " "
6953 echo "Checking the availability of certain socket constants..." >& 4
6954 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
6955         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
6956         $cat >try.c <<EOF
6957 #include <sys/types.h>
6958 #include <sys/socket.h>
6959 int main() {
6960     int i = $ENUM;
6961 }
6962 EOF
6963         val="$undef"
6964         set try; if eval $compile; then
6965                 val="$define"
6966         fi
6967         set d_${enum}; eval $setvar
6968         $rm -f try.c try
6969 done
6970
6971 set sendmsg d_sendmsg
6972 eval $inlibc
6973
6974 set recvmsg d_recvmsg
6975 eval $inlibc
6976
6977 echo " "
6978 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
6979 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
6980 eval $hasfield
6981 case "$d_msghdr_s" in
6982 "$define")      echo "Yup, it does." >&4
6983                 ;;
6984 *)              echo "Nope, it doesn't." >&4
6985                 ;;
6986 esac
6987
6988 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
6989 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
6990 eval $hasfield
6991 case "$d_cmsghdr_s" in
6992 "$define")      echo "Yup, it does." >&4
6993                 ;;
6994 *)              echo "Nope, it doesn't." >&4
6995                 ;;
6996 esac
6997
6998 : check for const keyword
6999 echo " "
7000 echo 'Checking to see if your C compiler knows about "const"...' >&4
7001 $cat >const.c <<'EOCP'
7002 typedef struct spug { int drokk; } spug;
7003 int main()
7004 {
7005         const char *foo;
7006         const spug y;
7007 }
7008 EOCP
7009 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7010         val="$define"
7011         echo "Yup, it does."
7012 else
7013         val="$undef"
7014         echo "Nope, it doesn't."
7015 fi
7016 set d_const
7017 eval $setvar
7018
7019 : see if crypt exists
7020 echo " "
7021 if set crypt val -f d_crypt; eval $csym; $val; then
7022         echo 'crypt() found.' >&4
7023         val="$define"
7024         cryptlib=''
7025 else
7026         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7027         if $test -z "$cryptlib"; then
7028                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7029         else
7030                 cryptlib=-lcrypt
7031         fi
7032         if $test -z "$cryptlib"; then
7033                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7034         else
7035                 cryptlib=-lcrypt
7036         fi
7037         if $test -z "$cryptlib"; then
7038                 cryptlib=`./loc libcrypt$_a "" $libpth`
7039         else
7040                 cryptlib=-lcrypt
7041         fi
7042         if $test -z "$cryptlib"; then
7043                 echo 'crypt() NOT found.' >&4
7044                 val="$undef"
7045         else
7046                 val="$define"
7047         fi
7048 fi
7049 set d_crypt
7050 eval $setvar
7051
7052 : get csh whereabouts
7053 case "$csh" in
7054 'csh') val="$undef" ;;
7055 *) val="$define" ;;
7056 esac
7057 set d_csh
7058 eval $setvar
7059 : Respect a hint or command line value for full_csh.
7060 case "$full_csh" in
7061 '') full_csh=$csh ;;
7062 esac
7063
7064 : see if cuserid exists
7065 set cuserid d_cuserid
7066 eval $inlibc
7067
7068 : see if this is a limits.h system
7069 set limits.h i_limits
7070 eval $inhdr
7071
7072 : see if this is a float.h system
7073 set float.h i_float
7074 eval $inhdr
7075
7076 : See if number of significant digits in a double precision number is known
7077 echo " "
7078 $cat >dbl_dig.c <<EOM
7079 #$i_limits I_LIMITS
7080 #$i_float I_FLOAT
7081 #ifdef I_LIMITS
7082 #include <limits.h>
7083 #endif
7084 #ifdef I_FLOAT
7085 #include <float.h>
7086 #endif
7087 #ifdef DBL_DIG
7088 printf("Contains DBL_DIG");
7089 #endif
7090 EOM
7091 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7092 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7093         echo "DBL_DIG found." >&4
7094         val="$define"
7095 else
7096         echo "DBL_DIG NOT found." >&4
7097         val="$undef"
7098 fi
7099 $rm -f dbl_dig.?
7100 set d_dbl_dig
7101 eval $setvar
7102
7103
7104 if $test X"$use64bits" = X"$define"; then
7105         : see if dbminit64 exists
7106         set dbminit64 d_dbminit64
7107         eval $inlibc
7108
7109         : see if dbmclose64 exists
7110         set dbmclose64 d_dbmclose64
7111         eval $inlibc
7112
7113         : see if fetch64 exists
7114         set fetch64 d_fetch64
7115         eval $inlibc
7116
7117         : see if store64 exists
7118         set store64 d_store64
7119         eval $inlibc
7120
7121         : see if delete64 exists
7122         set delete64 d_delete64
7123         eval $inlibc
7124
7125         : see if firstkey64 exists
7126         set firstkey64 d_firstkey64
7127         eval $inlibc
7128
7129         : see if nextkey64 exists
7130         set nextkey64 d_nextkey64
7131         eval $inlibc
7132 else
7133         val="$undef"
7134         for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
7135         do
7136                 set $xxx
7137                 eval $setvar
7138         done
7139 fi
7140
7141 : see if difftime exists
7142 set difftime d_difftime
7143 eval $inlibc
7144
7145 : see if sys/stat.h is available
7146 set sys/stat.h i_sysstat
7147 eval $inhdr
7148
7149 : see if this is a dirent system
7150 echo " "
7151 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7152         val="$define"
7153         echo "<dirent.h> found." >&4
7154 else
7155         val="$undef"
7156         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7157                 echo "<sys/dir.h> found." >&4
7158                 echo " "
7159         else
7160                 xinc=`./findhdr sys/ndir.h`
7161         fi
7162         echo "<dirent.h> NOT found." >&4
7163 fi
7164 set i_dirent
7165 eval $setvar
7166
7167 : Look for type of directory structure.
7168 echo " "
7169 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7170
7171 case "$direntrytype" in
7172 ''|' ')
7173         case "$i_dirent" in
7174         $define) guess1='struct dirent' ;;
7175         *) guess1='struct direct'  ;;
7176         esac
7177         ;;
7178 *)      guess1="$direntrytype"
7179         ;;
7180 esac
7181
7182 case "$guess1" in
7183 'struct dirent') guess2='struct direct' ;;
7184 *) guess2='struct dirent' ;;
7185 esac
7186                 
7187 if $contains "$guess1" try.c >/dev/null 2>&1; then
7188         direntrytype="$guess1"
7189         echo "Your directory entries are $direntrytype." >&4
7190 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7191         direntrytype="$guess2"
7192         echo "Your directory entries seem to be $direntrytype." >&4
7193 else
7194         echo "I don't recognize your system's directory entries." >&4
7195         rp="What type is used for directory entries on this system?"
7196         dflt="$guess1"
7197         . ./myread
7198         direntrytype="$ans"
7199 fi
7200 $rm -f try.c
7201
7202
7203 : see if the directory entry stores field length
7204 echo " "
7205 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7206 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7207         echo "Good, your directory entry keeps length information in d_namlen." >&4
7208         val="$define"
7209 else
7210         echo "Your directory entry does not know about the d_namlen field." >&4
7211         val="$undef"
7212 fi
7213 set d_dirnamlen
7214 eval $setvar
7215 $rm -f try.c
7216
7217
7218 if $test X"$use64bits" = X"$define"; then
7219         : see if fstat64 exists
7220         set fstat64 d_fstat64
7221         eval $inlibc
7222
7223         : see if ftruncate64 exists
7224         set ftruncate64 d_ftruncate64
7225         eval $inlibc
7226
7227         : see if lockf64 exists
7228         set lockf64 d_lockf64
7229         eval $inlibc
7230
7231         : see if lseek64 exists
7232         set lseek64 d_lseek64
7233         eval $inlibc
7234
7235         : see if lstat64 exists
7236         set lstat64 d_lstat64
7237         eval $inlibc
7238
7239         : see if open64 exists
7240         set open64 d_open64
7241         eval $inlibc
7242
7243         : see if opendir64 exists
7244         set opendir64 d_opendir64
7245         eval $inlibc
7246
7247         : see if readdir64 exists
7248         set readdir64 d_readdir64
7249         eval $inlibc
7250
7251         : see if seekdir64 exists
7252         set seekdir64 d_seekdir64
7253         eval $inlibc
7254
7255         : see if stat64 exists
7256         set stat64 d_stat64
7257         eval $inlibc
7258
7259         : see if telldir64 exists
7260         set telldir64 d_telldir64
7261         eval $inlibc
7262
7263         : see if truncate64 exists
7264         set truncate64 d_truncate64
7265         eval $inlibc
7266
7267         : check for off64_t
7268         echo " "
7269         echo $n "Checking to see if your system supports off64_t...$c" >&4
7270         $cat >try.c <<EOCP
7271 #include <sys/types.h>
7272 off64_t foo() { off64_t x; x = 7; return x; }'
7273 EOCP
7274         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7275                 val="$define"
7276                 echo " Yup, it does." >&4
7277         else
7278                 val="$undef"
7279                 echo " Nope, it doesn't." >&4
7280         fi
7281         $rm -f try.*
7282         set d_off64t
7283         eval $setvar
7284
7285         : check for ino64_t
7286         echo " "
7287         echo $n "Checking to see if your system supports ino64_t...$c" >&4
7288         val="$undef"
7289         case "$i_sysstat" in
7290         "$define" )
7291                 $cat >try.c <<EOCP
7292 #include <sys/types.h>
7293 #include <sys/stat.h>
7294 ino64_t foo() { ino64_t x; x = 7; return x; }'
7295 EOCP
7296                 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7297                         val="$define"
7298                 fi
7299                 $rm -f try.*
7300                 ;;
7301         esac
7302         if $test "X$val" = X"$define"; then
7303                 echo " Yup, it does." >&4
7304         else
7305                 echo " Nope, it doesn't." >&4
7306         fi
7307         set d_ino64t
7308         eval $setvar
7309
7310         : check for struct flock64
7311         echo " "
7312         echo "Checking to see if your system supports struct flock64..." >&4
7313         if $h_fcntl; then
7314                 set d_flock64_s flock64 l_len define fcntl.h
7315                 eval $hasfield
7316         else
7317                 val="$undef"
7318                 set d_flock64_s
7319                 eval $setvar
7320         fi
7321         case "$d_flock64_s" in
7322         "$define")      echo "Yup, it does." >&4
7323                         ;;
7324         *)              echo "Nope, it doesn't." >&4
7325                         ;;
7326         esac
7327
7328         : check for struct dirent64
7329         echo " "
7330         echo "Checking to see if your system supports struct dirent64..." >&4
7331         set d_dirent64_s dirent64 d_off $i_dirent dirent.h
7332         eval $hasfield
7333         case "$d_dirent64_s" in
7334         "$define")      echo "Yup, it does." >&4
7335                         ;;
7336         *)              echo "Nope, it doesn't." >&4
7337                         ;;
7338         esac
7339
7340 else
7341         val="$undef"
7342         for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64t d_ino64t d_flock64_s d_dirent64_s
7343         do
7344                 set $xxx
7345                 eval $setvar
7346         done
7347 fi
7348
7349 : see if dlerror exists
7350 xxx_runnm="$runnm"
7351 runnm=false
7352 set dlerror d_dlerror
7353 eval $inlibc
7354 runnm="$xxx_runnm"
7355
7356 : see if dlfcn is available
7357 set dlfcn.h i_dlfcn
7358 eval $inhdr
7359
7360 case "$usedl" in
7361 $define|y|true)
7362         $cat << EOM
7363
7364 On a few systems, the dynamically loaded modules that perl generates and uses
7365 will need a different extension than shared libs. The default will probably
7366 be appropriate.
7367
7368 EOM
7369         case "$dlext" in
7370         '')     dflt="$so" ;;
7371         *)      dflt="$dlext" ;;
7372         esac
7373         rp='What is the extension of dynamically loaded modules'
7374         . ./myread
7375         dlext="$ans"
7376         ;;
7377 *)
7378         dlext="none"
7379         ;;
7380 esac
7381
7382 : Check if dlsym need a leading underscore
7383 echo " "
7384 val="$undef"
7385
7386 case "$dlsrc" in
7387 dl_dlopen.xs)
7388         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7389         $cat >dyna.c <<'EOM'
7390 fred () { }
7391 EOM
7392
7393 $cat >fred.c<<EOM
7394
7395 #include <stdio.h>
7396 #$i_dlfcn I_DLFCN
7397 #ifdef I_DLFCN
7398 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7399 #else
7400 #include <sys/types.h>
7401 #include <nlist.h>
7402 #include <link.h>
7403 #endif
7404
7405 extern int fred() ;
7406
7407 int main()
7408 {
7409     void * handle ;
7410     void * symbol ;
7411 #ifndef RTLD_LAZY
7412     int mode = 1 ;
7413 #else
7414     int mode = RTLD_LAZY ;
7415 #endif
7416     handle = dlopen("./dyna.$dlext", mode) ;
7417     if (handle == NULL) {
7418         printf ("1\n") ;
7419         fflush (stdout) ;
7420         exit(0);
7421     }
7422     symbol = dlsym(handle, "fred") ;
7423     if (symbol == NULL) {
7424         /* try putting a leading underscore */
7425         symbol = dlsym(handle, "_fred") ;
7426         if (symbol == NULL) {
7427             printf ("2\n") ;
7428             fflush (stdout) ;
7429             exit(0);
7430         }
7431         printf ("3\n") ;
7432     }
7433     else
7434         printf ("4\n") ;
7435     fflush (stdout) ;
7436     exit(0);
7437 }
7438 EOM
7439         : Call the object file tmp-dyna.o in case dlext=o.
7440         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
7441                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
7442                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
7443                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
7444                 xxx=`./fred`
7445                 case $xxx in
7446                 1)      echo "Test program failed using dlopen." >&4
7447                         echo "Perhaps you should not use dynamic loading." >&4;;
7448                 2)      echo "Test program failed using dlsym." >&4
7449                         echo "Perhaps you should not use dynamic loading." >&4;;
7450                 3)      echo "dlsym needs a leading underscore" >&4
7451                         val="$define" ;;
7452                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
7453                 esac
7454         else
7455                 echo "I can't compile and run the test program." >&4
7456         fi
7457         ;;
7458 esac
7459                 
7460 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
7461
7462 set d_dlsymun
7463 eval $setvar
7464
7465 hasproto='varname=$1; func=$2; shift; shift;
7466 while $test $# -ge 2; do
7467         case "$1" in
7468         $define) echo "#include <$2>";;
7469         esac ;
7470     shift 2;
7471 done > try.c;
7472 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
7473 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
7474         echo "$func() prototype found.";
7475         val="$define";
7476 else
7477         echo "$func() prototype NOT found.";
7478         val="$undef";
7479 fi;
7480 set $varname;
7481 eval $setvar;
7482 $rm -f try.c tryout.c'
7483
7484 : see if prototype for drand48 is available
7485 echo " "
7486 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
7487 eval $hasproto
7488
7489 : see if dup2 exists
7490 set dup2 d_dup2
7491 eval $inlibc
7492
7493 : see if eaccess exists
7494 set eaccess d_eaccess
7495 eval $inlibc
7496
7497 : see if endgrent exists
7498 set endgrent d_endgrent
7499 eval $inlibc
7500
7501 : see if endhostent exists
7502 set endhostent d_endhent
7503 eval $inlibc
7504
7505 : see if endnetent exists
7506 set endnetent d_endnent
7507 eval $inlibc
7508
7509 : see if endprotoent exists
7510 set endprotoent d_endpent
7511 eval $inlibc
7512
7513 : see if endpwent exists
7514 set endpwent d_endpwent
7515 eval $inlibc
7516
7517 : see if endservent exists
7518 set endservent d_endsent
7519 eval $inlibc
7520
7521 : Locate the flags for 'open()'
7522 echo " "
7523 $cat >open3.c <<'EOCP'
7524 #include <sys/types.h>
7525 #ifdef I_FCNTL
7526 #include <fcntl.h>
7527 #endif
7528 #ifdef I_SYS_FILE
7529 #include <sys/file.h>
7530 #endif
7531 int main() {
7532         if(O_RDONLY);
7533 #ifdef O_TRUNC
7534         exit(0);
7535 #else
7536         exit(1);
7537 #endif
7538 }
7539 EOCP
7540 : check sys/file.h first to get FREAD on Sun
7541 if $test `./findhdr sys/file.h` && \
7542                 set open3 -DI_SYS_FILE && eval $compile; then
7543         h_sysfile=true;
7544         echo "<sys/file.h> defines the O_* constants..." >&4
7545         if ./open3; then
7546                 echo "and you have the 3 argument form of open()." >&4
7547                 val="$define"
7548         else
7549                 echo "but not the 3 argument form of open().  Oh, well." >&4
7550                 val="$undef"
7551         fi
7552 elif $test `./findhdr fcntl.h` && \
7553                 set open3 -DI_FCNTL && eval $compile; then
7554         h_fcntl=true;
7555         echo "<fcntl.h> defines the O_* constants..." >&4
7556         if ./open3; then
7557                 echo "and you have the 3 argument form of open()." >&4
7558                 val="$define"
7559         else
7560                 echo "but not the 3 argument form of open().  Oh, well." >&4
7561                 val="$undef"
7562         fi
7563 else
7564         val="$undef"
7565         echo "I can't find the O_* constant definitions!  You got problems." >&4
7566 fi
7567 set d_open3
7568 eval $setvar
7569 $rm -f open3*
7570
7571 : check for non-blocking I/O stuff
7572 case "$h_sysfile" in
7573 true) echo "#include <sys/file.h>" > head.c;;
7574 *)
7575         case "$h_fcntl" in
7576         true) echo "#include <fcntl.h>" > head.c;;
7577         *) echo "#include <sys/fcntl.h>" > head.c;;
7578         esac
7579         ;;
7580 esac
7581 echo " "
7582 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
7583 case "$o_nonblock" in
7584 '')
7585         $cat head.c > try.c
7586         $cat >>try.c <<'EOCP'
7587 int main() {
7588 #ifdef O_NONBLOCK
7589         printf("O_NONBLOCK\n");
7590         exit(0);
7591 #endif
7592 #ifdef O_NDELAY
7593         printf("O_NDELAY\n");
7594         exit(0);
7595 #endif
7596 #ifdef FNDELAY
7597         printf("FNDELAY\n");
7598         exit(0);
7599 #endif
7600         exit(0);
7601 }
7602 EOCP
7603         set try
7604         if eval $compile_ok; then
7605                 o_nonblock=`./try`
7606                 case "$o_nonblock" in
7607                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
7608                 *) echo "Seems like we can use $o_nonblock.";;
7609                 esac
7610         else
7611                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
7612         fi
7613         ;;
7614 *) echo "Using $hint value $o_nonblock.";;
7615 esac
7616 $rm -f try try.* .out core
7617
7618 echo " "
7619 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
7620 case "$eagain" in
7621 '')
7622         $cat head.c > try.c
7623         $cat >>try.c <<EOCP
7624 #include <errno.h>
7625 #include <sys/types.h>
7626 #include <signal.h>
7627 #define MY_O_NONBLOCK $o_nonblock
7628 #ifndef errno  /* XXX need better Configure test */
7629 extern int errno;
7630 #endif
7631 $signal_t blech(x) int x; { exit(3); }
7632 EOCP
7633         $cat >> try.c <<'EOCP'
7634 int main()
7635 {
7636         int pd[2];
7637         int pu[2];
7638         char buf[1];
7639         char string[100];
7640
7641         pipe(pd);       /* Down: child -> parent */
7642         pipe(pu);       /* Up: parent -> child */
7643         if (0 != fork()) {
7644                 int ret;
7645                 close(pd[1]);   /* Parent reads from pd[0] */
7646                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
7647                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
7648                         exit(1);
7649                 signal(SIGALRM, blech);
7650                 alarm(5);
7651                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
7652                         exit(2);
7653                 sprintf(string, "%d\n", ret);
7654                 write(2, string, strlen(string));
7655                 alarm(0);
7656 #ifdef EAGAIN
7657                 if (errno == EAGAIN) {
7658                         printf("EAGAIN\n");
7659                         goto ok;
7660                 }
7661 #endif
7662 #ifdef EWOULDBLOCK
7663                 if (errno == EWOULDBLOCK)
7664                         printf("EWOULDBLOCK\n");
7665 #endif
7666         ok:
7667                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
7668                 sleep(2);                               /* Give it time to close our pipe */
7669                 alarm(5);
7670                 ret = read(pd[0], buf, 1);      /* Should read EOF */
7671                 alarm(0);
7672                 sprintf(string, "%d\n", ret);
7673                 write(3, string, strlen(string));
7674                 exit(0);
7675         }
7676
7677         close(pd[0]);                   /* We write to pd[1] */
7678         close(pu[1]);                   /* We read from pu[0] */
7679         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
7680         close(pd[1]);                   /* Pipe pd is now fully closed! */
7681         exit(0);                                /* Bye bye, thank you for playing! */
7682 }
7683 EOCP
7684         set try
7685         if eval $compile_ok; then
7686                 echo "$startsh" >mtry
7687                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
7688                 chmod +x mtry
7689                 ./mtry >/dev/null 2>&1
7690                 case $? in
7691                 0) eagain=`$cat try.out`;;
7692                 1) echo "Could not perform non-blocking setting!";;
7693                 2) echo "I did a successful read() for something that was not there!";;
7694                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
7695                 *) echo "Something terribly wrong happened during testing.";;
7696                 esac
7697                 rd_nodata=`$cat try.ret`
7698                 echo "A read() system call with no data present returns $rd_nodata."
7699                 case "$rd_nodata" in
7700                 0|-1) ;;
7701                 *)
7702                         echo "(That's peculiar, fixing that to be -1.)"
7703                         rd_nodata=-1
7704                         ;;
7705                 esac
7706                 case "$eagain" in
7707                 '')
7708                         echo "Forcing errno EAGAIN on read() with no data available."
7709                         eagain=EAGAIN
7710                         ;;
7711                 *)
7712                         echo "Your read() sets errno to $eagain when no data is available."
7713                         ;;
7714                 esac
7715                 status=`$cat try.err`
7716                 case "$status" in
7717                 0) echo "And it correctly returns 0 to signal EOF.";;
7718                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
7719                 *) echo "However, your read() returns '$status' on EOF??";;
7720                 esac
7721                 val="$define"
7722                 if test "$status" = "$rd_nodata"; then
7723                         echo "WARNING: you can't distinguish between EOF and no data!"
7724                         val="$undef"
7725                 fi
7726         else
7727                 echo "I can't compile the test program--assuming errno EAGAIN will do."
7728                 eagain=EAGAIN
7729         fi
7730         set d_eofnblk
7731         eval $setvar
7732         ;;
7733 *)
7734         echo "Using $hint value $eagain."
7735         echo "Your read() returns $rd_nodata when no data is present."
7736         case "$d_eofnblk" in
7737         "$define") echo "And you can see EOF because read() returns 0.";;
7738         "$undef") echo "But you can't see EOF status from read() returned value.";;
7739         *)
7740                 echo "(Assuming you can't see EOF status from read anyway.)"
7741                 d_eofnblk=$undef
7742                 ;;
7743         esac
7744         ;;
7745 esac
7746 $rm -f try try.* .out core head.c mtry
7747
7748 : see if fchmod exists
7749 set fchmod d_fchmod
7750 eval $inlibc
7751
7752 : see if fchown exists
7753 set fchown d_fchown
7754 eval $inlibc
7755
7756 : see if this is an fcntl system
7757 set fcntl d_fcntl
7758 eval $inlibc
7759
7760 : see if sys/select.h has to be included
7761 set sys/select.h i_sysselct
7762 eval $inhdr
7763
7764 : see if we should include time.h, sys/time.h, or both
7765 echo " "
7766 if test "X$timeincl" = X; then
7767         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
7768         $echo $n "I'm now running the test program...$c"
7769         $cat >try.c <<'EOCP'
7770 #include <sys/types.h>
7771 #ifdef I_TIME
7772 #include <time.h>
7773 #endif
7774 #ifdef I_SYSTIME
7775 #ifdef SYSTIMEKERNEL
7776 #define KERNEL
7777 #endif
7778 #include <sys/time.h>
7779 #endif
7780 #ifdef I_SYSSELECT
7781 #include <sys/select.h>
7782 #endif
7783 int main()
7784 {
7785         struct tm foo;
7786 #ifdef S_TIMEVAL
7787         struct timeval bar;
7788 #endif
7789 #ifdef S_TIMEZONE
7790         struct timezone tzp;
7791 #endif
7792         if (foo.tm_sec == foo.tm_sec)
7793                 exit(0);
7794 #ifdef S_TIMEVAL
7795         if (bar.tv_sec == bar.tv_sec)
7796                 exit(0);
7797 #endif
7798         exit(1);
7799 }
7800 EOCP
7801         flags=''
7802         for s_timezone in '-DS_TIMEZONE' ''; do
7803         sysselect=''
7804         for s_timeval in '-DS_TIMEVAL' ''; do
7805         for i_systimek in '' '-DSYSTIMEKERNEL'; do
7806         for i_time in '' '-DI_TIME'; do
7807         for i_systime in '-DI_SYSTIME' ''; do
7808                 case "$flags" in
7809                 '') $echo $n ".$c"
7810                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
7811                         if eval $compile; then
7812                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
7813                                 shift
7814                                 flags="$*"
7815                                 echo " "
7816                                 $echo $n "Succeeded with $flags$c"
7817                         fi
7818                         ;;
7819                 esac
7820         done
7821         done
7822         done
7823         done
7824         done
7825         timeincl=''
7826         echo " "
7827         case "$flags" in
7828         *SYSTIMEKERNEL*) i_systimek="$define"
7829                 timeincl=`./findhdr sys/time.h`
7830                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
7831         *) i_systimek="$undef";;
7832         esac
7833         case "$flags" in
7834         *I_TIME*) i_time="$define"
7835                 timeincl=`./findhdr time.h`" $timeincl"
7836                 echo "We'll include <time.h>." >&4;;
7837         *) i_time="$undef";;
7838         esac
7839         case "$flags" in
7840         *I_SYSTIME*) i_systime="$define"
7841                 timeincl=`./findhdr sys/time.h`" $timeincl"
7842                 echo "We'll include <sys/time.h>." >&4;;
7843         *) i_systime="$undef";;
7844         esac
7845         $rm -f try.c try
7846 fi
7847
7848 : check for fd_set items
7849 $cat <<EOM
7850
7851 Checking to see how well your C compiler handles fd_set and friends ...
7852 EOM
7853 $cat >fd_set.c <<EOCP
7854 #$i_systime I_SYS_TIME
7855 #$i_sysselct I_SYS_SELECT
7856 #$d_socket HAS_SOCKET
7857 #include <sys/types.h>
7858 #ifdef HAS_SOCKET
7859 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
7860 #endif
7861 #ifdef I_SYS_TIME
7862 #include <sys/time.h>
7863 #endif
7864 #ifdef I_SYS_SELECT
7865 #include <sys/select.h>
7866 #endif
7867 int main() {
7868         fd_set fds;
7869
7870 #ifdef TRYBITS
7871         if(fds.fds_bits);
7872 #endif
7873
7874 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
7875         exit(0);
7876 #else
7877         exit(1);
7878 #endif
7879 }
7880 EOCP
7881 set fd_set -DTRYBITS
7882 if eval $compile; then
7883         d_fds_bits="$define"
7884         d_fd_set="$define"
7885         echo "Well, your system knows about the normal fd_set typedef..." >&4
7886         if ./fd_set; then
7887                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
7888                 d_fd_macros="$define"
7889         else
7890                 $cat >&4 <<'EOM'
7891 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
7892 EOM
7893                 d_fd_macros="$undef"
7894         fi
7895 else
7896         $cat <<'EOM'
7897 Hmm, your compiler has some difficulty with fd_set.  Checking further...
7898 EOM
7899         set fd_set
7900         if eval $compile; then
7901                 d_fds_bits="$undef"
7902                 d_fd_set="$define"
7903                 echo "Well, your system has some sort of fd_set available..." >&4
7904                 if ./fd_set; then
7905                         echo "and you have the normal fd_set macros." >&4
7906                         d_fd_macros="$define"
7907                 else
7908                         $cat <<'EOM'
7909 but not the normal fd_set macros!  Gross!  More work for me...
7910 EOM
7911                         d_fd_macros="$undef"
7912                 fi
7913         else
7914         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
7915                 d_fd_set="$undef"
7916                 d_fds_bits="$undef"
7917                 d_fd_macros="$undef"
7918         fi
7919 fi
7920 $rm -f fd_set*
7921
7922 : see if fgetpos exists
7923 set fgetpos d_fgetpos
7924 eval $inlibc
7925
7926
7927 if $test X"$use64bits" = X"$define"; then
7928         : see if fgetpos64 exists
7929         set fgetpos64 d_fgetpos64
7930         eval $inlibc
7931
7932         : see if fopen64 exists
7933         set freopen64 d_fopen64
7934         eval $inlibc
7935
7936         : see if freopen64 exists
7937         set freopen64 d_freopen64
7938         eval $inlibc
7939
7940         : see if fseek64 exists
7941         set fseek64 d_fseek64
7942         eval $inlibc
7943
7944         : see if fseeko64 exists
7945         set fseeko64 d_fseeko64
7946         eval $inlibc
7947
7948         : see if fsetpos64 exists
7949         set fsetpos64 d_fsetpos64
7950         eval $inlibc
7951
7952         : see if ftell64 exists
7953         set ftell64 d_ftell64
7954         eval $inlibc
7955
7956         : see if ftello64 exists
7957         set ftello64 d_ftello64
7958         eval $inlibc
7959
7960         : see if tmpfile64 exists
7961         set tmpfile64 d_tmpfile64
7962         eval $inlibc
7963 else
7964         val="$undef"
7965         for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
7966         do
7967                 set $xxx
7968                 eval $setvar
7969         done
7970 fi
7971
7972 : see if flock exists
7973 set flock d_flock
7974 eval $inlibc
7975
7976 : see if fork exists
7977 set fork d_fork
7978 eval $inlibc
7979
7980 : see if pathconf exists
7981 set pathconf d_pathconf
7982 eval $inlibc
7983
7984 : see if fpathconf exists
7985 set fpathconf d_fpathconf
7986 eval $inlibc
7987
7988 : see if fseeko exists
7989 set fseeko d_fseeko
7990 eval $inlibc
7991
7992 : see if fsetpos exists
7993 set fsetpos d_fsetpos
7994 eval $inlibc
7995
7996 : see if this is a sys/param system
7997 set sys/param.h i_sysparam
7998 eval $inhdr
7999
8000 : see if this is a sys/mount.h system
8001 set sys/mount.h i_sysmount
8002 eval $inhdr
8003
8004
8005 : see if statfs exists
8006 set statfs d_statfs
8007 eval $inlibc
8008
8009 : see if fstatfs exists
8010 set fstatfs d_fstatfs
8011 eval $inlibc
8012
8013 : see if statfs knows about mount flags
8014 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8015 eval $hasfield
8016
8017
8018 : see if statvfs exists
8019 set statvfs d_statvfs
8020 eval $inlibc
8021
8022 : see if fstatvfs exists
8023 set fstatvfs d_fstatvfs
8024 eval $inlibc
8025
8026
8027 : see if ftello exists
8028 set ftello d_ftello
8029 eval $inlibc
8030
8031 : see if getgrent exists
8032 set getgrent d_getgrent
8033 eval $inlibc
8034
8035 : see if gethostbyaddr exists
8036 set gethostbyaddr d_gethbyaddr
8037 eval $inlibc
8038
8039 : see if gethostbyname exists
8040 set gethostbyname d_gethbyname
8041 eval $inlibc
8042
8043 : see if gethostent exists
8044 set gethostent d_gethent
8045 eval $inlibc
8046
8047 : see how we will look up host name
8048 echo " "
8049 if false; then
8050         : dummy stub to allow use of elif
8051 elif set gethostname val -f d_gethname; eval $csym; $val; then
8052         echo 'gethostname() found.' >&4
8053         d_gethname="$define"
8054         call=gethostname
8055 elif set uname val -f d_uname; eval $csym; $val; then
8056         if ./xenix; then
8057                 $cat <<'EOM'
8058 uname() was found, but you're running xenix, and older versions of xenix
8059 have a broken uname(). If you don't really know whether your xenix is old
8060 enough to have a broken system call, use the default answer.
8061
8062 EOM
8063                 dflt=y
8064                 case "$d_uname" in
8065                 "$define") dflt=n;;
8066                 esac
8067                 rp='Is your uname() broken?'
8068                 . ./myread
8069                 case "$ans" in
8070                 n*) d_uname="$define"; call=uname;;
8071                 esac
8072         else
8073                 echo 'uname() found.' >&4
8074                 d_uname="$define"
8075                 call=uname
8076         fi
8077 fi
8078 case "$d_gethname" in
8079 '') d_gethname="$undef";;
8080 esac
8081 case "$d_uname" in
8082 '') d_uname="$undef";;
8083 esac
8084 case "$d_uname$d_gethname" in
8085 *define*)
8086         dflt=n
8087         cat <<EOM
8088  
8089 Every now and then someone has a $call() that lies about the hostname
8090 but can't be fixed for political or economic reasons.  If you wish, I can
8091 pretend $call() isn't there and maybe compute hostname at run-time
8092 thanks to the '$phostname' command.
8093
8094 EOM
8095         rp="Shall I ignore $call() from now on?"
8096         . ./myread
8097         case "$ans" in
8098         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8099         esac;;
8100 esac
8101 case "$phostname" in
8102 '') aphostname='';;
8103 *) case "$aphostname" in
8104         /*) ;;
8105         *) set X $phostname
8106                 shift
8107                 file=$1
8108                 shift
8109                 file=`./loc $file $file $pth`
8110                 aphostname=`echo $file $*`
8111                 ;;
8112         esac
8113         ;;
8114 esac
8115 case "$d_uname$d_gethname" in
8116 *define*) ;;
8117 *)
8118         case "$phostname" in
8119         '')
8120                 echo "There will be no way for $package to get your hostname." >&4;;
8121         *)
8122         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8123                 ;;
8124         esac;;
8125 esac
8126 case "$d_phostname" in
8127 '') d_phostname="$undef";;
8128 esac
8129
8130 : see if this is a netdb.h system
8131 set netdb.h i_netdb
8132 eval $inhdr
8133
8134 : see if prototypes for various gethostxxx netdb.h functions are available
8135 echo " "
8136 set d_gethostprotos gethostent $i_netdb netdb.h
8137 eval $hasproto
8138
8139 : see if getlogin exists
8140 set getlogin d_getlogin
8141 eval $inlibc
8142
8143 : see if getnetbyaddr exists
8144 set getnetbyaddr d_getnbyaddr
8145 eval $inlibc
8146
8147 : see if getnetbyname exists
8148 set getnetbyname d_getnbyname
8149 eval $inlibc
8150
8151 : see if getnetent exists
8152 set getnetent d_getnent
8153 eval $inlibc
8154
8155 : see if prototypes for various getnetxxx netdb.h functions are available
8156 echo " "
8157 set d_getnetprotos getnetent $i_netdb netdb.h
8158 eval $hasproto
8159
8160
8161 : see if getprotobyname exists
8162 set getprotobyname d_getpbyname
8163 eval $inlibc
8164
8165 : see if getprotobynumber exists
8166 set getprotobynumber d_getpbynumber
8167 eval $inlibc
8168
8169 : see if getprotoent exists
8170 set getprotoent d_getpent
8171 eval $inlibc
8172
8173 : see if getpgid exists
8174 set getpgid d_getpgid
8175 eval $inlibc
8176
8177 : see if getpgrp2 exists
8178 set getpgrp2 d_getpgrp2
8179 eval $inlibc
8180
8181 : see if getppid exists
8182 set getppid d_getppid
8183 eval $inlibc
8184
8185 : see if getpriority exists
8186 set getpriority d_getprior
8187 eval $inlibc
8188
8189 : see if prototypes for various getprotoxxx netdb.h functions are available
8190 echo " "
8191 set d_getprotoprotos getprotoent $i_netdb netdb.h
8192 eval $hasproto
8193
8194 : see if getpwent exists
8195 set getpwent d_getpwent
8196 eval $inlibc
8197
8198
8199 : see if getservbyname exists
8200 set getservbyname d_getsbyname
8201 eval $inlibc
8202
8203 : see if getservbyport exists
8204 set getservbyport d_getsbyport
8205 eval $inlibc
8206
8207 : see if getservent exists
8208 set getservent d_getsent
8209 eval $inlibc
8210
8211 : see if prototypes for various getservxxx netdb.h functions are available
8212 echo " "
8213 set d_getservprotos getservent $i_netdb netdb.h
8214 eval $hasproto
8215
8216 : see if gettimeofday or ftime exists
8217 set gettimeofday d_gettimeod
8218 eval $inlibc
8219 case "$d_gettimeod" in
8220 "$undef")
8221         set ftime d_ftime 
8222         eval $inlibc
8223         ;;
8224 *)
8225         val="$undef"; set d_ftime; eval $setvar
8226         ;;
8227 esac
8228 case "$d_gettimeod$d_ftime" in
8229 "$undef$undef")
8230         echo " "
8231         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8232         ;;
8233 esac
8234
8235 : see if this is an grp system
8236 set grp.h i_grp
8237 eval $inhdr
8238
8239 case "$i_grp" in
8240 $define)
8241         xxx=`./findhdr grp.h`
8242         $cppstdin $cppflags $cppminus < $xxx >$$.h
8243
8244         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8245                 val="$define"
8246         else
8247                 val="$undef"
8248         fi
8249         set d_grpasswd
8250         eval $setvar
8251
8252         $rm -f $$.h
8253         ;;
8254 *)
8255         val="$undef";
8256         set d_grpasswd; eval $setvar
8257         ;;
8258 esac
8259
8260 : see if this is a netinet/in.h or sys/in.h system
8261 set netinet/in.h i_niin sys/in.h i_sysin
8262 eval $inhdr
8263
8264 : see if arpa/inet.h has to be included
8265 set arpa/inet.h i_arpainet
8266 eval $inhdr
8267
8268 : see if htonl --and friends-- exists
8269 val=''
8270 set htonl val
8271 eval $inlibc
8272
8273 : Maybe they are macros.
8274 case "$val" in
8275 $undef)
8276         $cat >htonl.c <<EOM
8277 #include <stdio.h>
8278 #include <sys/types.h>
8279 #$i_niin I_NETINET_IN
8280 #$i_sysin I_SYS_IN
8281 #$i_arpainet I_ARPA_INET
8282 #ifdef I_NETINET_IN
8283 #include <netinet/in.h>
8284 #endif
8285 #ifdef I_SYS_IN
8286 #include <sys/in.h>
8287 #endif
8288 #ifdef I_ARPA_INET
8289 #include <arpa/inet.h>
8290 #endif
8291 #ifdef htonl
8292 printf("Defined as a macro.");
8293 #endif
8294 EOM
8295         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8296         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8297                 val="$define"
8298                 echo "But it seems to be defined as a macro." >&4
8299         fi
8300         $rm -f htonl.?
8301         ;;
8302 esac
8303 set d_htonl
8304 eval $setvar
8305
8306 : see which of string.h or strings.h is needed
8307 echo " "
8308 strings=`./findhdr string.h`
8309 if $test "$strings" && $test -r "$strings"; then
8310         echo "Using <string.h> instead of <strings.h>." >&4
8311         val="$define"
8312 else
8313         val="$undef"
8314         strings=`./findhdr strings.h`
8315         if $test "$strings" && $test -r "$strings"; then
8316                 echo "Using <strings.h> instead of <string.h>." >&4
8317         else
8318                 echo "No string header found -- You'll surely have problems." >&4
8319         fi
8320 fi
8321 set i_string
8322 eval $setvar
8323 case "$i_string" in
8324 "$undef") strings=`./findhdr strings.h`;;
8325 *)        strings=`./findhdr string.h`;;
8326 esac
8327
8328 : index or strchr
8329 echo " "
8330 if set index val -f; eval $csym; $val; then
8331         if set strchr val -f d_strchr; eval $csym; $val; then
8332                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8333                         val="$define"
8334                         vali="$undef"
8335                         echo "strchr() found." >&4
8336                 else
8337                         val="$undef"
8338                         vali="$define"
8339                         echo "index() found." >&4
8340                 fi
8341         else
8342                 val="$undef"
8343                 vali="$define"
8344                 echo "index() found." >&4
8345         fi
8346 else
8347         if set strchr val -f d_strchr; eval $csym; $val; then
8348                 val="$define"
8349                 vali="$undef"
8350                 echo "strchr() found." >&4
8351         else
8352                 echo "No index() or strchr() found!" >&4
8353                 val="$undef"
8354                 vali="$undef"
8355         fi
8356 fi
8357 set d_strchr; eval $setvar
8358 val="$vali"
8359 set d_index; eval $setvar
8360
8361 : check whether inet_aton exists
8362 set inet_aton d_inetaton
8363 eval $inlibc
8364
8365 : see if inttypes.h is available
8366 : we want a real compile instead of Inhdr because some systems
8367 : have an inttypes.h which includes non-existent headers
8368 echo " "
8369 $cat >try.c <<EOCP
8370 #include <inttypes.h>
8371 int main() {
8372         static int32_t foo32 = 0x12345678;
8373 }
8374 EOCP
8375 set try
8376 if eval $compile; then
8377         echo "<inttypes.h> found." >&4
8378         val="$define"
8379 else
8380         echo "<inttypes.h> NOT found." >&4
8381         val="$undef"
8382 fi
8383 $rm -f try.c try
8384 set i_inttypes
8385 eval $setvar
8386
8387 : check for int64_t
8388 case "$use64bits" in
8389 "$define" )
8390         echo " "
8391         echo $n "Checking to see if your system supports int64_t...$c" >&4
8392         $cat >try.c <<EOCP
8393 #include <sys/types.h>
8394 #$i_inttypes I_INTTYPES
8395 #ifdef I_INTTYPES
8396 #include <inttypes.h>
8397 #endif
8398 int64_t foo() { int64_t x; x = 7; return x; }
8399 EOCP
8400         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8401                 val="$define"
8402                 echo " Yup, it does." >&4
8403         else
8404                 val="$undef"
8405                 echo " Nope, it doesn't." >&4
8406         fi
8407         $rm -f try.*
8408         ;;
8409 *)      val="$undef"
8410         ;;
8411 esac
8412 set d_int64t
8413 eval $setvar
8414
8415
8416 : Look for isascii
8417 echo " "
8418 $cat >isascii.c <<'EOCP'
8419 #include <stdio.h>
8420 #include <ctype.h>
8421 int main() {
8422         int c = 'A';
8423         if (isascii(c))
8424                 exit(0);
8425         else
8426                 exit(1);
8427 }
8428 EOCP
8429 set isascii
8430 if eval $compile; then
8431         echo "isascii() found." >&4
8432         val="$define"
8433 else
8434         echo "isascii() NOT found." >&4
8435         val="$undef"
8436 fi
8437 set d_isascii
8438 eval $setvar
8439 $rm -f isascii*
8440
8441 : see if killpg exists
8442 set killpg d_killpg
8443 eval $inlibc
8444
8445 : see if lchown exists
8446 echo " "
8447 $cat > try.c <<'EOCP'
8448 /* System header to define __stub macros and hopefully few prototypes,
8449     which can conflict with char lchown(); below.  */
8450 #include <assert.h>
8451 /* Override any gcc2 internal prototype to avoid an error.  */
8452 /* We use char because int might match the return type of a gcc2
8453    builtin and then its argument prototype would still apply.  */
8454 char lchown();
8455 int main() {
8456     /*  The GNU C library defines this for functions which it implements
8457         to always fail with ENOSYS.  Some functions are actually named
8458         something starting with __ and the normal name is an alias.  */
8459 #if defined (__stub_lchown) || defined (__stub___lchown)
8460 choke me
8461 #else
8462 lchown();
8463 #endif
8464 ; return 0; }
8465 EOCP
8466 set try
8467 if eval $compile; then
8468     $echo "lchown() found." >&4
8469     val="$define"
8470 else
8471     $echo "lchown() NOT found." >&4
8472     val="$undef"
8473 fi
8474 set d_lchown
8475 eval $setvar
8476
8477 : see if link exists
8478 set link d_link
8479 eval $inlibc
8480
8481 : see if localeconv exists
8482 set localeconv d_locconv
8483 eval $inlibc
8484
8485 : see if lockf exists
8486 set lockf d_lockf
8487 eval $inlibc
8488
8489 : check for length of double
8490 echo " "
8491 case "$doublesize" in
8492 '')
8493         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
8494         $cat >try.c <<'EOCP'
8495 #include <stdio.h>
8496 int main()
8497 {
8498         printf("%d\n", sizeof(double));
8499 }
8500 EOCP
8501         set try
8502         if eval $compile_ok; then
8503                 doublesize=`./try`
8504                 $echo " $doublesize bytes." >&4
8505         else
8506                 dflt='8'
8507                 echo "(I can't seem to compile the test program.  Guessing...)"
8508                 rp="What is the size of a double precision number (in bytes)?"
8509                 . ./myread
8510                 doublesize="$ans"
8511         fi
8512         ;;
8513 esac
8514 $rm -f try.c try
8515
8516 : check for long doubles
8517 echo " "
8518 echo $n "Checking to see if your system supports long doubles...$c" >&4
8519 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
8520 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8521         val="$define"
8522         echo " Yup, it does." >&4
8523 else
8524         val="$undef"
8525         echo " Nope, it doesn't." >&4
8526 fi
8527 $rm try.*
8528 set d_longdbl
8529 eval $setvar
8530
8531 : check for length of long double
8532 case "${d_longdbl}${longdblsize}" in
8533 $define)
8534         echo " "
8535         $echo $n "Checking to see how big your long doubles are...$c" >&4
8536         $cat >try.c <<'EOCP'
8537 #include <stdio.h>
8538 int main()
8539 {
8540         printf("%d\n", sizeof(long double));
8541 }
8542 EOCP
8543         set try
8544         if eval $compile; then
8545                 longdblsize=`./try`
8546                 $echo " $longdblsize bytes." >&4
8547         else
8548                 dflt='8'
8549                 echo " "
8550                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
8551                 rp="What is the size of a long double (in bytes)?"
8552                 . ./myread
8553                 longdblsize="$ans"
8554         fi
8555         if $test "X$doublesize" = "X$longdblsize"; then
8556                 echo "(That isn't any different from an ordinary double.)"
8557         fi      
8558         ;;
8559 esac
8560 $rm -f try.c try
8561
8562 : check for long long
8563 echo " "
8564 echo $n "Checking to see if your system supports long long...$c" >&4
8565 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
8566 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8567         val="$define"
8568         echo " Yup, it does." >&4
8569 else
8570         val="$undef"
8571         echo " Nope, it doesn't." >&4
8572 fi
8573 $rm try.*
8574 set d_longlong
8575 eval $setvar
8576
8577 : check for length of long long
8578 case "${d_longlong}${longlongsize}" in
8579 $define)
8580         echo " "
8581         $echo $n "Checking to see how big your long longs are...$c" >&4
8582         $cat >try.c <<'EOCP'
8583 #include <stdio.h>
8584 int main()
8585 {
8586         printf("%d\n", sizeof(long long));
8587 }
8588 EOCP
8589         set try
8590         if eval $compile_ok; then
8591                 longlongsize=`./try`
8592                 $echo " $longlongsize bytes." >&4
8593         else
8594                 dflt='8'
8595                 echo " "
8596                 echo "(I can't seem to compile the test program.  Guessing...)"
8597                 rp="What is the size of a long long (in bytes)?"
8598                 . ./myread
8599                 longlongsize="$ans"
8600         fi
8601         if $test "X$longsize" = "X$longlongsize"; then
8602                 echo "(That isn't any different from an ordinary long.)"
8603         fi      
8604         ;;
8605 esac
8606 $rm -f try.c try
8607
8608 : see if lstat exists
8609 set lstat d_lstat
8610 eval $inlibc
8611
8612 : see if madvise exists
8613 set madvise d_madvise
8614 eval $inlibc
8615
8616 : see if mblen exists
8617 set mblen d_mblen
8618 eval $inlibc
8619
8620 : see if mbstowcs exists
8621 set mbstowcs d_mbstowcs
8622 eval $inlibc
8623
8624 : see if mbtowc exists
8625 set mbtowc d_mbtowc
8626 eval $inlibc
8627
8628 : see if memcmp exists
8629 set memcmp d_memcmp
8630 eval $inlibc
8631
8632 : see if memcpy exists
8633 set memcpy d_memcpy
8634 eval $inlibc
8635
8636 : see if memmove exists
8637 set memmove d_memmove
8638 eval $inlibc
8639
8640 : see if memset exists
8641 set memset d_memset
8642 eval $inlibc
8643
8644 : see if mkdir exists
8645 set mkdir d_mkdir
8646 eval $inlibc
8647
8648 : see if mkfifo exists
8649 set mkfifo d_mkfifo
8650 eval $inlibc
8651
8652 : see if mktime exists
8653 set mktime d_mktime
8654 eval $inlibc
8655
8656 : see if this is a sys/mman.h system
8657 set sys/mman.h i_sysmman
8658 eval $inhdr
8659
8660 : see if mmap exists
8661 set mmap d_mmap
8662 eval $inlibc
8663 : see what shmat returns
8664 : default to something harmless
8665 mmaptype='void *'
8666 case "$i_sysmman$d_mmap" in
8667 "$define$define")
8668         $cat >mmap.c <<'END'
8669 #include <sys/mman.h>
8670 void *mmap();
8671 END
8672         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
8673                 mmaptype='void *'
8674         else
8675                 mmaptype='caddr_t'
8676         fi
8677         echo "and it returns ($mmaptype)." >&4
8678         ;;
8679 esac
8680
8681
8682
8683 : see if mprotect exists
8684 set mprotect d_mprotect
8685 eval $inlibc
8686
8687 : see if msgctl exists
8688 set msgctl d_msgctl
8689 eval $inlibc
8690
8691 : see if msgget exists
8692 set msgget d_msgget
8693 eval $inlibc
8694
8695 : see if msgsnd exists
8696 set msgsnd d_msgsnd
8697 eval $inlibc
8698
8699 : see if msgrcv exists
8700 set msgrcv d_msgrcv
8701 eval $inlibc
8702
8703 : see how much of the 'msg*(2)' library is present.
8704 h_msg=true
8705 echo " "
8706 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
8707 *"$undef"*) h_msg=false;;
8708 esac
8709 case "$osname" in
8710 freebsd)
8711     case "`ipcs 2>&1`" in
8712     "SVID messages"*"not configured"*)
8713         echo "Your $osname does not have the msg*(2) configured." >&4
8714         h_msg=false
8715         val="$undef"
8716         set msgctl d_msgctl
8717         eval $setvar
8718         set msgget d_msgget
8719         eval $setvar
8720         set msgsnd d_msgsnd
8721         eval $setvar
8722         set msgrcv d_msgrcv
8723         eval $setvar
8724         ;;
8725     esac
8726     ;;
8727 esac
8728 : we could also check for sys/ipc.h ...
8729 if $h_msg && $test `./findhdr sys/msg.h`; then
8730         echo "You have the full msg*(2) library." >&4
8731         val="$define"
8732 else
8733         echo "You don't have the full msg*(2) library." >&4
8734         val="$undef"
8735 fi
8736 set d_msg
8737 eval $setvar
8738
8739 : see if msync exists
8740 set msync d_msync
8741 eval $inlibc
8742
8743 : see if munmap exists
8744 set munmap d_munmap
8745 eval $inlibc
8746
8747 : see if nice exists
8748 set nice d_nice
8749 eval $inlibc
8750
8751 : how to create joinable pthreads
8752 if test "X$usethreads" = "X$define"; then
8753         echo " "
8754         echo "Checking what constant to use for creating joinable pthreads..." >&4 
8755         $cat >try.c <<'EOCP'
8756 #include <pthread.h>
8757 int main() {
8758     int detachstate = JOINABLE;
8759 }
8760 EOCP
8761         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
8762         if eval $compile; then
8763                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&2
8764                 val="$undef" # Yes, undef.
8765                 set d_old_pthread_create_joinable
8766                 eval $setvar
8767                 val=""
8768                 set old_pthread_create_joinable
8769                 eval $setvar
8770         else
8771                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
8772                 if eval $compile; then
8773                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&2
8774                         val="$define"
8775                         set d_old_pthread_create_joinable
8776                         eval $setvar
8777                         val=PTHREAD_CREATE_UNDETACHED
8778                         set old_pthread_create_joinable
8779                         eval $setvar
8780                 else            
8781                         set try -DJOINABLE=__UNDETACHED
8782                         if eval $compile; then
8783                                 echo "You seem to use __UNDETACHED." >&2
8784                                 val="$define"
8785                                 set d_old_pthread_create_joinable
8786                                 eval $setvar
8787                                 val=__UNDETACHED
8788                                 set old_pthread_create_joinable
8789                                 eval $setvar
8790                         else
8791                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&2
8792                                 val="$define"
8793                                 set d_old_pthread_create_joinable
8794                                 eval $setvar
8795                                 val=0
8796                                 set old_pthread_create_joinable
8797                                 eval $setvar
8798                         fi
8799                 fi
8800         fi
8801         $rm -f try try.*
8802 else
8803     d_old_pthread_create_joinable="$undef"
8804     old_pthread_create_joinable=""
8805 fi
8806
8807 : see if pause exists
8808 set pause d_pause
8809 eval $inlibc
8810
8811 : see if pipe exists
8812 set pipe d_pipe
8813 eval $inlibc
8814
8815 : see if poll exists
8816 set poll d_poll
8817 eval $inlibc
8818
8819
8820 : see whether the various POSIXish _yields exist
8821 $cat >try.c <<EOP
8822 #include <pthread.h>
8823 #include <stdio.h>
8824 int main() {
8825 #ifdef SCHED_YIELD
8826         sched_yield();
8827 #else
8828 #ifdef PTHREAD_YIELD
8829         pthread_yield();
8830 #else
8831 #ifdef PTHREAD_YIELD_NULL
8832         pthread_yield(NULL);
8833 #endif
8834 #endif
8835 #endif
8836 }
8837 EOP
8838 : see if sched_yield exists
8839 set try -DSCHED_YIELD
8840 if eval $compile; then
8841     val="$define"
8842     sched_yield='sched_yield()'
8843 else
8844     val="$undef"
8845 fi
8846 case "$usethreads" in
8847 $define)
8848         case "$val" in
8849         $define) echo 'sched_yield() found.' >&4        ;;
8850         *)       echo 'sched_yield() NOT found.' >&4    ;;
8851         esac
8852 esac
8853 set d_sched_yield
8854 eval $setvar
8855
8856 : see if pthread_yield exists
8857 set try -DPTHREAD_YIELD
8858 if eval $compile; then
8859     val="$define"
8860     case "$sched_yield" in
8861     '') sched_yield='pthread_yield()' ;;
8862     esac
8863 else
8864     set try -DPTHREAD_YIELD_NULL
8865     if eval $compile; then
8866         val="$define"
8867         case "$sched_yield" in
8868         '') sched_yield='pthread_yield(NULL)' ;;
8869         esac
8870     else
8871         val="$undef"
8872     fi
8873 fi
8874 case "$usethreads" in
8875 $define)
8876         case "$val" in
8877         $define) echo 'pthread_yield() found.' >&4      ;;
8878         *)       echo 'pthread_yield() NOT found.' >&4  ;;
8879         esac
8880         ;;
8881 esac
8882 set d_pthread_yield
8883 eval $setvar
8884
8885 case "$sched_yield" in
8886 '') sched_yield=undef ;;
8887 esac
8888
8889 $rm -f try try.*
8890
8891 : see if this is a pwd.h system
8892 set pwd.h i_pwd
8893 eval $inhdr
8894
8895 case "$i_pwd" in
8896 $define)
8897         xxx=`./findhdr pwd.h`
8898         $cppstdin $cppflags $cppminus < $xxx >$$.h
8899
8900         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
8901                 val="$define"
8902         else
8903                 val="$undef"
8904         fi
8905         set d_pwquota
8906         eval $setvar
8907
8908         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
8909                 val="$define"
8910         else
8911                 val="$undef"
8912         fi
8913         set d_pwage
8914         eval $setvar
8915
8916         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
8917                 val="$define"
8918         else
8919                 val="$undef"
8920         fi
8921         set d_pwchange
8922         eval $setvar
8923
8924         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
8925                 val="$define"
8926         else
8927                 val="$undef"
8928         fi
8929         set d_pwclass
8930         eval $setvar
8931
8932         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
8933                 val="$define"
8934         else
8935                 val="$undef"
8936         fi
8937         set d_pwexpire
8938         eval $setvar
8939
8940         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
8941                 val="$define"
8942         else
8943                 val="$undef"
8944         fi
8945         set d_pwcomment
8946         eval $setvar
8947
8948         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
8949                 val="$define"
8950         else
8951                 val="$undef"
8952         fi
8953         set d_pwgecos
8954         eval $setvar
8955
8956         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
8957                 val="$define"
8958         else
8959                 val="$undef"
8960         fi
8961         set d_pwpasswd
8962         eval $setvar
8963
8964         $rm -f $$.h
8965         ;;
8966 *)
8967         val="$undef"; 
8968         set d_pwquota; eval $setvar
8969         set d_pwage; eval $setvar
8970         set d_pwchange; eval $setvar
8971         set d_pwclass; eval $setvar
8972         set d_pwexpire; eval $setvar
8973         set d_pwcomment; eval $setvar
8974         set d_pwgecos; eval $setvar
8975         set d_pwpasswd; eval $setvar
8976         ;;
8977 esac
8978
8979 : see if readdir and friends exist
8980 set readdir d_readdir
8981 eval $inlibc
8982 set seekdir d_seekdir
8983 eval $inlibc
8984 set telldir d_telldir
8985 eval $inlibc
8986 set rewinddir d_rewinddir
8987 eval $inlibc
8988
8989 : see if readlink exists
8990 set readlink d_readlink
8991 eval $inlibc
8992
8993 : see if readv exists
8994 set readv d_readv
8995 eval $inlibc
8996
8997 : see if rename exists
8998 set rename d_rename
8999 eval $inlibc
9000
9001 : see if rmdir exists
9002 set rmdir d_rmdir
9003 eval $inlibc
9004
9005 : see if memory.h is available.
9006 val=''
9007 set memory.h val
9008 eval $inhdr
9009
9010 : See if it conflicts with string.h
9011 case "$val" in
9012 $define)
9013         case "$strings" in
9014         '') ;;
9015         *)
9016                 $cppstdin $cppflags $cppminus < $strings > mem.h
9017                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9018                         echo " "
9019                         echo "We won't be including <memory.h>."
9020                         val="$undef"
9021                 fi
9022                 $rm -f mem.h
9023                 ;;
9024         esac
9025 esac
9026 set i_memory
9027 eval $setvar
9028
9029 : can bcopy handle overlapping blocks?
9030 val="$undef"
9031 case "$d_bcopy" in
9032 "$define")
9033         echo " "
9034         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9035         $cat >try.c <<EOCP
9036 #$i_memory I_MEMORY
9037 #$i_stdlib I_STDLIB
9038 #$i_string I_STRING
9039 #$i_unistd I_UNISTD
9040 EOCP
9041         $cat >>try.c <<'EOCP'
9042 #include <stdio.h>
9043 #ifdef I_MEMORY
9044 #  include <memory.h>
9045 #endif
9046 #ifdef I_STDLIB
9047 #  include <stdlib.h>
9048 #endif
9049 #ifdef I_STRING
9050 #  include <string.h>
9051 #else
9052 #  include <strings.h>
9053 #endif
9054 #ifdef I_UNISTD
9055 #  include <unistd.h>  /* Needed for NetBSD */
9056 #endif
9057 int main()
9058 {
9059 char buf[128], abc[128];
9060 char *b;
9061 int len;
9062 int off;
9063 int align;
9064
9065 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9066
9067 for (align = 7; align >= 0; align--) {
9068         for (len = 36; len; len--) {
9069                 b = buf+align;
9070                 bcopy(abc, b, len);
9071                 for (off = 1; off <= len; off++) {
9072                         bcopy(b, b+off, len);
9073                         bcopy(b+off, b, len);
9074                         if (bcmp(b, abc, len))
9075                                 exit(1);
9076                 }
9077         }
9078 }
9079 exit(0);
9080 }
9081 EOCP
9082         set try
9083         if eval $compile_ok; then
9084                 if ./try 2>/dev/null; then
9085                         echo "Yes, it can."
9086                         val="$define"
9087                 else
9088                         echo "It can't, sorry."
9089                         case "$d_memmove" in
9090                         "$define") echo "But that's Ok since you have memmove()." ;;
9091                         esac
9092                 fi
9093         else
9094                 echo "(I can't compile the test program, so we'll assume not...)"
9095                 case "$d_memmove" in
9096                 "$define") echo "But that's Ok since you have memmove()." ;;
9097                 esac
9098         fi
9099         ;;
9100 esac
9101 $rm -f try.* try core
9102 set d_safebcpy
9103 eval $setvar
9104
9105 : can memcpy handle overlapping blocks?
9106 val="$undef"
9107 case "$d_memcpy" in
9108 "$define")
9109         echo " "
9110         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9111         $cat >try.c <<EOCP
9112 #$i_memory I_MEMORY
9113 #$i_stdlib I_STDLIB
9114 #$i_string I_STRING
9115 #$i_unistd I_UNISTD
9116 EOCP
9117         $cat >>try.c <<'EOCP'
9118 #include <stdio.h>
9119 #ifdef I_MEMORY
9120 #  include <memory.h>
9121 #endif
9122 #ifdef I_STDLIB
9123 #  include <stdlib.h>
9124 #endif
9125 #ifdef I_STRING
9126 #  include <string.h>
9127 #else
9128 #  include <strings.h>
9129 #endif
9130 #ifdef I_UNISTD
9131 #  include <unistd.h>  /* Needed for NetBSD */
9132 #endif
9133 int main()
9134 {
9135 char buf[128], abc[128];
9136 char *b;
9137 int len;
9138 int off;
9139 int align;
9140
9141 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9142    try to store the string in read-only memory. */
9143 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9144
9145 for (align = 7; align >= 0; align--) {
9146         for (len = 36; len; len--) {
9147                 b = buf+align;
9148                 memcpy(b, abc, len);
9149                 for (off = 1; off <= len; off++) {
9150                         memcpy(b+off, b, len);
9151                         memcpy(b, b+off, len);
9152                         if (memcmp(b, abc, len))
9153                                 exit(1);
9154                 }
9155         }
9156 }
9157 exit(0);
9158 }
9159 EOCP
9160         set try
9161         if eval $compile_ok; then
9162                 if ./try 2>/dev/null; then
9163                         echo "Yes, it can."
9164                         val="$define"
9165                 else
9166                         echo "It can't, sorry."
9167                         case "$d_memmove" in
9168                         "$define") echo "But that's Ok since you have memmove()." ;;
9169                         esac
9170                 fi
9171         else
9172                 echo "(I can't compile the test program, so we'll assume not...)"
9173                 case "$d_memmove" in
9174                 "$define") echo "But that's Ok since you have memmove()." ;;
9175                 esac
9176         fi
9177         ;;
9178 esac
9179 $rm -f try.* try core
9180 set d_safemcpy
9181 eval $setvar
9182
9183 : can memcmp be trusted to compare relative magnitude?
9184 val="$undef"
9185 case "$d_memcmp" in
9186 "$define")
9187         echo " "
9188         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9189         $cat >try.c <<EOCP
9190 #$i_memory I_MEMORY
9191 #$i_stdlib I_STDLIB
9192 #$i_string I_STRING
9193 #$i_unistd I_UNISTD
9194 EOCP
9195         $cat >>try.c <<'EOCP'
9196 #include <stdio.h>
9197 #ifdef I_MEMORY
9198 #  include <memory.h>
9199 #endif
9200 #ifdef I_STDLIB
9201 #  include <stdlib.h>
9202 #endif
9203 #ifdef I_STRING
9204 #  include <string.h>
9205 #else
9206 #  include <strings.h>
9207 #endif
9208 #ifdef I_UNISTD
9209 #  include <unistd.h>  /* Needed for NetBSD */
9210 #endif
9211 int main()
9212 {
9213 char a = -1;
9214 char b = 0;
9215 if ((a < b) && memcmp(&a, &b, 1) < 0)
9216         exit(1);
9217 exit(0);
9218 }
9219 EOCP
9220         set try
9221         if eval $compile_ok; then
9222                 if ./try 2>/dev/null; then
9223                         echo "Yes, it can."
9224                         val="$define"
9225                 else
9226                         echo "No, it can't (it uses signed chars)."
9227                 fi
9228         else
9229                 echo "(I can't compile the test program, so we'll assume not...)"
9230         fi
9231         ;;
9232 esac
9233 $rm -f try.* try core
9234 set d_sanemcmp
9235 eval $setvar
9236
9237 : see if select exists
9238 set select d_select
9239 eval $inlibc
9240
9241 : see if semctl exists
9242 set semctl d_semctl
9243 eval $inlibc
9244
9245 : see if semget exists
9246 set semget d_semget
9247 eval $inlibc
9248
9249 : see if semop exists
9250 set semop d_semop
9251 eval $inlibc
9252
9253 : see how much of the 'sem*(2)' library is present.
9254 h_sem=true
9255 echo " "
9256 case "$d_semctl$d_semget$d_semop" in
9257 *"$undef"*) h_sem=false;;
9258 esac
9259 case "$osname" in
9260 freebsd)
9261     case "`ipcs 2>&1`" in
9262     "SVID messages"*"not configured"*)
9263         echo "Your $osname does not have the sem*(2) configured." >&4
9264         h_sem=false
9265         val="$undef"
9266         set semctl d_semctl
9267         eval $setvar
9268         set semget d_semget
9269         eval $setvar
9270         set semop d_semop
9271         eval $setvar
9272         ;;
9273     esac
9274     ;;
9275 esac
9276 : we could also check for sys/ipc.h ...
9277 if $h_sem && $test `./findhdr sys/sem.h`; then
9278         echo "You have the full sem*(2) library." >&4
9279         val="$define"
9280 else
9281         echo "You don't have the full sem*(2) library." >&4
9282         val="$undef"
9283 fi
9284 set d_sem
9285 eval $setvar
9286
9287 : see whether sys/sem.h defines union semun
9288 echo " "
9289 $cat > try.c <<'END'
9290 #include <sys/types.h>
9291 #include <sys/ipc.h>
9292 #include <sys/sem.h>
9293 int main () { union semun semun; semun.buf = 0; }
9294 END
9295 set try
9296 if eval $compile; then
9297     echo "You have union semun in <sys/sem.h>." >&4
9298     val="$define"
9299 else
9300     echo "You do not have union semun in <sys/sem.h>." >&4
9301     val="$undef"
9302 fi
9303 $rm -f try try.c try.h
9304 set d_union_semun
9305 eval $setvar
9306
9307 : see how to do semctl IPC_STAT
9308 case "$d_sem" in
9309 $define)
9310     : see whether semctl IPC_STAT can use union semun
9311     echo " "
9312     $cat > try.h <<END
9313 #ifndef S_IRUSR
9314 #   ifdef S_IREAD
9315 #       define S_IRUSR S_IREAD
9316 #       define S_IWUSR S_IWRITE
9317 #       define S_IXUSR S_IEXEC
9318 #   else
9319 #       define S_IRUSR 0400
9320 #       define S_IWUSR 0200
9321 #       define S_IXUSR 0100
9322 #   endif
9323 #   define S_IRGRP (S_IRUSR>>3)
9324 #   define S_IWGRP (S_IWUSR>>3)
9325 #   define S_IXGRP (S_IXUSR>>3)
9326 #   define S_IROTH (S_IRUSR>>6)
9327 #   define S_IWOTH (S_IWUSR>>6)
9328 #   define S_IXOTH (S_IXUSR>>6)
9329 #endif
9330 #ifndef S_IRWXU
9331 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9332 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9333 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9334 #endif
9335 END
9336
9337     $cat > try.c <<END
9338 #include <sys/types.h>
9339 #include <sys/ipc.h>
9340 #include <sys/sem.h>
9341 #include <sys/stat.h>
9342 #include <stdio.h>
9343 #include <errno.h>
9344 #include "try.h"
9345 #ifndef errno
9346 extern int errno;
9347 #endif
9348 #$d_union_semun HAS_UNION_SEMUN
9349 int main() {
9350     union semun
9351 #ifndef HAS_UNION_SEMUN
9352     {
9353         int val;
9354         struct semid_ds *buf;
9355         unsigned short *array;
9356     }
9357 #endif
9358     arg;
9359     int sem, st;
9360
9361 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9362     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9363     if (sem > -1) {
9364         struct semid_ds argbuf;
9365         arg.buf = &argbuf;
9366 #       ifdef IPC_STAT
9367         st = semctl(sem, 0, IPC_STAT, arg);
9368         if (st == 0)
9369             printf("semun\n");
9370         else
9371 #       endif /* IPC_STAT */
9372             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9373 #       ifdef IPC_RMID
9374         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9375 #       endif /* IPC_RMID */
9376             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9377     } else
9378 #endif /* IPC_PRIVATE && ... */
9379         printf("semget failed: errno = %d\n", errno);
9380   return 0;
9381 }
9382 END
9383     val="$undef"
9384     set try
9385     if eval $compile; then
9386         xxx=`./try`
9387         case "$xxx" in
9388         semun) val="$define" ;;
9389         esac
9390     fi
9391     $rm -f try try.c
9392     set d_semctl_semun
9393     eval $setvar
9394     case "$d_semctl_semun" in
9395     $define)
9396         echo "You can use union semun for semctl IPC_STAT." >&4
9397         also='also'
9398         ;;
9399     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9400         also=''
9401         ;;
9402     esac
9403
9404     : see whether semctl IPC_STAT can use struct semid_ds pointer
9405     $cat > try.c <<'END'
9406 #include <sys/types.h>
9407 #include <sys/ipc.h>
9408 #include <sys/sem.h>
9409 #include <sys/stat.h>
9410 #include "try.h"
9411 #include <stdio.h>
9412 #include <errno.h>
9413 #ifndef errno
9414 extern int errno;
9415 #endif
9416 int main() {
9417     struct semid_ds arg;
9418     int sem, st;
9419
9420 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9421     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9422     if (sem > -1) {
9423 #       ifdef IPC_STAT
9424         st = semctl(sem, 0, IPC_STAT, &arg);
9425         if (st == 0)
9426             printf("semid_ds\n");
9427         else
9428 #       endif /* IPC_STAT */
9429             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9430 #       ifdef IPC_RMID
9431         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9432 #       endif /* IPC_RMID */
9433             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9434     } else
9435 #endif /* IPC_PRIVATE && ... */
9436         printf("semget failed: errno = %d\n", errno);
9437
9438     return 0;
9439 }
9440 END
9441     val="$undef"
9442     set try
9443     if eval $compile; then
9444         xxx=`./try`
9445         case "$xxx" in
9446         semid_ds) val="$define" ;;
9447         esac
9448     fi
9449     $rm -f try try.c
9450     set d_semctl_semid_ds
9451     eval $setvar
9452     case "$d_semctl_semid_ds" in
9453     $define)
9454         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9455         ;;
9456     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9457         ;;
9458     esac
9459     $rm -f try.h
9460     ;;
9461 *)  val="$undef"
9462
9463     # We do not have the full sem*(2) library, so assume we can not
9464     # use either.
9465
9466     set d_semctl_semun
9467     eval $setvar
9468
9469     set d_semctl_semid_ds
9470     eval $setvar
9471     ;;
9472 esac
9473
9474 : see if setegid exists
9475 set setegid d_setegid
9476 eval $inlibc
9477
9478 : see if seteuid exists
9479 set seteuid d_seteuid
9480 eval $inlibc
9481
9482 : see if setgrent exists
9483 set setgrent d_setgrent
9484 eval $inlibc
9485
9486 : see if sethostent exists
9487 set sethostent d_sethent
9488 eval $inlibc
9489
9490 : see if setlinebuf exists
9491 set setlinebuf d_setlinebuf
9492 eval $inlibc
9493
9494 : see if setlocale exists
9495 set setlocale d_setlocale
9496 eval $inlibc
9497
9498 : see if setnetent exists
9499 set setnetent d_setnent
9500 eval $inlibc
9501
9502 : see if setprotoent exists
9503 set setprotoent d_setpent
9504 eval $inlibc
9505
9506 : see if setpgid exists
9507 set setpgid d_setpgid
9508 eval $inlibc
9509
9510 : see if setpgrp2 exists
9511 set setpgrp2 d_setpgrp2
9512 eval $inlibc
9513
9514 : see if setpriority exists
9515 set setpriority d_setprior
9516 eval $inlibc
9517
9518 : see if setpwent exists
9519 set setpwent d_setpwent
9520 eval $inlibc
9521
9522 : see if setregid exists
9523 set setregid d_setregid
9524 eval $inlibc
9525 set setresgid d_setresgid
9526 eval $inlibc
9527
9528 : see if setreuid exists
9529 set setreuid d_setreuid
9530 eval $inlibc
9531 set setresuid d_setresuid
9532 eval $inlibc
9533
9534 : see if setrgid exists
9535 set setrgid d_setrgid
9536 eval $inlibc
9537
9538 : see if setruid exists
9539 set setruid d_setruid
9540 eval $inlibc
9541
9542 : see if setservent exists
9543 set setservent d_setsent
9544 eval $inlibc
9545
9546 : see if setsid exists
9547 set setsid d_setsid
9548 eval $inlibc
9549
9550 : see if setvbuf exists
9551 set setvbuf d_setvbuf
9552 eval $inlibc
9553
9554 : see if sfio.h is available
9555 set sfio.h i_sfio
9556 eval $inhdr
9557
9558
9559 : see if sfio library is available
9560 case "$i_sfio" in
9561 $define)
9562         val=''
9563         set sfreserve val
9564         eval $inlibc
9565         ;;
9566 *)
9567         val="$undef"
9568         ;;
9569 esac
9570 : Ok, but do we want to use it.
9571 case "$val" in
9572 $define)
9573         case "$usesfio" in
9574         true|$define|[yY]*) dflt='y';;
9575         *) dflt='n';;
9576         esac
9577         echo "$package can use the sfio library, but it is experimental."
9578         rp="You seem to have sfio available, do you want to try using it?"
9579         . ./myread
9580         case "$ans" in
9581         y|Y) ;;
9582         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
9583                 val="$undef"
9584                 : Remove sfio from list of libraries to use
9585                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
9586                 shift
9587                 libs="$*"
9588                 echo "libs = $libs" >&4
9589                 ;;
9590         esac
9591         ;;
9592 *)      case "$usesfio" in
9593         true|$define|[yY]*)
9594                 echo "Sorry, cannot find sfio on this machine" >&4
9595                 echo "Ignoring your setting of usesfio=$usesfio" >&4
9596                 ;;
9597         esac
9598         ;;
9599 esac
9600 set d_sfio
9601 eval $setvar
9602 case "$d_sfio" in
9603 $define) usesfio='true';;
9604 *) usesfio='false';;
9605 esac
9606
9607 : see if shmctl exists
9608 set shmctl d_shmctl
9609 eval $inlibc
9610
9611 : see if shmget exists
9612 set shmget d_shmget
9613 eval $inlibc
9614
9615 : see if shmat exists
9616 set shmat d_shmat
9617 eval $inlibc
9618 : see what shmat returns
9619 case "$d_shmat" in
9620 "$define")
9621         $cat >shmat.c <<'END'
9622 #include <sys/shm.h>
9623 void *shmat();
9624 END
9625         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
9626                 shmattype='void *'
9627         else
9628                 shmattype='char *'
9629         fi
9630         echo "and it returns ($shmattype)." >&4
9631         : see if a prototype for shmat is available
9632         xxx=`./findhdr sys/shm.h`
9633         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
9634         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
9635                 val="$define"
9636         else
9637                 val="$undef"
9638         fi
9639         $rm -f shmat.[co]
9640         ;;
9641 *)
9642         val="$undef"
9643         ;;
9644 esac
9645 set d_shmatprototype
9646 eval $setvar
9647
9648 : see if shmdt exists
9649 set shmdt d_shmdt
9650 eval $inlibc
9651
9652 : see how much of the 'shm*(2)' library is present.
9653 h_shm=true
9654 echo " "
9655 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
9656 *"$undef"*) h_shm=false;;
9657 esac
9658 case "$osname" in
9659 freebsd)
9660     case "`ipcs 2>&1`" in
9661     "SVID shared memory"*"not configured"*)
9662         echo "Your $osname does not have the shm*(2) configured." >&4
9663         h_shm=false
9664         val="$undef"
9665         set shmctl d_shmctl
9666         evat $setvar
9667         set shmget d_shmget
9668         evat $setvar
9669         set shmat d_shmat
9670         evat $setvar
9671         set shmdt d_shmdt
9672         evat $setvar
9673         ;;
9674     esac
9675     ;;
9676 esac
9677 : we could also check for sys/ipc.h ...
9678 if $h_shm && $test `./findhdr sys/shm.h`; then
9679         echo "You have the full shm*(2) library." >&4
9680         val="$define"
9681 else
9682         echo "You don't have the full shm*(2) library." >&4
9683         val="$undef"
9684 fi
9685 set d_shm
9686 eval $setvar
9687
9688 echo " "
9689 : see if we have sigaction
9690 if set sigaction val -f d_sigaction; eval $csym; $val; then
9691         echo 'sigaction() found.' >&4
9692         $cat > try.c <<'EOP'
9693 #include <stdio.h>
9694 #include <sys/types.h>
9695 #include <signal.h>
9696 int main()
9697 {
9698     struct sigaction act, oact;
9699 }
9700 EOP
9701         set try
9702         if eval $compile_ok; then
9703                 val="$define"
9704         else
9705                 echo "But you don't seem to have a useable struct sigaction." >&4
9706                 val="$undef"
9707         fi
9708 else
9709         echo 'sigaction NOT found.' >&4
9710         val="$undef"
9711 fi
9712 set d_sigaction; eval $setvar
9713 $rm -f try try$_o try.c
9714
9715 : see if sigsetjmp exists
9716 echo " "
9717 case "$d_sigsetjmp" in
9718 '')
9719         $cat >try.c <<'EOP'
9720 #include <setjmp.h>
9721 sigjmp_buf env;
9722 int set = 1;
9723 int main()
9724 {
9725         if (sigsetjmp(env,1))
9726                 exit(set);
9727         set = 0;
9728         siglongjmp(env, 1);
9729         exit(1);
9730 }
9731 EOP
9732         set try
9733         if eval $compile; then
9734                 if ./try >/dev/null 2>&1; then
9735                         echo "POSIX sigsetjmp found." >&4
9736                         val="$define"
9737                 else
9738                         $cat >&4 <<EOM
9739 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
9740 I'll ignore them.
9741 EOM
9742                         val="$undef"
9743                 fi
9744         else
9745                 echo "sigsetjmp not found." >&4
9746                 val="$undef"
9747         fi
9748         ;;
9749 *) val="$d_sigsetjmp"
9750         case "$d_sigsetjmp" in
9751         $define) echo "POSIX sigsetjmp found." >&4;;
9752         $undef) echo "sigsetjmp not found." >&4;;
9753         esac
9754         ;;
9755 esac
9756 set d_sigsetjmp
9757 eval $setvar
9758 $rm -f try.c try
9759
9760 : see if stat knows about block sizes
9761 echo " "
9762 set d_statblks stat st_blocks $i_sysstat sys/stat.h
9763 eval $hasfield
9764
9765 : see if _ptr and _cnt from stdio act std
9766 echo " "
9767 if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
9768         echo "(Looks like you have stdio.h from Linux.)"
9769         case "$stdio_ptr" in
9770         '') stdio_ptr='((fp)->_IO_read_ptr)'
9771                 ptr_lval=$define
9772                 ;;
9773         *)      ptr_lval=$d_stdio_ptr_lval;;
9774         esac
9775         case "$stdio_cnt" in
9776         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
9777                 cnt_lval=$undef
9778                 ;;
9779         *)      cnt_lval=$d_stdio_cnt_lval;;
9780         esac
9781         case "$stdio_base" in
9782         '') stdio_base='((fp)->_IO_read_base)';;
9783         esac
9784         case "$stdio_bufsiz" in
9785         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
9786         esac
9787 else
9788         case "$stdio_ptr" in
9789         '') stdio_ptr='((fp)->_ptr)'
9790                 ptr_lval=$define
9791                 ;;
9792         *)      ptr_lval=$d_stdio_ptr_lval;;
9793         esac
9794         case "$stdio_cnt" in
9795         '') stdio_cnt='((fp)->_cnt)'
9796                 cnt_lval=$define
9797                 ;;
9798         *)      cnt_lval=$d_stdio_cnt_lval;;
9799         esac
9800         case "$stdio_base" in
9801         '') stdio_base='((fp)->_base)';;
9802         esac
9803         case "$stdio_bufsiz" in
9804         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
9805         esac
9806 fi
9807 : test whether _ptr and _cnt really work
9808 echo "Checking how std your stdio is..." >&4
9809 $cat >try.c <<EOP
9810 #include <stdio.h>
9811 #define FILE_ptr(fp)    $stdio_ptr
9812 #define FILE_cnt(fp)    $stdio_cnt
9813 int main() {
9814         FILE *fp = fopen("try.c", "r");
9815         char c = getc(fp);
9816         if (
9817                 18 <= FILE_cnt(fp) &&
9818                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
9819         )
9820                 exit(0);
9821         exit(1);
9822 }
9823 EOP
9824 val="$undef"
9825 set try
9826 if eval $compile; then
9827         if ./try; then
9828                 echo "Your stdio acts pretty std."
9829                 val="$define"
9830         else
9831                 echo "Your stdio isn't very std."
9832         fi
9833 else
9834         echo "Your stdio doesn't appear very std."
9835 fi
9836 $rm -f try.c try
9837 set d_stdstdio
9838 eval $setvar
9839
9840 : Can _ptr be used as an lvalue?
9841 case "$d_stdstdio$ptr_lval" in
9842 $define$define) val=$define ;;
9843 *) val=$undef ;;
9844 esac
9845 set d_stdio_ptr_lval
9846 eval $setvar
9847
9848 : Can _cnt be used as an lvalue?
9849 case "$d_stdstdio$cnt_lval" in
9850 $define$define) val=$define ;;
9851 *) val=$undef ;;
9852 esac
9853 set d_stdio_cnt_lval
9854 eval $setvar
9855
9856 : see if _base is also standard
9857 val="$undef"
9858 case "$d_stdstdio" in
9859 $define)
9860         $cat >try.c <<EOP
9861 #include <stdio.h>
9862 #define FILE_base(fp)   $stdio_base
9863 #define FILE_bufsiz(fp) $stdio_bufsiz
9864 int main() {
9865         FILE *fp = fopen("try.c", "r");
9866         char c = getc(fp);
9867         if (
9868                 19 <= FILE_bufsiz(fp) &&
9869                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
9870         )
9871                 exit(0);
9872         exit(1);
9873 }
9874 EOP
9875         set try
9876         if eval $compile; then
9877                 if ./try; then
9878                         echo "And its _base field acts std."
9879                         val="$define"
9880                 else
9881                         echo "But its _base field isn't std."
9882                 fi
9883         else
9884                 echo "However, it seems to be lacking the _base field."
9885         fi
9886         $rm -f try.c try
9887         ;;
9888 esac
9889 set d_stdiobase
9890 eval $setvar
9891
9892 : see if strcoll exists
9893 set strcoll d_strcoll
9894 eval $inlibc
9895
9896 : check for structure copying
9897 echo " "
9898 echo "Checking to see if your C compiler can copy structs..." >&4
9899 $cat >try.c <<'EOCP'
9900 int main()
9901 {
9902         struct blurfl {
9903                 int dyick;
9904         } foo, bar;
9905
9906         foo = bar;
9907 }
9908 EOCP
9909 if $cc -c try.c >/dev/null 2>&1 ; then
9910         val="$define"
9911         echo "Yup, it can."
9912 else
9913         val="$undef"
9914         echo "Nope, it can't."
9915 fi
9916 set d_strctcpy
9917 eval $setvar
9918 $rm -f try.*
9919
9920 : see if strerror and/or sys_errlist[] exist
9921 echo " "
9922 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
9923     if set strerror val -f d_strerror; eval $csym; $val; then
9924                 echo 'strerror() found.' >&4
9925                 d_strerror="$define"
9926                 d_strerrm='strerror(e)'
9927                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
9928                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
9929                         d_syserrlst="$define"
9930                 else
9931                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
9932                         d_syserrlst="$undef"
9933                 fi
9934     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
9935                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
9936                 echo 'strerror() found in string header.' >&4
9937                 d_strerror="$define"
9938                 d_strerrm='strerror(e)'
9939                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
9940                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
9941                                 d_syserrlst="$define"
9942                 else
9943                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
9944                         d_syserrlst="$undef"
9945                 fi
9946     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
9947                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
9948                 d_strerror="$undef"
9949                 d_syserrlst="$define"
9950                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
9951     else
9952                 echo 'strerror() and sys_errlist[] NOT found.' >&4
9953                 d_strerror="$undef"
9954                 d_syserrlst="$undef"
9955                 d_strerrm='"unknown"'
9956     fi
9957 fi
9958
9959 : see if strtod exists
9960 set strtod d_strtod
9961 eval $inlibc
9962
9963 : see if strtol exists
9964 set strtol d_strtol
9965 eval $inlibc
9966
9967 : see if strtoul exists
9968 set strtoul d_strtoul
9969 eval $inlibc
9970
9971 : see if strxfrm exists
9972 set strxfrm d_strxfrm
9973 eval $inlibc
9974
9975 : see if symlink exists
9976 set symlink d_symlink
9977 eval $inlibc
9978
9979 : see if syscall exists
9980 set syscall d_syscall
9981 eval $inlibc
9982
9983 : see if sysconf exists
9984 set sysconf d_sysconf
9985 eval $inlibc
9986
9987 : see if system exists
9988 set system d_system
9989 eval $inlibc
9990
9991 : see if tcgetpgrp exists
9992 set tcgetpgrp d_tcgetpgrp
9993 eval $inlibc
9994
9995 : see if tcsetpgrp exists
9996 set tcsetpgrp d_tcsetpgrp
9997 eval $inlibc
9998
9999 : see if sys/types.h has to be included
10000 set sys/types.h i_systypes
10001 eval $inhdr
10002
10003 : see if prototype for telldir is available
10004 echo " "
10005 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10006 eval $hasproto
10007
10008 : define an is-a-typedef? function
10009 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10010 case "$inclist" in
10011 "") inclist="sys/types.h";;
10012 esac;
10013 eval "varval=\$$var";
10014 case "$varval" in
10015 "")
10016         $rm -f temp.c;
10017         for inc in $inclist; do
10018                 echo "#include <$inc>" >>temp.c;
10019         done;
10020         echo "#ifdef $type" >> temp.c;
10021         echo "printf(\"We have $type\");" >> temp.c;
10022         echo "#endif" >> temp.c;
10023         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10024         if $contains $type temp.E >/dev/null 2>&1; then
10025                 eval "$var=\$type";
10026         else
10027                 eval "$var=\$def";
10028         fi;
10029         $rm -f temp.?;;
10030 *) eval "$var=\$varval";;
10031 esac'
10032
10033 : define an is-a-typedef? function that prompts if the type is not available.
10034 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10035 case "$inclist" in
10036 "") inclist="sys/types.h";;
10037 esac;
10038 eval "varval=\$$var";
10039 case "$varval" in
10040 "")
10041         $rm -f temp.c;
10042         for inc in $inclist; do
10043                 echo "#include <$inc>" >>temp.c;
10044         done;
10045         echo "#ifdef $type" >> temp.c;
10046         echo "printf(\"We have $type\");" >> temp.c;
10047         echo "#endif" >> temp.c;
10048         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10049         echo " " ;
10050         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10051         if $contains $type temp.E >/dev/null 2>&1; then
10052                 echo "$type found." >&4;
10053                 eval "$var=\$type";
10054         else
10055                 echo "$type NOT found." >&4;
10056                 dflt="$def";
10057                 . ./myread ;
10058                 eval "$var=\$ans";
10059         fi;
10060         $rm -f temp.?;;
10061 *) eval "$var=\$varval";;
10062 esac'
10063
10064 : see if this is a sys/times.h system
10065 set sys/times.h i_systimes
10066 eval $inhdr
10067
10068 : see if times exists
10069 echo " "
10070 if set times val -f d_times; eval $csym; $val; then
10071         echo 'times() found.' >&4
10072         d_times="$define"
10073         inc=''
10074         case "$i_systimes" in
10075         "$define") inc='sys/times.h';;
10076         esac
10077         rp="What is the type returned by times() on this system?"
10078         set clock_t clocktype long stdio.h sys/types.h $inc
10079         eval $typedef_ask
10080 else
10081         echo 'times() NOT found, hope that will do.' >&4
10082         d_times="$undef"
10083         clocktype='int'
10084 fi
10085
10086 : see if truncate exists
10087 set truncate d_truncate
10088 eval $inlibc
10089
10090 : see if tzname[] exists
10091 echo " "
10092 if set tzname val -a d_tzname; eval $csym; $val; then
10093         val="$define"
10094         echo 'tzname[] found.' >&4
10095 else
10096         val="$undef"
10097         echo 'tzname[] NOT found.' >&4
10098 fi
10099 set d_tzname
10100 eval $setvar
10101
10102 : see if umask exists
10103 set umask d_umask
10104 eval $inlibc
10105
10106 : backward compatibility for d_hvfork
10107 if test X$d_hvfork != X; then
10108         d_vfork="$d_hvfork"
10109         d_hvfork=''
10110 fi
10111 : see if there is a vfork
10112 val=''
10113 set vfork val
10114 eval $inlibc
10115
10116 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10117 : perl on Solaris 2.x, and probably elsewhere.
10118 case "$val" in
10119 $define)
10120         echo " "
10121         case "$usevfork" in
10122         false) dflt='n';;
10123         *) dflt='y';;
10124         esac
10125         rp="Some systems have problems with vfork().  Do you want to use it?"
10126         . ./myread
10127         case "$ans" in
10128         y|Y) ;;
10129         *)
10130                 echo "Ok, we won't use vfork()."
10131                 val="$undef"
10132                 ;;
10133         esac
10134         ;;
10135 esac
10136 set d_vfork
10137 eval $setvar
10138 case "$d_vfork" in
10139 $define) usevfork='true';;
10140 *) usevfork='false';;
10141 esac
10142
10143 : see if this is an sysdir system
10144 set sys/dir.h i_sysdir
10145 eval $inhdr
10146
10147 : see if this is an sysndir system
10148 set sys/ndir.h i_sysndir
10149 eval $inhdr
10150
10151 : see if closedir exists
10152 set closedir d_closedir
10153 eval $inlibc
10154
10155 case "$d_closedir" in
10156 "$define")
10157         echo " "
10158         echo "Checking whether closedir() returns a status..." >&4
10159         cat > closedir.c <<EOM
10160 #$i_dirent I_DIRENT             /**/
10161 #$i_sysdir I_SYS_DIR            /**/
10162 #$i_sysndir I_SYS_NDIR          /**/
10163 #$i_systypes I_SYS_TYPES        /**/
10164
10165 #if defined(I_SYS_TYPES)
10166 #include <sys/types.h>
10167 #endif
10168 #if defined(I_DIRENT)
10169 #include <dirent.h>
10170 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10171 #include <sys/dir.h>
10172 #endif
10173 #else
10174 #ifdef I_SYS_NDIR
10175 #include <sys/ndir.h>
10176 #else
10177 #ifdef I_SYS_DIR
10178 #ifdef hp9000s500
10179 #include <ndir.h>       /* may be wrong in the future */
10180 #else
10181 #include <sys/dir.h>
10182 #endif
10183 #endif
10184 #endif
10185 #endif 
10186 int main() { return closedir(opendir(".")); }
10187 EOM
10188         set closedir
10189         if eval $compile_ok; then
10190                 if ./closedir > /dev/null 2>&1 ; then
10191                         echo "Yes, it does."
10192                         val="$undef"
10193                 else
10194                         echo "No, it doesn't."
10195                         val="$define"
10196                 fi
10197         else
10198                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10199                 val="$define"
10200         fi
10201         ;;
10202 *)
10203         val="$undef";
10204         ;;
10205 esac
10206 set d_void_closedir
10207 eval $setvar
10208 $rm -f closedir*
10209 : check for volatile keyword
10210 echo " "
10211 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10212 $cat >try.c <<'EOCP'
10213 int main()
10214 {
10215         typedef struct _goo_struct goo_struct;
10216         goo_struct * volatile goo = ((goo_struct *)0);
10217         struct _goo_struct {
10218                 long long_int;
10219                 int reg_int;
10220                 char char_var;
10221         };
10222         typedef unsigned short foo_t;
10223         char *volatile foo;
10224         volatile int bar;
10225         volatile foo_t blech;
10226         foo = foo;
10227 }
10228 EOCP
10229 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10230         val="$define"
10231         echo "Yup, it does."
10232 else
10233         val="$undef"
10234         echo "Nope, it doesn't."
10235 fi
10236 set d_volatile
10237 eval $setvar
10238 $rm -f try.*
10239
10240 : see if there is a wait4
10241 set wait4 d_wait4
10242 eval $inlibc
10243
10244 : see if waitpid exists
10245 set waitpid d_waitpid
10246 eval $inlibc
10247
10248 : see if wcstombs exists
10249 set wcstombs d_wcstombs
10250 eval $inlibc
10251
10252 : see if wctomb exists
10253 set wctomb d_wctomb
10254 eval $inlibc
10255
10256 : see if writev exists
10257 set writev d_writev
10258 eval $inlibc
10259
10260 : preserve RCS keywords in files with variable substitution, grrr
10261 Date='$Date'
10262 Id='$Id'
10263 Log='$Log'
10264 RCSfile='$RCSfile'
10265 Revision='$Revision'
10266
10267 : check for alignment requirements
10268 echo " "
10269 case "$alignbytes" in
10270 '') echo "Checking alignment constraints..." >&4
10271         $cat >try.c <<'EOCP'
10272 struct foobar {
10273         char foo;
10274         double bar;
10275 } try;
10276 int main()
10277 {
10278         printf("%d\n", (char *)&try.bar - (char *)&try.foo);
10279 }
10280 EOCP
10281         set try
10282         if eval $compile_ok; then
10283                 dflt=`./try`
10284         else
10285                 dflt='8'
10286                 echo "(I can't seem to compile the test program...)"
10287         fi
10288         ;;
10289 *) dflt="$alignbytes"
10290         ;;
10291 esac
10292 rp="Doubles must be aligned on a how-many-byte boundary?"
10293 . ./myread
10294 alignbytes="$ans"
10295 $rm -f try.c try
10296
10297 : check for ordering of bytes in a long
10298 case "$byteorder" in
10299 '')
10300         $cat <<'EOM'
10301   
10302 In the following, larger digits indicate more significance.  A big-endian
10303 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10304 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10305 machines may have weird orders like 3412.  A Cray will report 87654321. If
10306 the test program works the default is probably right.
10307 I'm now running the test program...
10308 EOM
10309         $cat >try.c <<'EOCP'
10310 #include <stdio.h>
10311 int main()
10312 {
10313         int i;
10314         union {
10315                 unsigned long l;
10316                 char c[sizeof(long)];
10317         } u;
10318
10319         if (sizeof(long) > 4)
10320                 u.l = (0x08070605L << 32) | 0x04030201L;
10321         else
10322                 u.l = 0x04030201L;
10323         for (i = 0; i < sizeof(long); i++)
10324                 printf("%c", u.c[i]+'0');
10325         printf("\n");
10326         exit(0);
10327 }
10328 EOCP
10329         xxx_prompt=y
10330         set try
10331         if eval $compile && ./try > /dev/null; then
10332                 dflt=`./try`
10333                 case "$dflt" in
10334                 [1-4][1-4][1-4][1-4]|12345678|87654321)
10335                         echo "(The test program ran ok.)"
10336                         echo "byteorder=$dflt"
10337                         xxx_prompt=n
10338                         ;;
10339                 ????|????????) echo "(The test program ran ok.)" ;;
10340                 *) echo "(The test program didn't run right for some reason.)" ;;
10341                 esac
10342         else
10343                 dflt='4321'
10344                 cat <<'EOM'
10345 (I can't seem to compile the test program.  Guessing big-endian...)
10346 EOM
10347         fi
10348         case "$xxx_prompt" in
10349         y)
10350                 rp="What is the order of bytes in a long?"
10351                 . ./myread
10352                 byteorder="$ans"
10353                 ;;
10354         *)      byteorder=$dflt
10355                 ;;
10356         esac
10357         ;;
10358 esac
10359 $rm -f try.c try
10360
10361 : how do we catenate cpp tokens here?
10362 echo " "
10363 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10364 $cat >cpp_stuff.c <<'EOCP'
10365 #define RCAT(a,b)a/**/b
10366 #define ACAT(a,b)a ## b
10367 RCAT(Rei,ser)
10368 ACAT(Cir,cus)
10369 EOCP
10370 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10371 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10372         echo "Oh!  Smells like ANSI's been here." >&4
10373         echo "We can catify or stringify, separately or together!"
10374         cpp_stuff=42
10375 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10376         echo "Ah, yes!  The good old days!" >&4
10377         echo "However, in the good old days we don't know how to stringify and"
10378         echo "catify at the same time."
10379         cpp_stuff=1
10380 else
10381         $cat >&4 <<EOM
10382 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10383 to have to edit the values of CAT[2-5] in config.h...
10384 EOM
10385         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10386 fi
10387 $rm -f cpp_stuff.*
10388
10389 : see if this is a db.h system
10390 set db.h i_db
10391 eval $inhdr
10392
10393 case "$i_db" in
10394 $define)
10395         : Check db version.
10396         echo " "
10397         echo "Checking Berkeley DB version ..." >&4
10398         $cat >try.c <<EOCP
10399 #$d_const HASCONST
10400 #ifndef HASCONST
10401 #define const
10402 #endif
10403 #include <sys/types.h>
10404 #include <stdio.h>
10405 #include <db.h>
10406 int main()
10407 {
10408 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10409     int Major, Minor, Patch ;
10410     unsigned long Version ;
10411     (void)db_version(&Major, &Minor, &Patch) ;
10412     printf("You have Berkeley DB Version 2 or greater\n");
10413
10414     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10415                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10416     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10417                 Major, Minor, Patch) ;
10418
10419     /* check that db.h & libdb are compatible */
10420     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
10421         printf("db.h and libdb are incompatible\n") ;
10422         exit(3);        
10423     }
10424
10425     printf("db.h and libdb are compatible\n") ;
10426
10427     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
10428                 + DB_VERSION_PATCH ;
10429
10430     /* needs to be >= 2.3.4 */
10431     if (Version < 2003004) {
10432     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
10433         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
10434         exit(2);        
10435     }
10436
10437     exit(0);
10438 #else
10439 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
10440     printf("You have Berkeley DB Version 1\n");
10441     exit(0);    /* DB version < 2: the coast is clear. */
10442 #else
10443     exit(1);    /* <db.h> not Berkeley DB? */
10444 #endif
10445 #endif
10446 }
10447 EOCP
10448         set try
10449         if eval $compile && ./try; then
10450                 echo 'Looks OK.' >&4
10451         else
10452                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
10453                 i_db=$undef
10454                 case " $libs " in
10455                 *"-ldb "*)
10456                         : Remove db from list of libraries to use
10457                         echo "Removing unusable -ldb from library list" >&4
10458                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
10459                         shift
10460                         libs="$*"
10461                         echo "libs = $libs" >&4
10462                         ;;
10463                 esac
10464         fi
10465         $rm -f try.*
10466         ;;
10467 esac
10468
10469 case "$i_db" in
10470 define)
10471         : Check the return type needed for hash 
10472         echo " "
10473         echo "Checking return type needed for hash for Berkeley DB ..." >&4
10474         $cat >try.c <<EOCP
10475 #$d_const HASCONST
10476 #ifndef HASCONST
10477 #define const
10478 #endif
10479 #include <sys/types.h>
10480 #include <db.h>
10481
10482 #ifndef DB_VERSION_MAJOR
10483 u_int32_t hash_cb (ptr, size)
10484 const void *ptr;
10485 size_t size;
10486 {
10487 }
10488 HASHINFO info;
10489 int main()
10490 {
10491         info.hash = hash_cb;
10492 }
10493 #endif
10494 EOCP
10495         if $cc $ccflags -c try.c >try.out 2>&1 ; then
10496                 if $contains warning try.out >>/dev/null 2>&1 ; then
10497                         db_hashtype='int'
10498                 else
10499                         db_hashtype='u_int32_t'
10500                 fi
10501         else
10502                 : XXX Maybe we should just give up here.
10503                 db_hashtype=u_int32_t
10504                 $cat try.out >&4
10505                 echo "Help:  I can't seem to compile the db test program." >&4
10506                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
10507         fi
10508         $rm -f try.*
10509         echo "Your version of Berkeley DB uses $db_hashtype for hash."
10510         ;;
10511 *)      db_hashtype=u_int32_t
10512         ;;
10513 esac
10514 case "$i_db" in
10515 define)
10516         : Check the return type needed for prefix 
10517         echo " "
10518         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
10519         cat >try.c <<EOCP
10520 #$d_const HASCONST
10521 #ifndef HASCONST
10522 #define const
10523 #endif
10524 #include <sys/types.h>
10525 #include <db.h>
10526
10527 #ifndef DB_VERSION_MAJOR
10528 size_t prefix_cb (key1, key2)
10529 const DBT *key1;
10530 const DBT *key2;
10531 {
10532 }
10533 BTREEINFO info;
10534 int main()
10535 {
10536         info.prefix = prefix_cb;
10537 }
10538 #endif
10539 EOCP
10540         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
10541                 if $contains warning try.out >>/dev/null 2>&1 ; then
10542                         db_prefixtype='int'
10543                 else
10544                         db_prefixtype='size_t'
10545                 fi
10546         else
10547                 db_prefixtype='size_t'
10548                 : XXX Maybe we should just give up here.
10549                 $cat try.out >&4
10550                 echo "Help:  I can't seem to compile the db test program." >&4
10551                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
10552         fi
10553         $rm -f try.*
10554         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
10555         ;;
10556 *)      db_prefixtype='size_t'
10557         ;;
10558 esac
10559
10560 : check for void type
10561 echo " "
10562 echo "Checking to see how well your C compiler groks the void type..." >&4
10563 case "$voidflags" in
10564 '')
10565         $cat >try.c <<'EOCP'
10566 #if TRY & 1
10567 void sub() {
10568 #else
10569 sub() {
10570 #endif
10571         extern void moo();      /* function returning void */
10572         void (*goo)();          /* ptr to func returning void */
10573 #if TRY & 8
10574         void *hue;              /* generic ptr */
10575 #endif
10576 #if TRY & 2
10577         void (*foo[10])();
10578 #endif
10579
10580 #if TRY & 4
10581         if(goo == moo) {
10582                 exit(0);
10583         }
10584 #endif
10585         exit(0);
10586 }
10587 int main() { sub(); }
10588 EOCP
10589         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
10590                 voidflags=$defvoidused
10591         echo "Good.  It appears to support void to the level $package wants.">&4
10592                 if $contains warning .out >/dev/null 2>&1; then
10593                         echo "However, you might get some warnings that look like this:"
10594                         $cat .out
10595                 fi
10596         else
10597 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
10598                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
10599                         echo "It supports 1..."
10600                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
10601                                 echo "It also supports 2..."
10602                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
10603                                         voidflags=7
10604                                         echo "And it supports 4 but not 8 definitely."
10605                                 else
10606                                         echo "It doesn't support 4..."
10607                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
10608                                                 voidflags=11
10609                                                 echo "But it supports 8."
10610                                         else
10611                                                 voidflags=3
10612                                                 echo "Neither does it support 8."
10613                                         fi
10614                                 fi
10615                         else
10616                                 echo "It does not support 2..."
10617                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
10618                                         voidflags=13
10619                                         echo "But it supports 4 and 8."
10620                                 else
10621                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
10622                                                 voidflags=5
10623                                                 echo "And it supports 4 but has not heard about 8."
10624                                         else
10625                                                 echo "However it supports 8 but not 4."
10626                                         fi
10627                                 fi
10628                         fi
10629                 else
10630                         echo "There is no support at all for void."
10631                         voidflags=0
10632                 fi
10633         fi
10634 esac
10635 case "$voidflags" in
10636 "$defvoidused") ;;
10637 *)      $cat >&4 <<'EOM'
10638   Support flag bits are:
10639     1: basic void declarations.
10640     2: arrays of pointers to functions returning void.
10641     4: operations between pointers to and addresses of void functions.
10642     8: generic void pointers.
10643 EOM
10644         dflt="$voidflags";
10645         rp="Your void support flags add up to what?"
10646         . ./myread
10647         voidflags="$ans"
10648         ;;
10649 esac
10650 $rm -f try.* .out
10651
10652
10653 : How can we generate normalized random numbers ?
10654 echo " "
10655 echo "Looking for a random number function..." >&4
10656 case "$randfunc" in
10657 '')
10658         if set drand48 val -f; eval $csym; $val; then
10659                 dflt="drand48"
10660                 echo "Good, found drand48()." >&4
10661         elif set random val -f; eval $csym; $val; then
10662                 dflt="random"
10663                 echo "OK, found random()." >&4
10664         else
10665                 dflt="rand"
10666                 echo "Yick, looks like I have to use rand()." >&4
10667         fi
10668         echo " "
10669         ;;
10670 *)
10671         dflt="$randfunc"
10672         ;;
10673 esac
10674 cont=true
10675
10676 case "$ccflags" in
10677 *-Dmy_rand=*|*-Dmy_srand=*)
10678         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
10679         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
10680         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
10681         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
10682         ;;
10683 esac
10684
10685 while $test "$cont"; do
10686         rp="Use which function to generate random numbers?"
10687         . ./myread
10688         if $test "$ans" = "$dflt"; then
10689                 : null
10690         else
10691                 randbits=''
10692         fi
10693         randfunc="$ans"
10694         if set $ans val -f; eval $csym; $val; then
10695                 cont=''
10696         else
10697                 dflt=y
10698                 rp="I cannot find function $ans. Use that name anyway?"
10699                 . ./myread
10700                 dflt=rand
10701                 case "$ans" in
10702                         [yY]*) cont='';;
10703                 esac
10704         fi
10705         case "$cont" in
10706         '')
10707                 case "$randfunc" in
10708                 drand48)
10709                         drand01="drand48()"
10710                         seedfunc="srand48"
10711                         randbits=48
10712                         randseedtype=long
10713                         ;;
10714                 rand|random)
10715                         case "$randbits" in
10716                         '')
10717 echo "Checking to see how many bits your $randfunc() function produces..." >&4
10718                                 $cat >try.c <<EOCP
10719 #$i_unistd I_UNISTD
10720 #$i_stdlib I_STDLIB
10721 #include <stdio.h>
10722 #ifdef I_UNISTD
10723 #  include <unistd.h>
10724 #endif
10725 #ifdef I_STDLIB
10726 #  include <stdlib.h>
10727 #endif
10728 int main()
10729 {
10730         register int i;
10731         register unsigned long tmp;
10732         register unsigned long max = 0L;
10733
10734         for (i = 1000; i; i--) {
10735                 tmp = (unsigned long) $randfunc();
10736                 if (tmp > max) max = tmp;
10737         }
10738         for (i = 0; max; i++)
10739                 max /= 2;
10740         printf("%d\n",i);
10741 }
10742 EOCP
10743                                 set try
10744                                 if eval $compile_ok; then
10745                                         dflt=`try`
10746                                 else
10747                                         dflt='?'
10748                                         echo "(I can't seem to compile the test program...)"
10749                                 fi
10750                                 ;;
10751                         *)
10752                                 dflt="$randbits"
10753                                 ;;
10754                         esac
10755                         rp="How many bits does your $randfunc() function produce?"
10756                         . ./myread
10757                         randbits="$ans"
10758                         $rm -f try.c try
10759                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10760                         seedfunc="s$randfunc"
10761                         randseedtype=unsigned
10762                         ;;
10763                 *)
10764                         dflt="31"
10765                         rp="How many bits does your $randfunc() function produce?"
10766                         . ./myread
10767                         randbits="$ans"
10768                         seedfunc="s$randfunc"
10769                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10770                         if set $seedfunc val -f; eval $csym; $val; then
10771                                 echo "(Using $seedfunc() to seed random generator)"
10772                         else
10773                                 echo "(Warning: no $seedfunc() to seed random generator)"
10774                                 seedfunc=rand
10775                         fi
10776                         randseedtype=unsigned
10777                         ;;
10778                 esac
10779                 ;;
10780         esac
10781 done
10782
10783 echo " "
10784 echo "Determining whether or not we are on an EBCDIC system..." >&4
10785 $cat >tebcdic.c <<'EOM'
10786 int main()
10787 {
10788   if ('M'==0xd4) return 0;
10789   return 1;
10790 }
10791 EOM
10792
10793 val=$undef
10794 set tebcdic
10795 if eval $compile_ok; then
10796         if ./tebcdic; then
10797                 echo "You have EBCDIC." >&4
10798                 val="$define"
10799         else
10800                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin." >&4
10801         fi
10802 else
10803         echo "I'm unable to compile the test program." >&4
10804         echo "I'll assume ASCII or some ISO Latin." >&4
10805 fi
10806 $rm -f tebcdic.c tebcdic
10807 set ebcdic
10808 eval $setvar
10809
10810 : see what type file positions are declared as in the library
10811 rp="What is the type for file position used by fsetpos()?"
10812 set fpos_t fpostype long stdio.h sys/types.h
10813 eval $typedef_ask
10814
10815 : Store the full pathname to the sed program for use in the C program
10816 full_sed=$sed
10817
10818 : see what type gids are declared as in the kernel
10819 echo " "
10820 echo "Looking for the type for group ids returned by getgid()."
10821 set gid_t gidtype xxx stdio.h sys/types.h
10822 eval $typedef
10823 case "$gidtype" in
10824 xxx)
10825         xxx=`./findhdr sys/user.h`
10826         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
10827         case $1 in
10828         unsigned) dflt="$1 $2" ;;
10829         *) dflt="$1" ;;
10830         esac
10831         ;;
10832 *) dflt="$gidtype";;
10833 esac
10834 case "$gidtype" in
10835 gid_t) echo "gid_t found." ;;
10836 *)      rp="What is the type for group ids returned by getgid()?"
10837         . ./myread
10838         gidtype="$ans"
10839         ;;
10840 esac
10841
10842 : see if getgroups exists
10843 set getgroups d_getgrps
10844 eval $inlibc
10845
10846 : see if setgroups exists
10847 set setgroups d_setgrps
10848 eval $inlibc
10849
10850
10851 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
10852 echo " "
10853 case "$d_getgrps$d_setgrps" in
10854 *define*)
10855         case "$groupstype" in
10856         '') dflt="$gidtype" ;;
10857         *)  dflt="$groupstype" ;;
10858         esac
10859         $cat <<EOM
10860 What type of pointer is the second argument to getgroups() and setgroups()?
10861 Usually this is the same as group ids, $gidtype, but not always.
10862
10863 EOM
10864         rp='What type pointer is the second argument to getgroups() and setgroups()?'
10865         . ./myread
10866         groupstype="$ans"
10867         ;;
10868 *)  groupstype="$gidtype";;
10869 esac
10870
10871 : see what type lseek is declared as in the kernel
10872 rp="What is the type used for lseek's offset on this system?"
10873 set off_t lseektype long stdio.h sys/types.h
10874 eval $typedef_ask
10875
10876 echo " "
10877 $echo $n "Checking to see how big your file offsets are...$c" >&4
10878 $cat >try.c <<EOCP
10879 #include <sys/types.h>
10880 #include <stdio.h>
10881 int main()
10882 {
10883         printf("%d\n", sizeof($lseektype));
10884 }
10885 EOCP
10886 set try
10887 if eval $compile_ok; then
10888         lseeksize=`./try`
10889         $echo " $lseeksize bytes." >&4
10890 else
10891         dflt='4'
10892         echo " "
10893         echo "(I can't seem to compile the test program.  Guessing...)"
10894         rp="What is the size of your file offsets (in bytes)?"
10895         . ./myread
10896         lseeksize="$ans"
10897 fi
10898 $rm -f try.c try
10899
10900 echo " "
10901 echo "Checking if your $make program sets \$(MAKE)..." >&4
10902 case "$make_set_make" in
10903 '')
10904         $sed 's/^X //' > testmake.mak << 'EOF'
10905 Xall:
10906 X       @echo 'maketemp="$(MAKE)"'
10907 EOF
10908         case "`$make -f testmake.mak 2>/dev/null`" in
10909         *maketemp=*) make_set_make='#' ;;
10910         *)      make_set_make="MAKE=$make" ;;
10911         esac
10912         $rm -f testmake.mak
10913         ;;
10914 esac
10915 case "$make_set_make" in
10916 '#') echo "Yup, it does.";;
10917 *) echo "Nope, it doesn't.";;
10918 esac
10919
10920 : see what type is used for mode_t
10921 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
10922 set mode_t modetype int stdio.h sys/types.h
10923 eval $typedef_ask
10924
10925 : define a fucntion to check prototypes
10926 $cat > protochk <<EOSH
10927 $startsh
10928 cc="$cc"
10929 optimize="$optimize"
10930 ccflags="$ccflags"
10931 prototype="$prototype"
10932 define="$define"
10933 rm=$rm
10934 EOSH
10935
10936 $cat >> protochk <<'EOSH'
10937
10938 $rm -f try.c
10939 foo="$1"
10940 shift
10941 while test $# -ge 2; do
10942         case "$1" in
10943                 $define) echo "#include <$2>" >> try.c ;;
10944                 literal) echo "$2" >> try.c ;;
10945         esac
10946     shift 2
10947 done
10948 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10949 cat >> try.c <<'EOCP'
10950 #ifdef CAN_PROTOTYPE
10951 #define _(args) args
10952 #else
10953 #define _(args) ()
10954 #endif
10955 EOCP
10956 echo "$foo" >> try.c
10957 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10958 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10959 status=$?
10960 $rm -f try.[co]
10961 exit $status
10962 EOSH
10963 chmod +x protochk
10964 $eunicefix protochk
10965
10966 : see what type is used for size_t
10967 rp="What is the type used for the length parameter for string functions?"
10968 set size_t sizetype 'unsigned int' stdio.h sys/types.h
10969 eval $typedef_ask
10970
10971 : check for type of arguments to gethostbyaddr. 
10972 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
10973         case "$d_gethbyaddr" in
10974         $define)
10975                 $cat <<EOM
10976
10977 Checking to see what type of arguments are accepted by gethostbyaddr().
10978 EOM
10979                 hdrs="$define sys/types.h
10980                         $d_socket sys/socket.h 
10981                         $i_niin netinet/in.h 
10982                         $i_netdb netdb.h
10983                         $i_unistd unistd.h"
10984                 : The first arg can 'char *' or 'void *'
10985                 : The second arg is some of integral type
10986                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
10987                         for yyy in size_t long int; do
10988                                 case "$netdb_host_type" in
10989                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
10990                                         if ./protochk "$try" $hdrs; then
10991                                                 echo "Your system accepts $xxx for the first arg."
10992                                                 echo "...and $yyy for the second arg."
10993                                                 netdb_host_type="$xxx"
10994                                                 netdb_hlen_type="$yyy"
10995                                         fi
10996                                         ;;
10997                                 esac
10998                         done
10999                 done
11000                 : In case none of those worked, prompt the user.
11001                 case "$netdb_host_type" in
11002                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11003                         dflt='char *'
11004                         . ./myread
11005                         netdb_host_type=$ans
11006                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11007                         dflt="$sizetype"
11008                         . ./myread
11009                         netdb_hlen_type=$ans
11010                         ;;
11011                 esac
11012                 ;;
11013         *)      : no gethostbyaddr, so pick harmless defaults
11014                 netdb_host_type='char *'
11015                 netdb_hlen_type="$sizetype"
11016                 ;;
11017         esac
11018         # Remove the "const" if needed. -- but then we'll have a 
11019         # prototype clash!
11020         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11021 fi
11022
11023 : check for type of argument to gethostbyname. 
11024 if test "X$netdb_name_type" = X ; then
11025         case "$d_gethbyname" in
11026         $define)
11027                 $cat <<EOM
11028
11029 Checking to see what type of argument is accepted by gethostbyname().
11030 EOM
11031                 hdrs="$define sys/types.h
11032                         $d_socket sys/socket.h 
11033                         $i_niin netinet/in.h 
11034                         $i_netdb netdb.h
11035                         $i_unistd unistd.h"
11036                 for xxx in "const char *" "char *"; do
11037                         case "$netdb_name_type" in
11038                         '')     try="extern struct hostent *gethostbyname($xxx);"
11039                                 if ./protochk "$try" $hdrs; then
11040                                         echo "Your system accepts $xxx."
11041                                         netdb_name_type="$xxx"
11042                                 fi
11043                                 ;;
11044                         esac
11045                 done
11046                 : In case none of those worked, prompt the user.
11047                 case "$netdb_name_type" in
11048                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11049                         dflt='char *'
11050                         . ./myread
11051                         netdb_name_type=$ans
11052                         ;;
11053                 esac
11054                 ;;
11055         *)      : no gethostbyname, so pick harmless default
11056                 netdb_name_type='char *'
11057                 ;;
11058         esac
11059 fi
11060
11061 : check for type of 1st argument to getnetbyaddr. 
11062 if test "X$netdb_net_type" = X ; then
11063         case "$d_getnbyaddr" in
11064         $define)
11065                 $cat <<EOM
11066
11067 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11068 EOM
11069                 hdrs="$define sys/types.h
11070                         $d_socket sys/socket.h 
11071                         $i_niin netinet/in.h 
11072                         $i_netdb netdb.h
11073                         $i_unistd unistd.h"
11074                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11075                         case "$netdb_net_type" in
11076                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11077                                 if ./protochk "$try" $hdrs; then
11078                                         echo "Your system accepts $xxx."
11079                                         netdb_net_type="$xxx"
11080                                 fi
11081                                 ;;
11082                         esac
11083                 done
11084                 : In case none of those worked, prompt the user.
11085                 case "$netdb_net_type" in
11086                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11087                         dflt='long'
11088                         . ./myread
11089                         netdb_net_type=$ans
11090                         ;;
11091                 esac
11092                 ;;
11093         *)      : no getnetbyaddr, so pick harmless default
11094                 netdb_net_type='long'
11095                 ;;
11096         esac
11097 fi
11098 : locate the preferred pager for this system
11099 case "$pager" in
11100 '')
11101         dflt=''
11102         case "$pg" in
11103         /*) dflt=$pg;;
11104         esac
11105         case "$more" in
11106         /*) dflt=$more;;
11107         esac
11108         case "$less" in
11109         /*) dflt=$less;;
11110         esac
11111         case "$dflt" in
11112         '') dflt=/usr/ucb/more;;
11113         esac
11114         ;;
11115 *) dflt="$pager";;
11116 esac
11117 echo " "
11118 fn=f/
11119 rp='What pager is used on your system?'
11120 . ./getfile
11121 pager="$ans"
11122
11123 : see what type pids are declared as in the kernel
11124 rp="What is the type of process ids on this system?"
11125 set pid_t pidtype int stdio.h sys/types.h
11126 eval $typedef_ask
11127
11128 : check for length of pointer
11129 echo " "
11130 case "$ptrsize" in
11131 '')
11132         $echo $n "Checking to see how big your pointers are...$c" >&4
11133         if test "$voidflags" -gt 7; then
11134                 echo '#define VOID_PTR char *' > try.c
11135         else
11136                 echo '#define VOID_PTR void *' > try.c
11137         fi
11138         $cat >>try.c <<'EOCP'
11139 #include <stdio.h>
11140 int main()
11141 {
11142         printf("%d\n", sizeof(VOID_PTR));
11143         exit(0);
11144 }
11145 EOCP
11146         set try
11147         if eval $compile_ok; then
11148                 ptrsize=`./try`
11149                 $echo " $ptrsize bytes." >&4
11150         else
11151                 dflt='4'
11152                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11153                 rp="What is the size of a pointer (in bytes)?"
11154                 . ./myread
11155                 ptrsize="$ans"
11156         fi
11157         ;;
11158 esac
11159 $rm -f try.c try
11160
11161 : see if ar generates random libraries by itself
11162 echo " "
11163 echo "Checking how to generate random libraries on your machine..." >&4
11164 echo 'int bar1() { return bar2(); }' > bar1.c
11165 echo 'int bar2() { return 2; }' > bar2.c
11166 $cat > foo.c <<'EOP'
11167 int main() { printf("%d\n", bar1()); exit(0); }
11168 EOP
11169 $cc $ccflags -c bar1.c >/dev/null 2>&1
11170 $cc $ccflags -c bar2.c >/dev/null 2>&1
11171 $cc $ccflags -c foo.c >/dev/null 2>&1
11172 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11173 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11174         ./foobar >/dev/null 2>&1; then
11175         echo "$ar appears to generate random libraries itself."
11176         orderlib=false
11177         ranlib=":"
11178 elif $ar ts bar$_a >/dev/null 2>&1 &&
11179         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11180         ./foobar >/dev/null 2>&1; then
11181                 echo "a table of contents needs to be added with '$ar ts'."
11182                 orderlib=false
11183                 ranlib="$ar ts"
11184 else
11185         case "$ranlib" in
11186         :) ranlib='';;
11187         '')
11188                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11189                 $test -f $ranlib || ranlib=''
11190                 ;;
11191         esac
11192         if $test -n "$ranlib"; then
11193                 echo "your system has '$ranlib'; we'll use that."
11194                 orderlib=false
11195         else
11196                 echo "your system doesn't seem to support random libraries"
11197                 echo "so we'll use lorder and tsort to order the libraries."
11198                 orderlib=true
11199                 ranlib=":"
11200         fi
11201 fi
11202 $rm -f foo* bar* 
11203
11204 : check for type of arguments to select. 
11205 case "$selecttype" in
11206 '') case "$d_select" in
11207         $define)
11208                 $cat <<EOM
11209 Checking to see what type of arguments are accepted by select().
11210 EOM
11211                 hdrs="$define sys/types.h
11212                         $i_systime sys/time.h 
11213                         $i_sysselct sys/select.h
11214                         $d_socket sys/socket.h"
11215                 : The first arg can be int, unsigned, or size_t
11216                 : The last arg may or may not be 'const'
11217                 val=''
11218                 : void pointer has been seen but using that
11219                 : breaks the selectminbits test
11220                 for xxx in 'fd_set *' 'int *'; do
11221                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
11222                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
11223                                         case "$val" in
11224                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
11225                                                 if ./protochk "$try" $hdrs; then
11226                                                         echo "Your system accepts $xxx."
11227                                                         val="$xxx"
11228                                                 fi
11229                                                 ;;
11230                                         esac
11231                                 done
11232                         done
11233                 done
11234                 case "$val" in
11235                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
11236                         case "$d_fd_set" in
11237                                 $define) dflt="fd_set *" ;;
11238                                 *)              dflt="int *" ;;
11239                         esac
11240                         . ./myread
11241                         val=$ans
11242                         ;;
11243                 esac
11244                 selecttype="$val"
11245                 ;;
11246         *)      : no select, so pick a harmless default
11247                 selecttype='int *'
11248                 ;;
11249         esac
11250         ;;
11251 esac
11252
11253 : check for the select 'width'
11254 case "$selectminbits" in
11255 '') case "$d_select" in
11256         $define)
11257                 $cat <<EOM
11258
11259 Checking to see on how many bits at a time your select() operates...
11260 EOM
11261                 $cat >try.c <<EOCP
11262 #include <sys/types.h>
11263 #$i_time I_TIME
11264 #$i_systime I_SYS_TIME
11265 #$i_systimek I_SYS_TIME_KERNEL
11266 #ifdef I_TIME
11267 #   include <time.h>
11268 #endif
11269 #ifdef I_SYS_TIME
11270 #   ifdef I_SYS_TIME_KERNEL
11271 #       define KERNEL
11272 #   endif
11273 #   include <sys/time.h>
11274 #   ifdef I_SYS_TIME_KERNEL
11275 #       undef KERNEL
11276 #   endif
11277 #endif
11278 #$i_sysselct I_SYS_SELECT
11279 #ifdef I_SYS_SELECT
11280 #include <sys/select.h>
11281 #endif
11282 #include <stdio.h>
11283 $selecttype b;
11284 #define S sizeof(*(b))
11285 #define MINBITS 64
11286 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
11287 #define NBITS  (NBYTES * 8)
11288 int main() {
11289     char s[NBYTES];
11290     struct timeval t;
11291     int i;
11292     FILE* fp;
11293     int fd;
11294
11295     fclose(stdin);
11296     fp = fopen("try.c", "r");
11297     if (fp == 0)
11298       exit(1);
11299     fd = fileno(fp);
11300     if (fd < 0)
11301       exit(2);
11302     b = ($selecttype)s;
11303     for (i = 0; i < NBITS; i++)
11304         FD_SET(i, b);
11305     t.tv_sec  = 0;
11306     t.tv_usec = 0;
11307     select(fd + 1, b, 0, 0, &t);
11308     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
11309     printf("%d\n", i + 1);
11310     return 0;
11311 }
11312 EOCP
11313                 set try
11314                 if eval $compile_ok; then
11315                         selectminbits=`./try`
11316                         case "$selectminbits" in
11317                         '')     cat >&4 <<EOM
11318 Cannot figure out on how many bits at a time your select() operates.
11319 I'll play safe and guess it is 32 bits.
11320 EOM
11321                                 selectminbits=32
11322                                 bits="32 bits"
11323                                 ;;
11324                         1)      bits="1 bit" ;;
11325                         *)      bits="$selectminbits bits" ;;
11326                         esac
11327                         echo "Your select() operates on $bits at a time." >&4
11328                 else
11329                         rp='What is the minimum number of bits your select() operates on?'
11330                         case "$byteorder" in
11331                         1234|12345678)  dflt=32 ;;
11332                         *)              dflt=1  ;;
11333                         esac
11334                         . ./myread
11335                         val=$ans
11336                         selectminbits="$val"
11337                 fi
11338                 $rm -f try.* try
11339                 ;;
11340         *)      : no select, so pick a harmless default
11341                 selectminbits='32'
11342                 ;;
11343         esac
11344         ;;
11345 esac
11346
11347 : Trace out the files included by signal.h, then look for SIGxxx names.
11348 : Remove SIGARRAYSIZE used by HPUX.
11349 : Remove SIGTYP void lines used by OS2.
11350 xxx=`echo '#include <signal.h>' |
11351         $cppstdin $cppminus $cppflags 2>/dev/null |
11352         $grep '^[       ]*#.*include' | 
11353         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
11354 : Check this list of files to be sure we have parsed the cpp output ok.
11355 : This will also avoid potentially non-existent files, such 
11356 : as ../foo/bar.h
11357 xxxfiles=''
11358 for xx in $xxx /dev/null ; do
11359         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
11360 done
11361 : If we have found no files, at least try signal.h
11362 case "$xxxfiles" in
11363 '')     xxxfiles=`./findhdr signal.h` ;;
11364 esac
11365 xxx=`awk '
11366 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ {
11367         print substr($2, 4, 20)
11368 }
11369 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
11370         print substr($3, 4, 20)
11371 }' $xxxfiles`
11372 : Append some common names just in case the awk scan failed.
11373 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
11374 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
11375 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
11376 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
11377 : generate a few handy files for later
11378 $cat > signal.c <<'EOCP'
11379 #include <sys/types.h>
11380 #include <signal.h>
11381 #include <stdio.h>
11382 int main() {
11383
11384 /* Strange style to avoid deeply-nested #if/#else/#endif */
11385 #ifndef NSIG
11386 #  ifdef _NSIG
11387 #    define NSIG (_NSIG)
11388 #  endif
11389 #endif
11390
11391 #ifndef NSIG
11392 #  ifdef SIGMAX
11393 #    define NSIG (SIGMAX+1)
11394 #  endif
11395 #endif
11396
11397 #ifndef NSIG
11398 #  ifdef SIG_MAX
11399 #    define NSIG (SIG_MAX+1)
11400 #  endif
11401 #endif
11402
11403 #ifndef NSIG
11404 #  ifdef MAXSIG
11405 #    define NSIG (MAXSIG+1)
11406 #  endif
11407 #endif
11408
11409 #ifndef NSIG
11410 #  ifdef MAX_SIG
11411 #    define NSIG (MAX_SIG+1)
11412 #  endif
11413 #endif
11414
11415 #ifndef NSIG
11416 #  ifdef SIGARRAYSIZE
11417 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
11418 #  endif
11419 #endif
11420
11421 #ifndef NSIG
11422 #  ifdef _sys_nsig
11423 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
11424 #  endif
11425 #endif
11426
11427 /* Default to some arbitrary number that's big enough to get most
11428    of the common signals.
11429 */
11430 #ifndef NSIG
11431 #    define NSIG 50
11432 #endif
11433
11434 printf("NSIG %d\n", NSIG);
11435
11436 #ifndef JUST_NSIG
11437
11438 EOCP
11439
11440 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
11441 {
11442         printf "#ifdef SIG"; printf $1; printf "\n"
11443         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
11444         printf $1; printf ");\n"
11445         printf "#endif\n"
11446 }
11447 END {
11448         printf "#endif /* JUST_NSIG */\n";
11449         printf "}\n";
11450 }
11451 ' >>signal.c
11452 $cat >signal.awk <<'EOP'
11453 BEGIN { ndups = 0 }
11454 $1 ~ /^NSIG$/ { nsig = $2 }
11455 ($1 !~ /^NSIG$/) && (NF == 2) {
11456     if ($2 > maxsig) { maxsig = $2 }
11457     if (sig_name[$2]) {
11458         dup_name[ndups] = $1
11459         dup_num[ndups] = $2
11460         ndups++ 
11461     }
11462     else {
11463         sig_name[$2] = $1
11464         sig_num[$2] = $2
11465     }
11466
11467 }
11468 END { 
11469     if (nsig == 0) { nsig = maxsig + 1 }
11470         for (n = 1; n < nsig; n++) {
11471                 if (sig_name[n]) {
11472                         printf("%s %d\n", sig_name[n], sig_num[n])
11473                 }
11474                 else {
11475                         printf("NUM%d %d\n", n, n) 
11476                 }
11477         }
11478     for (n = 0; n < ndups; n++) {
11479                 printf("%s %d\n", dup_name[n], dup_num[n])
11480     }
11481 }
11482 EOP
11483 $cat >signal_cmd <<EOS
11484 $startsh
11485 if $test -s signal.lst; then
11486     echo "Using your existing signal.lst file"
11487         exit 0
11488 fi
11489 xxx="$xxx"
11490 EOS
11491 $cat >>signal_cmd <<'EOS'
11492
11493 set signal
11494 if eval $compile_ok; then
11495         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
11496 else
11497         echo "(I can't seem be able to compile the whole test program)" >&4
11498         echo "(I'll try it in little pieces.)" >&4
11499         set signal -DJUST_NSIG
11500         if eval $compile_ok; then
11501                 ./signal$_exe > signal.nsg
11502                 $cat signal.nsg
11503         else
11504                 echo "I can't seem to figure out how many signals you have." >&4
11505                 echo "Guessing 50." >&4
11506                 echo 'NSIG 50' > signal.nsg
11507         fi
11508         : Now look at all the signal names, one at a time.
11509         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
11510                 $cat > signal.c <<EOCP
11511 #include <sys/types.h>
11512 #include <signal.h>
11513 #include <stdio.h>
11514 int main() {
11515 printf("$xx %d\n", SIG${xx});
11516 return 0;
11517 }
11518 EOCP
11519                 set signal
11520                 if eval $compile; then
11521                         echo "SIG${xx} found."
11522                         ./signal$_exe  >> signal.ls1
11523                 else
11524                         echo "SIG${xx} NOT found."
11525                 fi
11526         done
11527         if $test -s signal.ls1; then
11528                 $cat signal.nsg signal.ls1 |
11529                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
11530         fi
11531
11532 fi
11533 if $test -s signal.lst; then
11534         :
11535 else
11536         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
11537         echo 'kill -l' >signal
11538         set X `csh -f <signal`
11539         $rm -f signal
11540         shift
11541         case $# in
11542         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
11543         esac
11544         echo $@ | $tr ' ' $trnl | \
11545                 $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
11546 fi
11547 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
11548 EOS
11549 chmod a+x signal_cmd
11550 $eunicefix signal_cmd
11551
11552 : generate list of signal names
11553 echo " "
11554 case "$sig_name_init" in
11555 '') doinit=yes ;;
11556 *)  case "$sig_num_init" in
11557     ''|*,*) doinit=yes ;;
11558     esac ;;
11559 esac
11560 case "$doinit" in
11561 yes)
11562         echo "Generating a list of signal names and numbers..." >&4
11563         . ./signal_cmd
11564         sig_name=`$awk '{printf "%s ", $1}' signal.lst`
11565         sig_name="ZERO $sig_name"
11566         sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
11567                                                 { printf "\"%s\", ", $1 }
11568                                                 END { printf "0\n" }' signal.lst`
11569         sig_num=`$awk '{printf "%d ", $2}' signal.lst`
11570         sig_num="0 $sig_num"
11571         sig_num_init=`$awk 'BEGIN { printf "0, " }
11572                                         { printf "%d, ", $2}
11573                                         END { printf "0\n"}' signal.lst`
11574         ;;
11575 esac
11576 echo "The following signals are available:"
11577 echo " "
11578 echo $sig_name | $awk \
11579 'BEGIN { linelen = 0 }
11580 {
11581         for (i = 1; i <= NF; i++) {
11582                 name = "SIG" $i " "
11583                 linelen = linelen + length(name)
11584                 if (linelen > 70) {
11585                         printf "\n"
11586                         linelen = length(name)
11587                 }
11588                 printf "%s", name
11589         }
11590         printf "\n"
11591 }'
11592 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
11593
11594 : see what type is used for signed size_t
11595 set ssize_t ssizetype int stdio.h sys/types.h
11596 eval $typedef
11597 dflt="$ssizetype"
11598 $cat > ssize.c <<EOM
11599 #include <stdio.h>
11600 #include <sys/types.h>
11601 #define Size_t $sizetype
11602 #define SSize_t $dflt
11603 int main()
11604 {
11605         if (sizeof(Size_t) == sizeof(SSize_t))
11606                 printf("$dflt\n");
11607         else if (sizeof(Size_t) == sizeof(int))
11608                 printf("int\n");
11609         else 
11610                 printf("long\n");
11611         exit(0);
11612 }
11613 EOM
11614 echo " "
11615 set ssize
11616 if eval $compile_ok && ./ssize > /dev/null; then
11617         ssizetype=`./ssize`
11618         echo "I'll be using $ssizetype for functions returning a byte count." >&4
11619 else
11620         $cat >&4 <<EOM
11621 Help! I can't compile and run the ssize_t test program: please enlighten me!
11622 (This is probably a misconfiguration in your system or libraries, and
11623 you really ought to fix it.  Still, I'll try anyway.)
11624
11625 I need a type that is the same size as $sizetype, but is guaranteed to
11626 be signed.  Common values are ssize_t, int and long.
11627
11628 EOM
11629         rp="What signed type is the same size as $sizetype?"
11630         . ./myread
11631         ssizetype="$ans"
11632 fi
11633 $rm -f ssize ssize.*
11634
11635 : see what type of char stdio uses.
11636 echo " "
11637 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11638         echo "Your stdio uses unsigned chars." >&4
11639         stdchar="unsigned char"
11640 else
11641         echo "Your stdio uses signed chars." >&4
11642         stdchar="char"
11643 fi
11644
11645 : see if time exists
11646 echo " "
11647 if test "X$d_time" = X -o X"$timetype" = X; then
11648     if set time val -f d_time; eval $csym; $val; then
11649                 echo 'time() found.' >&4
11650                 val="$define"
11651                 rp="What is the type returned by time() on this system?"
11652                 set time_t timetype long stdio.h sys/types.h
11653                 eval $typedef_ask
11654     else
11655                 echo 'time() not found, hope that will do.' >&4
11656                 val="$undef"
11657                 timetype='int';
11658     fi
11659     set d_time
11660     eval $setvar
11661 fi
11662
11663 : see what type uids are declared as in the kernel
11664 echo " "
11665 echo "Looking for the type for user ids returned by getuid()."
11666 set uid_t uidtype xxx stdio.h sys/types.h
11667 eval $typedef
11668 case "$uidtype" in
11669 xxx)
11670         xxx=`./findhdr sys/user.h`
11671         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
11672         case $1 in
11673         unsigned) dflt="$1 $2" ;;
11674         *) dflt="$1" ;;
11675         esac
11676         ;;
11677 *) dflt="$uidtype";;
11678 esac
11679 case "$uidtype" in
11680 uid_t)  echo "uid_t found." ;;
11681 *)      rp="What is the type for user ids returned by getuid()?"
11682         . ./myread
11683         uidtype="$ans"
11684         ;;
11685 esac
11686
11687 : see if dbm.h is available
11688 : see if dbmclose exists
11689 set dbmclose d_dbmclose
11690 eval $inlibc
11691
11692 case "$d_dbmclose" in
11693 $define)
11694         set dbm.h i_dbm
11695         eval $inhdr
11696         case "$i_dbm" in
11697         $define)
11698                 val="$undef"
11699                 set i_rpcsvcdbm
11700                 eval $setvar
11701                 ;;
11702         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11703                 eval $inhdr
11704                 ;;
11705         esac
11706         ;;
11707 *)      echo "We won't be including <dbm.h>"
11708         val="$undef"
11709         set i_dbm
11710         eval $setvar
11711         val="$undef"
11712         set i_rpcsvcdbm
11713         eval $setvar
11714         ;;
11715 esac
11716
11717 : see if this is a sys/file.h system
11718 val=''
11719 set sys/file.h val
11720 eval $inhdr
11721
11722 : do we need to include sys/file.h ?
11723 case "$val" in
11724 "$define")
11725         echo " "
11726         if $h_sysfile; then
11727                 val="$define"
11728                 echo "We'll be including <sys/file.h>." >&4
11729         else
11730                 val="$undef"
11731                 echo "We won't be including <sys/file.h>." >&4
11732         fi
11733         ;;
11734 *)
11735         h_sysfile=false
11736         ;;
11737 esac
11738 set i_sysfile
11739 eval $setvar
11740
11741 : see if fcntl.h is there
11742 val=''
11743 set fcntl.h val
11744 eval $inhdr
11745
11746 : see if we can include fcntl.h
11747 case "$val" in
11748 "$define")
11749         echo " "
11750         if $h_fcntl; then
11751                 val="$define"
11752                 echo "We'll be including <fcntl.h>." >&4
11753         else
11754                 val="$undef"
11755                 if $h_sysfile; then
11756         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11757                 else
11758                         echo "We won't be including <fcntl.h>." >&4
11759                 fi
11760         fi
11761         ;;
11762 *)
11763         h_fcntl=false
11764         val="$undef"
11765         ;;
11766 esac
11767 set i_fcntl
11768 eval $setvar
11769
11770 : see if locale.h is available
11771 set locale.h i_locale
11772 eval $inhdr
11773
11774 : see if mach cthreads are available
11775 if test "X$usethreads" = "X$define"; then
11776         set mach/cthreads.h i_machcthr
11777         eval $inhdr
11778 else
11779         i_machcthr="$undef"
11780 fi
11781
11782
11783
11784 : see if this is a math.h system
11785 set math.h i_math
11786 eval $inhdr
11787
11788 : see if this is a mntent.h system
11789 set mntent.h i_mntent
11790 eval $inhdr
11791
11792 : see if ndbm.h is available
11793 set ndbm.h t_ndbm
11794 eval $inhdr
11795 case "$t_ndbm" in
11796 $define)
11797         : see if dbm_open exists
11798         set dbm_open d_dbm_open
11799         eval $inlibc
11800         case "$d_dbm_open" in
11801         $undef)
11802                 t_ndbm="$undef"
11803                 echo "We won't be including <ndbm.h>"
11804                 ;;
11805         esac
11806         ;;
11807 esac
11808 val="$t_ndbm"
11809 set i_ndbm
11810 eval $setvar
11811
11812 : see if net/errno.h is available
11813 val=''
11814 set net/errno.h val
11815 eval $inhdr
11816
11817 : Unfortunately, it causes problems on some systems.  Arrgh.
11818 case "$val" in
11819 $define)
11820         cat > try.c <<'EOM'
11821 #include <stdio.h>
11822 #include <errno.h>
11823 #include <net/errno.h>
11824 int func()
11825 {
11826         return ENOTSOCK;
11827 }
11828 EOM
11829         if $cc $ccflags -c try.c >/dev/null 2>&1; then
11830                 echo "We'll be including <net/errno.h>." >&4
11831         else
11832                 echo "We won't be including <net/errno.h>." >&4
11833                 val="$undef"
11834         fi
11835         $rm -f try.* try
11836         ;;
11837 esac
11838 set i_neterrno
11839 eval $setvar
11840
11841 : see if this is a poll.h system
11842 set poll.h i_poll
11843 eval $inhdr
11844
11845 : get C preprocessor symbols handy
11846 echo " "
11847 $echo $n "Hmm... $c"
11848 echo $al | $tr ' ' $trnl >Cppsym.know
11849 $cat <<EOSS >Cppsym
11850 $startsh
11851 case "\$1" in
11852 -l) list=true
11853         shift
11854         ;;
11855 esac
11856 unknown=''
11857 case "\$list\$#" in
11858 1|2)
11859         for sym do
11860                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
11861                         exit 0
11862                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
11863                         :
11864                 else
11865                         unknown="\$unknown \$sym"
11866                 fi
11867         done
11868         set X \$unknown
11869         shift
11870         ;;
11871 esac
11872 case \$# in
11873 0) exit 1;;
11874 esac
11875 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
11876 #ifdef \1\\
11877 exit 0; _ _ _ _\1\\      \1\\
11878 #endif\\
11879 /' >Cppsym\$\$
11880 echo "exit 1; _ _ _" >>Cppsym\$\$
11881 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
11882 case "\$list" in
11883 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
11884 *)
11885         sh Cppsym2\$\$
11886         status=\$?
11887         ;;
11888 esac
11889 $rm -f Cppsym\$\$ Cppsym2\$\$
11890 exit \$status
11891 EOSS
11892 chmod +x Cppsym
11893 $eunicefix Cppsym
11894 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
11895
11896 : now check the C compiler for additional symbols
11897 $cat >ccsym <<EOS
11898 $startsh
11899 $cat >tmp.c <<EOF
11900 extern int foo;
11901 EOF
11902 for i in \`$cc -v -c tmp.c 2>&1\`
11903 do
11904         case "\$i" in
11905         -D*) echo "\$i" | $sed 's/^-D//';;
11906         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
11907         esac
11908 done
11909 $rm -f try.c
11910 EOS
11911 chmod +x ccsym
11912 $eunicefix ccsym
11913 ./ccsym > ccsym1.raw
11914 if $test -s ccsym1.raw; then
11915        $sort ccsym1.raw | $uniq >ccsym.raw
11916 else
11917        mv ccsym1.raw ccsym.raw
11918 fi
11919
11920 $awk '/\=/ { print $0; next }
11921         { print $0"=1" }' ccsym.raw >ccsym.list
11922 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
11923 $comm -13 ccsym.true ccsym.list >ccsym.own
11924 $comm -12 ccsym.true ccsym.list >ccsym.com
11925 $comm -23 ccsym.true ccsym.list >ccsym.cpp
11926 also=''
11927 if $test -z ccsym.raw; then
11928         echo "Your C compiler doesn't seem to define any symbols!" >&4
11929         echo " "
11930         echo "However, your C preprocessor defines the following symbols:"
11931         $cat Cppsym.true
11932         ccsymbols=''
11933         cppsymbols=`$cat Cppsym.true`
11934         cppccsymbols="$cppsymbols"
11935 else
11936         if $test -s ccsym.com; then
11937                 echo "Your C compiler and pre-processor define these symbols:"
11938                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
11939                 also='also '
11940                 symbols='ones'
11941                 cppccsymbols=`$cat ccsym.com`
11942                 $test "$silent" || sleep 1
11943         fi
11944         if $test -s ccsym.cpp; then
11945                 $test "$also" && echo " "
11946                 echo "Your C pre-processor ${also}defines the following symbols:"
11947                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
11948                 also='further '
11949                 cppsymbols=`$cat ccsym.cpp`
11950                 $test "$silent" || sleep 1
11951         fi
11952         if $test -s ccsym.own; then
11953                 $test "$also" && echo " "
11954                 echo "Your C compiler ${also}defines the following cpp symbols:"
11955                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
11956                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
11957                 ccsymbols=`$cat ccsym.own`
11958                 $test "$silent" || sleep 1
11959         fi
11960 fi
11961 $rm -f ccsym*
11962
11963 : see if this is a termio system
11964 val="$undef"
11965 val2="$undef"
11966 val3="$undef"
11967 if $test `./findhdr termios.h`; then
11968         set tcsetattr i_termios
11969         eval $inlibc
11970         val3="$i_termios"
11971 fi
11972 echo " "
11973 case "$val3" in
11974 "$define") echo "You have POSIX termios.h... good!" >&4;;
11975 *) if ./Cppsym pyr; then
11976                 case "`/bin/universe`" in
11977                 ucb) if $test `./findhdr sgtty.h`; then
11978                                 val2="$define"
11979                                 echo "<sgtty.h> found." >&4
11980                         else
11981                                 echo "System is pyramid with BSD universe."
11982                                 echo "<sgtty.h> not found--you could have problems." >&4
11983                         fi;;
11984                 *) if $test `./findhdr termio.h`; then
11985                                 val="$define"
11986                                 echo "<termio.h> found." >&4
11987                         else
11988                                 echo "System is pyramid with USG universe."
11989                                 echo "<termio.h> not found--you could have problems." >&4
11990                         fi;;
11991                 esac
11992         elif ./usg; then
11993                 if $test `./findhdr termio.h`; then
11994                         echo "<termio.h> found." >&4
11995                         val="$define"
11996                 elif $test `./findhdr sgtty.h`; then
11997                         echo "<sgtty.h> found." >&4
11998                         val2="$define"
11999                 else
12000 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12001                 fi
12002         else
12003                 if $test `./findhdr sgtty.h`; then
12004                         echo "<sgtty.h> found." >&4
12005                         val2="$define"
12006                 elif $test `./findhdr termio.h`; then
12007                         echo "<termio.h> found." >&4
12008                         val="$define"
12009                 else
12010 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12011                 fi
12012         fi;;
12013 esac
12014 set i_termio; eval $setvar
12015 val=$val2; set i_sgtty; eval $setvar
12016 val=$val3; set i_termios; eval $setvar
12017
12018 : see if stdarg is available
12019 echo " "
12020 if $test `./findhdr stdarg.h`; then
12021         echo "<stdarg.h> found." >&4
12022         valstd="$define"
12023 else
12024         echo "<stdarg.h> NOT found." >&4
12025         valstd="$undef"
12026 fi
12027
12028 : see if varags is available
12029 echo " "
12030 if $test `./findhdr varargs.h`; then
12031         echo "<varargs.h> found." >&4
12032 else
12033         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12034 fi
12035
12036 : set up the varargs testing programs
12037 $cat > varargs.c <<EOP
12038 #ifdef I_STDARG
12039 #include <stdarg.h>
12040 #endif
12041 #ifdef I_VARARGS
12042 #include <varargs.h>
12043 #endif
12044
12045 #ifdef I_STDARG
12046 int f(char *p, ...)
12047 #else
12048 int f(va_alist)
12049 va_dcl
12050 #endif
12051 {
12052         va_list ap;
12053 #ifndef I_STDARG
12054         char *p;
12055 #endif
12056 #ifdef I_STDARG
12057         va_start(ap,p);
12058 #else
12059         va_start(ap);
12060         p = va_arg(ap, char *);
12061 #endif
12062         va_end(ap);
12063 }
12064 EOP
12065 $cat > varargs <<EOP
12066 $startsh
12067 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12068         echo "true"
12069 else
12070         echo "false"
12071 fi
12072 $rm -f varargs$_o
12073 EOP
12074 chmod +x varargs
12075
12076 : now check which varargs header should be included
12077 echo " "
12078 i_varhdr=''
12079 case "$valstd" in
12080 "$define")
12081         if `./varargs I_STDARG`; then
12082                 val='stdarg.h'
12083         elif `./varargs I_VARARGS`; then
12084                 val='varargs.h'
12085         fi
12086         ;;
12087 *)
12088         if `./varargs I_VARARGS`; then
12089                 val='varargs.h'
12090         fi
12091         ;;
12092 esac
12093 case "$val" in
12094 '')
12095 echo "I could not find the definition for va_dcl... You have problems..." >&4
12096         val="$undef"; set i_stdarg; eval $setvar
12097         val="$undef"; set i_varargs; eval $setvar
12098         ;;
12099 *) 
12100         set i_varhdr
12101         eval $setvar
12102         case "$i_varhdr" in
12103         stdarg.h)
12104                 val="$define"; set i_stdarg; eval $setvar
12105                 val="$undef"; set i_varargs; eval $setvar
12106                 ;;
12107         varargs.h)
12108                 val="$undef"; set i_stdarg; eval $setvar
12109                 val="$define"; set i_varargs; eval $setvar
12110                 ;;
12111         esac
12112         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12113 esac
12114 $rm -f varargs*
12115
12116 : see if stddef is available
12117 set stddef.h i_stddef
12118 eval $inhdr
12119
12120 : see if sys/access.h is available
12121 set sys/access.h i_sysaccess
12122 eval $inhdr
12123
12124 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12125 set sys/filio.h i_sysfilio
12126 eval $inhdr
12127 echo " "
12128 if $test `./findhdr sys/ioctl.h`; then
12129         val="$define"
12130         echo '<sys/ioctl.h> found.' >&4
12131 else
12132         val="$undef"
12133         if $test $i_sysfilio = "$define"; then
12134             echo '<sys/ioctl.h> NOT found.' >&4
12135         else
12136                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12137                 $test $i_termio = "$define" && xxx="termio.h"
12138                 $test $i_termios = "$define" && xxx="termios.h"
12139 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12140         fi
12141 fi
12142 set i_sysioctl
12143 eval $setvar
12144
12145 : see if sys/resource.h has to be included
12146 set sys/resource.h i_sysresrc
12147 eval $inhdr
12148
12149 : see if sys/security.h is available
12150 set sys/security.h i_syssecrt
12151 eval $inhdr
12152
12153 : see if this is a sys/statvfs.h system
12154 set sys/statvfs.h i_sysstatvfs
12155 eval $inhdr
12156
12157 : see if this is a sys/un.h system
12158 set sys/un.h i_sysun
12159 eval $inhdr
12160
12161 : see if this is a syswait system
12162 set sys/wait.h i_syswait
12163 eval $inhdr
12164
12165 : see if this is an utime system
12166 set utime.h i_utime
12167 eval $inhdr
12168
12169 : see if this is a values.h system
12170 set values.h i_values
12171 eval $inhdr
12172
12173 : see if this is a vfork system
12174 case "$d_vfork" in
12175 "$define")
12176         set vfork.h i_vfork
12177         eval $inhdr
12178         ;;
12179 *)
12180         i_vfork="$undef"
12181         ;;
12182 esac
12183
12184 : see if gdbm.h is available
12185 set gdbm.h t_gdbm
12186 eval $inhdr
12187 case "$t_gdbm" in
12188 $define)
12189         : see if gdbm_open exists
12190         set gdbm_open d_gdbm_open
12191         eval $inlibc
12192         case "$d_gdbm_open" in
12193         $undef)
12194                 t_gdbm="$undef"
12195                 echo "We won't be including <gdbm.h>"
12196                 ;;
12197         esac
12198         ;;
12199 esac
12200 val="$t_gdbm"
12201 set i_gdbm
12202 eval $setvar
12203
12204 echo " "
12205 echo "Looking for extensions..." >&4
12206 tdir=`pwd`
12207 cd $rsrc/ext
12208 : If we are using the old config.sh, known_extensions may contain
12209 : old or inaccurate or duplicate values.
12210 known_extensions=''
12211 nonxs_extensions=''
12212 : We do not use find because it might not be available.
12213 : We do not just use MANIFEST because the user may have dropped
12214 : some additional extensions into the source tree and expect them
12215 : to be built.
12216 for xxx in * ; do
12217         case "$xxx" in
12218         DynaLoader|dynaload) ;;
12219         *)      if $test -f $xxx/$xxx.xs; then
12220                         known_extensions="$known_extensions $xxx"
12221                 elif $test -f $xxx/Makefile.PL; then
12222                         nonxs_extensions="$nonxs_extensions $xxx"
12223                 else
12224                         if $test -d $xxx; then
12225                                 # Look for nested extensions, eg. Devel/Dprof.
12226                                 cd $xxx
12227                                 for yyy in * ; do
12228                                 if $test -f $yyy/$yyy.xs; then
12229                                         known_extensions="$known_extensions $xxx/$yyy"
12230                                 elif $test -f $yyy/Makefile.PL; then
12231                                         nonxs_extensions="$nonxs_extensions $xxx/$yyy"
12232                                 fi
12233                                 done
12234                                 cd ..
12235                         fi
12236                 fi 
12237                 ;;
12238         esac
12239 done
12240 set X $nonxs_extensions
12241 shift
12242 nonxs_extensions="$*"
12243 set X $known_extensions
12244 shift
12245 known_extensions="$*"
12246 cd $tdir
12247
12248 : Now see which are supported on this system.
12249 avail_ext=''
12250 for xxx in $known_extensions ; do
12251         case "$xxx" in
12252         DB_File|db_file)
12253                 case "$i_db" in
12254                 $define) avail_ext="$avail_ext $xxx" ;;
12255                 esac
12256                 ;;
12257         GDBM_File|gdbm_fil)
12258                 case "$i_gdbm" in 
12259                 $define) avail_ext="$avail_ext $xxx" ;;
12260                 esac
12261                 ;;
12262         NDBM_File|ndbm_fil)
12263                 case "$i_ndbm" in
12264                 $define) avail_ext="$avail_ext $xxx" ;;
12265                 esac
12266                 ;;
12267         ODBM_File|odbm_fil) 
12268                 case "${i_dbm}${i_rpcsvcdbm}" in
12269                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12270                 esac
12271                 ;;
12272         POSIX|posix)
12273                 case "$useposix" in
12274                 true|define|y) avail_ext="$avail_ext $xxx" ;;
12275                 esac
12276                 ;;
12277         Opcode|opcode)
12278                 case "$useopcode" in
12279                 true|define|y) avail_ext="$avail_ext $xxx" ;;
12280                 esac
12281                 ;;
12282         Socket|socket)
12283                 case "$d_socket" in 
12284                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12285                 esac
12286                 ;;
12287         Thread|thread)
12288                 case "$usethreads" in 
12289                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12290                 esac
12291                 ;;
12292         IPC/SysV|ipc/sysv)
12293                 : XXX Do we need a useipcsysv variable here
12294                 case "${d_msg}${d_sem}${d_shm}" in 
12295                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12296                 esac
12297                 ;;
12298         *)      avail_ext="$avail_ext $xxx"
12299                 ;;
12300         esac
12301 done
12302
12303 set X $avail_ext
12304 shift
12305 avail_ext="$*"
12306
12307 : Now see which nonxs extensions are supported on this system.
12308 : For now assume all are.
12309 nonxs_ext=''
12310 for xxx in $nonxs_extensions ; do
12311         case "$xxx" in
12312         *)      nonxs_ext="$nonxs_ext $xxx"
12313                 ;;
12314         esac
12315 done
12316
12317 set X $nonxs_ext
12318 shift
12319 nonxs_ext="$*"
12320
12321 case $usedl in
12322 $define)
12323         $cat <<EOM
12324 A number of extensions are supplied with $package.  You may choose to
12325 compile these extensions for dynamic loading (the default), compile
12326 them into the $package executable (static loading), or not include
12327 them at all.  Answer "none" to include no extensions.
12328 Note that DynaLoader is always built and need not be mentioned here.
12329
12330 EOM
12331         case "$dynamic_ext" in
12332         '') dflt="$avail_ext" ;;
12333         *)      dflt="$dynamic_ext"
12334                 # Perhaps we are reusing an old out-of-date config.sh.
12335                 case "$hint" in
12336                 previous)
12337                         if test X"$dynamic_ext" != X"$avail_ext"; then
12338                                 $cat <<EOM
12339 NOTICE:  Your previous config.sh list may be incorrect. 
12340 The extensions now available to you are 
12341         ${avail_ext}
12342 but the default list from your previous config.sh is
12343         ${dynamic_ext} 
12344
12345 EOM
12346                         fi
12347                         ;;
12348                 esac
12349                 ;;
12350         esac
12351         case "$dflt" in
12352         '')     dflt=none;;
12353         esac
12354         rp="What extensions do you wish to load dynamically?"
12355         . ./myread
12356         case "$ans" in
12357         none) dynamic_ext=' ' ;;
12358         *) dynamic_ext="$ans" ;;
12359         esac
12360
12361         case "$static_ext" in
12362         '')
12363                 : Exclude those already listed in dynamic linking
12364                 dflt=''
12365                 for xxx in $avail_ext; do
12366                         case " $dynamic_ext " in
12367                         *" $xxx "*) ;;
12368                         *) dflt="$dflt $xxx" ;;
12369                         esac
12370                 done
12371                 set X $dflt
12372                 shift
12373                 dflt="$*"
12374                 ;;
12375         *)  dflt="$static_ext" 
12376                 ;;
12377         esac
12378
12379         case "$dflt" in
12380         '')     dflt=none;;
12381         esac
12382         rp="What extensions do you wish to load statically?"
12383         . ./myread
12384         case "$ans" in
12385         none) static_ext=' ' ;;
12386         *) static_ext="$ans" ;;
12387         esac
12388         ;;
12389 *)
12390         $cat <<EOM
12391 A number of extensions are supplied with $package.  Answer "none" 
12392 to include no extensions. 
12393 Note that DynaLoader is always built and need not be mentioned here.
12394
12395 EOM
12396         case "$static_ext" in
12397         '') dflt="$avail_ext" ;;
12398         *)      dflt="$static_ext"
12399                 # Perhaps we are reusing an old out-of-date config.sh.
12400                 case "$hint" in
12401                 previous)
12402                         if test X"$static_ext" != X"$avail_ext"; then
12403                                 $cat <<EOM
12404 NOTICE:  Your previous config.sh list may be incorrect. 
12405 The extensions now available to you are 
12406         ${avail_ext}
12407 but the default list from your previous config.sh is
12408         ${static_ext} 
12409
12410 EOM
12411                         fi
12412                         ;;
12413                 esac
12414                 ;;
12415         esac
12416         : Exclude those that are not xs extensions
12417         case "$dflt" in
12418         '')     dflt=none;;
12419         esac
12420         rp="What extensions do you wish to include?"
12421         . ./myread
12422         case "$ans" in
12423         none) static_ext=' ' ;;
12424         *) static_ext="$ans" ;;
12425         esac
12426         ;;
12427 esac
12428
12429 set X $dynamic_ext $static_ext $nonxs_ext
12430 shift
12431 extensions="$*"
12432
12433 : Remove build directory name from cppstdin so it can be used from
12434 : either the present location or the final installed location.
12435 echo " "
12436 : Get out of the UU directory to get correct path name.
12437 cd ..
12438 case "$cppstdin" in
12439 `pwd`/cppstdin)
12440         echo "Stripping down cppstdin path name"
12441         cppstdin=cppstdin
12442         ;;
12443 esac
12444 cd UU
12445
12446 : end of configuration questions
12447 echo " "
12448 echo "End of configuration questions."
12449 echo " "
12450
12451 : back to where it started
12452 if test -d ../UU; then
12453         cd ..
12454 fi
12455
12456 : configuration may be patched via a 'config.over' file
12457 if $test -f config.over; then
12458         echo " "
12459         dflt=y
12460         rp='I see a config.over file.  Do you wish to load it?'
12461         . UU/myread
12462         case "$ans" in
12463         n*) echo "OK, I'll ignore it.";;
12464         *)      . ./config.over
12465                 echo "Configuration override changes have been loaded."
12466                 ;;
12467         esac
12468 fi
12469
12470 : in case they want portability, strip down executable paths
12471 case "$d_portable" in
12472 "$define")
12473         echo " "
12474         echo "Stripping down executable paths..." >&4
12475         for file in $loclist $trylist; do
12476                 if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
12477                         eval $file="\$file"
12478                 fi
12479         done
12480         ;;
12481 esac
12482
12483 : create config.sh file
12484 echo " "
12485 echo "Creating config.sh..." >&4
12486 $spitshell <<EOT >config.sh
12487 $startsh
12488 #
12489 # This file was produced by running the Configure script. It holds all the
12490 # definitions figured out by Configure. Should you modify one of these values,
12491 # do not forget to propagate your changes by running "Configure -der". You may
12492 # instead choose to run each of the .SH files by yourself, or "Configure -S".
12493 #
12494
12495 # Package name      : $package
12496 # Source directory  : $src
12497 # Configuration time: $cf_time
12498 # Configured by     : $cf_by
12499 # Target system     : $myuname
12500
12501 Author='$Author'
12502 Date='$Date'
12503 Header='$Header'
12504 Id='$Id'
12505 Locker='$Locker'
12506 Log='$Log'
12507 Mcc='$Mcc'
12508 RCSfile='$RCSfile'
12509 Revision='$Revision'
12510 Source='$Source'
12511 State='$State'
12512 _a='$_a'
12513 _exe='$_exe'
12514 _o='$_o'
12515 afs='$afs'
12516 alignbytes='$alignbytes'
12517 ansi2knr='$ansi2knr'
12518 aphostname='$aphostname'
12519 apiversion='$apiversion'
12520 ar='$ar'
12521 archlib='$archlib'
12522 archlibexp='$archlibexp'
12523 archname64='$archname64'
12524 archname='$archname'
12525 archobjs='$archobjs'
12526 awk='$awk'
12527 baserev='$baserev'
12528 bash='$bash'
12529 bin='$bin'
12530 binexp='$binexp'
12531 bison='$bison'
12532 byacc='$byacc'
12533 byteorder='$byteorder'
12534 c='$c'
12535 castflags='$castflags'
12536 cat='$cat'
12537 cc='$cc'
12538 cccdlflags='$cccdlflags'
12539 ccdlflags='$ccdlflags'
12540 ccflags='$ccflags'
12541 ccsymbols='$ccsymbols'
12542 cf_by='$cf_by'
12543 cf_email='$cf_email'
12544 cf_time='$cf_time'
12545 chgrp='$chgrp'
12546 chmod='$chmod'
12547 chown='$chown'
12548 clocktype='$clocktype'
12549 comm='$comm'
12550 compress='$compress'
12551 contains='$contains'
12552 cp='$cp'
12553 cpio='$cpio'
12554 cpp='$cpp'
12555 cpp_stuff='$cpp_stuff'
12556 cppccsymbols='$cppccsymbols'
12557 cppflags='$cppflags'
12558 cpplast='$cpplast'
12559 cppminus='$cppminus'
12560 cpprun='$cpprun'
12561 cppstdin='$cppstdin'
12562 cppsymbols='$cppsymbols'
12563 cryptlib='$cryptlib'
12564 csh='$csh'
12565 d_Gconvert='$d_Gconvert'
12566 d_access='$d_access'
12567 d_accessx='$d_accessx'
12568 d_alarm='$d_alarm'
12569 d_archlib='$d_archlib'
12570 d_attribut='$d_attribut'
12571 d_bcmp='$d_bcmp'
12572 d_bcopy='$d_bcopy'
12573 d_bsd='$d_bsd'
12574 d_bsdgetpgrp='$d_bsdgetpgrp'
12575 d_bsdsetpgrp='$d_bsdsetpgrp'
12576 d_bzero='$d_bzero'
12577 d_casti32='$d_casti32'
12578 d_castneg='$d_castneg'
12579 d_charvspr='$d_charvspr'
12580 d_chown='$d_chown'
12581 d_chroot='$d_chroot'
12582 d_chsize='$d_chsize'
12583 d_closedir='$d_closedir'
12584 d_cmsghdr_s='$d_cmsghdr_s'
12585 d_const='$d_const'
12586 d_crypt='$d_crypt'
12587 d_csh='$d_csh'
12588 d_cuserid='$d_cuserid'
12589 d_dbl_dig='$d_dbl_dig'
12590 d_dbmclose64='$d_dbmclose64'
12591 d_dbminit64='$d_dbminit64'
12592 d_delete64='$d_delete64'
12593 d_difftime='$d_difftime'
12594 d_dirent64_s='$d_dirent64_s'
12595 d_dirnamlen='$d_dirnamlen'
12596 d_dlerror='$d_dlerror'
12597 d_dlopen='$d_dlopen'
12598 d_dlsymun='$d_dlsymun'
12599 d_dosuid='$d_dosuid'
12600 d_drand48proto='$d_drand48proto'
12601 d_dup2='$d_dup2'
12602 d_eaccess='$d_eaccess'
12603 d_endgrent='$d_endgrent'
12604 d_endhent='$d_endhent'
12605 d_endnent='$d_endnent'
12606 d_endpent='$d_endpent'
12607 d_endpwent='$d_endpwent'
12608 d_endsent='$d_endsent'
12609 d_eofnblk='$d_eofnblk'
12610 d_eunice='$d_eunice'
12611 d_fchmod='$d_fchmod'
12612 d_fchown='$d_fchown'
12613 d_fcntl='$d_fcntl'
12614 d_fd_macros='$d_fd_macros'
12615 d_fd_set='$d_fd_set'
12616 d_fds_bits='$d_fds_bits'
12617 d_fetch64='$d_fetch64'
12618 d_fgetpos64='$d_fgetpos64'
12619 d_fgetpos='$d_fgetpos'
12620 d_firstkey64='$d_firstkey64'
12621 d_flexfnam='$d_flexfnam'
12622 d_flock64_s='$d_flock64_s'
12623 d_flock='$d_flock'
12624 d_fopen64='$d_fopen64'
12625 d_fork='$d_fork'
12626 d_fpathconf='$d_fpathconf'
12627 d_freopen64='$d_freopen64'
12628 d_fseek64='$d_fseek64'
12629 d_fseeko64='$d_fseeko64'
12630 d_fseeko='$d_fseeko'
12631 d_fsetpos64='$d_fsetpos64'
12632 d_fsetpos='$d_fsetpos'
12633 d_fstat64='$d_fstat64'
12634 d_fstatfs='$d_fstatfs'
12635 d_fstatvfs='$d_fstatvfs'
12636 d_ftell64='$d_ftell64'
12637 d_ftello64='$d_ftello64'
12638 d_ftello='$d_ftello'
12639 d_ftime='$d_ftime'
12640 d_ftruncate64='$d_ftruncate64'
12641 d_getgrent='$d_getgrent'
12642 d_getgrps='$d_getgrps'
12643 d_gethbyaddr='$d_gethbyaddr'
12644 d_gethbyname='$d_gethbyname'
12645 d_gethent='$d_gethent'
12646 d_gethname='$d_gethname'
12647 d_gethostprotos='$d_gethostprotos'
12648 d_getlogin='$d_getlogin'
12649 d_getnbyaddr='$d_getnbyaddr'
12650 d_getnbyname='$d_getnbyname'
12651 d_getnent='$d_getnent'
12652 d_getnetprotos='$d_getnetprotos'
12653 d_getpbyname='$d_getpbyname'
12654 d_getpbynumber='$d_getpbynumber'
12655 d_getpent='$d_getpent'
12656 d_getpgid='$d_getpgid'
12657 d_getpgrp2='$d_getpgrp2'
12658 d_getpgrp='$d_getpgrp'
12659 d_getppid='$d_getppid'
12660 d_getprior='$d_getprior'
12661 d_getprotoprotos='$d_getprotoprotos'
12662 d_getpwent='$d_getpwent'
12663 d_getsbyname='$d_getsbyname'
12664 d_getsbyport='$d_getsbyport'
12665 d_getsent='$d_getsent'
12666 d_getservprotos='$d_getservprotos'
12667 d_gettimeod='$d_gettimeod'
12668 d_gnulibc='$d_gnulibc'
12669 d_grpasswd='$d_grpasswd'
12670 d_htonl='$d_htonl'
12671 d_index='$d_index'
12672 d_inetaton='$d_inetaton'
12673 d_ino64t='$d_ino64t'
12674 d_int64t='$d_int64t'
12675 d_iovec_s='$d_iovec_s'
12676 d_isascii='$d_isascii'
12677 d_killpg='$d_killpg'
12678 d_lchown='$d_lchown'
12679 d_link='$d_link'
12680 d_locconv='$d_locconv'
12681 d_lockf64='$d_lockf64'
12682 d_lockf='$d_lockf'
12683 d_longdbl='$d_longdbl'
12684 d_longlong='$d_longlong'
12685 d_lseek64='$d_lseek64'
12686 d_lstat64='$d_lstat64'
12687 d_lstat='$d_lstat'
12688 d_madvise='$d_madvise'
12689 d_mblen='$d_mblen'
12690 d_mbstowcs='$d_mbstowcs'
12691 d_mbtowc='$d_mbtowc'
12692 d_memcmp='$d_memcmp'
12693 d_memcpy='$d_memcpy'
12694 d_memmove='$d_memmove'
12695 d_memset='$d_memset'
12696 d_mkdir='$d_mkdir'
12697 d_mkfifo='$d_mkfifo'
12698 d_mktime='$d_mktime'
12699 d_mmap='$d_mmap'
12700 d_mprotect='$d_mprotect'
12701 d_msg='$d_msg'
12702 d_msg_ctrunc='$d_msg_ctrunc'
12703 d_msg_dontroute='$d_msg_dontroute'
12704 d_msg_oob='$d_msg_oob'
12705 d_msg_peek='$d_msg_peek'
12706 d_msg_proxy='$d_msg_proxy'
12707 d_msgctl='$d_msgctl'
12708 d_msgget='$d_msgget'
12709 d_msghdr_s='$d_msghdr_s'
12710 d_msgrcv='$d_msgrcv'
12711 d_msgsnd='$d_msgsnd'
12712 d_msync='$d_msync'
12713 d_munmap='$d_munmap'
12714 d_mymalloc='$d_mymalloc'
12715 d_nextkey64='$d_nextkey64'
12716 d_nice='$d_nice'
12717 d_off64t='$d_off64t'
12718 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
12719 d_oldpthreads='$d_oldpthreads'
12720 d_oldsock='$d_oldsock'
12721 d_open3='$d_open3'
12722 d_open64='$d_open64'
12723 d_opendir64='$d_opendir64'
12724 d_pathconf='$d_pathconf'
12725 d_pause='$d_pause'
12726 d_phostname='$d_phostname'
12727 d_pipe='$d_pipe'
12728 d_poll='$d_poll'
12729 d_portable='$d_portable'
12730 d_pthread_yield='$d_pthread_yield'
12731 d_pwage='$d_pwage'
12732 d_pwchange='$d_pwchange'
12733 d_pwclass='$d_pwclass'
12734 d_pwcomment='$d_pwcomment'
12735 d_pwexpire='$d_pwexpire'
12736 d_pwgecos='$d_pwgecos'
12737 d_pwpasswd='$d_pwpasswd'
12738 d_pwquota='$d_pwquota'
12739 d_readdir64='$d_readdir64'
12740 d_readdir='$d_readdir'
12741 d_readlink='$d_readlink'
12742 d_readv='$d_readv'
12743 d_recvmsg='$d_recvmsg'
12744 d_rename='$d_rename'
12745 d_rewinddir='$d_rewinddir'
12746 d_rmdir='$d_rmdir'
12747 d_safebcpy='$d_safebcpy'
12748 d_safemcpy='$d_safemcpy'
12749 d_sanemcmp='$d_sanemcmp'
12750 d_sched_yield='$d_sched_yield'
12751 d_scm_rights='$d_scm_rights'
12752 d_seekdir64='$d_seekdir64'
12753 d_seekdir='$d_seekdir'
12754 d_select='$d_select'
12755 d_sem='$d_sem'
12756 d_semctl='$d_semctl'
12757 d_semctl_semid_ds='$d_semctl_semid_ds'
12758 d_semctl_semun='$d_semctl_semun'
12759 d_semget='$d_semget'
12760 d_semop='$d_semop'
12761 d_sendmsg='$d_sendmsg'
12762 d_setegid='$d_setegid'
12763 d_seteuid='$d_seteuid'
12764 d_setgrent='$d_setgrent'
12765 d_setgrps='$d_setgrps'
12766 d_sethent='$d_sethent'
12767 d_setlinebuf='$d_setlinebuf'
12768 d_setlocale='$d_setlocale'
12769 d_setnent='$d_setnent'
12770 d_setpent='$d_setpent'
12771 d_setpgid='$d_setpgid'
12772 d_setpgrp2='$d_setpgrp2'
12773 d_setpgrp='$d_setpgrp'
12774 d_setprior='$d_setprior'
12775 d_setpwent='$d_setpwent'
12776 d_setregid='$d_setregid'
12777 d_setresgid='$d_setresgid'
12778 d_setresuid='$d_setresuid'
12779 d_setreuid='$d_setreuid'
12780 d_setrgid='$d_setrgid'
12781 d_setruid='$d_setruid'
12782 d_setsent='$d_setsent'
12783 d_setsid='$d_setsid'
12784 d_setvbuf='$d_setvbuf'
12785 d_sfio='$d_sfio'
12786 d_shm='$d_shm'
12787 d_shmat='$d_shmat'
12788 d_shmatprototype='$d_shmatprototype'
12789 d_shmctl='$d_shmctl'
12790 d_shmdt='$d_shmdt'
12791 d_shmget='$d_shmget'
12792 d_sigaction='$d_sigaction'
12793 d_sigsetjmp='$d_sigsetjmp'
12794 d_socket='$d_socket'
12795 d_sockpair='$d_sockpair'
12796 d_stat64='$d_stat64'
12797 d_statblks='$d_statblks'
12798 d_statfs='$d_statfs'
12799 d_statfsflags='$d_statfsflags'
12800 d_statvfs='$d_statvfs'
12801 d_stdio_cnt_lval='$d_stdio_cnt_lval'
12802 d_stdio_ptr_lval='$d_stdio_ptr_lval'
12803 d_stdiobase='$d_stdiobase'
12804 d_stdstdio='$d_stdstdio'
12805 d_store64='$d_store64'
12806 d_strchr='$d_strchr'
12807 d_strcoll='$d_strcoll'
12808 d_strctcpy='$d_strctcpy'
12809 d_strerrm='$d_strerrm'
12810 d_strerror='$d_strerror'
12811 d_strtod='$d_strtod'
12812 d_strtol='$d_strtol'
12813 d_strtoul='$d_strtoul'
12814 d_strxfrm='$d_strxfrm'
12815 d_suidsafe='$d_suidsafe'
12816 d_symlink='$d_symlink'
12817 d_syscall='$d_syscall'
12818 d_sysconf='$d_sysconf'
12819 d_sysernlst='$d_sysernlst'
12820 d_syserrlst='$d_syserrlst'
12821 d_system='$d_system'
12822 d_tcgetpgrp='$d_tcgetpgrp'
12823 d_tcsetpgrp='$d_tcsetpgrp'
12824 d_telldir64='$d_telldir64'
12825 d_telldir='$d_telldir'
12826 d_telldirproto='$d_telldirproto'
12827 d_time='$d_time'
12828 d_times='$d_times'
12829 d_tmpfile64='$d_tmpfile64'
12830 d_truncate64='$d_truncate64'
12831 d_truncate='$d_truncate'
12832 d_tzname='$d_tzname'
12833 d_umask='$d_umask'
12834 d_uname='$d_uname'
12835 d_union_semun='$d_union_semun'
12836 d_vfork='$d_vfork'
12837 d_void_closedir='$d_void_closedir'
12838 d_voidsig='$d_voidsig'
12839 d_voidtty='$d_voidtty'
12840 d_volatile='$d_volatile'
12841 d_vprintf='$d_vprintf'
12842 d_wait4='$d_wait4'
12843 d_waitpid='$d_waitpid'
12844 d_wcstombs='$d_wcstombs'
12845 d_wctomb='$d_wctomb'
12846 d_writev='$d_writev'
12847 d_xenix='$d_xenix'
12848 date='$date'
12849 db_hashtype='$db_hashtype'
12850 db_prefixtype='$db_prefixtype'
12851 defvoidused='$defvoidused'
12852 direntrytype='$direntrytype'
12853 dlext='$dlext'
12854 dlsrc='$dlsrc'
12855 doublesize='$doublesize'
12856 drand01='$drand01'
12857 dynamic_ext='$dynamic_ext'
12858 eagain='$eagain'
12859 ebcdic='$ebcdic'
12860 echo='$echo'
12861 egrep='$egrep'
12862 emacs='$emacs'
12863 eunicefix='$eunicefix'
12864 exe_ext='$exe_ext'
12865 expr='$expr'
12866 extensions='$extensions'
12867 find='$find'
12868 firstmakefile='$firstmakefile'
12869 flex='$flex'
12870 fpostype='$fpostype'
12871 freetype='$freetype'
12872 full_csh='$full_csh'
12873 full_sed='$full_sed'
12874 gccversion='$gccversion'
12875 gidtype='$gidtype'
12876 glibpth='$glibpth'
12877 grep='$grep'
12878 groupcat='$groupcat'
12879 groupstype='$groupstype'
12880 gzip='$gzip'
12881 h_fcntl='$h_fcntl'
12882 h_sysfile='$h_sysfile'
12883 hint='$hint'
12884 hostcat='$hostcat'
12885 huge='$huge'
12886 i_arpainet='$i_arpainet'
12887 i_bsdioctl='$i_bsdioctl'
12888 i_db='$i_db'
12889 i_dbm='$i_dbm'
12890 i_dirent='$i_dirent'
12891 i_dld='$i_dld'
12892 i_dlfcn='$i_dlfcn'
12893 i_fcntl='$i_fcntl'
12894 i_float='$i_float'
12895 i_gdbm='$i_gdbm'
12896 i_grp='$i_grp'
12897 i_inttypes='$i_inttypes'
12898 i_limits='$i_limits'
12899 i_locale='$i_locale'
12900 i_machcthr='$i_machcthr'
12901 i_malloc='$i_malloc'
12902 i_math='$i_math'
12903 i_memory='$i_memory'
12904 i_mntent='$i_mntent'
12905 i_ndbm='$i_ndbm'
12906 i_netdb='$i_netdb'
12907 i_neterrno='$i_neterrno'
12908 i_niin='$i_niin'
12909 i_poll='$i_poll'
12910 i_pwd='$i_pwd'
12911 i_rpcsvcdbm='$i_rpcsvcdbm'
12912 i_sfio='$i_sfio'
12913 i_sgtty='$i_sgtty'
12914 i_stdarg='$i_stdarg'
12915 i_stddef='$i_stddef'
12916 i_stdlib='$i_stdlib'
12917 i_string='$i_string'
12918 i_sysaccess='$i_sysaccess'
12919 i_sysdir='$i_sysdir'
12920 i_sysfile='$i_sysfile'
12921 i_sysfilio='$i_sysfilio'
12922 i_sysin='$i_sysin'
12923 i_sysioctl='$i_sysioctl'
12924 i_sysmman='$i_sysmman'
12925 i_sysmount='$i_sysmount'
12926 i_sysndir='$i_sysndir'
12927 i_sysparam='$i_sysparam'
12928 i_sysresrc='$i_sysresrc'
12929 i_syssecrt='$i_syssecrt'
12930 i_sysselct='$i_sysselct'
12931 i_syssockio='$i_syssockio'
12932 i_sysstat='$i_sysstat'
12933 i_sysstatvfs='$i_sysstatvfs'
12934 i_systime='$i_systime'
12935 i_systimek='$i_systimek'
12936 i_systimes='$i_systimes'
12937 i_systypes='$i_systypes'
12938 i_sysuio='$i_sysuio'
12939 i_sysun='$i_sysun'
12940 i_syswait='$i_syswait'
12941 i_termio='$i_termio'
12942 i_termios='$i_termios'
12943 i_time='$i_time'
12944 i_unistd='$i_unistd'
12945 i_utime='$i_utime'
12946 i_values='$i_values'
12947 i_varargs='$i_varargs'
12948 i_varhdr='$i_varhdr'
12949 i_vfork='$i_vfork'
12950 ignore_versioned_solibs='$ignore_versioned_solibs'
12951 incpath='$incpath'
12952 inews='$inews'
12953 installarchlib='$installarchlib'
12954 installbin='$installbin'
12955 installman1dir='$installman1dir'
12956 installman3dir='$installman3dir'
12957 installprivlib='$installprivlib'
12958 installscript='$installscript'
12959 installsitearch='$installsitearch'
12960 installsitelib='$installsitelib'
12961 installusrbinperl='$installusrbinperl'
12962 intsize='$intsize'
12963 known_extensions='$known_extensions'
12964 ksh='$ksh'
12965 large='$large'
12966 ld='$ld'
12967 lddlflags='$lddlflags'
12968 ldflags='$ldflags'
12969 less='$less'
12970 lib_ext='$lib_ext'
12971 libc='$libc'
12972 libperl='$libperl'
12973 libpth='$libpth'
12974 libs='$libs'
12975 libswanted='$libswanted'
12976 line='$line'
12977 lint='$lint'
12978 lkflags='$lkflags'
12979 ln='$ln'
12980 lns='$lns'
12981 locincpth='$locincpth'
12982 loclibpth='$loclibpth'
12983 longdblsize='$longdblsize'
12984 longlongsize='$longlongsize'
12985 longsize='$longsize'
12986 lp='$lp'
12987 lpr='$lpr'
12988 ls='$ls'
12989 lseeksize='$lseeksize'
12990 lseektype='$lseektype'
12991 mail='$mail'
12992 mailx='$mailx'
12993 make='$make'
12994 make_set_make='$make_set_make'
12995 mallocobj='$mallocobj'
12996 mallocsrc='$mallocsrc'
12997 malloctype='$malloctype'
12998 man1dir='$man1dir'
12999 man1direxp='$man1direxp'
13000 man1ext='$man1ext'
13001 man3dir='$man3dir'
13002 man3direxp='$man3direxp'
13003 man3ext='$man3ext'
13004 medium='$medium'
13005 mips='$mips'
13006 mips_type='$mips_type'
13007 mkdir='$mkdir'
13008 mmaptype='$mmaptype'
13009 models='$models'
13010 modetype='$modetype'
13011 more='$more'
13012 mv='$mv'
13013 myarchname='$myarchname'
13014 mydomain='$mydomain'
13015 myhostname='$myhostname'
13016 myuname='$myuname'
13017 n='$n'
13018 netdb_hlen_type='$netdb_hlen_type'
13019 netdb_host_type='$netdb_host_type'
13020 netdb_name_type='$netdb_name_type'
13021 netdb_net_type='$netdb_net_type'
13022 nm='$nm'
13023 nm_opt='$nm_opt'
13024 nm_so_opt='$nm_so_opt'
13025 nonxs_ext='$nonxs_ext'
13026 nroff='$nroff'
13027 o_nonblock='$o_nonblock'
13028 obj_ext='$obj_ext'
13029 old_pthread_create_joinable='$old_pthread_create_joinable'
13030 optimize='$optimize'
13031 orderlib='$orderlib'
13032 osname='$osname'
13033 osvers='$osvers'
13034 package='$package'
13035 pager='$pager'
13036 passcat='$passcat'
13037 patchlevel='$patchlevel'
13038 path_sep='$path_sep'
13039 perl='$perl'
13040 perladmin='$perladmin'
13041 perlpath='$perlpath'
13042 pg='$pg'
13043 phostname='$phostname'
13044 pidtype='$pidtype'
13045 plibpth='$plibpth'
13046 pmake='$pmake'
13047 pr='$pr'
13048 prefix='$prefix'
13049 prefixexp='$prefixexp'
13050 privlib='$privlib'
13051 privlibexp='$privlibexp'
13052 prototype='$prototype'
13053 ptrsize='$ptrsize'
13054 randbits='$randbits'
13055 randfunc='$randfunc'
13056 randseedtype='$randseedtype'
13057 ranlib='$ranlib'
13058 rd_nodata='$rd_nodata'
13059 rm='$rm'
13060 rmail='$rmail'
13061 runnm='$runnm'
13062 sched_yield='$sched_yield'
13063 scriptdir='$scriptdir'
13064 scriptdirexp='$scriptdirexp'
13065 sed='$sed'
13066 seedfunc='$seedfunc'
13067 selectminbits='$selectminbits'
13068 selecttype='$selecttype'
13069 sendmail='$sendmail'
13070 sh='$sh'
13071 shar='$shar'
13072 sharpbang='$sharpbang'
13073 shmattype='$shmattype'
13074 shortsize='$shortsize'
13075 shrpenv='$shrpenv'
13076 shsharp='$shsharp'
13077 sig_name='$sig_name'
13078 sig_name_init='$sig_name_init'
13079 sig_num='$sig_num'
13080 sig_num_init='$sig_num_init'
13081 signal_t='$signal_t'
13082 sitearch='$sitearch'
13083 sitearchexp='$sitearchexp'
13084 sitelib='$sitelib'
13085 sitelibexp='$sitelibexp'
13086 sizetype='$sizetype'
13087 sleep='$sleep'
13088 smail='$smail'
13089 small='$small'
13090 so='$so'
13091 sockethdr='$sockethdr'
13092 socketlib='$socketlib'
13093 sort='$sort'
13094 spackage='$spackage'
13095 spitshell='$spitshell'
13096 split='$split'
13097 src='$src'
13098 ssizetype='$ssizetype'
13099 startperl='$startperl'
13100 startsh='$startsh'
13101 static_ext='$static_ext'
13102 stdchar='$stdchar'
13103 stdio_base='$stdio_base'
13104 stdio_bufsiz='$stdio_bufsiz'
13105 stdio_cnt='$stdio_cnt'
13106 stdio_filbuf='$stdio_filbuf'
13107 stdio_ptr='$stdio_ptr'
13108 strings='$strings'
13109 submit='$submit'
13110 subversion='$subversion'
13111 sysman='$sysman'
13112 tail='$tail'
13113 tar='$tar'
13114 tbl='$tbl'
13115 tee='$tee'
13116 test='$test'
13117 timeincl='$timeincl'
13118 timetype='$timetype'
13119 touch='$touch'
13120 tr='$tr'
13121 trnl='$trnl'
13122 troff='$troff'
13123 uidtype='$uidtype'
13124 uname='$uname'
13125 uniq='$uniq'
13126 use64bits='$use64bits'
13127 usedl='$usedl'
13128 usemultiplicity='$usemultiplicity'
13129 usemymalloc='$usemymalloc'
13130 usenm='$usenm'
13131 useopcode='$useopcode'
13132 useperlio='$useperlio'
13133 useposix='$useposix'
13134 usesfio='$usesfio'
13135 useshrplib='$useshrplib'
13136 usethreads='$usethreads'
13137 usevfork='$usevfork'
13138 usrinc='$usrinc'
13139 uuname='$uuname'
13140 version='$version'
13141 vi='$vi'
13142 voidflags='$voidflags'
13143 xlibpth='$xlibpth'
13144 zcat='$zcat'
13145 zip='$zip'
13146 EOT
13147
13148 : Add in command line options if available
13149 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
13150
13151 : add special variables
13152 $test -f $src/patchlevel.h && \
13153 awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
13154 echo "CONFIG=true" >>config.sh
13155
13156 : propagate old symbols
13157 if $test -f UU/config.sh; then
13158         <UU/config.sh sort | uniq >UU/oldconfig.sh
13159         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
13160         sort | uniq -u >UU/oldsyms
13161         set X `cat UU/oldsyms`
13162         shift
13163         case $# in
13164         0) ;;
13165         *)
13166                 cat <<EOM
13167 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
13168 EOM
13169                 echo "# Variables propagated from previous config.sh file." >>config.sh
13170                 for sym in `cat UU/oldsyms`; do
13171                         echo "    Propagating $hint variable "'$'"$sym..."
13172                         eval 'tmp="$'"${sym}"'"'
13173                         echo "$tmp" | \
13174                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
13175                 done
13176                 ;;
13177         esac
13178 fi
13179
13180 : Finish up by extracting the .SH files
13181 case "$alldone" in
13182 exit)
13183         $rm -rf UU
13184         echo "Done."
13185         exit 0
13186         ;;
13187 cont)
13188         ;;
13189 '')
13190         dflt=''
13191         nostick=true
13192         $cat <<EOM
13193
13194 If you'd like to make any changes to the config.sh file before I begin
13195 to configure things, do it as a shell escape now (e.g. !vi config.sh).
13196
13197 EOM
13198         rp="Press return or use a shell escape to edit config.sh:"
13199         . UU/myread
13200         nostick=''
13201         case "$ans" in
13202         '') ;;
13203         *) : in case they cannot read
13204                 sh 1>&4 -c "$ans";;
13205         esac
13206         ;;
13207 esac
13208
13209 : if this fails, just run all the .SH files by hand
13210 . ./config.sh
13211
13212 echo " "
13213 exec 1>&4
13214 . ./UU/extract
13215
13216 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
13217         dflt=y
13218         case "$silent" in
13219         true) ;;
13220         *)
13221                 $cat <<EOM
13222
13223 Now you need to generate make dependencies by running "$make depend".
13224 You might prefer to run it in background: "$make depend > makedepend.out &"
13225 It can take a while, so you might not want to run it right now.
13226
13227 EOM
13228                 ;;
13229         esac
13230         rp="Run $make depend now?"
13231         . UU/myread
13232         case "$ans" in
13233         y*)
13234                 $make depend && echo "Now you must run a $make."
13235                 ;;
13236         *)
13237                 echo "You must run '$make depend' then '$make'."
13238                 ;;
13239         esac
13240 elif test -f [Mm]akefile; then
13241         echo " "
13242         echo "Now you must run a $make."
13243 else
13244         echo "Done."
13245 fi
13246
13247 if $test -f Policy.sh; then
13248     $cat <<EOM
13249
13250 If you compile $package on a different machine or from a different object
13251 directory, copy the Policy.sh file from this object directory to the
13252 new one before you run Configure -- this will help you with most of
13253 the policy defaults.
13254
13255 EOM
13256 fi
13257 if $test -f config.msg; then
13258     echo "Hmm.  I also noted the following information while running:"
13259     echo " "
13260     $cat config.msg >&4
13261     $rm -f config.msg
13262 fi
13263 $rm -f kit*isdone ark*isdone
13264 $rm -rf UU
13265
13266 : End of Configure
13267