Re: Misspelled macro in ext/POSIX/POSIX.xs?
[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 Sat Apr  3 16:33:12 EET DST 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 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 baserev=''
282 bin=''
283 binexp=''
284 installbin=''
285 byteorder=''
286 cc=''
287 gccversion=''
288 ccflags=''
289 cppflags=''
290 ldflags=''
291 lkflags=''
292 locincpth=''
293 optimize=''
294 cf_email=''
295 cf_by=''
296 cf_time=''
297 contains=''
298 cpp_stuff=''
299 cpplast=''
300 cppminus=''
301 cpprun=''
302 cppstdin=''
303 crosscompile=''
304 d_access=''
305 d_accessx=''
306 d_alarm=''
307 d_attribut=''
308 d_bcmp=''
309 d_bcopy=''
310 d_bzero=''
311 d_casti32=''
312 castflags=''
313 d_castneg=''
314 d_chown=''
315 d_chroot=''
316 d_chsize=''
317 d_closedir=''
318 d_void_closedir=''
319 d_const=''
320 cryptlib=''
321 d_crypt=''
322 d_csh=''
323 full_csh=''
324 d_cuserid=''
325 d_dbl_dig=''
326 d_difftime=''
327 d_dlerror=''
328 d_dlopen=''
329 d_dlsymun=''
330 d_dosuid=''
331 d_suidsafe=''
332 d_drand48proto=''
333 d_dup2=''
334 d_eaccess=''
335 d_endgrent=''
336 d_endhent=''
337 d_endnent=''
338 d_endpent=''
339 d_endpwent=''
340 d_endsent=''
341 d_fchmod=''
342 d_fchown=''
343 d_fcntl=''
344 d_fd_macros=''
345 d_fd_set=''
346 d_fds_bits=''
347 d_fgetpos=''
348 d_flexfnam=''
349 d_flock=''
350 d_fork=''
351 d_fseeko=''
352 d_fsetpos=''
353 d_ftello=''
354 d_ftime=''
355 d_gettimeod=''
356 d_Gconvert=''
357 d_getgrent=''
358 d_getgrps=''
359 d_gethbyaddr=''
360 d_gethbyname=''
361 d_gethent=''
362 aphostname=''
363 d_gethname=''
364 d_phostname=''
365 d_uname=''
366 d_gethostprotos=''
367 d_getlogin=''
368 d_getmntent=''
369 d_getnbyaddr=''
370 d_getnbyname=''
371 d_getnent=''
372 d_getnetprotos=''
373 d_getpent=''
374 d_getpgid=''
375 d_getpgrp2=''
376 d_bsdgetpgrp=''
377 d_getpgrp=''
378 d_getppid=''
379 d_getprior=''
380 d_getpbyname=''
381 d_getpbynumber=''
382 d_getprotoprotos=''
383 d_getpwent=''
384 d_getsent=''
385 d_getservprotos=''
386 d_getsbyname=''
387 d_getsbyport=''
388 d_gnulibc=''
389 d_hasmntopt=''
390 d_htonl=''
391 d_inetaton=''
392 d_isascii=''
393 d_killpg=''
394 d_lchown=''
395 d_link=''
396 d_locconv=''
397 d_lockf=''
398 d_longdbl=''
399 longdblsize=''
400 d_longlong=''
401 longlongsize=''
402 d_lstat=''
403 d_madvise=''
404 d_mblen=''
405 d_mbstowcs=''
406 d_mbtowc=''
407 d_memcmp=''
408 d_memcpy=''
409 d_memmove=''
410 d_memset=''
411 d_mkdir=''
412 d_mkfifo=''
413 d_mktime=''
414 d_mmap=''
415 mmaptype=''
416 d_mprotect=''
417 d_msg=''
418 d_msgctl=''
419 d_msgget=''
420 d_msgrcv=''
421 d_msgsnd=''
422 d_msync=''
423 d_munmap=''
424 d_nice=''
425 d_open3=''
426 d_fpathconf=''
427 d_pathconf=''
428 d_pause=''
429 d_pipe=''
430 d_poll=''
431 d_portable=''
432 d_old_pthread_create_joinable=''
433 old_pthread_create_joinable=''
434 d_pthread_yield=''
435 d_sched_yield=''
436 sched_yield=''
437 d_readdir=''
438 d_rewinddir=''
439 d_seekdir=''
440 d_telldir=''
441 d_readlink=''
442 d_readv=''
443 d_rename=''
444 d_rmdir=''
445 d_safebcpy=''
446 d_safemcpy=''
447 d_sanemcmp=''
448 d_select=''
449 d_sem=''
450 d_semctl=''
451 d_semget=''
452 d_semop=''
453 d_setegid=''
454 d_seteuid=''
455 d_setgrent=''
456 d_setgrps=''
457 d_sethent=''
458 d_setlinebuf=''
459 d_setlocale=''
460 d_setnent=''
461 d_setpent=''
462 d_setpgid=''
463 d_setpgrp2=''
464 d_bsdsetpgrp=''
465 d_setpgrp=''
466 d_setprior=''
467 d_setpwent=''
468 d_setregid=''
469 d_setresgid=''
470 d_setresuid=''
471 d_setreuid=''
472 d_setrgid=''
473 d_setruid=''
474 d_setsent=''
475 d_setsid=''
476 d_setvbuf=''
477 d_sfio=''
478 usesfio=''
479 d_shm=''
480 d_shmat=''
481 d_shmatprototype=''
482 shmattype=''
483 d_shmctl=''
484 d_shmdt=''
485 d_shmget=''
486 d_sigaction=''
487 d_sigsetjmp=''
488 d_cmsghdr_s=''
489 d_msg_ctrunc=''
490 d_msg_dontroute=''
491 d_msg_oob=''
492 d_msg_peek=''
493 d_msg_proxy=''
494 d_msghdr_s=''
495 d_oldsock=''
496 d_recvmsg=''
497 d_scm_rights=''
498 d_sendmsg=''
499 d_socket=''
500 d_sockpair=''
501 sockethdr=''
502 socketlib=''
503 d_statblks=''
504 d_fstatfs=''
505 d_statfs=''
506 d_statfsflags=''
507 d_fstatvfs=''
508 d_statvfs=''
509 d_stdio_cnt_lval=''
510 d_stdio_ptr_lval=''
511 d_stdiobase=''
512 d_stdstdio=''
513 stdio_base=''
514 stdio_bufsiz=''
515 stdio_cnt=''
516 stdio_filbuf=''
517 stdio_ptr=''
518 d_index=''
519 d_strchr=''
520 d_strcoll=''
521 d_strctcpy=''
522 d_strerrm=''
523 d_strerror=''
524 d_sysernlst=''
525 d_syserrlst=''
526 d_strtod=''
527 d_strtol=''
528 d_strtoul=''
529 d_strxfrm=''
530 d_symlink=''
531 d_syscall=''
532 d_sysconf=''
533 d_system=''
534 d_tcgetpgrp=''
535 d_tcsetpgrp=''
536 d_telldirproto=''
537 d_time=''
538 timetype=''
539 clocktype=''
540 d_times=''
541 d_truncate=''
542 d_tzname=''
543 d_umask=''
544 d_semctl_semid_ds=''
545 d_semctl_semun=''
546 d_union_semun=''
547 d_vfork=''
548 usevfork=''
549 d_voidsig=''
550 signal_t=''
551 d_volatile=''
552 d_charvspr=''
553 d_vprintf=''
554 d_wait4=''
555 d_waitpid=''
556 d_wcstombs=''
557 d_wctomb=''
558 d_writev=''
559 d_dbmclose64=''
560 d_dbminit64=''
561 d_delete64=''
562 d_fetch64=''
563 d_firstkey64=''
564 d_nextkey64=''
565 d_store64=''
566 dlext=''
567 cccdlflags=''
568 ccdlflags=''
569 dlsrc=''
570 ld=''
571 lddlflags=''
572 usedl=''
573 doublesize=''
574 ebcdic=''
575 fpostype=''
576 gidtype=''
577 groupstype=''
578 h_fcntl=''
579 h_sysfile=''
580 i_arpainet=''
581 db_hashtype=''
582 db_prefixtype=''
583 i_db=''
584 i_dbm=''
585 i_rpcsvcdbm=''
586 d_dirnamlen=''
587 direntrytype=''
588 i_dirent=''
589 i_dld=''
590 i_dlfcn=''
591 i_fcntl=''
592 i_float=''
593 i_gdbm=''
594 d_grpasswd=''
595 i_grp=''
596 d_int64t=''
597 i_inttypes=''
598 i_limits=''
599 i_locale=''
600 i_machcthr=''
601 i_malloc=''
602 i_math=''
603 i_memory=''
604 i_mntent=''
605 i_ndbm=''
606 i_netdb=''
607 i_neterrno=''
608 i_niin=''
609 i_sysin=''
610 i_poll=''
611 i_pthread=''
612 d_pwage=''
613 d_pwchange=''
614 d_pwclass=''
615 d_pwcomment=''
616 d_pwexpire=''
617 d_pwgecos=''
618 d_pwpasswd=''
619 d_pwquota=''
620 i_pwd=''
621 i_sfio=''
622 i_stddef=''
623 i_stdlib=''
624 i_string=''
625 strings=''
626 i_sysaccess=''
627 i_sysdir=''
628 i_sysfile=''
629 d_voidtty=''
630 i_bsdioctl=''
631 i_sysfilio=''
632 i_sysioctl=''
633 i_syssockio=''
634 i_sysmman=''
635 i_sysmount=''
636 i_sysndir=''
637 i_sysparam=''
638 i_sysresrc=''
639 i_syssecrt=''
640 i_sysselct=''
641 i_sysstat=''
642 i_sysstatvfs=''
643 i_systimes=''
644 i_systypes=''
645 d_iovec_s=''
646 i_sysuio=''
647 i_sysun=''
648 i_syswait=''
649 i_sgtty=''
650 i_termio=''
651 i_termios=''
652 i_systime=''
653 i_systimek=''
654 i_time=''
655 timeincl=''
656 i_unistd=''
657 i_utime=''
658 i_values=''
659 i_stdarg=''
660 i_varargs=''
661 i_varhdr=''
662 i_vfork=''
663 installusrbinperl=''
664 intsize=''
665 longsize=''
666 shortsize=''
667 d_dirent64_s=''
668 d_flock64_s=''
669 d_fstat64=''
670 d_ftruncate64=''
671 d_ino64_t=''
672 d_llseek=''
673 d_lockf64=''
674 d_lseek64=''
675 d_lstat64=''
676 d_off64_t=''
677 d_offset_t=''
678 d_open64=''
679 d_opendir64=''
680 d_readdir64=''
681 d_seekdir64=''
682 d_stat64=''
683 d_telldir64=''
684 d_truncate64=''
685 libc=''
686 libperl=''
687 shrpenv=''
688 useshrplib=''
689 glibpth=''
690 libpth=''
691 loclibpth=''
692 plibpth=''
693 xlibpth=''
694 ignore_versioned_solibs=''
695 libs=''
696 lns=''
697 lseeksize=''
698 lseektype=''
699 make_set_make=''
700 d_mymalloc=''
701 freetype=''
702 mallocobj=''
703 mallocsrc=''
704 malloctype=''
705 usemymalloc=''
706 installman1dir=''
707 man1dir=''
708 man1direxp=''
709 man1ext=''
710 installman3dir=''
711 man3dir=''
712 man3direxp=''
713 man3ext=''
714 huge=''
715 large=''
716 medium=''
717 models=''
718 small=''
719 split=''
720 modetype=''
721 multiarch=''
722 mydomain=''
723 myhostname=''
724 phostname=''
725 c=''
726 n=''
727 d_eofnblk=''
728 eagain=''
729 o_nonblock=''
730 rd_nodata=''
731 netdb_hlen_type=''
732 netdb_host_type=''
733 netdb_name_type=''
734 netdb_net_type=''
735 groupcat=''
736 hostcat=''
737 passcat=''
738 orderlib=''
739 ranlib=''
740 package=''
741 spackage=''
742 pager=''
743 apiversion=''
744 patchlevel=''
745 subversion=''
746 version=''
747 perladmin=''
748 perlpath=''
749 pidtype=''
750 prefix=''
751 prefixexp=''
752 installprivlib=''
753 privlib=''
754 privlibexp=''
755 prototype=''
756 ptrsize=''
757 drand01=''
758 randbits=''
759 randfunc=''
760 randseedtype=''
761 seedfunc=''
762 installscript=''
763 scriptdir=''
764 scriptdirexp=''
765 selectminbits=''
766 selecttype=''
767 sh=''
768 sig_name=''
769 sig_name_init=''
770 sig_num=''
771 sig_num_init=''
772 installsitearch=''
773 sitearch=''
774 sitearchexp=''
775 installsitelib=''
776 sitelib=''
777 sitelibexp=''
778 sizetype=''
779 so=''
780 sharpbang=''
781 shsharp=''
782 spitshell=''
783 src=''
784 ssizetype=''
785 startperl=''
786 startsh=''
787 stdchar=''
788 d_fgetpos64=''
789 d_fopen64=''
790 d_freopen64=''
791 d_fseek64=''
792 d_fseeko64=''
793 d_fsetpos64=''
794 d_ftell64=''
795 d_ftello64=''
796 d_tmpfile64=''
797 sysman=''
798 trnl=''
799 uidtype=''
800 archname64=''
801 use64bits=''
802 usemultiplicity=''
803 nm_opt=''
804 nm_so_opt=''
805 runnm=''
806 usenm=''
807 useperlio=''
808 d_oldpthreads=''
809 usethreads=''
810 incpath=''
811 mips=''
812 mips_type=''
813 usrinc=''
814 defvoidused=''
815 voidflags=''
816 CONFIG=''
817
818 define='define'
819 undef='undef'
820 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
821 rmlist=''
822
823 : We must find out about Eunice early
824 eunicefix=':'
825 if test -f /etc/unixtovms; then
826         eunicefix=/etc/unixtovms
827 fi
828 if test -f /etc/unixtovms.exe; then
829         eunicefix=/etc/unixtovms.exe
830 fi
831
832 i_whoami=''
833 : Possible local include directories to search.
834 : Set locincpth to "" in a hint file to defeat local include searches.
835 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
836 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
837 :
838 : no include file wanted by default
839 inclwanted=''
840
841 : list of known cpp symbols, sorted alphabetically
842 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
843 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
844 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
845 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
846 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
847 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
848 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
849 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
850 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
851 al="$al VMS Xenix286"
852 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
853 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
854 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
855 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
856 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
857 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
858 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
859 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
860 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
861 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
862 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
863 al="$al __SVR4_2__ __UMAXV__"
864 al="$al ____386BSD____ __alpha __alpha__ __amiga"
865 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
866 al="$al __host_mips__"
867 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
868 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
869 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
870 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
871 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
872 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
873 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
874 al="$al __mc88100 __mc88100__ __mips __mips__"
875 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
876 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
877 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
878 al="$al _host_mips _mips _unix"
879 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
880 al="$al apollo ardent att386 att3b"
881 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
882 al="$al cadmus clipper concurrent convex cray ctix"
883 al="$al dmert encore gcos gcx gimpel gould"
884 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
885 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
886 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
887 al="$al i186 i286 i386 i486 i8086"
888 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
889 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
890 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
891 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
892 al="$al mc88000 mc88100 merlin mert mips mvs n16"
893 al="$al ncl_el ncl_mr"
894 al="$al news1500 news1700 news1800 news1900 news3700"
895 al="$al news700 news800 news900 ns16000 ns32000"
896 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
897 al="$al parisc pc532 pdp11 plexus posix pyr"
898 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
899 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
900 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
901 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
902 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
903 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
904 al="$al xenix z8000"
905
906 : Trailing extension.  Override this in a hint file, if needed.
907 _exe=''
908 : Extra object files, if any, needed on this platform.
909 archobjs=''
910 groupstype=''
911 : change the next line if compiling for Xenix/286 on Xenix/386
912 xlibpth='/usr/lib/386 /lib/386'
913
914 : Possible local library directories to search.
915 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
916 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
917
918 : general looking path for locating libraries
919 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
920 glibpth="$glibpth /lib /usr/lib $xlibpth"
921 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
922 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
923
924 : Private path used by Configure to find libraries.  Its value
925 : is prepended to libpth. This variable takes care of special
926 : machines, like the mips.  Usually, it should be empty.
927 plibpth=''
928
929 : default library list
930 libswanted=''
931 : some systems want to use only the non-versioned libso:s
932 ignore_versioned_solibs=''
933 : full support for void wanted by default
934 defvoidused=15
935
936 : set useposix=false in your hint file to disable the POSIX extension.
937 useposix=true
938 : set useopcode=false in your hint file to disable the Opcode extension.
939 useopcode=true
940 : set usemultiplicity on the Configure command line to enable multiplicity.
941 : set usethreads on the Configure command line to enable threads.
942 : List of libraries we want.
943 : If anyone needs -lnet, put it in a hint file.
944 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
945 libswanted="$libswanted dld ld sun m rt c cposix posix"
946 libswanted="$libswanted ndir dir crypt"
947 libswanted="$libswanted ucb bsd BSD PW x"
948 : We probably want to search /usr/shlib before most other libraries.
949 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
950 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
951 glibpth="/usr/shlib $glibpth"
952 : Do not use vfork unless overridden by a hint file.
953 usevfork=false
954
955 : Find the basic shell for Bourne shell scripts
956 case "$sh" in
957 '')
958         case "$SYSTYPE" in
959         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
960         *) xxx='/bin/sh';;
961         esac
962         if test -f "$xxx"; then
963                 sh="$xxx"
964         else
965                 : Build up a list and do a single loop so we can 'break' out.
966                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
967                 for xxx in sh bash ksh pdksh ash; do
968                         for p in $pth; do
969                                 try="$try ${p}/${xxx}"
970                         done
971                 done
972                 for xxx in $try; do
973                         if test -f "$xxx"; then
974                                 sh="$xxx";
975                                 break
976                         elif test -f "$xxx.exe"; then
977                                 sh="$xxx";
978                                 break
979                         fi
980                 done
981         fi
982         ;;
983 esac
984
985 case "$sh" in
986 '')     cat <<EOM >&2
987 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
988
989 Usually it's in /bin/sh.  How did you even get this far?
990 Please contact me (Perl Maintainers) at perlbug@perl.com and 
991 we'll try to straighten this all out.
992 EOM
993         exit 1
994         ;;
995 esac
996
997 : see if sh knows # comments
998 if `$sh -c '#' >/dev/null 2>&1`; then
999         shsharp=true
1000         spitshell=cat
1001         xcat=/bin/cat
1002         test -f $xcat || xcat=/usr/bin/cat
1003         echo "#!$xcat" >try
1004         $eunicefix try
1005         chmod +x try
1006         ./try > today
1007         if test -s today; then
1008                 sharpbang='#!'
1009         else
1010                 echo "#! $xcat" > try
1011                 $eunicefix try
1012                 chmod +x try
1013                 ./try > today
1014                 if test -s today; then
1015                         sharpbang='#! '
1016                 else
1017                         sharpbang=': use '
1018                 fi
1019         fi
1020 else
1021         echo " "
1022         echo "Your $sh doesn't grok # comments--I will strip them later on."
1023         shsharp=false
1024         cd ..
1025         echo "exec grep -v '^[  ]*#'" >spitshell
1026         chmod +x spitshell
1027         $eunicefix spitshell
1028         spitshell=`pwd`/spitshell
1029         cd UU
1030         echo "I presume that if # doesn't work, #! won't work either!"
1031         sharpbang=': use '
1032 fi
1033 rm -f try today
1034
1035 : figure out how to guarantee sh startup
1036 case "$startsh" in
1037 '') startsh=${sharpbang}${sh} ;;
1038 *)
1039 esac
1040 cat >try <<EOSS
1041 $startsh
1042 set abc
1043 test "$?abc" != 1
1044 EOSS
1045
1046 chmod +x try
1047 $eunicefix try
1048 if ./try; then
1049         : echo "Yup, it does."
1050 else
1051         echo "Hmm... '$startsh' does not guarantee sh startup..."
1052         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1053 fi
1054 rm -f try
1055
1056
1057 : Save command line options in file UU/cmdline.opt for later use in
1058 : generating config.sh.
1059 cat > cmdline.opt <<EOSH
1060 # Configure command line arguments.
1061 config_arg0='$0'
1062 config_args='$*'
1063 config_argc=$#
1064 EOSH
1065 argn=1
1066 for arg in "$@"; do
1067         cat >>cmdline.opt <<EOSH
1068 config_arg$argn='$arg'
1069 EOSH
1070         argn=`expr $argn + 1`
1071 done
1072
1073 : produce awk script to parse command line options
1074 cat >options.awk <<'EOF'
1075 BEGIN {
1076         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
1077
1078         len = length(optstr);
1079         for (i = 1; i <= len; i++) {
1080                 c = substr(optstr, i, 1);
1081                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1082                 if (a == ":") {
1083                         arg[c] = 1;
1084                         i++;
1085                 }
1086                 opt[c] = 1;
1087         }
1088 }
1089 {
1090         expect = 0;
1091         str = $0;
1092         if (substr(str, 1, 1) != "-") {
1093                 printf("'%s'\n", str);
1094                 next;
1095         }
1096         len = length($0);
1097         for (i = 2; i <= len; i++) {
1098                 c = substr(str, i, 1);
1099                 if (!opt[c]) {
1100                         printf("-%s\n", substr(str, i));
1101                         next;
1102                 }
1103                 printf("-%s\n", c);
1104                 if (arg[c]) {
1105                         if (i < len)
1106                                 printf("'%s'\n", substr(str, i + 1));
1107                         else
1108                                 expect = 1;
1109                         next;
1110                 }
1111         }
1112 }
1113 END {
1114         if (expect)
1115                 print "?";
1116 }
1117 EOF
1118
1119 : process the command line options
1120 set X `for arg in "$@"; do echo "X$arg"; done |
1121         sed -e s/X// | awk -f options.awk`
1122 eval "set $*"
1123 shift
1124 rm -f options.awk
1125
1126 : set up default values
1127 fastread=''
1128 reuseval=false
1129 config_sh=''
1130 alldone=''
1131 error=''
1132 silent=''
1133 extractsh=''
1134 override=''
1135 knowitall=''
1136 rm -f optdef.sh
1137 cat >optdef.sh <<EOS
1138 $startsh
1139 EOS
1140
1141
1142 : option parsing
1143 while test $# -gt 0; do
1144         case "$1" in
1145         -d) shift; fastread=yes;;
1146         -e) shift; alldone=cont;;
1147         -f)
1148                 shift
1149                 cd ..
1150                 if test -r "$1"; then
1151                         config_sh="$1"
1152                 else
1153                         echo "$me: cannot read config file $1." >&2
1154                         error=true
1155                 fi
1156                 cd UU
1157                 shift;;
1158         -h) shift; error=true;;
1159         -r) shift; reuseval=true;;
1160         -s) shift; silent=true; realsilent=true;;
1161         -E) shift; alldone=exit;;
1162         -K) shift; knowitall=true;;
1163         -O) shift; override=true;;
1164         -S) shift; silent=true; extractsh=true;;
1165         -D)
1166                 shift
1167                 case "$1" in
1168                 *=)
1169                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1170                         echo "$me: ignoring -D $1" >&2
1171                         ;;
1172                 *=*) echo "$1" | \
1173                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1174                 *) echo "$1='define'" >> optdef.sh;;
1175                 esac
1176                 shift
1177                 ;;
1178         -U)
1179                 shift
1180                 case "$1" in
1181                 *=) echo "$1" >> optdef.sh;;
1182                 *=*)
1183                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1184                         echo "$me: ignoring -U $1" >&2
1185                         ;;
1186                 *) echo "$1='undef'" >> optdef.sh;;
1187                 esac
1188                 shift
1189                 ;;
1190         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1191                 exit 0;;
1192         --) break;;
1193         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1194         *) break;;
1195         esac
1196 done
1197
1198 case "$error" in
1199 true)
1200         cat >&2 <<EOM
1201 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1202                  [-U symbol] [-U symbol=]
1203   -d : use defaults for all answers.
1204   -e : go on without questioning past the production of config.sh.
1205   -f : specify an alternate default configuration file.
1206   -h : print this help message and exit (with an error status).
1207   -r : reuse C symbols value if possible (skips costly nm extraction).
1208   -s : silent mode, only echoes questions and essential information.
1209   -D : define symbol to have some value:
1210          -D symbol         symbol gets the value 'define'
1211          -D symbol=value   symbol gets the value 'value'
1212   -E : stop at the end of questions, after having produced config.sh.
1213   -K : do not use unless you know what you are doing.
1214   -O : let -D and -U override definitions from loaded configuration file.
1215   -S : perform variable substitutions on all .SH files (can mix with -f)
1216   -U : undefine symbol:
1217          -U symbol    symbol gets the value 'undef'
1218          -U symbol=   symbol gets completely empty
1219   -V : print version number and exit (with a zero status).
1220 EOM
1221         exit 1
1222         ;;
1223 esac
1224
1225 : Sanity checks
1226 case "$fastread$alldone" in
1227 yescont|yesexit) ;;
1228 *)
1229         if test ! -t 0; then
1230                 echo "Say 'sh Configure', not 'sh <Configure'"
1231                 exit 1
1232         fi
1233         ;;
1234 esac
1235
1236 exec 4>&1
1237 case "$silent" in
1238 true) exec 1>/dev/null;;
1239 esac
1240
1241 : run the defines and the undefines, if any, but leave the file out there...
1242 touch optdef.sh
1243 . ./optdef.sh
1244
1245 : set package name
1246 package=perl5
1247 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1248 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1249 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1250 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1251 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1252 esac
1253
1254 : Some greps do not return status, grrr.
1255 echo "grimblepritz" >grimble
1256 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1257         contains=contains
1258 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1259         contains=grep
1260 else
1261         contains=contains
1262 fi
1263 rm -f grimble
1264 : the following should work in any shell
1265 case "$contains" in
1266 contains*)
1267         echo " "
1268         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1269         cat >contains <<'EOSS'
1270 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1271 EOSS
1272 chmod +x contains
1273 esac
1274
1275 : Find the path to the source tree
1276 case "$src" in
1277 '') case "$0" in
1278     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1279     *)   src='.';;
1280     esac;;
1281 esac
1282 case "$src" in
1283 '')     src=/
1284         rsrc=/
1285         ;;
1286 /*) rsrc="$src";;
1287 *) rsrc="../$src";;
1288 esac
1289 if test -f $rsrc/Configure && \
1290         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1291 then
1292    : found it, so we are ok.
1293 else
1294         rsrc=''
1295         for src in . .. ../.. ../../.. ../../../..; do
1296                 if test -f ../$src/Configure && \
1297                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1298                 then
1299                         rsrc=../$src
1300                         break
1301                 fi
1302         done
1303 fi
1304 case "$rsrc" in
1305 '')
1306         cat <<EOM >&4
1307
1308 Sorry, I can't seem to locate the source dir for $package.  Please start
1309 Configure with an explicit path -- i.e. /some/path/Configure.
1310
1311 EOM
1312         exit 1
1313         ;;
1314 ../.)   rsrc='..';;
1315 *)
1316         echo " "
1317         echo "Sources for $package found in \"$src\"." >&4
1318         ;;
1319 esac
1320
1321 : script used to extract .SH files with variable substitutions
1322 cat >extract <<'EOS'
1323 CONFIGDOTSH=true
1324 echo "Doing variable substitutions on .SH files..."
1325 if test -f $src/MANIFEST; then
1326         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1327 else
1328         echo "(Looking for .SH files under the source directory.)"
1329         set x `(cd $src; find . -name "*.SH" -print)`
1330 fi
1331 shift
1332 case $# in
1333 0) set x `(cd $src; echo *.SH)`; shift;;
1334 esac
1335 if test ! -f $src/$1; then
1336         shift
1337 fi
1338 mkdir_p='
1339 name=$1;
1340 create="";
1341 while test $name; do
1342         if test ! -d "$name"; then
1343                 create="$name $create";
1344                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1345                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1346         else
1347                 name="";
1348         fi;
1349 done;
1350 for file in $create; do
1351         mkdir $file;
1352 done
1353 '
1354 for file in $*; do
1355         case "$src" in
1356         ".")
1357                 case "$file" in
1358                 */*)
1359                         dir=`expr X$file : 'X\(.*\)/'`
1360                         file=`expr X$file : 'X.*/\(.*\)'`
1361                         (cd $dir && . ./$file)
1362                         ;;
1363                 *)
1364                         . ./$file
1365                         ;;
1366                 esac
1367                 ;;
1368         *)
1369                 case "$file" in
1370                 */*)
1371                         dir=`expr X$file : 'X\(.*\)/'`
1372                         file=`expr X$file : 'X.*/\(.*\)'`
1373                         (set x $dir; shift; eval $mkdir_p)
1374                         sh <$src/$dir/$file
1375                         ;;
1376                 *)
1377                         sh <$src/$file
1378                         ;;
1379                 esac
1380                 ;;
1381         esac
1382 done
1383 if test -f $src/config_h.SH; then
1384         if test ! -f config.h; then
1385         : oops, they left it out of MANIFEST, probably, so do it anyway.
1386         . $src/config_h.SH
1387         fi
1388 fi
1389 EOS
1390
1391 : extract files and exit if asked to do so
1392 case "$extractsh" in
1393 true)
1394         case "$realsilent" in
1395         true) ;;
1396         *) exec 1>&4;;
1397         esac
1398         case "$config_sh" in
1399         '') config_sh='config.sh';;
1400         esac
1401         echo " "
1402         echo "Fetching answers from $config_sh..."
1403         cd ..
1404         . $config_sh
1405         test "$override" && . ./optdef.sh
1406         echo " "
1407         . UU/extract
1408         rm -rf UU
1409         echo "Done."
1410         exit 0
1411         ;;
1412 esac
1413
1414 : Eunice requires " " instead of "", can you believe it
1415 echo " "
1416 : Here we go...
1417 echo "Beginning of configuration questions for $package."
1418
1419 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1420
1421 : first determine how to suppress newline on echo command
1422 echo " "
1423 echo "Checking echo to see how to suppress newlines..."
1424 (echo "hi there\c" ; echo " ") >.echotmp
1425 if $contains c .echotmp >/dev/null 2>&1 ; then
1426         echo "...using -n."
1427         n='-n'
1428         c=''
1429 else
1430         cat <<'EOM'
1431 ...using \c
1432 EOM
1433         n=''
1434         c='\c'
1435 fi
1436 echo $n "The star should be here-->$c"
1437 echo '*'
1438 rm -f .echotmp
1439
1440 : Now test for existence of everything in MANIFEST
1441 echo " "
1442 if test -f $rsrc/MANIFEST; then
1443         echo "First let's make sure your kit is complete.  Checking..." >&4
1444         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1445         rm -f missing
1446         tmppwd=`pwd`
1447         for filelist in x??; do
1448                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1449         done
1450         if test -s missing; then
1451                 cat missing >&4
1452                 cat >&4 <<'EOM'
1453
1454 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1455
1456 You have the option of continuing the configuration process, despite the
1457 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1458 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1459 and contact the author (perlbug@perl.com).
1460
1461 EOM
1462                 echo $n "Continue? [n] $c" >&4
1463                 read ans
1464                 case "$ans" in
1465                 y*)
1466                         echo "Continuing..." >&4
1467                         rm -f missing
1468                         ;;
1469                 *)
1470                         echo "ABORTING..." >&4
1471                         kill $$
1472                         ;;
1473                 esac
1474         else
1475                 echo "Looks good..."
1476         fi
1477 else
1478         echo "There is no MANIFEST file.  I hope your kit is complete !"
1479 fi
1480 rm -f missing x??
1481
1482 echo " "
1483 : Find the appropriate value for a newline for tr
1484 if test -n "$DJGPP"; then
1485        trnl='\012'
1486 fi
1487 if test X"$trnl" = X; then
1488         case "`echo foo|tr '\n' x 2>/dev/null`" in
1489         foox) trnl='\n' ;;
1490         esac
1491 fi
1492 if test X"$trnl" = X; then
1493         case "`echo foo|tr '\012' x 2>/dev/null`" in
1494         foox) trnl='\012' ;;
1495         esac
1496 fi
1497 if test X"$trnl" = X; then
1498         cat <<EOM >&2
1499
1500 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1501
1502 EOM
1503         exit 1
1504 fi
1505
1506 : compute the number of columns on the terminal for proper question formatting
1507 case "$COLUMNS" in
1508 '') COLUMNS='80';;
1509 esac
1510
1511 : set up the echo used in my read
1512 myecho="case \"\$xxxm\" in
1513 '') echo $n \"\$rp $c\" >&4;;
1514 *) case \"\$rp\" in
1515         '') echo $n \"[\$xxxm] $c\";;
1516         *)
1517                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1518                         echo \"\$rp\" >&4
1519                         echo $n \"[\$xxxm] $c\" >&4
1520                 else
1521                         echo $n \"\$rp [\$xxxm] $c\" >&4
1522                 fi
1523                 ;;
1524         esac;;
1525 esac"
1526
1527 : now set up to do reads with possible shell escape and default assignment
1528 cat <<EOSC >myread
1529 $startsh
1530 xxxm=\$dflt
1531 $myecho
1532 ans='!'
1533 case "\$fastread" in
1534 yes) case "\$dflt" in
1535         '') ;;
1536         *) ans='';
1537                 case "\$silent-\$rp" in
1538                 true-) ;;
1539                 *) echo " " >&4;;
1540                 esac;;
1541         esac;;
1542 *) case "\$silent" in
1543         true) case "\$rp" in
1544                 '') ans='';;
1545                 esac;;
1546         esac;;
1547 esac
1548 while expr "X\$ans" : "X!" >/dev/null; do
1549         read answ
1550         set x \$xxxm
1551         shift
1552         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1553         case  "\$answ" in
1554         "!")
1555                 sh 1>&4
1556                 echo " "
1557                 $myecho
1558                 ;;
1559         !*)
1560                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1561                 shift
1562                 sh 1>&4 -c "\$*"
1563                 echo " "
1564                 $myecho
1565                 ;;
1566         "\$ans")
1567                 case "\$ans" in
1568                 \\&*)
1569                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1570                         shift
1571                         case "\$1" in
1572                         -d)
1573                                 fastread=yes
1574                                 echo "(OK, I'll run with -d after this question.)" >&4
1575                                 ;;
1576                         -*)
1577                                 echo "*** Sorry, \$1 not supported yet." >&4
1578                                 ;;
1579                         esac
1580                         $myecho
1581                         ans=!
1582                         ;;
1583                 esac;;
1584         *)
1585                 case "\$aok" in
1586                 y)
1587                         echo "*** Substitution done -- please confirm."
1588                         xxxm="\$ans"
1589                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1590                         xxxm="\$ans"
1591                         ans=!
1592                         ;;
1593                 *)
1594                         echo "*** Error -- try again."
1595                         ans=!
1596                         ;;
1597                 esac
1598                 $myecho
1599                 ;;
1600         esac
1601         case "\$ans\$xxxm\$nostick" in
1602         '')
1603                 ans=!
1604                 $myecho
1605                 ;;
1606         esac
1607 done
1608 case "\$ans" in
1609 '') ans="\$xxxm";;
1610 esac
1611 EOSC
1612
1613 : create .config dir to save info across Configure sessions
1614 test -d ../.config || mkdir ../.config
1615 cat >../.config/README <<EOF
1616 This directory created by Configure to save information that should
1617 persist across sessions for $package.
1618
1619 You may safely delete it if you wish.
1620 EOF
1621
1622 : general instructions
1623 needman=true
1624 firsttime=true
1625 user=`(logname) 2>/dev/null`
1626 case "$user" in
1627 '') user=`whoami 2>&1`;;
1628 esac
1629 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1630         firsttime=false
1631         echo " "
1632         rp='Would you like to see the instructions?'
1633         dflt=n
1634         . ./myread
1635         case "$ans" in
1636         [yY]*) ;;
1637         *) needman=false;;
1638         esac
1639 fi
1640 if $needman; then
1641         cat <<EOH
1642
1643 This installation shell script will examine your system and ask you questions
1644 to determine how the perl5 package should be installed. If you get
1645 stuck on a question, you may use a ! shell escape to start a subshell or
1646 execute a command.  Many of the questions will have default answers in square
1647 brackets; typing carriage return will give you the default.
1648
1649 On some of the questions which ask for file or directory names you are allowed
1650 to use the ~name construct to specify the login directory belonging to "name",
1651 even if you don't have a shell which knows about that.  Questions where this is
1652 allowed will be marked "(~name ok)".
1653
1654 EOH
1655         rp=''
1656         dflt='Type carriage return to continue'
1657         . ./myread
1658         cat <<'EOH'
1659
1660 The prompter used in this script allows you to use shell variables and
1661 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1662 in the default answer, as if the default line was a set of arguments given to a
1663 script shell.  This means you may also use $* to repeat the whole default line,
1664 so you do not have to re-type everything to add something to the default.
1665
1666 Everytime there is a substitution, you will have to confirm.  If there is an
1667 error (e.g. an unmatched backtick), the default answer will remain unchanged
1668 and you will be prompted again.
1669
1670 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1671 the questions and use the computed defaults (or the previous answers if there
1672 was already a config.sh file). Type 'Configure -h' for a list of options.
1673 You may also start interactively and then answer '& -d' at any prompt to turn
1674 on the non-interactive behaviour for the remainder of the execution.
1675
1676 EOH
1677         . ./myread
1678         cat <<EOH
1679
1680 Much effort has been expended to ensure that this shell script will run on any
1681 Unix system.  If despite that it blows up on yours, your best bet is to edit
1682 Configure and run it again.  If you can't run Configure for some reason,
1683 you'll have to generate a config.sh file by hand.  Whatever problems you
1684 have, let me (perlbug@perl.com) know how I blew it.
1685
1686 This installation script affects things in two ways:
1687
1688 1) it may do direct variable substitutions on some of the files included
1689    in this kit.
1690 2) it builds a config.h file for inclusion in C programs.  You may edit
1691    any of these files as the need arises after running this script.
1692
1693 If you make a mistake on a question, there is no easy way to back up to it
1694 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1695 files.  Configure will offer to let you do this before it runs the SH files.
1696
1697 EOH
1698         dflt='Type carriage return to continue'
1699         . ./myread
1700         case "$firsttime" in
1701         true) echo $user >>../.config/instruct;;
1702         esac
1703 fi
1704
1705 : find out where common programs are
1706 echo " "
1707 echo "Locating common programs..." >&4
1708 cat <<EOSC >loc
1709 $startsh
1710 case \$# in
1711 0) exit 1;;
1712 esac
1713 thing=\$1
1714 shift
1715 dflt=\$1
1716 shift
1717 for dir in \$*; do
1718         case "\$thing" in
1719         .)
1720         if test -d \$dir/\$thing; then
1721                 echo \$dir
1722                 exit 0
1723         fi
1724         ;;
1725         *)
1726         for thisthing in \$dir/\$thing; do
1727                 : just loop through to pick last item
1728         done
1729         if test -f \$thisthing; then
1730                 echo \$thisthing
1731                 exit 0
1732         elif test -f \$dir/\$thing.exe; then
1733                 if test -n "$DJGPP"; then
1734                         echo \$dir/\$thing.exe
1735                 else
1736                         : on Eunice apparently
1737                         echo \$dir/\$thing
1738                 fi
1739                 exit 0
1740         fi
1741         ;;
1742         esac
1743 done
1744 echo \$dflt
1745 exit 1
1746 EOSC
1747 chmod +x loc
1748 $eunicefix loc
1749 loclist="
1750 awk
1751 cat
1752 comm
1753 cp
1754 echo
1755 expr
1756 grep
1757 ls
1758 make
1759 mkdir
1760 rm
1761 sed
1762 sort
1763 touch
1764 tr
1765 uniq
1766 "
1767 trylist="
1768 Mcc
1769 ar
1770 byacc
1771 cpp
1772 csh
1773 date
1774 egrep
1775 gzip
1776 less
1777 ln
1778 more
1779 nm
1780 nroff
1781 pg
1782 test
1783 uname
1784 zip
1785 "
1786 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1787 pth="$pth /lib /usr/lib"
1788 for file in $loclist; do
1789         eval xxx=\$$file
1790         case "$xxx" in
1791         /*|?:[\\/]*)
1792                 if test -f "$xxx"; then
1793                         : ok
1794                 else
1795                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1796                         xxx=`./loc $file $file $pth`
1797                 fi
1798                 ;;
1799         '') xxx=`./loc $file $file $pth`;;
1800         *) xxx=`./loc $xxx $xxx $pth`;;
1801         esac
1802         eval $file=$xxx
1803         eval _$file=$xxx
1804         case "$xxx" in
1805         /*)
1806                 echo $file is in $xxx.
1807                 ;;
1808         ?:[\\/]*)
1809                 echo $file is in $xxx.
1810                 ;;
1811         *)
1812                 echo "I don't know where '$file' is, and my life depends on it." >&4
1813                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1814                 exit 1
1815                 ;;
1816         esac
1817 done
1818 echo " "
1819 echo "Don't worry if any of the following aren't found..."
1820 say=offhand
1821 for file in $trylist; do
1822         eval xxx=\$$file
1823         case "$xxx" in
1824         /*|?:[\\/]*)
1825                 if test -f "$xxx"; then
1826                         : ok
1827                 else
1828                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1829                         xxx=`./loc $file $file $pth`
1830                 fi
1831                 ;;
1832         '') xxx=`./loc $file $file $pth`;;
1833         *) xxx=`./loc $xxx $xxx $pth`;;
1834         esac
1835         eval $file=$xxx
1836         eval _$file=$xxx
1837         case "$xxx" in
1838         /*)
1839                 echo $file is in $xxx.
1840                 ;;
1841         ?:[\\/]*)
1842                 echo $file is in $xxx.
1843                 ;;
1844         *)
1845                 echo "I don't see $file out there, $say."
1846                 say=either
1847                 ;;
1848         esac
1849 done
1850 case "$egrep" in
1851 egrep)
1852         echo "Substituting grep for egrep."
1853         egrep=$grep
1854         ;;
1855 esac
1856 case "$ln" in
1857 ln)
1858         echo "Substituting cp for ln."
1859         ln=$cp
1860         ;;
1861 esac
1862 case "$test" in
1863 test)
1864         echo "Hopefully test is built into your sh."
1865         ;;
1866 *)
1867         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1868                 echo "Using the test built into your sh."
1869                 test=test
1870                 _test=test
1871         fi
1872         ;;
1873 esac
1874 case "$echo" in
1875 echo)
1876         echo "Hopefully echo is built into your sh."
1877         ;;
1878 '') ;;
1879 *)
1880         echo " "
1881 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1882         $echo $n "hi there$c" >foo1
1883         echo $n "hi there$c" >foo2
1884         if cmp foo1 foo2 >/dev/null 2>&1; then
1885                 echo "They are compatible.  In fact, they may be identical."
1886         else
1887                 case "$n" in
1888                 '-n') n='' c='\c';;
1889                 *) n='-n' c='';;
1890                 esac
1891                 cat <<FOO
1892 They are not compatible!  You are probably running ksh on a non-USG system.
1893 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1894 have echo built in and we may have to run some Bourne shell scripts.  That
1895 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1896
1897 FOO
1898                 $echo $n "The star should be here-->$c"
1899                 $echo "*"
1900         fi
1901         $rm -f foo1 foo2
1902         ;;
1903 esac
1904
1905 : determine whether symbolic links are supported
1906 echo " "
1907 $touch blurfl
1908 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1909         echo "Symbolic links are supported." >&4
1910         lns="$ln -s"
1911 else
1912         echo "Symbolic links are NOT supported." >&4
1913         lns="$ln"
1914 fi
1915 $rm -f blurfl sym
1916
1917 : see whether [:lower:] and [:upper:] are supported character classes
1918 echo " "
1919 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1920 ABYZ)
1921         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1922         up='[:upper:]'
1923         low='[:lower:]'
1924         ;;
1925 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1926         # (0xc9 and 0xd1), therefore that is a nice testing point.
1927         if test "X$up" = X -o "X$low" = X; then
1928             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1929             ij) up='[A-Z]'
1930                 low='[a-z]'
1931                 ;;
1932             esac
1933         fi
1934         if test "X$up" = X -o "X$low" = X; then
1935             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1936             ij) up='A-Z'
1937                 low='a-z'
1938                 ;;
1939             esac
1940         fi
1941         if test "X$up" = X -o "X$low" = X; then
1942             case "`echo IJ | od -x 2>/dev/null`" in
1943             *C9D1*|*c9d1*)
1944                 echo "Hey, this might be EBCDIC." >&4
1945                 if test "X$up" = X -o "X$low" = X; then
1946                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1947                     ij) up='[A-IJ-RS-Z]'
1948                         low='[a-ij-rs-z]'
1949                         ;;
1950                     esac
1951                 fi
1952                 if test "X$up" = X -o "X$low" = X; then
1953                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1954                     ij) up='A-IJ-RS-Z'
1955                         low='a-ij-rs-z'
1956                         ;;
1957                     esac
1958                 fi
1959                 ;;
1960             esac
1961         fi
1962 esac
1963 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
1964 ij)
1965     echo "Using $up and $low to convert case." >&4
1966     ;;
1967 *)
1968     echo "I don't know how to translate letters from upper to lower case." >&4
1969     echo "Your tr is not acting any way I know of." >&4
1970     exit 1
1971     ;;
1972 esac
1973 : set up the translation script tr, must be called with ./tr of course
1974 cat >tr <<EOSC
1975 $startsh
1976 case "\$1\$2" in
1977 '[A-Z][a-z]') exec $tr '$up' '$low';;
1978 '[a-z][A-Z]') exec $tr '$low' '$up';;
1979 esac
1980 exec $tr "\$@"
1981 EOSC
1982 chmod +x tr
1983 $eunicefix tr
1984
1985 : Try to determine whether config.sh was made on this system
1986 case "$config_sh" in
1987 '')
1988 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1989 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
1990 # because the A-Z/a-z are not consecutive.
1991 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1992         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1993 newmyuname="$myuname"
1994 dflt=n
1995 case "$knowitall" in
1996 '')
1997         if test -f ../config.sh; then
1998                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1999                         eval "`grep myuname= ../config.sh`"
2000                 fi
2001                 if test "X$myuname" = "X$newmyuname"; then
2002                         dflt=y
2003                 fi
2004         fi
2005         ;;
2006 *) dflt=y;;
2007 esac
2008
2009 : Get old answers from old config file if Configure was run on the
2010 : same system, otherwise use the hints.
2011 hint=default
2012 cd ..
2013 if test -f config.sh; then
2014         echo " "
2015         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2016         . UU/myread
2017         case "$ans" in
2018         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2019         *)  echo "Fetching default answers from your old config.sh file..." >&4
2020                 tmp_n="$n"
2021                 tmp_c="$c"
2022                 tmp_sh="$sh"
2023                 . ./config.sh
2024                 cp config.sh UU
2025                 n="$tmp_n"
2026                 c="$tmp_c"
2027                 : Older versions did not always set $sh.  Catch re-use of such
2028                 : an old config.sh.
2029                 case "$sh" in
2030                 '') sh="$tmp_sh" ;;
2031                 esac
2032                 hint=previous
2033                 ;;
2034         esac
2035 fi
2036 if test ! -f config.sh; then
2037         $cat <<EOM
2038
2039 First time through, eh?  I have some defaults handy for some systems
2040 that need some extra help getting the Configure answers right:
2041
2042 EOM
2043         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2044         dflt=''
2045         : Half the following guesses are probably wrong... If you have better
2046         : tests or hints, please send them to perlbug@perl.com
2047         : The metaconfig authors would also appreciate a copy...
2048         $test -f /irix && osname=irix
2049         $test -f /xenix && osname=sco_xenix
2050         $test -f /dynix && osname=dynix
2051         $test -f /dnix && osname=dnix
2052         $test -f /lynx.os && osname=lynxos
2053         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2054         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2055         $test -f /bin/mips && /bin/mips && osname=mips
2056         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2057                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2058         $test -d /usr/apollo/bin && osname=apollo
2059         $test -f /etc/saf/_sactab && osname=svr4
2060         $test -d /usr/include/minix && osname=minix
2061         if $test -d /MachTen -o -d /MachTen_Folder; then
2062                 osname=machten
2063                 if $test -x /sbin/version; then
2064                         osvers=`/sbin/version | $awk '{print $2}' |
2065                         $sed -e 's/[A-Za-z]$//'`
2066                 elif $test -x /usr/etc/version; then
2067                         osvers=`/usr/etc/version | $awk '{print $2}' |
2068                         $sed -e 's/[A-Za-z]$//'`
2069                 else
2070                         osvers="$2.$3"
2071                 fi
2072         fi
2073        $test -f /sys/posix.dll &&
2074                $test -f /usr/bin/what &&
2075                set X `/usr/bin/what /sys/posix.dll` &&
2076                $test "$3" = UWIN &&
2077                osname=uwin &&
2078                osvers="$5"
2079         if $test -f $uname; then
2080                 set X $myuname
2081                 shift
2082
2083                 case "$5" in
2084                 fps*) osname=fps ;;
2085                 mips*)
2086                         case "$4" in
2087                         umips) osname=umips ;;
2088                         *) osname=mips ;;
2089                         esac;;
2090                 [23]100) osname=mips ;;
2091                 next*) osname=next ;;
2092                 i386*)
2093                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2094                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2095                                 osname='sco'
2096                                 osvers=$tmp
2097                         elif $test -f /etc/kconfig; then
2098                                 osname=isc
2099                                 if test "$lns" = "ln -s"; then
2100                                         osvers=4
2101                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2102                                         osvers=3
2103                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2104                                         osvers=2
2105                                 fi
2106                         fi
2107                         tmp=''
2108                         ;;
2109                 pc*)
2110                         if test -n "$DJGPP"; then
2111                                 osname=dos
2112                                 osvers=djgpp
2113                         fi
2114                         ;;
2115                 esac
2116
2117                 case "$1" in
2118                 aix) osname=aix
2119                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2120                         case "$tmp" in
2121                         'not found') osvers="$4"."$3" ;;
2122                         '<3240'|'<>3240') osvers=3.2.0 ;;
2123                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2124                         '=3250'|'>3250') osvers=3.2.5 ;;
2125                         *) osvers=$tmp;;
2126                         esac
2127                         ;;
2128                 *dc.osx) osname=dcosx
2129                         osvers="$3"
2130                         ;;
2131                 dnix) osname=dnix
2132                         osvers="$3"
2133                         ;;
2134                 domainos) osname=apollo
2135                         osvers="$3"
2136                         ;;
2137                 dgux) osname=dgux 
2138                         osvers="$3"
2139                         ;;
2140                 dynixptx*) osname=dynixptx
2141                         osvers=`echo "$4"|sed 's/^v//'`
2142                         ;;
2143                 freebsd) osname=freebsd 
2144                         osvers="$3" ;;
2145                 genix) osname=genix ;;
2146                 hp*) osname=hpux 
2147                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2148                         ;;
2149                 irix*) osname=irix
2150                         case "$3" in
2151                         4*) osvers=4 ;;
2152                         5*) osvers=5 ;;
2153                         *)      osvers="$3" ;;
2154                         esac
2155                         ;;
2156                 linux) osname=linux
2157                         case "$3" in
2158                         *)      osvers="$3" ;;
2159                         esac
2160                         ;;
2161                 MiNT) osname=mint
2162                         ;;
2163                 netbsd*) osname=netbsd
2164                         osvers="$3"
2165                         ;;
2166                 news-os) osvers="$3"
2167                         case "$3" in
2168                         4*) osname=newsos4 ;;
2169                         *) osname=newsos ;;
2170                         esac
2171                         ;;
2172                 bsd386) osname=bsd386
2173                         osvers=`$uname -r`
2174                         ;;
2175                 POSIX-BC | posix-bc ) osname=posix-bc
2176                         osvers="$3"
2177                         ;;
2178                 powerux | power_ux | powermax_os | powermaxos | \
2179                 powerunix | power_unix) osname=powerux
2180                         osvers="$3"
2181                         ;;
2182                 next*) osname=next ;;
2183                 solaris) osname=solaris
2184                         case "$3" in
2185                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2186                         *)      osvers="$3" ;;
2187                         esac
2188                         ;;
2189                 sunos) osname=sunos
2190                         case "$3" in
2191                         5*) osname=solaris
2192                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2193                         *)      osvers="$3" ;;
2194                         esac
2195                         ;;
2196                 titanos) osname=titanos
2197                         case "$3" in
2198                         1*) osvers=1 ;;
2199                         2*) osvers=2 ;;
2200                         3*) osvers=3 ;;
2201                         4*) osvers=4 ;;
2202                         *)      osvers="$3" ;;
2203                         esac
2204                         ;;
2205                 ultrix) osname=ultrix
2206                         osvers="$3"
2207                         ;;
2208                 osf1|mls+)      case "$5" in
2209                                 alpha)
2210                                         osname=dec_osf
2211                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2212                                         ;;
2213                         hp*)    osname=hp_osf1  ;;
2214                         mips)   osname=mips_osf1 ;;
2215                         esac
2216                         ;;
2217                 uts) osname=uts 
2218                         osvers="$3"
2219                         ;;
2220                 qnx) osname=qnx
2221                         osvers="$4"
2222                         ;;
2223                 $2) case "$osname" in
2224                         *isc*) ;;
2225                         *freebsd*) ;;
2226                         svr*)
2227                                 : svr4.x or possibly later
2228                                 case "svr$3" in 
2229                                 ${osname}*)
2230                                         osname=svr$3
2231                                         osvers=$4
2232                                         ;;
2233                                 esac
2234                                 case "$osname" in
2235                                 svr4.0)
2236                                         : Check for ESIX
2237                                         if test -f /stand/boot ; then
2238                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2239                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2240                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2241                                                         if test -n "$isesix"; then
2242                                                                 osname=esix4
2243                                                         fi
2244                                                 fi
2245                                         fi
2246                                         ;;
2247                                 esac
2248                                 ;;
2249                         *)      if test -f /etc/systemid; then
2250                                         osname=sco
2251                                         set `echo $3 | $sed 's/\./ /g'` $4
2252                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2253                                                 osvers=$1.$2.$3
2254                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2255                                                 osvers=$1.$2
2256                                         elif $test -f $src/hints/sco_$1.sh; then
2257                                                 osvers=$1
2258                                         fi
2259                                 else
2260                                         case "$osname" in
2261                                         '') : Still unknown.  Probably a generic Sys V.
2262                                                 osname="sysv"
2263                                                 osvers="$3"
2264                                                 ;;
2265                                         esac
2266                                 fi
2267                                 ;;
2268                         esac
2269                         ;;
2270                 *)      case "$osname" in
2271                         '') : Still unknown.  Probably a generic BSD.
2272                                 osname="$1"
2273                                 osvers="$3"
2274                                 ;;
2275                         esac
2276                         ;;
2277                 esac
2278         else
2279                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2280                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2281                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2282                                 osname=news_os
2283                         fi
2284                         $rm -f UU/kernel.what
2285                 elif test -d c:/.; then
2286                         set X $myuname
2287                         osname=os2
2288                         osvers="$5"
2289                 fi
2290         fi
2291         
2292         : Now look for a hint file osname_osvers, unless one has been
2293         : specified already.
2294         case "$hintfile" in
2295         ''|' ')
2296                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2297                 : Also try without trailing minor version numbers.
2298                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2299                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2300                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2301                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2302                 case "$file" in
2303                 '') dflt=none ;;
2304                 *)  case "$osvers" in
2305                         '') dflt=$file
2306                                 ;;
2307                         *)  if $test -f $src/hints/$file.sh ; then
2308                                         dflt=$file
2309                                 elif $test -f $src/hints/$xfile.sh ; then
2310                                         dflt=$xfile
2311                                 elif $test -f $src/hints/$xxfile.sh ; then
2312                                         dflt=$xxfile
2313                                 elif $test -f $src/hints/$xxxfile.sh ; then
2314                                         dflt=$xxxfile
2315                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2316                                         dflt=$xxxxfile
2317                                 elif $test -f "$src/hints/${osname}.sh" ; then
2318                                         dflt="${osname}"
2319                                 else
2320                                         dflt=none
2321                                 fi
2322                                 ;;
2323                         esac
2324                         ;;
2325                 esac
2326                 if $test -f Policy.sh ; then
2327                         case "$dflt" in
2328                         *Policy*) ;;
2329                         none) dflt="Policy" ;;
2330                         *) dflt="Policy $dflt" ;;
2331                         esac
2332                 fi
2333                 ;;
2334         *)
2335                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2336                 ;;
2337         esac
2338
2339         if $test -f Policy.sh ; then
2340                 $cat <<EOM
2341
2342 There's also a Policy hint file available, which should make the
2343 site-specific (policy) questions easier to answer.
2344 EOM
2345
2346         fi
2347
2348         $cat <<EOM
2349
2350 You may give one or more space-separated answers, or "none" if appropriate.
2351 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2352 is a good thing.  DO NOT give a wrong version.
2353
2354 EOM
2355
2356         rp="Which of these apply, if any?"
2357         . UU/myread
2358         tans=$ans
2359         for file in $tans; do
2360                 if $test X$file = XPolicy -a -f Policy.sh; then
2361                         . Policy.sh
2362                         $cat Policy.sh >> UU/config.sh
2363                 elif $test -f $src/hints/$file.sh; then
2364                         . $src/hints/$file.sh
2365                         $cat $src/hints/$file.sh >> UU/config.sh
2366                 elif $test X$tans = X -o X$tans = Xnone ; then
2367                         : nothing
2368                 else
2369                         : Give one chance to correct a possible typo.
2370                         echo "$file.sh does not exist"
2371                         dflt=$file
2372                         rp="hint to use instead?"
2373                         . UU/myread
2374                         for file in $ans; do
2375                                 if $test -f "$src/hints/$file.sh"; then
2376                                         . $src/hints/$file.sh
2377                                         $cat $src/hints/$file.sh >> UU/config.sh
2378                                 elif $test X$ans = X -o X$ans = Xnone ; then
2379                                         : nothing
2380                                 else
2381                                         echo "$file.sh does not exist -- ignored."
2382                                 fi
2383                         done
2384                 fi
2385         done
2386
2387         hint=recommended
2388         : Remember our hint file for later.
2389         if $test -f "$src/hints/$file.sh" ; then
2390                 hintfile="$file"
2391         else
2392                 hintfile=''
2393         fi
2394 fi
2395 cd UU
2396 ;;
2397 *)
2398         echo " "
2399         echo "Fetching default answers from $config_sh..." >&4
2400         tmp_n="$n"
2401         tmp_c="$c"
2402         cd ..
2403         cp $config_sh config.sh 2>/dev/null
2404         chmod +w config.sh
2405         . ./config.sh
2406         cd UU
2407         cp ../config.sh .
2408         n="$tmp_n"
2409         c="$tmp_c"
2410         hint=previous
2411         ;;
2412 esac
2413 test "$override" && . ./optdef.sh
2414 myuname="$newmyuname"
2415
2416 : Restore computed paths
2417 for file in $loclist $trylist; do
2418         eval $file="\$_$file"
2419 done
2420
2421 cat << EOM
2422
2423 Configure uses the operating system name and version to set some defaults.
2424 The default value is probably right if the name rings a bell. Otherwise,
2425 since spelling matters for me, either accept the default or answer "none"
2426 to leave it blank.
2427
2428 EOM
2429 case "$osname" in
2430         ''|' ')
2431                 case "$hintfile" in
2432                 ''|' '|none) dflt=none ;;
2433                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2434                 esac
2435                 ;;
2436         *) dflt="$osname" ;;
2437 esac
2438 rp="Operating system name?"
2439 . ./myread
2440 case "$ans" in
2441 none)  osname='' ;;
2442 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2443 esac
2444 echo " "
2445 case "$osvers" in
2446         ''|' ')
2447                 case "$hintfile" in
2448                 ''|' '|none) dflt=none ;;
2449                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2450                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2451                         case "$dflt" in
2452                         ''|' ') dflt=none ;;
2453                         esac
2454                         ;;
2455                 esac
2456                 ;;
2457         *) dflt="$osvers" ;;
2458 esac
2459 rp="Operating system version?"
2460 . ./myread
2461 case "$ans" in
2462 none)  osvers='' ;;
2463 *) osvers="$ans" ;;
2464 esac
2465
2466 : who configured the system
2467 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2468 cf_by=`(logname) 2>/dev/null`
2469 case "$cf_by" in
2470 "")
2471         cf_by=`(whoami) 2>/dev/null`
2472         case "$cf_by" in
2473         "") cf_by=unknown ;;
2474         esac ;;
2475 esac
2476
2477 : set up the script used to warn in case of inconsistency
2478 cat <<EOS >whoa
2479 $startsh
2480 EOS
2481 cat <<'EOSC' >>whoa
2482 dflt=y
2483 echo " "
2484 echo "*** WHOA THERE!!! ***" >&4
2485 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2486 rp="    Keep the $hint value?"
2487 . ./myread
2488 case "$ans" in
2489 y) td=$was; tu=$was;;
2490 esac
2491 EOSC
2492
2493 : function used to set $1 to $val
2494 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2495 case "$val$was" in
2496 $define$undef) . ./whoa; eval "$var=\$td";;
2497 $undef$define) . ./whoa; eval "$var=\$tu";;
2498 *) eval "$var=$val";;
2499 esac'
2500
2501 cat <<EOM
2502
2503 Perl can be built to take advantage of threads, on some systems.
2504 To do so, Configure must be run with -Dusethreads.
2505
2506 Note that threading is a highly experimental feature, and
2507 some known race conditions still remain.  If you choose to try
2508 it, be very sure to not actually deploy it for production
2509 purposes.  README.threads has more details, and is required
2510 reading if you enable threads.
2511 EOM
2512 case "$usethreads" in
2513 $define|true|[yY]*)     dflt='y';;
2514 *) dflt='n';;
2515 esac
2516 rp='Build a threading Perl?'
2517 . ./myread
2518 case "$ans" in
2519 y|Y)    val="$define" ;;     
2520 *)      val="$undef" ;;
2521 esac
2522 set usethreads
2523 eval $setvar 
2524
2525 case "$d_oldpthreads" in
2526 '')     : Configure tests would be welcome here.  For now, assume undef.
2527         val="$undef" ;;
2528 *)      val="$d_oldpthreads" ;;
2529 esac
2530 set d_oldpthreads
2531 eval $setvar
2532
2533
2534 case "$usethreads" in
2535 "$define"|true|[yY]*)
2536 : Look for a hint-file generated 'call-back-unit'.  If the
2537 : user has specified that a threading perl is to be built,
2538 : we may need to set or change some other defaults.
2539         if $test -f usethreads.cbu; then
2540                 . ./usethreads.cbu
2541         fi
2542         case "$osname" in
2543         aix|dec_osf|dos_djgpp|freebsd|hpux|irix|linux|next|openbsd|os2|solaris|vmesa)
2544                 # Known thread-capable platforms.
2545                 ;;
2546         *)
2547                 cat >&4 <<EOM
2548 $osname is not known to support threads.
2549 Please let perlbug@perl.com know how to do that.
2550
2551 Cannot continue, aborting.
2552 EOM
2553                 exit 1
2554         ;;
2555         esac # $osname
2556     ;;
2557 esac # $usethreads
2558
2559 cat <<EOM
2560
2561 Perl can be built so that multiple Perl interpreters can coexist
2562 within the same Perl executable.  To do so, Configure must be run with
2563 -Dusemultiplicity.
2564
2565 Normally you do not need this and you should answer no.
2566
2567 EOM
2568 case "$usemultiplicity" in
2569 $define|true|[yY]*)     dflt='y';;
2570 *) dflt='n';;
2571 esac
2572 rp='Build Perl for multiplicity?'
2573 . ./myread
2574 case "$ans" in
2575 y|Y)    val="$define" ;;     
2576 *)      val="$undef" ;;
2577 esac
2578 set usemultiplicity
2579 eval $setvar 
2580
2581 cat <<EOM
2582
2583 Perl can be built to take advantage of explicit 64-bit interfaces,
2584 on some systems.  To do so, Configure must be run with -Duse64bits.
2585
2586 If this doesn't make any sense to you, just accept the default 'n'.
2587 EOM
2588 case "$use64bits" in
2589 $define|true|[yY]*)     dflt='y';;
2590 *) dflt='n';;
2591 esac
2592 rp='Try to use explicit 64-bit interfaces, if available?'
2593 . ./myread
2594 case "$ans" in
2595 y|Y) 
2596         val="$define"
2597         ;;     
2598 *)      
2599         val="$undef"
2600         ;;
2601 esac
2602 set use64bits
2603 eval $setvar
2604
2605 case "$archname64" in
2606 '') archname64='' ;;    # not a typo
2607 esac
2608
2609 case "$use64bits" in
2610 "$define"|true|[yY]*)
2611 : Look for a hint-file generated 'call-back-unit'.  If the
2612 : user has specified that a threading perl is to be built,
2613 : we may need to set or change some other defaults.
2614         if $test -f use64bits.cbu; then
2615                 . ./use64bits.cbu
2616         fi
2617         case "$osname" in
2618         dec_osf|hpux|irix|solaris|unicos)
2619                 # Known 64-bit capable platforms.
2620                 ;;
2621         *)
2622                 cat >&4 <<EOM
2623 $osname is not known to support 64-bit interfaces.
2624 Please let perlbug@perl.com know how to do that.
2625
2626 Cannot continue, aborting.
2627 EOM
2628                 exit 1
2629                 ;;
2630         esac
2631         ;;
2632 esac
2633
2634 : determine the architecture name
2635 echo " "
2636 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2637         tarch=`arch`"-$osname"
2638 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2639         if uname -m > tmparch 2>&1 ; then
2640                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
2641                         -e 's/$/'"-$osname/" tmparch`
2642         else
2643                 tarch="$osname"
2644         fi
2645         $rm -f tmparch
2646 else
2647         tarch="$osname"
2648 fi
2649 case "$myarchname" in
2650 ''|"$tarch") ;;
2651 *)
2652         echo "(Your architecture name used to be $myarchname.)"
2653         archname=''
2654         ;;
2655 esac
2656 myarchname="$tarch"
2657 case "$archname" in
2658 '') dflt="$tarch";;
2659 *) dflt="$archname";;
2660 esac
2661 rp='What is your architecture name'
2662 . ./myread
2663 archname="$ans"
2664 case "$usethreads" in
2665 $define)
2666         echo "Threads selected." >&4
2667         case "$archname" in
2668         *-thread*) echo "...and architecture name already has -thread." >&4
2669                 ;;
2670         *)      archname="$archname-thread"
2671                 echo "...setting architecture name to $archname." >&4
2672                 ;;
2673         esac
2674         ;;
2675 esac
2676 case "$usemultiplicity" in
2677 $define)
2678         echo "Multiplicity selected." >&4
2679         case "$archname" in
2680         *-multi*) echo "...and architecture name already has -multi." >&4
2681                 ;;
2682         *)      archname="$archname-multi"
2683                 echo "...setting architecture name to $archname." >&4
2684                 ;;
2685         esac
2686         ;;
2687 esac
2688 case "$use64bits" in
2689 $define)
2690         echo "Explicit 64-bitness selected." >&4
2691         case "$archname64" in
2692         '')
2693                 ;;
2694         *)
2695                 case "$archname" in
2696                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
2697                         ;;
2698                 *)      archname="$archname-$archname64"
2699                         echo "...setting architecture name to $archname." >&4
2700                         ;;
2701                 esac
2702                 ;;
2703         esac
2704 esac
2705
2706 : is AFS running?
2707 echo " "
2708 case "$afs" in
2709 $define|true)   afs=true ;;
2710 $undef|false)   afs=false ;;
2711 *)      if test -d /afs; then
2712                 afs=true
2713         else
2714                 afs=false
2715         fi
2716         ;;
2717 esac
2718 if $afs; then
2719         echo "AFS may be running... I'll be extra cautious then..." >&4
2720 else
2721         echo "AFS does not seem to be running..." >&4
2722 fi
2723
2724 : decide how portable to be.  Allow command line overrides.
2725 case "$d_portable" in
2726 "$undef") ;;
2727 *)      d_portable="$define" ;;
2728 esac
2729
2730 : set up shell script to do ~ expansion
2731 cat >filexp <<EOSS
2732 $startsh
2733 : expand filename
2734 case "\$1" in
2735  ~/*|~)
2736         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2737         ;;
2738  ~*)
2739         if $test -f /bin/csh; then
2740                 /bin/csh -f -c "glob \$1"
2741                 failed=\$?
2742                 echo ""
2743                 exit \$failed
2744         else
2745                 name=\`$expr x\$1 : '..\([^/]*\)'\`
2746                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2747                 if $test ! -d "\$dir"; then
2748                         me=\`basename \$0\`
2749                         echo "\$me: can't locate home directory for: \$name" >&2
2750                         exit 1
2751                 fi
2752                 case "\$1" in
2753                 */*)
2754                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2755                         ;;
2756                 *)
2757                         echo \$dir
2758                         ;;
2759                 esac
2760         fi
2761         ;;
2762 *)
2763         echo \$1
2764         ;;
2765 esac
2766 EOSS
2767 chmod +x filexp
2768 $eunicefix filexp
2769
2770 : now set up to get a file name
2771 cat <<EOS >getfile
2772 $startsh
2773 EOS
2774 cat <<'EOSC' >>getfile
2775 tilde=''
2776 fullpath=''
2777 already=''
2778 skip=''
2779 none_ok=''
2780 exp_file=''
2781 nopath_ok=''
2782 orig_rp="$rp"
2783 orig_dflt="$dflt"
2784
2785 case "$fn" in
2786 *\(*)
2787         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
2788         fn=`echo $fn | sed 's/(.*)//'`
2789         ;;
2790 esac
2791
2792 case "$fn" in
2793 *:*)
2794         loc_file=`expr $fn : '.*:\(.*\)'`
2795         fn=`expr $fn : '\(.*\):.*'`
2796         ;;
2797 esac
2798
2799 case "$fn" in
2800 *~*) tilde=true;;
2801 esac
2802 case "$fn" in
2803 */*) fullpath=true;;
2804 esac
2805 case "$fn" in
2806 *+*) skip=true;;
2807 esac
2808 case "$fn" in
2809 *n*) none_ok=true;;
2810 esac
2811 case "$fn" in
2812 *e*) exp_file=true;;
2813 esac
2814 case "$fn" in
2815 *p*) nopath_ok=true;;
2816 esac
2817
2818 case "$fn" in
2819 *f*) type='File';;
2820 *d*) type='Directory';;
2821 *l*) type='Locate';;
2822 esac
2823
2824 what="$type"
2825 case "$what" in
2826 Locate) what='File';;
2827 esac
2828
2829 case "$exp_file" in
2830 '')
2831         case "$d_portable" in
2832         "$define") ;;
2833         *) exp_file=true;;
2834         esac
2835         ;;
2836 esac
2837
2838 cd ..
2839 while test "$type"; do
2840         redo=''
2841         rp="$orig_rp"
2842         dflt="$orig_dflt"
2843         case "$tilde" in
2844         true) rp="$rp (~name ok)";;
2845         esac
2846         . UU/myread
2847         if test -f UU/getfile.ok && \
2848                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2849         then
2850                 value="$ans"
2851                 ansexp="$ans"
2852                 break
2853         fi
2854         case "$ans" in
2855         none)
2856                 value=''
2857                 ansexp=''
2858                 case "$none_ok" in
2859                 true) type='';;
2860                 esac
2861                 ;;
2862         *)
2863                 case "$tilde" in
2864                 '') value="$ans"
2865                         ansexp="$ans";;
2866                 *)
2867                         value=`UU/filexp $ans`
2868                         case $? in
2869                         0)
2870                                 if test "$ans" != "$value"; then
2871                                         echo "(That expands to $value on this system.)"
2872                                 fi
2873                                 ;;
2874                         *) value="$ans";;
2875                         esac
2876                         ansexp="$value"
2877                         case "$exp_file" in
2878                         '') value="$ans";;
2879                         esac
2880                         ;;
2881                 esac
2882                 case "$fullpath" in
2883                 true)
2884                         case "$ansexp" in
2885                         /*) value="$ansexp" ;;
2886                         *)
2887                                 redo=true
2888                                 case "$already" in
2889                                 true)
2890                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
2891                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
2892                                         ;;
2893                                 *)
2894                                 echo "Please give a full path name, starting with slash." >&4
2895                                         case "$tilde" in
2896                                         true)
2897                                 echo "Note that using ~name is ok provided it expands well." >&4
2898                                                 already=true
2899                                                 ;;
2900                                         esac
2901                                 esac
2902                                 ;;
2903                         esac
2904                         ;;
2905                 esac
2906                 case "$redo" in
2907                 '')
2908                         case "$type" in
2909                         File)
2910                                 if test -f "$ansexp"; then
2911                                         type=''
2912                                 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2913                                 then
2914                                         echo "($value is not a plain file, but that's ok.)"
2915                                         type=''
2916                                 fi
2917                                 ;;
2918                         Directory)
2919                                 if test -d "$ansexp"; then
2920                                         type=''
2921                                 fi
2922                                 ;;
2923                         Locate)
2924                                 if test -d "$ansexp"; then
2925                                         echo "(Looking for $loc_file in directory $value.)"
2926                                         value="$value/$loc_file"
2927                                         ansexp="$ansexp/$loc_file"
2928                                 fi
2929                                 if test -f "$ansexp"; then
2930                                         type=''
2931                                 fi
2932                                 case "$nopath_ok" in
2933                                 true)   case "$value" in
2934                                         */*) ;;
2935                                         *)      echo "Assuming $value will be in people's path."
2936                                                 type=''
2937                                                 ;;
2938                                         esac
2939                                         ;;
2940                                 esac
2941                                 ;;
2942                         esac
2943
2944                         case "$skip" in
2945                         true) type='';
2946                         esac
2947
2948                         case "$type" in
2949                         '') ;;
2950                         *)
2951                                 if test "$fastread" = yes; then
2952                                         dflt=y
2953                                 else
2954                                         dflt=n
2955                                 fi
2956                                 rp="$what $value doesn't exist.  Use that name anyway?"
2957                                 . UU/myread
2958                                 dflt=''
2959                                 case "$ans" in
2960                                 y*) type='';;
2961                                 *) echo " ";;
2962                                 esac
2963                                 ;;
2964                         esac
2965                         ;;
2966                 esac
2967                 ;;
2968         esac
2969 done
2970 cd UU
2971 ans="$value"
2972 rp="$orig_rp"
2973 dflt="$orig_dflt"
2974 rm -f getfile.ok
2975 EOSC
2976
2977 : determine root of directory hierarchy where package will be installed.
2978 case "$prefix" in
2979 '')
2980         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2981         ;;
2982 *)
2983         dflt="$prefix"
2984         ;;
2985 esac
2986 $cat <<EOM
2987
2988 By default, $package will be installed in $dflt/bin, manual
2989 pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2990 all installation directories. Typically set to /usr/local, but you
2991 may choose /usr if you wish to install $package among your system
2992 binaries. If you wish to have binaries under /bin but manual pages
2993 under /usr/local/man, that's ok: you will be prompted separately
2994 for each of the installation directories, the prefix being only used
2995 to set the defaults.
2996
2997 EOM
2998 fn=d~
2999 rp='Installation prefix to use?'
3000 . ./getfile
3001 oldprefix=''
3002 case "$prefix" in
3003 '') ;;
3004 *)
3005         case "$ans" in
3006         "$prefix") ;;
3007         *) oldprefix="$prefix";;
3008         esac
3009         ;;
3010 esac
3011 prefix="$ans"
3012 prefixexp="$ansexp"
3013
3014 : set the prefixit variable, to compute a suitable default value
3015 prefixit='case "$3" in
3016 ""|none)
3017         case "$oldprefix" in
3018         "") eval "$1=\"\$$2\"";;
3019         *)
3020                 case "$3" in
3021                 "") eval "$1=";;
3022                 none)
3023                         eval "tp=\"\$$2\"";
3024                         case "$tp" in
3025                         ""|" ") eval "$1=\"\$$2\"";;
3026                         *) eval "$1=";;
3027                         esac;;
3028                 esac;;
3029         esac;;
3030 *)
3031         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3032         case "$tp" in
3033         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3034         /*-$oldprefix/*|\~*-$oldprefix/*)
3035                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3036         *) eval "$1=\"\$$2\"";;
3037         esac;;
3038 esac'
3039
3040 : set the base revision
3041 baserev=5.0
3042
3043 : get the patchlevel
3044 echo " "
3045 echo "Getting the current patchlevel..." >&4
3046 if $test -r $rsrc/patchlevel.h;then
3047         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3048         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3049 else
3050         patchlevel=0
3051         subversion=0
3052 fi
3053 $echo $n "(You have $package" $c
3054 case "$package" in
3055 "*$baserev")    ;;
3056 *)              $echo $n " $baserev" $c ;;
3057 esac
3058 $echo $n " patchlevel $patchlevel" $c
3059 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3060 echo ".)"
3061
3062 if test 0 -eq "$subversion"; then
3063         version=`LC_ALL=C; export LC_ALL; \
3064                  echo $baserev $patchlevel | \
3065                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3066 else
3067         version=`LC_ALL=C; export LC_ALL; \
3068                  echo $baserev $patchlevel $subversion | \
3069                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3070 fi
3071 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3072 if test "$subversion" -lt 50; then
3073         apiversion=`LC_ALL=C; export LC_ALL; \
3074                  LANGUAGE=C; export LANGUAGE; \
3075                  echo $baserev $patchlevel | \
3076                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3077 else
3078         apiversion="$version"
3079 fi
3080
3081 : determine where private library files go
3082 : Usual default is /usr/local/lib/perl5/$version.
3083 : Also allow things like /opt/perl/lib/$version, since 
3084 : /opt/perl/lib/perl5... would be redundant.
3085 case "$prefix" in
3086 *perl*) set dflt privlib lib/$version ;;
3087 *)       set dflt privlib lib/$package/$version ;;
3088 esac
3089 eval $prefixit
3090 $cat <<EOM
3091
3092 There are some auxiliary files for $package that need to be put into a
3093 private library directory that is accessible by everyone.
3094
3095 EOM
3096 fn=d~+
3097 rp='Pathname where the private library files will reside?'
3098 . ./getfile
3099 if $test "X$privlibexp" != "X$ansexp"; then
3100         installprivlib=''
3101 fi
3102 privlib="$ans"
3103 privlibexp="$ansexp"
3104 if $afs; then
3105         $cat <<EOM
3106
3107 Since you are running AFS, I need to distinguish the directory in which
3108 private files reside from the directory in which they are installed (and from
3109 which they are presumably copied to the former directory by occult means).
3110
3111 EOM
3112         case "$installprivlib" in
3113         '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3114         *) dflt="$installprivlib";;
3115         esac
3116         fn=de~
3117         rp='Where will private files be installed?'
3118         . ./getfile
3119         installprivlib="$ans"
3120 else
3121         installprivlib="$privlibexp"
3122 fi
3123
3124 : set the prefixup variable, to restore leading tilda escape
3125 prefixup='case "$prefixexp" in
3126 "$prefix") ;;
3127 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3128 esac'
3129
3130 : determine where public architecture dependent libraries go
3131 set archlib archlib
3132 eval $prefixit
3133 : privlib default is /usr/local/lib/$package/$version
3134 : archlib default is /usr/local/lib/$package/$version/$archname
3135 : privlib may have an optional trailing /share.
3136 tdflt=`echo $privlib | $sed 's,/share$,,'`
3137 tdflt=$tdflt/$archname
3138 case "$archlib" in
3139 '')     dflt=$tdflt
3140         ;;
3141 *)      dflt="$archlib"
3142     ;;
3143 esac
3144 cat <<EOM
3145
3146 $spackage contains architecture-dependent library files.  If you are
3147 sharing libraries in a heterogeneous environment, you might store
3148 these files in a separate location.  Otherwise, you can just include
3149 them with the rest of the public library files.
3150
3151 EOM
3152 fn=d+~
3153 rp='Where do you want to put the public architecture-dependent libraries?'
3154 . ./getfile
3155 archlib="$ans"
3156 archlibexp="$ansexp"
3157
3158 if $afs; then
3159         $cat <<EOM
3160
3161 Since you are running AFS, I need to distinguish the directory in
3162 which architecture-dependent library files reside from the directory
3163 in which they are installed (and from which they are presumably copied
3164 to the former directory by occult means).
3165
3166 EOM
3167         case "$installarchlib" in
3168         '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3169         *) dflt="$installarchlib";;
3170         esac
3171         fn=de~
3172         rp='Where will architecture-dependent library files be installed?'
3173         . ./getfile
3174         installarchlib="$ans"
3175 else
3176         installarchlib="$archlibexp"
3177 fi
3178 if $test X"$archlib" = X"$privlib"; then
3179         d_archlib="$undef"
3180 else
3181         d_archlib="$define"
3182 fi
3183
3184 : make some quick guesses about what we are up against
3185 echo " "
3186 $echo $n "Hmm...  $c"
3187 echo exit 1 >bsd
3188 echo exit 1 >usg
3189 echo exit 1 >v7
3190 echo exit 1 >osf1
3191 echo exit 1 >eunice
3192 echo exit 1 >xenix
3193 echo exit 1 >venix
3194 echo exit 1 >os2
3195 d_bsd="$undef"
3196 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3197 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3198 then
3199         echo "Looks kind of like an OSF/1 system, but we'll see..."
3200         echo exit 0 >osf1
3201 elif test `echo abc | tr a-z A-Z` = Abc ; then
3202         xxx=`./loc addbib blurfl $pth`
3203         if $test -f $xxx; then
3204         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3205                 echo exit 0 >bsd
3206                 echo exit 0 >usg
3207         else
3208                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3209                         echo "Looks kind of like an extended USG system, but we'll see..."
3210                 else
3211                         echo "Looks kind of like a USG system, but we'll see..."
3212                 fi
3213                 echo exit 0 >usg
3214         fi
3215 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3216         echo "Looks kind of like a BSD system, but we'll see..."
3217         d_bsd="$define"
3218         echo exit 0 >bsd
3219 else
3220         echo "Looks kind of like a Version 7 system, but we'll see..."
3221         echo exit 0 >v7
3222 fi
3223 case "$eunicefix" in
3224 *unixtovms*)
3225         $cat <<'EOI'
3226 There is, however, a strange, musty smell in the air that reminds me of
3227 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3228 EOI
3229         echo exit 0 >eunice
3230         d_eunice="$define"
3231 : it so happens the Eunice I know will not run shell scripts in Unix format
3232         ;;
3233 *)
3234         echo " "
3235         echo "Congratulations.  You aren't running Eunice."
3236         d_eunice="$undef"
3237         ;;
3238 esac
3239 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3240 case "$p_" in
3241 :) ;;
3242 *)
3243         $cat <<'EOI'
3244 I have the feeling something is not exactly right, however...don't tell me...
3245 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3246 EOI
3247         echo exit 0 >os2
3248         ;;
3249 esac
3250 if test -f /xenix; then
3251         echo "Actually, this looks more like a XENIX system..."
3252         echo exit 0 >xenix
3253         d_xenix="$define"
3254 else
3255         echo " "
3256         echo "It's not Xenix..."
3257         d_xenix="$undef"
3258 fi
3259 chmod +x xenix
3260 $eunicefix xenix
3261 if test -f /venix; then
3262         echo "Actually, this looks more like a VENIX system..."
3263         echo exit 0 >venix
3264 else
3265         echo " "
3266         if ./xenix; then
3267                 : null
3268         else
3269                 echo "Nor is it Venix..."
3270         fi
3271 fi
3272 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3273 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3274 $rm -f foo
3275
3276 : see if setuid scripts can be secure
3277 $cat <<EOM
3278
3279 Some kernels have a bug that prevents setuid #! scripts from being
3280 secure.  Some sites have disabled setuid #! scripts because of this.
3281
3282 First let's decide if your kernel supports secure setuid #! scripts.
3283 (If setuid #! scripts would be secure but have been disabled anyway,
3284 don't say that they are secure if asked.)
3285
3286 EOM
3287
3288 val="$undef"
3289 if $test -d /dev/fd; then
3290         echo "#!$ls" >reflect
3291         chmod +x,u+s reflect
3292         ./reflect >flect 2>&1
3293         if $contains "/dev/fd" flect >/dev/null; then
3294                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3295                 val="$define"
3296         else
3297                 $cat <<EOM
3298 If you are not sure if they are secure, I can check but I'll need a
3299 username and password different from the one you are using right now.
3300 If you don't have such a username or don't want me to test, simply
3301 enter 'none'.
3302
3303 EOM
3304                 rp='Other username to test security of setuid scripts with?'
3305                 dflt='none'
3306                 . ./myread
3307                 case "$ans" in
3308                 n|none)
3309                         case "$d_suidsafe" in
3310                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3311                                 dflt=n;;
3312                         "$undef")
3313                                 echo "Well, the $hint value is *not* secure." >&4
3314                                 dflt=n;;
3315                         *)      echo "Well, the $hint value *is* secure." >&4
3316                                 dflt=y;;
3317                         esac
3318                         ;;
3319                 *)
3320                         $rm -f reflect flect
3321                         echo "#!$ls" >reflect
3322                         chmod +x,u+s reflect
3323                         echo >flect
3324                         chmod a+w flect
3325                         echo '"su" will (probably) prompt you for '"$ans's password."
3326                         su $ans -c './reflect >flect'
3327                         if $contains "/dev/fd" flect >/dev/null; then
3328                                 echo "Okay, it looks like setuid scripts are secure." >&4
3329                                 dflt=y
3330                         else
3331                                 echo "I don't think setuid scripts are secure." >&4
3332                                 dflt=n
3333                         fi
3334                         ;;
3335                 esac
3336                 rp='Does your kernel have *secure* setuid scripts?'
3337                 . ./myread
3338                 case "$ans" in
3339                 [yY]*)  val="$define";;
3340                 *)      val="$undef";;
3341                 esac
3342         fi
3343 else
3344         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3345         echo "(That's for file descriptors, not floppy disks.)"
3346         val="$undef"
3347 fi
3348 set d_suidsafe
3349 eval $setvar
3350
3351 $rm -f reflect flect
3352
3353 : now see if they want to do setuid emulation
3354 echo " "
3355 val="$undef"
3356 case "$d_suidsafe" in
3357 "$define")
3358         val="$undef"
3359         echo "No need to emulate SUID scripts since they are secure here." >& 4
3360         ;;
3361 *)
3362         $cat <<EOM
3363 Some systems have disabled setuid scripts, especially systems where
3364 setuid scripts cannot be secure.  On systems where setuid scripts have
3365 been disabled, the setuid/setgid bits on scripts are currently
3366 useless.  It is possible for $package to detect those bits and emulate
3367 setuid/setgid in a secure fashion.  This emulation will only work if
3368 setuid scripts have been disabled in your kernel.
3369
3370 EOM
3371         case "$d_dosuid" in
3372         "$define") dflt=y ;;
3373         *) dflt=n ;;
3374         esac
3375         rp="Do you want to do setuid/setgid emulation?"
3376         . ./myread
3377         case "$ans" in
3378         [yY]*)  val="$define";;
3379         *)      val="$undef";;
3380         esac
3381         ;;
3382 esac
3383 set d_dosuid
3384 eval $setvar
3385
3386 : determine where manual pages are on this system
3387 echo " "
3388 case "$sysman" in
3389 '') 
3390         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3391         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3392         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3393         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3394         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3395         sysman=`./loc . /usr/man/man1 $syspath`
3396         ;;
3397 esac
3398 if $test -d "$sysman"; then
3399         echo "System manual is in $sysman." >&4
3400 else
3401         echo "Could not find manual pages in source form." >&4
3402 fi
3403
3404 : see what memory models we can support
3405 case "$models" in
3406 '')
3407         $cat >pdp11.c <<'EOP'
3408 int main() {
3409 #ifdef pdp11
3410         exit(0);
3411 #else
3412         exit(1);
3413 #endif
3414 }
3415 EOP
3416         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3417         if $test -f pdp11 && ./pdp11 2>/dev/null; then
3418                 dflt='unsplit split'
3419         else
3420                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3421                 case "$tans" in
3422                 X) dflt='none';;
3423                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3424                                 dflt='small'
3425                         else
3426                                 dflt=''
3427                         fi
3428                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
3429                                 dflt="$dflt medium"
3430                         fi
3431                         if $test -d /lib/large || $test -d /usr/lib/large; then
3432                                 dflt="$dflt large"
3433                         fi
3434                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
3435                                 dflt="$dflt huge"
3436                         fi
3437                 esac
3438         fi;;
3439 *) dflt="$models";;
3440 esac
3441 $cat <<EOM
3442  
3443 Some systems have different model sizes.  On most systems they are called
3444 small, medium, large, and huge.  On the PDP11 they are called unsplit and
3445 split.  If your system doesn't support different memory models, say "none".
3446 If you wish to force everything to one memory model, say "none" here and
3447 put the appropriate flags later when it asks you for other cc and ld flags.
3448 Venix systems may wish to put "none" and let the compiler figure things out.
3449 (In the following question multiple model names should be space separated.)
3450
3451 The default for most systems is "none".
3452
3453 EOM
3454 rp="Which memory models are supported?"
3455 . ./myread
3456 models="$ans"
3457
3458 case "$models" in
3459 none)
3460         small=''
3461         medium=''
3462         large=''
3463         huge=''
3464         unsplit=''
3465         split=''
3466         ;;
3467 *split)
3468         case "$split" in
3469         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3470                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3471                         dflt='-i'
3472                 else
3473                         dflt='none'
3474                 fi;;
3475         *) dflt="$split";;
3476         esac
3477         rp="What flag indicates separate I and D space?"
3478         . ./myread
3479         tans="$ans"
3480         case "$tans" in
3481         none) tans='';;
3482         esac
3483         split="$tans"
3484         unsplit='';;
3485 *large*|*small*|*medium*|*huge*)
3486         case "$models" in
3487         *large*)
3488                 case "$large" in
3489                 '') dflt='-Ml';;
3490                 *) dflt="$large";;
3491                 esac
3492         rp="What flag indicates large model?"
3493         . ./myread
3494         tans="$ans"
3495         case "$tans" in
3496         none) tans='';
3497         esac
3498         large="$tans";;
3499         *) large='';;
3500         esac
3501         case "$models" in
3502         *huge*) case "$huge" in
3503                 '') dflt='-Mh';;
3504                 *) dflt="$huge";;
3505                 esac
3506                 rp="What flag indicates huge model?"
3507                 . ./myread
3508                 tans="$ans"
3509                 case "$tans" in
3510                 none) tans='';
3511                 esac
3512                 huge="$tans";;
3513         *) huge="$large";;
3514         esac
3515         case "$models" in
3516         *medium*) case "$medium" in
3517                 '') dflt='-Mm';;
3518                 *) dflt="$medium";;
3519                 esac
3520                 rp="What flag indicates medium model?"
3521                 . ./myread
3522                 tans="$ans"
3523                 case "$tans" in
3524                 none) tans='';
3525                 esac
3526                 medium="$tans";;
3527         *) medium="$large";;
3528         esac
3529         case "$models" in
3530         *small*) case "$small" in
3531                 '') dflt='none';;
3532                 *) dflt="$small";;
3533                 esac
3534                 rp="What flag indicates small model?"
3535                 . ./myread
3536                 tans="$ans"
3537                 case "$tans" in
3538                 none) tans='';
3539                 esac
3540                 small="$tans";;
3541         *) small='';;
3542         esac
3543         ;;
3544 *)
3545         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3546         ;;
3547 esac
3548 $rm -f pdp11.* pdp11
3549
3550 : see if we need a special compiler
3551 echo " "
3552 if ./usg; then
3553         case "$cc" in
3554         '') case "$Mcc" in
3555                 /*) dflt='Mcc';;
3556                 *) case "$large" in
3557                         -M*) dflt='cc';;
3558                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3559                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3560                                                 dflt='cc'
3561                                         else
3562                                                 dflt='cc -M'
3563                                         fi
3564                                 else
3565                                         dflt='cc'
3566                                 fi;;
3567                         esac;;
3568                 esac;;
3569         *)  dflt="$cc";;
3570         esac
3571         case "$dflt" in
3572         *M*)    $cat <<'EOM'
3573 On some older systems the default C compiler will not resolve multiple global
3574 references that happen to have the same name.  On some such systems the "Mcc"
3575 command may be used to force these to be resolved.  On other systems a "cc -M"
3576 command is required.  (Note that the -M flag on other systems indicates a
3577 memory model to use!) If you have the Gnu C compiler, you might wish to use
3578 that instead.
3579
3580 EOM
3581         ;;
3582         esac
3583         rp="Use which C compiler?"
3584         . ./myread
3585         cc="$ans"
3586 else
3587         case "$cc" in
3588         '') dflt=cc;;
3589         *) dflt="$cc";;
3590         esac
3591         rp="Use which C compiler?"
3592         . ./myread
3593         cc="$ans"
3594 fi
3595 : Look for a hint-file generated 'call-back-unit'.  Now that the
3596 : user has specified the compiler, we may need to set or change some
3597 : other defaults.
3598 if $test -f cc.cbu; then
3599     . ./cc.cbu
3600 fi
3601 echo " "
3602 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3603 $cat >gccvers.c <<EOM
3604 #include <stdio.h>
3605 int main() {
3606 #ifdef __GNUC__
3607 #ifdef __VERSION__
3608         printf("%s\n", __VERSION__);
3609 #else
3610         printf("%s\n", "1");
3611 #endif
3612 #endif
3613         exit(0);
3614 }
3615 EOM
3616 if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3617         gccversion=`./gccvers`
3618         case "$gccversion" in
3619         '') echo "You are not using GNU cc." ;;
3620         *)  echo "You are using GNU cc $gccversion." ;;
3621         esac
3622 else
3623         echo " "
3624         echo "*** WHOA THERE!!! ***" >&4
3625         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3626         case "$knowitall" in
3627         '')
3628         echo "    You'd better start hunting for one and let me know about it." >&4
3629                 exit 1
3630                 ;;
3631         esac
3632 fi
3633 $rm -f gccvers*
3634 case "$gccversion" in
3635 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3636 esac
3637
3638 : What should the include directory be ?
3639 echo " "
3640 $echo $n "Hmm...  $c"
3641 dflt='/usr/include'
3642 incpath=''
3643 mips_type=''
3644 if $test -f /bin/mips && /bin/mips; then
3645         echo "Looks like a MIPS system..."
3646         $cat >usr.c <<'EOCP'
3647 #ifdef SYSTYPE_BSD43
3648 /bsd43
3649 #endif
3650 EOCP
3651         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3652                 dflt='/bsd43/usr/include'
3653                 incpath='/bsd43'
3654                 mips_type='BSD 4.3'
3655         else
3656                 mips_type='System V'
3657         fi
3658         $rm -f usr.c usr.out
3659         echo "and you're compiling with the $mips_type compiler and libraries."
3660         xxx_prompt=y
3661         echo "exit 0" >mips
3662 else
3663         echo "Doesn't look like a MIPS system."
3664         xxx_prompt=n
3665         echo "exit 1" >mips
3666 fi
3667 chmod +x mips
3668 $eunicefix mips
3669 case "$usrinc" in
3670 '') ;;
3671 *) dflt="$usrinc";;
3672 esac
3673 case "$xxx_prompt" in
3674 y)      fn=d/
3675         echo " "
3676         rp='Where are the include files you want to use?'
3677         . ./getfile
3678         usrinc="$ans"
3679         ;;
3680 *)      usrinc="$dflt"
3681         ;;
3682 esac
3683
3684 : see how we invoke the C preprocessor
3685 echo " "
3686 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3687 cat <<'EOT' >testcpp.c
3688 #define ABC abc
3689 #define XYZ xyz
3690 ABC.XYZ
3691 EOT
3692 cd ..
3693 if test ! -f cppstdin; then
3694         echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3695 else
3696         echo "Keeping your $hint cppstdin wrapper."
3697 fi
3698 chmod 755 cppstdin
3699 wrapper=`pwd`/cppstdin
3700 ok='false'
3701 cd UU
3702
3703 if $test "X$cppstdin" != "X" && \
3704         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3705         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3706 then
3707         echo "You used to use $cppstdin $cppminus so we'll use that again."
3708         case "$cpprun" in
3709         '') echo "But let's see if we can live without a wrapper..." ;;
3710         *)
3711                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3712                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3713                 then
3714                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3715                         ok='true'
3716                 else
3717                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3718                 fi
3719                 ;;
3720         esac
3721 else
3722         case "$cppstdin" in
3723         '') ;;
3724         *)
3725                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3726                 ;;
3727         esac
3728 fi
3729
3730 if $ok; then
3731         : nothing
3732 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3733         $cc -E <testcpp.c >testcpp.out 2>&1; \
3734         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3735         echo "Yup, it does."
3736         x_cpp="$cc -E"
3737         x_minus='';
3738 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3739         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3740         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3741         echo "Yup, it does."
3742         x_cpp="$cc -E"
3743         x_minus='-';
3744 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3745         $cc -P <testcpp.c >testcpp.out 2>&1; \
3746         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3747         echo "Yipee, that works!"
3748         x_cpp="$cc -P"
3749         x_minus='';
3750 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3751         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3752         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3753         echo "At long last!"
3754         x_cpp="$cc -P"
3755         x_minus='-';
3756 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3757         $cpp <testcpp.c >testcpp.out 2>&1; \
3758         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3759         echo "It works!"
3760         x_cpp="$cpp"
3761         x_minus='';
3762 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3763         $cpp - <testcpp.c >testcpp.out 2>&1; \
3764         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3765         echo "Hooray, it works!  I was beginning to wonder."
3766         x_cpp="$cpp"
3767         x_minus='-';
3768 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3769         $wrapper <testcpp.c >testcpp.out 2>&1; \
3770         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3771         x_cpp="$wrapper"
3772         x_minus=''
3773         echo "Eureka!"
3774 else
3775         dflt=''
3776         rp="No dice.  I can't find a C preprocessor.  Name one:"
3777         . ./myread
3778         x_cpp="$ans"
3779         x_minus=''
3780         $x_cpp <testcpp.c >testcpp.out 2>&1
3781         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3782                 echo "OK, that will do." >&4
3783         else
3784 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3785                 exit 1
3786         fi
3787 fi
3788
3789 case "$ok" in
3790 false)
3791         cppstdin="$x_cpp"
3792         cppminus="$x_minus"
3793         cpprun="$x_cpp"
3794         cpplast="$x_minus"
3795         set X $x_cpp
3796         shift
3797         case "$1" in
3798         "$cpp")
3799                 echo "Perhaps can we force $cc -E using a wrapper..."
3800                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3801                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3802                 then
3803                         echo "Yup, we can."
3804                         cppstdin="$wrapper"
3805                         cppminus='';
3806                 else
3807                         echo "Nope, we'll have to live without it..."
3808                 fi
3809                 ;;
3810         esac
3811         case "$cpprun" in
3812         "$wrapper")
3813                 cpprun=''
3814                 cpplast=''
3815                 ;;
3816         esac
3817         ;;
3818 esac
3819
3820 case "$cppstdin" in
3821 "$wrapper"|'cppstdin') ;;
3822 *) $rm -f $wrapper;;
3823 esac
3824 $rm -f testcpp.c testcpp.out
3825
3826 : Set private lib path
3827 case "$plibpth" in
3828 '') if ./mips; then
3829                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3830         fi;;
3831 esac
3832 case "$libpth" in
3833 ' ') dlist='';;
3834 '') dlist="$loclibpth $plibpth $glibpth";;
3835 *) dlist="$libpth";;
3836 esac
3837
3838 : Now check and see which directories actually exist, avoiding duplicates
3839 libpth=''
3840 for xxx in $dlist
3841 do
3842     if $test -d $xxx; then
3843                 case " $libpth " in
3844                 *" $xxx "*) ;;
3845                 *) libpth="$libpth $xxx";;
3846                 esac
3847     fi
3848 done
3849 $cat <<'EOM'
3850
3851 Some systems have incompatible or broken versions of libraries.  Among
3852 the directories listed in the question below, please remove any you
3853 know not to be holding relevant libraries, and add any that are needed.
3854 Say "none" for none.
3855
3856 EOM
3857 case "$libpth" in
3858 '') dflt='none';;
3859 *)
3860         set X $libpth
3861         shift
3862         dflt=${1+"$@"}
3863         ;;
3864 esac
3865 rp="Directories to use for library searches?"
3866 . ./myread
3867 case "$ans" in
3868 none) libpth=' ';;
3869 *) libpth="$ans";;
3870 esac
3871
3872 : compute shared library extension
3873 case "$so" in
3874 '')
3875         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3876                 dflt='sl'
3877         else
3878                 dflt='so'
3879         fi
3880         ;;
3881 *) dflt="$so";;
3882 esac
3883 $cat <<EOM
3884
3885 On some systems, shared libraries may be available.  Answer 'none' if
3886 you want to suppress searching of shared libraries for the remaining
3887 of this configuration.
3888
3889 EOM
3890 rp='What is the file extension used for shared libraries?'
3891 . ./myread
3892 so="$ans"
3893
3894 : Define several unixisms.
3895 : Hints files or command line option can be used to override them.
3896 : The convoluted testing is in case hints files set either the old
3897 : or the new name.
3898 case "$_exe" in
3899 '')     case "$exe_ext" in
3900     '') ;;
3901         *)      _exe="$exe_ext" ;;
3902         esac
3903         ;;
3904 esac
3905 case "$_a" in
3906 '')     case "$lib_ext" in
3907     '') _a='.a';;
3908         *)      _a="$lib_ext" ;;
3909         esac
3910         ;;
3911 esac
3912 case "$_o" in
3913 '') case "$obj_ext" in
3914         '')     _o='.o';;
3915         *)      _o="$obj_ext";;
3916         esac
3917         ;;
3918 esac
3919 case "$p_" in
3920 '') case "$path_sep" in
3921         '')     p_=':';;
3922         *)      p_="$path_sep";;
3923         esac
3924         ;;
3925 esac
3926 exe_ext=$_exe
3927 lib_ext=$_a
3928 obj_ext=$_o
3929 path_sep=$p_
3930
3931 : Which makefile gets called first.  This is used by make depend.
3932 case "$firstmakefile" in
3933 '') firstmakefile='makefile';;
3934 esac
3935
3936 : Looking for optional libraries
3937 echo " "
3938 echo "Checking for optional libraries..." >&4
3939 case "$libs" in
3940 ' '|'') dflt='';;
3941 *) dflt="$libs";;
3942 esac
3943 case "$libswanted" in
3944 '') libswanted='c_s';;
3945 esac
3946 for thislib in $libswanted; do
3947         
3948         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3949                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3950                 echo "Found -l$thislib (shared)."
3951                 case " $dflt " in
3952                 *"-l$thislib "*);;
3953                 *) dflt="$dflt -l$thislib";;
3954                 esac
3955         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3956                 echo "Found -l$thislib (shared)."
3957                 case " $dflt " in
3958                 *"-l$thislib "*);;
3959                 *) dflt="$dflt -l$thislib";;
3960                 esac
3961         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3962                 echo "Found -l$thislib."
3963                 case " $dflt " in
3964                 *"-l$thislib "*);;
3965                 *) dflt="$dflt -l$thislib";;
3966                 esac
3967         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3968                 echo "Found -l$thislib."
3969                 case " $dflt " in
3970                 *"-l$thislib "*);;
3971                 *) dflt="$dflt -l$thislib";;
3972                 esac
3973         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3974                 echo "Found -l${thislib}_s."
3975                 case " $dflt " in
3976                 *"-l$thislib "*);;
3977                 *) dflt="$dflt -l${thislib}_s";;
3978                 esac
3979         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3980                 echo "Found -l$thislib."
3981                 case " $dflt " in
3982                 *"-l$thislib "*);;
3983                 *) dflt="$dflt -l$thislib";;
3984                 esac
3985         else
3986                 echo "No -l$thislib."
3987         fi
3988 done
3989 set X $dflt
3990 shift
3991 dflt="$*"
3992 case "$libs" in
3993 '') dflt="$dflt";;
3994 *) dflt="$libs";;
3995 esac
3996 case "$dflt" in
3997 ' '|'') dflt='none';;
3998 esac
3999
4000 $cat <<EOM
4001  
4002 Some versions of Unix support shared libraries, which make executables smaller
4003 but make load time slightly longer.
4004
4005 On some systems, mostly System V Release 3's, the shared library is included
4006 by putting the option "-lc_s" as the last thing on the cc command line when
4007 linking.  Other systems use shared libraries by default.  There may be other
4008 libraries needed to compile $package on your machine as well.  If your system
4009 needs the "-lc_s" option, include it here.  Include any other special libraries
4010 here as well.  Say "none" for none.
4011 EOM
4012
4013 echo " "
4014 rp="Any additional libraries?"
4015 . ./myread
4016 case "$ans" in
4017 none) libs=' ';;
4018 *) libs="$ans";;
4019 esac
4020
4021 : determine optimize, if desired, or use for debug flag also
4022 case "$optimize" in
4023 ' '|$undef) dflt='none';;
4024 '') dflt='-O';;
4025 *) dflt="$optimize";;
4026 esac
4027 $cat <<EOH
4028
4029 Some C compilers have problems with their optimizers.  By default, $package
4030 compiles with the -O flag to use the optimizer.  Alternately, you might want
4031 to use the symbolic debugger, which uses the -g flag (on traditional Unix
4032 systems).  Either flag can be specified here.  To use neither flag, specify
4033 the word "none".
4034
4035 EOH
4036 rp="What optimizer/debugger flag should be used?"
4037 . ./myread
4038 optimize="$ans"
4039 case "$optimize" in
4040 'none') optimize=" ";;
4041 esac
4042
4043 dflt=''
4044 : We will not override a previous value, but we might want to
4045 : augment a hint file
4046 case "$hint" in
4047 none|recommended)
4048         case "$gccversion" in
4049         1*) dflt='-fpcc-struct-return' ;;
4050         esac
4051         case "$optimize" in
4052         *-g*) dflt="$dflt -DDEBUGGING";;
4053         esac
4054         case "$gccversion" in
4055         2*) if test -d /etc/conf/kconfig.d &&
4056                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4057                 then
4058                         dflt="$dflt -posix"
4059                 fi
4060                 ;;
4061         esac
4062         ;;
4063 esac
4064
4065 case "$mips_type" in
4066 *BSD*|'') inclwanted="$locincpth $usrinc";;
4067 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4068 esac
4069 for thisincl in $inclwanted; do
4070         if $test -d $thisincl; then
4071                 if $test x$thisincl != x$usrinc; then
4072                         case "$dflt" in
4073                         *$thisincl*);;
4074                         *) dflt="$dflt -I$thisincl";;
4075                         esac
4076                 fi
4077         fi
4078 done
4079
4080 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4081         xxx=true;
4082 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4083         xxx=true;
4084 else
4085         xxx=false;
4086 fi;
4087 if $xxx; then
4088         case "$dflt" in
4089         *$2*);;
4090         *) dflt="$dflt -D$2";;
4091         esac;
4092 fi'
4093
4094 set signal.h LANGUAGE_C; eval $inctest
4095
4096 case "$hint" in
4097 none|recommended) dflt="$ccflags $dflt" ;;
4098 *) dflt="$ccflags";;
4099 esac
4100
4101 case "$dflt" in
4102 ''|' ') dflt=none;;
4103 esac
4104 $cat <<EOH
4105
4106 Your C compiler may want other flags.  For this question you should include
4107 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4108 but you should NOT include libraries or ld flags like -lwhatever.  If you
4109 want $package to honor its debug switch, you should include -DDEBUGGING here.
4110 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4111
4112 To use no flags, specify the word "none".
4113
4114 EOH
4115 set X $dflt
4116 shift
4117 dflt=${1+"$@"}
4118 rp="Any additional cc flags?"
4119 . ./myread
4120 case "$ans" in
4121 none) ccflags='';;
4122 *) ccflags="$ans";;
4123 esac
4124
4125 : the following weeds options from ccflags that are of no interest to cpp
4126 cppflags="$ccflags"
4127 case "$gccversion" in
4128 1*) cppflags="$cppflags -D__GNUC__"
4129 esac
4130 case "$mips_type" in
4131 '');;
4132 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4133 esac
4134 case "$cppflags" in
4135 '');;
4136 *)
4137         echo " "
4138         echo "Let me guess what the preprocessor flags are..." >&4
4139         set X $cppflags
4140         shift
4141         cppflags=''
4142         $cat >cpp.c <<'EOM'
4143 #define BLURFL foo
4144
4145 BLURFL xx LFRULB
4146 EOM
4147         previous=''
4148         for flag in $*
4149         do
4150                 case "$flag" in
4151                 -*) ftry="$flag";;
4152                 *) ftry="$previous $flag";;
4153                 esac
4154                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4155                         >cpp1.out 2>/dev/null && \
4156                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4157                         >cpp2.out 2>/dev/null && \
4158                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4159                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4160                 then
4161                         cppflags="$cppflags $ftry"
4162                         previous=''
4163                 else
4164                         previous="$flag"
4165                 fi
4166         done
4167         set X $cppflags
4168         shift
4169         cppflags=${1+"$@"}
4170         case "$cppflags" in
4171         *-*)  echo "They appear to be: $cppflags";;
4172         esac
4173         $rm -f cpp.c cpp?.out
4174         ;;
4175 esac
4176
4177 : flags used in final linking phase
4178 case "$ldflags" in
4179 '') if ./venix; then
4180                 dflt='-i -z'
4181         else
4182                 dflt=''
4183         fi
4184         case "$ccflags" in
4185         *-posix*) dflt="$dflt -posix" ;;
4186         esac
4187         ;;
4188 *) dflt="$ldflags";;
4189 esac
4190
4191 : Try to guess additional flags to pick up local libraries.
4192 for thislibdir in $libpth; do
4193         case " $loclibpth " in
4194         *" $thislibdir "*)
4195                 case "$dflt " in 
4196                 *"-L$thislibdir "*) ;;
4197                 *)  dflt="$dflt -L$thislibdir" ;;
4198                 esac
4199                 ;;
4200         esac
4201 done
4202
4203 case "$dflt" in
4204 '') dflt='none' ;;
4205 esac
4206
4207 $cat <<EOH
4208
4209 Your C linker may need flags.  For this question you should
4210 include -L/whatever and any other flags used by the C linker, but you
4211 should NOT include libraries like -lwhatever.
4212
4213 Make sure you include the appropriate -L/path flags if your C linker
4214 does not normally search all of the directories you specified above,
4215 namely
4216         $libpth
4217 To use no flags, specify the word "none".
4218
4219 EOH
4220
4221 rp="Any additional ld flags (NOT including libraries)?"
4222 . ./myread
4223 case "$ans" in
4224 none) ldflags='';;
4225 *) ldflags="$ans";;
4226 esac
4227 rmlist="$rmlist pdp11"
4228
4229 : coherency check
4230 echo " "
4231 echo "Checking your choice of C compiler and flags for coherency..." >&4
4232 $cat > try.c <<'EOF'
4233 #include <stdio.h>
4234 int main() { printf("Ok\n"); exit(0); }
4235 EOF
4236 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4237 shift
4238 $cat >try.msg <<'EOM'
4239 I've tried to compile and run the following simple program:
4240
4241 EOM
4242 $cat try.c >> try.msg
4243
4244 $cat >> try.msg <<EOM
4245
4246 I used the command:
4247
4248         $*
4249         ./try
4250
4251 and I got the following output:
4252
4253 EOM
4254 dflt=y
4255 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4256         if sh -c './try' >>try.msg 2>&1; then
4257                 xxx=`./try`
4258                 case "$xxx" in
4259                 "Ok") dflt=n ;;
4260                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4261                         case " $libs " in
4262                         *" -lsfio "*)
4263                                 cat >> try.msg <<'EOQS'
4264 If $libs contains -lsfio, and sfio is mis-configured, then it
4265 sometimes (apparently) runs and exits with a 0 status, but with no
4266 output!  It may have to do with sfio's use of _exit vs. exit.
4267
4268 EOQS
4269                                 rp="You have a big problem.  Shall I abort Configure"
4270                                 dflt=y
4271                                 ;;
4272                         esac
4273                         ;;
4274                 esac
4275         else
4276                 echo "The program compiled OK, but exited with status $?." >>try.msg
4277                 rp="You have a problem.  Shall I abort Configure"
4278                 dflt=y
4279         fi
4280 else
4281         echo "I can't compile the test program." >>try.msg
4282         rp="You have a BIG problem.  Shall I abort Configure"
4283         dflt=y
4284 fi
4285 case "$dflt" in
4286 y)
4287         $cat try.msg >&4
4288         case "$knowitall" in
4289         '')
4290                 echo "(The supplied flags or libraries might be incorrect.)"
4291                 ;;
4292         *) dflt=n;;
4293         esac
4294         echo " "
4295         . ./myread
4296         case "$ans" in
4297         n*|N*) ;;
4298         *)      echo "Ok.  Stopping Configure." >&4
4299                 exit 1
4300                 ;;
4301         esac
4302         ;;
4303 n) echo "OK, that should do.";;
4304 esac
4305 $rm -f try try.* core
4306
4307 : determine filename position in cpp output
4308 echo " "
4309 echo "Computing filename position in cpp output for #include directives..." >&4
4310 echo '#include <stdio.h>' > foo.c
4311 $cat >fieldn <<EOF
4312 $startsh
4313 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4314 $grep '^[       ]*#.*stdio\.h' | \
4315 while read cline; do
4316         pos=1
4317         set \$cline
4318         while $test \$# -gt 0; do
4319                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4320                         echo "\$pos"
4321                         exit 0
4322                 fi
4323                 shift
4324                 pos=\`expr \$pos + 1\`
4325         done
4326 done
4327 EOF
4328 chmod +x fieldn
4329 fieldn=`./fieldn`
4330 $rm -f foo.c fieldn
4331 case $fieldn in
4332 '') pos='???';;
4333 1) pos=first;;
4334 2) pos=second;;
4335 3) pos=third;;
4336 *) pos="${fieldn}th";;
4337 esac
4338 echo "Your cpp writes the filename in the $pos field of the line."
4339
4340 : locate header file
4341 $cat >findhdr <<EOF
4342 $startsh
4343 wanted=\$1
4344 name=''
4345 if test -f $usrinc/\$wanted; then
4346         echo "$usrinc/\$wanted"
4347         exit 0
4348 fi
4349 awkprg='{ print \$$fieldn }'
4350 echo "#include <\$wanted>" > foo\$\$.c
4351 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4352 $grep "^[       ]*#.*\$wanted" | \
4353 while read cline; do
4354         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4355         case "\$name" in
4356         */\$wanted) echo "\$name"; exit 0;;
4357         *) name='';;
4358         esac;
4359 done;
4360 $rm -f foo\$\$.c;
4361 case "\$name" in
4362 '') exit 1;;
4363 esac
4364 EOF
4365 chmod +x findhdr
4366
4367 : define an alternate in-header-list? function
4368 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4369 cont=true; xxf="echo \"<\$1> found.\" >&4";
4370 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4371 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4372 esac;
4373 case $# in 4) instead=instead;; *) instead="at last";; esac;
4374 while $test "$cont"; do
4375         xxx=`./findhdr $1`
4376         var=$2; eval "was=\$$2";
4377         if $test "$xxx" && $test -r "$xxx";
4378         then eval $xxf;
4379         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4380                 cont="";
4381         else eval $xxnf;
4382         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4383         set $yyy; shift; shift; yyy=$@;
4384         case $# in 0) cont="";;
4385         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4386                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4387         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4388                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4389         esac;
4390 done;
4391 while $test "$yyy";
4392 do set $yyy; var=$2; eval "was=\$$2";
4393         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4394         set $yyy; shift; shift; yyy=$@;
4395 done'
4396
4397 : see if this is a malloc.h system
4398 set malloc.h i_malloc
4399 eval $inhdr
4400
4401 : see if stdlib is available
4402 set stdlib.h i_stdlib
4403 eval $inhdr
4404
4405 : determine which malloc to compile in
4406 echo " "
4407 case "$usemymalloc" in
4408 ''|[yY]*|true|$define)  dflt='y' ;;
4409 *)      dflt='n' ;;
4410 esac
4411 rp="Do you wish to attempt to use the malloc that comes with $package?"
4412 . ./myread
4413 usemymalloc="$ans"
4414 case "$ans" in
4415 y*|true)
4416         usemymalloc='y'
4417         mallocsrc='malloc.c'
4418         mallocobj="malloc$_o"
4419         d_mymalloc="$define"
4420         case "$libs" in
4421         *-lmalloc*)
4422                 : Remove malloc from list of libraries to use
4423                 echo "Removing unneeded -lmalloc from library list" >&4
4424                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4425                 shift
4426                 libs="$*"
4427                 echo "libs = $libs" >&4
4428                 ;;
4429         esac
4430         ;;
4431 *)
4432         usemymalloc='n'
4433         mallocsrc=''
4434         mallocobj=''
4435         d_mymalloc="$undef"
4436         ;;
4437 esac
4438
4439 : compute the return types of malloc and free
4440 echo " "
4441 $cat >malloc.c <<END
4442 #$i_malloc I_MALLOC
4443 #$i_stdlib I_STDLIB
4444 #include <stdio.h>
4445 #include <sys/types.h>
4446 #ifdef I_MALLOC
4447 #include <malloc.h>
4448 #endif
4449 #ifdef I_STDLIB
4450 #include <stdlib.h>
4451 #endif
4452 #ifdef TRY_MALLOC
4453 void *malloc();
4454 #endif
4455 #ifdef TRY_FREE
4456 void free();
4457 #endif
4458 END
4459 case "$malloctype" in
4460 '')
4461         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4462                 malloctype='void *'
4463         else
4464                 malloctype='char *'
4465         fi
4466         ;;
4467 esac
4468 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4469
4470 case "$freetype" in
4471 '')
4472         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4473                 freetype='void'
4474         else
4475                 freetype='int'
4476         fi
4477         ;;
4478 esac
4479 echo "Your system uses $freetype free(), it would seem." >&4
4480 $rm -f malloc.[co]
4481 : Cruising for prototypes
4482 echo " "
4483 echo "Checking out function prototypes..." >&4
4484 $cat >prototype.c <<'EOCP'
4485 int main(int argc, char *argv[]) {
4486         exit(0);}
4487 EOCP
4488 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4489         echo "Your C compiler appears to support function prototypes."
4490         val="$define"
4491 else
4492         echo "Your C compiler doesn't seem to understand function prototypes."
4493         val="$undef"
4494 fi
4495 set prototype
4496 eval $setvar
4497 $rm -f prototype*
4498
4499 case "$prototype" in
4500 "$define") ;;
4501 *)      ansi2knr='ansi2knr'
4502         echo " "
4503         cat <<EOM >&4
4504
4505 $me:  FATAL ERROR:
4506 This version of $package can only be compiled by a compiler that 
4507 understands function prototypes.  Unfortunately, your C compiler 
4508         $cc $ccflags
4509 doesn't seem to understand them.  Sorry about that.
4510
4511 If GNU cc is available for your system, perhaps you could try that instead.  
4512
4513 Eventually, we hope to support building Perl with pre-ANSI compilers.
4514 If you would like to help in that effort, please contact <perlbug@perl.org>.
4515
4516 Aborting Configure now.
4517 EOM
4518         exit 2
4519         ;;
4520 esac
4521
4522 : determine where public executables go
4523 echo " "
4524 set dflt bin bin
4525 eval $prefixit
4526 fn=d~
4527 rp='Pathname where the public executables will reside?'
4528 . ./getfile
4529 if $test "X$ansexp" != "X$binexp"; then
4530         installbin=''
4531 fi
4532 bin="$ans"
4533 binexp="$ansexp"
4534 if $afs; then
4535         $cat <<EOM
4536
4537 Since you are running AFS, I need to distinguish the directory in which
4538 executables reside from the directory in which they are installed (and from
4539 which they are presumably copied to the former directory by occult means).
4540
4541 EOM
4542         case "$installbin" in
4543         '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4544         *) dflt="$installbin";;
4545         esac
4546         fn=de~
4547         rp='Where will public executables be installed?'
4548         . ./getfile
4549         installbin="$ans"
4550 else
4551         installbin="$binexp"
4552 fi
4553
4554 : determine whether to install perl also as /usr/bin/perl
4555
4556 echo " "
4557 if test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4558         $cat <<EOM
4559 Many scripts expect to perl to be installed as /usr/bin/perl.
4560 I can install the perl you are about to compile also as /usr/bin/perl
4561 (in addition to $installbin/perl).
4562 EOM
4563         case "$installusrbinperl" in
4564         "$undef"|[nN]*) dflt='n';;
4565         *)              dflt='y';;
4566         esac
4567         rp="Do you want to install perl as /usr/bin/perl?"
4568         . ./myread
4569         case "$ans" in
4570         [yY]*)  val="$define";;
4571         *)      val="$undef" ;;
4572         esac
4573 else
4574         val="$undef"
4575 fi
4576 set installusrbinperl
4577 eval $setvar
4578
4579 : define a shorthand compile call
4580 compile='
4581 mc_file=$1;
4582 shift;
4583 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4584 : define a shorthand compile call for compilations that should be ok.
4585 compile_ok='
4586 mc_file=$1;
4587 shift;
4588 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4589
4590 echo " "
4591 echo "Checking for GNU C Library..." >&4
4592 cat >gnulibc.c <<EOM
4593 #include <stdio.h>
4594 int main()
4595 {
4596 #ifdef __GLIBC__
4597     exit(0);
4598 #else
4599     exit(1);
4600 #endif
4601 }
4602 EOM
4603 set gnulibc
4604 if eval $compile_ok && ./gnulibc; then
4605         val="$define"
4606         echo "You are using the GNU C Library"
4607 else
4608         val="$undef"
4609         echo "You are not using the GNU C Library"
4610 fi
4611 $rm -f gnulibc*
4612 set d_gnulibc
4613 eval $setvar
4614
4615 : see if nm is to be used to determine whether a symbol is defined or not
4616 case "$usenm" in
4617 '')
4618         dflt=''
4619         case "$d_gnulibc" in
4620         "$define")
4621                 echo " "
4622                 echo "nm probably won't work on the GNU C Library." >&4
4623                 dflt=n
4624                 ;;
4625         esac
4626         case "$dflt" in
4627         '') 
4628                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4629                         echo " "
4630                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4631                         echo "'nm' won't be sufficient on this sytem." >&4
4632                         dflt=n
4633                 fi
4634                 ;;
4635         esac
4636         case "$dflt" in
4637         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4638                 if $test $dflt -gt 20; then
4639                         dflt=y
4640                 else
4641                         dflt=n
4642                 fi
4643                 ;;
4644         esac
4645         ;;
4646 *)
4647         case "$usenm" in
4648         true|$define) dflt=y;;
4649         *) dflt=n;;
4650         esac
4651         ;;
4652 esac
4653 $cat <<EOM
4654
4655 I can use $nm to extract the symbols from your C libraries. This
4656 is a time consuming task which may generate huge output on the disk (up
4657 to 3 megabytes) but that should make the symbols extraction faster. The
4658 alternative is to skip the 'nm' extraction part and to compile a small
4659 test program instead to determine whether each symbol is present. If
4660 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4661 this may be the best solution.
4662
4663 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4664
4665 EOM
4666 rp="Shall I use $nm to extract C symbols from the libraries?"
4667 . ./myread
4668 case "$ans" in
4669 [Nn]*) usenm=false;;
4670 *) usenm=true;;
4671 esac
4672
4673 runnm=$usenm
4674 case "$reuseval" in
4675 true) runnm=false;;
4676 esac
4677
4678 : nm options which may be necessary
4679 case "$nm_opt" in
4680 '') if $test -f /mach_boot; then
4681                 nm_opt=''       # Mach
4682         elif $test -d /usr/ccs/lib; then
4683                 nm_opt='-p'     # Solaris (and SunOS?)
4684         elif $test -f /dgux; then
4685                 nm_opt='-p'     # DG-UX
4686         elif $test -f /lib64/rld; then
4687                 nm_opt='-p'     # 64-bit Irix
4688         else
4689                 nm_opt=''
4690         fi;;
4691 esac
4692
4693 : nm options which may be necessary for shared libraries but illegal
4694 : for archive libraries.  Thank you, Linux.
4695 case "$nm_so_opt" in
4696 '')     case "$myuname" in
4697         *linux*)
4698                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4699                         nm_so_opt='--dynamic'
4700                 fi
4701                 ;;
4702         esac
4703         ;;
4704 esac
4705
4706 case "$runnm" in
4707 true)
4708 : get list of predefined functions in a handy place
4709 echo " "
4710 case "$libc" in
4711 '') libc=unknown
4712         case "$libs" in
4713         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4714         esac
4715         ;;
4716 esac
4717 libnames='';
4718 case "$libs" in
4719 '') ;;
4720 *)  for thislib in $libs; do
4721         case "$thislib" in
4722         -lc|-lc_s)
4723                 : Handle C library specially below.
4724                 ;;
4725         -l*)
4726                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4727                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4728                         :
4729                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4730                         :
4731                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4732                         :
4733                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4734                         :
4735                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4736                         :
4737                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4738                         :
4739                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4740                         :
4741                 else
4742                         try=''
4743                 fi
4744                 libnames="$libnames $try"
4745                 ;;
4746         *) libnames="$libnames $thislib" ;;
4747         esac
4748         done
4749         ;;
4750 esac
4751 xxx=normal
4752 case "$libc" in
4753 unknown)
4754         set /lib/libc.$so
4755         for xxx in $libpth; do
4756                 $test -r $1 || set $xxx/libc.$so
4757                 : The messy sed command sorts on library version numbers.
4758                 $test -r $1 || \
4759                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4760                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4761                                 h
4762                                 s/[0-9][0-9]*/0000&/g
4763                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4764                                 G
4765                                 s/\n/ /' | \
4766                          sort | $sed -e 's/^.* //'`
4767                 eval set \$$#
4768         done
4769         $test -r $1 || set /usr/ccs/lib/libc.$so
4770         $test -r $1 || set /lib/libsys_s$_a
4771         ;;
4772 *)
4773         set blurfl
4774         ;;
4775 esac
4776 if $test -r "$1"; then
4777         echo "Your (shared) C library seems to be in $1."
4778         libc="$1"
4779 elif $test -r /lib/libc && $test -r /lib/clib; then
4780         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4781         xxx=apollo
4782         libc='/lib/clib /lib/libc'
4783         if $test -r /lib/syslib; then
4784                 echo "(Your math library is in /lib/syslib.)"
4785                 libc="$libc /lib/syslib"
4786         fi
4787 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4788         echo "Your C library seems to be in $libc, as you said before."
4789 elif $test -r $incpath/usr/lib/libc$_a; then
4790         libc=$incpath/usr/lib/libc$_a;
4791         echo "Your C library seems to be in $libc.  That's fine."
4792 elif $test -r /lib/libc$_a; then
4793         libc=/lib/libc$_a;
4794         echo "Your C library seems to be in $libc.  You're normal."
4795 else
4796         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4797                 :
4798         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4799                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4800         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4801                 :
4802         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4803                 :
4804         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4805                 :
4806         else
4807                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4808         fi
4809         if $test -r "$tans"; then
4810                 echo "Your C library seems to be in $tans, of all places."
4811                 libc=$tans
4812         else
4813                 libc='blurfl'
4814         fi
4815 fi
4816 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4817         dflt="$libc"
4818         cat <<EOM
4819
4820 If the guess above is wrong (which it might be if you're using a strange
4821 compiler, or your machine supports multiple models), you can override it here.
4822
4823 EOM
4824 else
4825         dflt=''
4826         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
4827         cat >&4 <<EOM
4828 I can't seem to find your C library.  I've looked in the following places:
4829
4830 EOM
4831         $sed 's/^/      /' libpath
4832         cat <<EOM
4833
4834 None of these seems to contain your C library. I need to get its name...
4835
4836 EOM
4837 fi
4838 fn=f
4839 rp='Where is your C library?'
4840 . ./getfile
4841 libc="$ans"
4842
4843 echo " "
4844 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
4845 set X `cat libnames`
4846 shift
4847 xxx=files
4848 case $# in 1) xxx=file; esac
4849 echo "Extracting names from the following $xxx for later perusal:" >&4
4850 echo " "
4851 $sed 's/^/      /' libnames >&4
4852 echo " "
4853 $echo $n "This may take a while...$c" >&4
4854
4855 for file in $*; do
4856         case $file in
4857         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4858         *) $nm $nm_opt $file 2>/dev/null;;
4859         esac
4860 done >libc.tmp
4861
4862 $echo $n ".$c"
4863 $grep fprintf libc.tmp > libc.ptf
4864 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4865 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4866 xxx='[ADTSIW]'
4867 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4868         eval $xscan;\
4869         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4870                 eval $xrun
4871 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4872         eval $xscan;\
4873         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4874                 eval $xrun
4875 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4876         eval $xscan;\
4877         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4878                 eval $xrun
4879 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4880         eval $xscan;\
4881         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4882                 eval $xrun
4883 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4884         eval $xscan;\
4885         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4886                 eval $xrun
4887 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4888         eval $xscan;\
4889         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4890                 eval $xrun
4891 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4892                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4893         eval $xscan;\
4894         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4895                 eval $xrun
4896 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4897         eval $xscan;\
4898         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4899                 eval $xrun
4900 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4901         eval $xscan;\
4902         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4903                 eval $xrun
4904 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4905         eval $xscan;\
4906         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4907                 eval $xrun
4908 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4909         eval $xscan;\
4910         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4911                 eval $xrun
4912 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4913         eval $xscan;\
4914         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4915                 eval $xrun
4916 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4917         eval $xscan;\
4918         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4919                 eval $xrun
4920 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4921         eval $xscan;\
4922         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4923                 eval $xrun
4924 else
4925         $nm -p $* 2>/dev/null >libc.tmp
4926         $grep fprintf libc.tmp > libc.ptf
4927         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4928                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4929         then
4930                 nm_opt='-p'
4931                 eval $xrun
4932         else
4933                 echo " "
4934                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4935                 com=''
4936                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4937                         for thisname in $libnames $libc; do
4938                                 $ar t $thisname >>libc.tmp
4939                         done
4940                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4941                         echo "Ok." >&4
4942                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4943                         # Repeat libc to extract forwarders to DLL entries too
4944                         for thisname in $libnames $libc; do
4945                                 $ar tv $thisname >>libc.tmp
4946                                 # Revision 50 of EMX has bug in $ar.
4947                                 # it will not extract forwarders to DLL entries
4948                                 # Use emximp which will extract exactly them.
4949                                 emximp -o tmp.imp $thisname \
4950                                     2>/dev/null && \
4951                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4952                                     < tmp.imp >>libc.tmp
4953                                 $rm tmp.imp
4954                         done
4955                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4956                         echo "Ok." >&4
4957                 else
4958                         echo "$ar didn't seem to work right." >&4
4959                         echo "Maybe this is a Cray...trying bld instead..." >&4
4960                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4961                         then
4962                                 for thisname in $libnames; do
4963                                         bld t $libnames | \
4964                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4965                                         $ar t $thisname >>libc.tmp
4966                                 done
4967                                 echo "Ok." >&4
4968                         else
4969                                 echo "That didn't work either.  Giving up." >&4
4970                                 exit 1
4971                         fi
4972                 fi
4973         fi
4974 fi
4975 nm_extract="$com"
4976 if $test -f /lib/syscalls.exp; then
4977         echo " "
4978         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4979         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4980 fi
4981 ;;
4982 esac
4983 $rm -f libnames libpath
4984
4985 : see if dld is available
4986 set dld.h i_dld
4987 eval $inhdr
4988
4989 : is a C symbol defined?
4990 csym='tlook=$1;
4991 case "$3" in
4992 -v) tf=libc.tmp; tc=""; tdc="";;
4993 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4994 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4995 esac;
4996 tx=yes;
4997 case "$reuseval-$4" in
4998 true-) ;;
4999 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5000 esac;
5001 case "$tx" in
5002 yes)
5003         case "$runnm" in
5004         true)
5005                 if $contains $tlook $tf >/dev/null 2>&1;
5006                 then tval=true;
5007                 else tval=false;
5008                 fi;;
5009         *)
5010                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5011                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5012                 then tval=true;
5013                 else tval=false;
5014                 fi;
5015                 $rm -f t t.c;;
5016         esac;;
5017 *)
5018         case "$tval" in
5019         $define) tval=true;;
5020         *) tval=false;;
5021         esac;;
5022 esac;
5023 eval "$2=$tval"'
5024
5025 : define an is-in-libc? function
5026 inlibc='echo " "; td=$define; tu=$undef;
5027 sym=$1; var=$2; eval "was=\$$2";
5028 tx=yes;
5029 case "$reuseval$was" in
5030 true) ;;
5031 true*) tx=no;;
5032 esac;
5033 case "$tx" in
5034 yes)
5035         set $sym tres -f;
5036         eval $csym;
5037         case "$tres" in
5038         true)
5039                 echo "$sym() found." >&4;
5040                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5041         *)
5042                 echo "$sym() NOT found." >&4;
5043                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5044         esac;;
5045 *)
5046         case "$was" in
5047         $define) echo "$sym() found." >&4;;
5048         *) echo "$sym() NOT found." >&4;;
5049         esac;;
5050 esac'
5051
5052 : see if dlopen exists
5053 xxx_runnm="$runnm"
5054 runnm=false
5055 set dlopen d_dlopen
5056 eval $inlibc
5057 runnm="$xxx_runnm"
5058
5059 : determine which dynamic loading, if any, to compile in
5060 echo " "
5061 dldir="ext/DynaLoader"
5062 case "$usedl" in
5063 $define|y|true)
5064         dflt='y'
5065         usedl="$define"
5066         ;;
5067 $undef|n|false)
5068         dflt='n'
5069         usedl="$undef"
5070         ;;
5071 *) 
5072         dflt='n'
5073         case "$d_dlopen" in
5074             $define) dflt='y' ;;
5075         esac
5076         case "$i_dld" in
5077             $define) dflt='y' ;;
5078         esac
5079         : Does a dl_xxx.xs file exist for this operating system
5080         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5081         ;;
5082 esac
5083 rp="Do you wish to use dynamic loading?"
5084 . ./myread
5085 usedl="$ans"
5086 case "$ans" in
5087 y*) usedl="$define"
5088         case "$dlsrc" in
5089         '')
5090                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5091                         dflt="$dldir/dl_${osname}.xs"
5092                 elif $test "$d_dlopen" = "$define" ; then
5093                         dflt="$dldir/dl_dlopen.xs"
5094                 elif $test "$i_dld" = "$define" ; then
5095                         dflt="$dldir/dl_dld.xs"
5096                 else
5097                         dflt=''
5098                 fi
5099                 ;;
5100         *)      dflt="$dldir/$dlsrc"
5101                 ;;
5102         esac
5103     echo "The following dynamic loading files are available:"
5104         : Can not go over to $dldir because getfile has path hard-coded in.
5105         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5106         rp="Source file to use for dynamic loading"
5107         fn="fne"
5108         # XXX This getfile call will fail the existence check if you try 
5109         # building away from $src (this is not supported yet).
5110         . ./getfile
5111         usedl="$define"
5112         : emulate basename
5113         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5114
5115         $cat << EOM
5116
5117 Some systems may require passing special flags to $cc -c to
5118 compile modules that will be used to create a shared library.
5119 To use no flags, say "none".
5120
5121 EOM
5122     case "$cccdlflags" in
5123     '') case "$gccversion" in
5124                 '') case "$osname" in
5125                         hpux)   dflt='+z' ;;
5126                         next)   dflt='none' ;;
5127                         irix*)  dflt='-KPIC' ;;
5128                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5129                         sunos)  dflt='-pic' ;;
5130                         *)      dflt='none' ;;
5131                     esac
5132                         ;;
5133                 *)  case "$osname" in
5134                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5135                         *)      dflt='-fpic' ;;
5136                     esac ;;
5137             esac ;;
5138         ' ') dflt='none' ;;
5139     *)  dflt="$cccdlflags" ;;
5140     esac
5141     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5142     . ./myread
5143     case "$ans" in
5144     none) cccdlflags=' ' ;;
5145     *) cccdlflags="$ans" ;;
5146     esac
5147
5148     cat << EOM
5149
5150 Some systems use ld to create libraries that can be dynamically loaded,
5151 while other systems (such as those using ELF) use $cc.
5152
5153 EOM
5154         case "$ld" in
5155         '')     $cat >try.c <<'EOM'
5156 /* Test for whether ELF binaries are produced */
5157 #include <fcntl.h>
5158 #include <stdlib.h>
5159 int main() {
5160         char b[4];
5161         int i = open("a.out",O_RDONLY);
5162         if(i == -1) 
5163                 exit(1); /* fail */
5164         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5165                 exit(0); /* succeed (yes, it's ELF) */
5166         else
5167                 exit(1); /* fail */
5168 }
5169 EOM
5170                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5171                         cat <<EOM
5172 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5173 EOM
5174                         dflt="$cc"
5175                 else
5176                         echo "I'll use ld to build dynamic libraries."
5177                         dflt='ld'
5178                 fi
5179                 rm -f try.c a.out
5180                 ;;
5181         *)      dflt="$ld"
5182                 ;;
5183         esac
5184
5185     rp="What command should be used to create dynamic libraries?"
5186     . ./myread
5187         ld="$ans"
5188
5189     cat << EOM
5190
5191 Some systems may require passing special flags to $ld to create a
5192 library that can be dynamically loaded.  If your ld flags include
5193 -L/other/path options to locate libraries outside your loader's normal
5194 search path, you may need to specify those -L options here as well.  To
5195 use no flags, say "none".
5196
5197 EOM
5198     case "$lddlflags" in
5199     '') case "$osname" in
5200                         beos) dflt='-nostart' ;;
5201                         hpux)  dflt='-b' ;;
5202                         linux|irix*)    dflt='-shared' ;;
5203                         next)  dflt='none' ;;
5204                         solaris) dflt='-G' ;;
5205                         sunos) dflt='-assert nodefinitions' ;;
5206                         svr4*|esix*) dflt="-G $ldflags" ;;
5207                 *)     dflt='none' ;;
5208                         esac
5209                         ;;
5210     *) dflt="$lddlflags" ;;
5211     esac
5212
5213         : Try to guess additional flags to pick up local libraries.
5214         : Be careful not to append to a plain 'none'
5215         case "$dflt" in
5216         none) dflt='' ;;
5217         esac
5218         for thisflag in $ldflags; do
5219                 case "$thisflag" in
5220                 -L*)
5221                         case " $dflt " in
5222                         *" $thisflag "*) ;;
5223                         *) dflt="$dflt $thisflag" ;;
5224                         esac
5225                         ;;
5226                 esac
5227         done
5228
5229         case "$dflt" in
5230         ''|' ') dflt='none' ;;
5231         esac
5232
5233     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5234     . ./myread
5235     case "$ans" in
5236     none) lddlflags=' ' ;;
5237     *) lddlflags="$ans" ;;
5238     esac
5239
5240         cat <<EOM
5241
5242 Some systems may require passing special flags to $cc to indicate that
5243 the resulting executable will use dynamic linking.  To use no flags,
5244 say "none".
5245
5246 EOM
5247     case "$ccdlflags" in
5248     '') case "$osname" in
5249                 hpux)   dflt='-Wl,-E' ;;
5250                 linux)  dflt='-rdynamic' ;;
5251                 next)   dflt='none' ;;
5252                 sunos)  dflt='none' ;;
5253                 *)      dflt='none' ;;
5254             esac ;;
5255     ' ')  dflt='none' ;;
5256     *)  dflt="$ccdlflags" ;;
5257     esac
5258     rp="Any special flags to pass to $cc to use dynamic loading?"
5259     . ./myread
5260     case "$ans" in
5261     none) ccdlflags=' ' ;;
5262     *) ccdlflags="$ans" ;;
5263     esac
5264     ;;
5265 *)  usedl="$undef"
5266         ld='ld'
5267     dlsrc='dl_none.xs'
5268     lddlflags=''
5269     ccdlflags=''
5270     ;;
5271 esac
5272
5273 also=''
5274 case "$usedl" in
5275 $undef)
5276         # No dynamic loading being used, so don't bother even to prompt.
5277         useshrplib='false'
5278         ;;
5279 *)      case "$useshrplib" in
5280         '')     case "$osname" in
5281                 svr4*|dgux|dynixptx|esix|powerux|beos)
5282                         dflt=y
5283                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5284                         ;;
5285                 next*)
5286                         case "$osvers" in
5287                         4*)     dflt=y
5288                                 also='Building a shared libperl is needed for MAB support.'
5289                                 ;;
5290                         *)      dflt=n
5291                                 ;;
5292                         esac
5293                         ;;
5294                 *)      dflt=n
5295                         ;;
5296                 esac
5297                 ;;
5298         $define|true|[Yy]*)
5299                 dflt=y
5300                 ;;
5301         *)      dflt=n
5302                 ;;
5303         esac
5304         $cat << EOM
5305
5306 The perl executable is normally obtained by linking perlmain.c with
5307 libperl${_a}, any static extensions (usually just DynaLoader), and
5308 any other libraries needed on this system (such as -lm, etc.).  Since
5309 your system supports dynamic loading, it is probably possible to build
5310 a shared libperl.$so.  If you will have more than one executable linked
5311 to libperl.$so, this will significantly reduce the size of each
5312 executable, but it may have a noticeable affect on performance.  The
5313 default is probably sensible for your system.
5314 $also
5315
5316 EOM
5317         rp="Build a shared libperl.$so (y/n)"
5318         . ./myread
5319         case "$ans" in
5320         true|$define|[Yy]*)
5321                 useshrplib='true'
5322                 # Why does next4 have to be so different?
5323                 case "${osname}${osvers}" in
5324                 next4*|rhapsody*)
5325                         xxx='DYLD_LIBRARY_PATH' ;;
5326                 os2*)   xxx='' ;; # Nothing special needed.
5327                 beos*)  xxx='' ;;
5328                 *)              xxx='LD_LIBRARY_PATH' ;;
5329                 esac
5330                 ;;
5331         *)      useshrplib='false' ;;
5332         esac
5333         ;;
5334 esac
5335
5336 case "$useshrplib" in
5337 true)
5338         case "$libperl" in
5339         '')
5340                 # Figure out a good name for libperl.so.  Since it gets stored in
5341                 # a version-specific architecture-dependent library, the version
5342                 # number isn't really that important, except for making cc/ld happy.
5343                 #
5344                 # A name such as libperl.so.3.1
5345                 majmin="libperl.$so.$patchlevel.$subversion"
5346                 # A name such as libperl.so.301
5347                 majonly=`echo $patchlevel $subversion |
5348                         $awk '{printf "%d%02d", $1, $2}'`
5349                 majonly=libperl.$so.$majonly
5350                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5351                 # rely on figuring it out from the naming of libc.
5352                 case "${osname}${osvers}" in
5353                 next4*)
5354                         dflt=libperl.5.$so
5355                         # XXX How handle the --version stuff for MAB?
5356                         ;;
5357                 linux*)  # ld won't link with a bare -lperl otherwise.
5358                         dflt=libperl.$so
5359                         ;;
5360                 *)      # Try to guess based on whether libc has major.minor.
5361                         case "$libc" in
5362                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5363                         *libc.$so.[0-9]*) dflt=$majonly ;;
5364                         *)      dflt=libperl.$so ;;
5365                         esac
5366                         ;;
5367                 esac
5368                 ;;
5369         *)      dflt=$libperl
5370                 ;;
5371         esac
5372         cat << EOM
5373
5374 I need to select a good name for the shared libperl.  If your system uses
5375 library names with major and minor numbers, then you might want something
5376 like $majmin.  Alternatively, if your system uses a single version
5377 number for shared libraries, then you might want to use $majonly.
5378 Or, your system might be quite happy with a simple libperl.$so.
5379
5380 Since the shared libperl will get installed into a version-specific
5381 architecture-dependent directory, the version number of the shared perl
5382 library probably isn't important, so the default should be o.k.
5383
5384 EOM
5385         rp='What name do you want to give to the shared libperl?'
5386         . ./myread
5387         libperl=$ans
5388         echo "Ok, I'll use $libperl"
5389         ;;
5390 *)
5391         libperl="libperl${_a}"
5392         ;;
5393 esac
5394
5395 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5396 case "$shrpdir" in
5397 '') ;;
5398 *)      $cat >&4 <<EOM
5399 WARNING:  Use of the shrpdir variable for the installation location of
5400 the shared $libperl is not supported.  It was never documented and
5401 will not work in this version.  Let me (perlbug@perl.com)
5402 know of any problems this may cause.
5403
5404 EOM
5405         case "$shrpdir" in
5406         "$archlibexp/CORE")
5407                 $cat >&4 <<EOM
5408 But your current setting of $shrpdir is
5409 the default anyway, so it's harmless.
5410 EOM
5411                 ;;
5412         *)
5413                 $cat >&4 <<EOM
5414 Further, your current attempted setting of $shrpdir
5415 conflicts with the value of $archlibexp/CORE
5416 that installperl will use.
5417 EOM
5418                 ;;
5419         esac
5420         ;;
5421 esac
5422
5423 # How will the perl executable find the installed shared $libperl?
5424 # Add $xxx to ccdlflags.
5425 # If we can't figure out a command-line option, use $shrpenv to
5426 # set env LD_RUN_PATH.  The main perl makefile uses this.
5427 shrpdir=$archlibexp/CORE
5428 xxx=''
5429 tmp_shrpenv=''
5430 if "$useshrplib"; then
5431     case "$osname" in 
5432         aix)
5433                 # We'll set it in Makefile.SH...
5434                 ;;
5435         solaris|netbsd)
5436                 xxx="-R $shrpdir"
5437                 ;;
5438         freebsd)
5439                 xxx="-Wl,-R$shrpdir"
5440                 ;;
5441         linux|irix*|dec_osf)
5442                 xxx="-Wl,-rpath,$shrpdir"
5443                 ;;
5444         next)
5445                 # next doesn't like the default...
5446                 ;;
5447         beos)
5448                 # beos doesn't like the default, either.
5449                 ;;
5450         *)
5451                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5452                 ;;
5453         esac
5454         case "$xxx" in
5455         '') ;;
5456         *)      
5457                 # Only add $xxx if it isn't already in ccdlflags.
5458                 case " $ccdlflags " in
5459                 *" $xxx "*)     ;;
5460                 *)      ccdlflags="$ccdlflags $xxx"
5461                         cat <<EOM >&4
5462
5463 Adding $xxx to the flags
5464 passed to $ld so that the perl executable will find the 
5465 installed shared $libperl.
5466
5467 EOM
5468                         ;;
5469                 esac
5470                 ;;
5471         esac
5472 fi
5473 # Respect a hint or command-line value.
5474 case "$shrpenv" in
5475 '') shrpenv="$tmp_shrpenv" ;;
5476 esac
5477
5478 : determine where manual pages go
5479 set man1dir man1dir none
5480 eval $prefixit
5481 $cat <<EOM
5482
5483 $spackage has manual pages available in source form.
5484 EOM
5485 case "$nroff" in
5486 nroff)
5487         echo "However, you don't have nroff, so they're probably useless to you."
5488         case "$man1dir" in
5489         '') man1dir="none";;
5490         esac;;
5491 esac
5492 echo "If you don't want the manual sources installed, answer 'none'."
5493 case "$man1dir" in
5494 ' ') dflt=none
5495         ;;
5496 '')
5497         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5498         lookpath="$lookpath $prefixexp/man/p_man/man1"
5499         lookpath="$lookpath $prefixexp/man/u_man/man1"
5500         lookpath="$lookpath $prefixexp/man/man.1"
5501         case "$sysman" in
5502         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5503         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5504         esac
5505         set dflt
5506         eval $prefixup
5507         ;;
5508 *)  dflt="$man1dir"
5509         ;;
5510 esac
5511 echo " "
5512 fn=dn+~
5513 rp="Where do the main $spackage manual pages (source) go?"
5514 . ./getfile
5515 if $test "X$man1direxp" != "X$ansexp"; then
5516         installman1dir=''
5517 fi
5518 man1dir="$ans"
5519 man1direxp="$ansexp"
5520 case "$man1dir" in
5521 '') man1dir=' '
5522         installman1dir='';;
5523 esac
5524 if $afs; then
5525         $cat <<EOM
5526
5527 Since you are running AFS, I need to distinguish the directory in which
5528 manual pages reside from the directory in which they are installed (and from
5529 which they are presumably copied to the former directory by occult means).
5530
5531 EOM
5532         case "$installman1dir" in
5533         '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
5534         *) dflt="$installman1dir";;
5535         esac
5536         fn=de~
5537         rp='Where will man pages be installed?'
5538         . ./getfile
5539         installman1dir="$ans"
5540 else
5541         installman1dir="$man1direxp"
5542 fi
5543
5544 : What suffix to use on installed man pages
5545
5546 case "$man1dir" in
5547 ' ')
5548         man1ext='0'
5549         ;;
5550 *)
5551         rp="What suffix should be used for the main $spackage man pages?"
5552         case "$man1ext" in
5553         '')     case "$man1dir" in
5554                 *1)  dflt=1 ;;
5555                 *1p) dflt=1p ;;
5556                 *1pm) dflt=1pm ;;
5557                 *l) dflt=l;;
5558                 *n) dflt=n;;
5559                 *o) dflt=o;;
5560                 *p) dflt=p;;
5561                 *C) dflt=C;;
5562                 *L) dflt=L;;
5563                 *L1) dflt=L1;;
5564                 *) dflt=1;;
5565                 esac
5566                 ;;
5567         *)      dflt="$man1ext";;
5568         esac
5569         . ./myread
5570         man1ext="$ans"
5571         ;;
5572 esac
5573
5574 : see if we can have long filenames
5575 echo " "
5576 rmlist="$rmlist /tmp/cf$$"
5577 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5578 first=123456789abcdef
5579 second=/tmp/cf$$/$first
5580 $rm -f $first $second
5581 if (echo hi >$first) 2>/dev/null; then
5582         if $test -f 123456789abcde; then
5583                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5584                 val="$undef"
5585         else
5586                 if (echo hi >$second) 2>/dev/null; then
5587                         if $test -f /tmp/cf$$/123456789abcde; then
5588                                 $cat <<'EOM'
5589 That's peculiar... You can have filenames longer than 14 characters, but only
5590 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5591 I shall consider your system cannot support long filenames at all.
5592 EOM
5593                                 val="$undef"
5594                         else
5595                                 echo 'You can have filenames longer than 14 characters.' >&4
5596                                 val="$define"
5597                         fi
5598                 else
5599                         $cat <<'EOM'
5600 How confusing! Some of your filesystems are sane enough to allow filenames
5601 longer than 14 characters but some others like /tmp can't even think about them.
5602 So, for now on, I shall assume your kernel does not allow them at all.
5603 EOM
5604                         val="$undef"
5605                 fi
5606         fi
5607 else
5608         $cat <<'EOM'
5609 You can't have filenames longer than 14 chars.  You can't even think about them!
5610 EOM
5611         val="$undef"
5612 fi 
5613 set d_flexfnam
5614 eval $setvar
5615 $rm -rf /tmp/cf$$ 123456789abcde*
5616
5617 : determine where library module manual pages go
5618 set man3dir man3dir none
5619 eval $prefixit
5620 $cat <<EOM
5621
5622 $spackage has manual pages for many of the library modules.
5623 EOM
5624
5625 case "$nroff" in
5626 nroff)
5627         $cat <<'EOM'
5628 However, you don't have nroff, so they're probably useless to you.
5629 EOM
5630         case "$man3dir" in
5631         '') man3dir="none";;
5632         esac;;
5633 esac
5634
5635 case "$d_flexfnam" in
5636 undef)
5637         $cat <<'EOM'
5638 However, your system can't handle the long file names like File::Basename.3. 
5639 EOM
5640         case "$man3dir" in
5641         '') man3dir="none";;
5642         esac;;
5643 esac
5644
5645 echo "If you don't want the manual sources installed, answer 'none'."
5646 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5647 case "$man3dir" in
5648 '')     case "$prefix" in 
5649         *$prog*) dflt=`echo $man1dir | 
5650                         $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
5651         *)      dflt="$privlib/man/man3" ;;
5652         esac
5653         ;;
5654 ' ') dflt=none;;
5655 *)      dflt="$man3dir" ;;
5656 esac
5657 echo " "
5658
5659 fn=dn+~
5660 rp="Where do the $package library man pages (source) go?"
5661 . ./getfile
5662 if test "X$man3direxp" != "X$ansexp"; then
5663         installman3dir=''
5664 fi
5665
5666 man3dir="$ans"
5667 man3direxp="$ansexp"
5668 case "$man3dir" in
5669 '') man3dir=' '
5670         installman3dir='';;
5671 esac
5672 if $afs; then
5673         $cat <<EOM
5674
5675 Since you are running AFS, I need to distinguish the directory in which
5676 manual pages reside from the directory in which they are installed (and from
5677 which they are presumably copied to the former directory by occult means).
5678
5679 EOM
5680         case "$installman3dir" in
5681         '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
5682         *) dflt="$installman3dir";;
5683         esac
5684         fn=de~
5685         rp='Where will man pages be installed?'
5686         . ./getfile
5687         installman3dir="$ans"
5688 else
5689         installman3dir="$man3direxp"
5690 fi
5691
5692 : What suffix to use on installed man pages
5693
5694 case "$man3dir" in
5695 ' ')
5696         man3ext='0'
5697         ;;
5698 *)
5699         rp="What suffix should be used for the $package library man pages?"
5700         case "$man3ext" in
5701         '')     case "$man3dir" in
5702                 *3)  dflt=3 ;;
5703                 *3p) dflt=3p ;;
5704                 *3pm) dflt=3pm ;;
5705                 *l) dflt=l;;
5706                 *n) dflt=n;;
5707                 *o) dflt=o;;
5708                 *p) dflt=p;;
5709                 *C) dflt=C;;
5710                 *L) dflt=L;;
5711                 *L3) dflt=L3;;
5712                 *) dflt=3;;
5713                 esac
5714                 ;;
5715         *)      dflt="$man3ext";;
5716         esac
5717         . ./myread
5718         man3ext="$ans"
5719         ;;
5720 esac
5721
5722 : see if we have to deal with yellow pages, now NIS.
5723 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5724         if $test -f /usr/etc/nibindd; then
5725                 echo " "
5726                 echo "I'm fairly confident you're on a NeXT."
5727                 echo " "
5728                 rp='Do you get the hosts file via NetInfo?'
5729                 dflt=y
5730                 case "$hostcat" in
5731                 nidump*) ;;
5732                 '') ;;
5733                 *) dflt=n;;
5734                 esac
5735                 . ./myread
5736                 case "$ans" in
5737                 y*) hostcat='nidump hosts .';;
5738                 *)      case "$hostcat" in
5739                         nidump*) hostcat='';;
5740                         esac
5741                         ;;
5742                 esac
5743         fi
5744         case "$hostcat" in
5745         nidump*) ;;
5746         *)
5747                 case "$hostcat" in
5748                 *ypcat*) dflt=y;;
5749                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5750                                 dflt=y
5751                         else
5752                                 dflt=n
5753                         fi;;
5754                 *) dflt=n;;
5755                 esac
5756                 echo " "
5757                 rp='Are you getting the hosts file via yellow pages?'
5758                 . ./myread
5759                 case "$ans" in
5760                 y*) hostcat='ypcat hosts';;
5761                 *) hostcat='cat /etc/hosts';;
5762                 esac
5763                 ;;
5764         esac
5765 fi
5766 case "$hostcat" in
5767 '') hostcat='cat /etc/hosts';;
5768 esac
5769 case "$groupcat" in
5770 '') groupcat='cat /etc/group';;
5771 esac
5772 case "$passcat" in
5773 '') passcat='cat /etc/passwd';;
5774 esac
5775
5776 : now get the host name
5777 echo " "
5778 echo "Figuring out host name..." >&4
5779 case "$myhostname" in
5780 '') cont=true
5781         echo 'Maybe "hostname" will work...'
5782         if tans=`sh -c hostname 2>&1` ; then
5783                 myhostname=$tans
5784                 phostname=hostname
5785                 cont=''
5786         fi
5787         ;;
5788 *) cont='';;
5789 esac
5790 if $test "$cont"; then
5791         if ./xenix; then
5792                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
5793                 if tans=`cat /etc/systemid 2>&1` ; then
5794                         myhostname=$tans
5795                         phostname='cat /etc/systemid'
5796                         echo "Whadyaknow.  Xenix always was a bit strange..."
5797                         cont=''
5798                 fi
5799         elif $test -r /etc/systemid; then
5800                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5801         fi
5802 fi
5803 if $test "$cont"; then
5804         echo 'No, maybe "uuname -l" will work...'
5805         if tans=`sh -c 'uuname -l' 2>&1` ; then
5806                 myhostname=$tans
5807                 phostname='uuname -l'
5808         else
5809                 echo 'Strange.  Maybe "uname -n" will work...'
5810                 if tans=`sh -c 'uname -n' 2>&1` ; then
5811                         myhostname=$tans
5812                         phostname='uname -n'
5813                 else
5814                         echo 'Oh well, maybe I can mine it out of whoami.h...'
5815                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
5816                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
5817                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
5818                         else
5819                                 case "$myhostname" in
5820                                 '') echo "Does this machine have an identity crisis or something?"
5821                                         phostname='';;
5822                                 *)
5823                                         echo "Well, you said $myhostname before..."
5824                                         phostname='echo $myhostname';;
5825                                 esac
5826                         fi
5827                 fi
5828         fi
5829 fi
5830 : you do not want to know about this
5831 set $myhostname
5832 myhostname=$1
5833
5834 : verify guess
5835 if $test "$myhostname" ; then
5836         dflt=y
5837         rp='Your host name appears to be "'$myhostname'".'" Right?"
5838         . ./myread
5839         case "$ans" in
5840         y*) ;;
5841         *) myhostname='';;
5842         esac
5843 fi
5844
5845 : bad guess or no guess
5846 while $test "X$myhostname" = X ; do
5847         dflt=''
5848         rp="Please type the (one word) name of your host:"
5849         . ./myread
5850         myhostname="$ans"
5851 done
5852
5853 : translate upper to lower if necessary
5854 case "$myhostname" in
5855 *[A-Z]*)
5856         echo "(Normalizing case in your host name)"
5857         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
5858         ;;
5859 esac
5860
5861 case "$myhostname" in
5862 *.*)
5863         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
5864         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
5865         echo "(Trimming domain name from host name--host name is now $myhostname)"
5866         ;;
5867 *) case "$mydomain" in
5868         '')
5869                 {
5870                         test "X$hostcat" = "Xypcat hosts" &&
5871                         ypmatch "$myhostname" hosts 2>/dev/null |\
5872                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
5873                         $test -s hosts
5874                 } || {
5875                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
5876                                         /[       ]$myhostname[  . ]/p" > hosts
5877                 }
5878                 tmp_re="[       . ]"
5879                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
5880                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
5881                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
5882                         hosts | $sort | $uniq | \
5883                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
5884                 case `$echo X$dflt` in
5885                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
5886                         dflt=.
5887                         ;;
5888                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
5889                         ;;
5890                 esac
5891                 case "$dflt" in
5892                 .)
5893                         tans=`./loc resolv.conf X /etc /usr/etc`
5894                         if $test -f "$tans"; then
5895                                 echo "(Attempting domain name extraction from $tans)"
5896                                 dflt=.`$sed -n -e 's/   / /g' \
5897                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
5898                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
5899                                 case "$dflt" in
5900                                 .) dflt=.`$sed -n -e 's/        / /g' \
5901                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
5902                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
5903                                         ;;
5904                                 esac
5905                         fi
5906                         ;;
5907                 esac
5908                 case "$dflt" in
5909                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
5910                         dflt=.`sh -c domainname 2>/dev/null`
5911                         case "$dflt" in
5912                         '') dflt='.';;
5913                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
5914                         esac
5915                         ;;
5916                 esac
5917                 case "$dflt" in
5918                 .) echo "(Lost all hope -- silly guess then)"
5919                         dflt='.uucp'
5920                         ;;
5921                 esac
5922                 $rm -f hosts
5923                 ;;
5924         *) dflt="$mydomain";;
5925         esac;;
5926 esac
5927 echo " "
5928 rp="What is your domain name?"
5929 . ./myread
5930 tans="$ans"
5931 case "$ans" in
5932 '') ;;
5933 .*) ;;
5934 *) tans=".$tans";;
5935 esac
5936 mydomain="$tans"
5937
5938 : translate upper to lower if necessary
5939 case "$mydomain" in
5940 *[A-Z]*)
5941         echo "(Normalizing case in your domain name)"
5942         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
5943         ;;
5944 esac
5945
5946 : a little sanity check here
5947 case "$phostname" in
5948 '') ;;
5949 *)
5950         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
5951         $myhostname$mydomain|$myhostname) ;;
5952         *)
5953                 case "$phostname" in
5954                 sed*)
5955                         echo "(That doesn't agree with your whoami.h file, by the way.)"
5956                         ;;
5957                 *)
5958                         echo "(That doesn't agree with your $phostname command, by the way.)"
5959                         ;;
5960                 esac
5961         ;;
5962         esac
5963         ;;
5964 esac
5965
5966 $cat <<EOM
5967
5968 I need to get your e-mail address in Internet format if possible, i.e.
5969 something like user@host.domain. Please answer accurately since I have
5970 no easy means to double check it. The default value provided below
5971 is most probably close to the reality but may not be valid from outside
5972 your organization...
5973
5974 EOM
5975 cont=x
5976 while test "$cont"; do
5977         case "$cf_email" in
5978         '') dflt="$cf_by@$myhostname$mydomain";;
5979         *) dflt="$cf_email";;
5980         esac
5981         rp='What is your e-mail address?'
5982         . ./myread
5983         cf_email="$ans"
5984         case "$cf_email" in
5985         *@*.*) cont='' ;;
5986         *)
5987                 rp='Address does not look like an Internet one.  Use it anyway?'
5988                 case "$fastread" in
5989                 yes) dflt=y ;;
5990                 *) dflt=n ;;
5991                 esac
5992                 . ./myread
5993                 case "$ans" in
5994                 y*) cont='' ;;
5995                 *) echo " " ;;
5996                 esac
5997                 ;;
5998         esac
5999 done
6000
6001 $cat <<EOM
6002
6003 If you or somebody else will be maintaining perl at your site, please
6004 fill in the correct e-mail address here so that they may be contacted
6005 if necessary. Currently, the "perlbug" program included with perl
6006 will send mail to this address in addition to perlbug@perl.com. You may
6007 enter "none" for no administrator.
6008
6009 EOM
6010 case "$perladmin" in
6011 '') dflt="$cf_email";;
6012 *) dflt="$perladmin";;
6013 esac
6014 rp='Perl administrator e-mail address'
6015 . ./myread
6016 perladmin="$ans"
6017
6018 : figure out how to guarantee perl startup
6019 case "$startperl" in
6020 '')
6021         case "$sharpbang" in
6022         *!)
6023                 $cat <<EOH
6024
6025 I can use the #! construct to start perl on your system. This will
6026 make startup of perl scripts faster, but may cause problems if you
6027 want to share those scripts and perl is not in a standard place
6028 ($binexp/perl) on all your platforms. The alternative is to force
6029 a shell by starting the script with a single ':' character.
6030
6031 EOH
6032                 dflt="$binexp/perl"
6033                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6034                 . ./myread
6035                 case "$ans" in
6036                 none)   startperl=": # use perl";;
6037                 *)      startperl="#!$ans"
6038                         if $test 30 -lt `echo "$ans" | wc -c`; then
6039                                 $cat >&4 <<EOM
6040
6041 WARNING:  Some systems limit the #! command to 32 characters.
6042 If you experience difficulty running Perl scripts with #!, try
6043 installing Perl in a directory with a shorter pathname.
6044
6045 EOM
6046                         fi ;;
6047                 esac
6048                 ;;
6049         *) startperl=": # use perl"
6050                 ;;
6051         esac
6052         ;;
6053 esac
6054 echo "I'll use $startperl to start perl scripts."
6055
6056 : figure best path for perl in scripts
6057 case "$perlpath" in
6058 '')
6059         perlpath="$binexp/perl"
6060         case "$startperl" in
6061         *!*) ;;
6062         *)
6063                 $cat <<EOH
6064
6065 I will use the "eval 'exec'" idiom to start Perl on your system.
6066 I can use the full path of your Perl binary for this purpose, but
6067 doing so may cause problems if you want to share those scripts and
6068 Perl is not always in a standard place ($binexp/perl).
6069
6070 EOH
6071                 dflt="$binexp/perl"
6072                 rp="What path shall I use in \"eval 'exec'\"?"
6073                 . ./myread
6074                 perlpath="$ans"
6075                 ;;
6076         esac
6077         ;;
6078 esac
6079 case "$startperl" in
6080 *!*)    ;;
6081 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6082 esac
6083
6084 : determine where public executable scripts go
6085 set scriptdir scriptdir
6086 eval $prefixit
6087 case "$scriptdir" in
6088 '')
6089         dflt="$bin"
6090         : guess some guesses
6091         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6092         $test -d /usr/share/bin && dflt=/usr/share/bin
6093         $test -d /usr/local/script && dflt=/usr/local/script
6094         $test -d $prefixexp/script && dflt=$prefixexp/script
6095         set dflt
6096         eval $prefixup
6097         ;;
6098 *)  dflt="$scriptdir"
6099         ;;
6100 esac
6101 $cat <<EOM
6102  
6103 Some installations have a separate directory just for executable scripts so
6104 that they can mount it across multiple architectures but keep the scripts in
6105 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6106 Or you might just lump your scripts in with all your other executables.
6107  
6108 EOM
6109 fn=d~
6110 rp='Where do you keep publicly executable scripts?'
6111 . ./getfile
6112 if $test "X$ansexp" != "X$scriptdirexp"; then
6113         installscript=''
6114 fi
6115 scriptdir="$ans"
6116 scriptdirexp="$ansexp"
6117 if $afs; then
6118         $cat <<EOM
6119
6120 Since you are running AFS, I need to distinguish the directory in which
6121 scripts reside from the directory in which they are installed (and from
6122 which they are presumably copied to the former directory by occult means).
6123
6124 EOM
6125         case "$installscript" in
6126         '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
6127         *) dflt="$installscript";;
6128         esac
6129         fn=de~
6130         rp='Where will public scripts be installed?'
6131         . ./getfile
6132         installscript="$ans"
6133 else
6134         installscript="$scriptdirexp"
6135 fi
6136
6137 : determine where site specific libraries go.
6138 : Usual default is /usr/local/lib/perl5/site_perl/$apiversion
6139 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6140 case "$prefix" in
6141 *perl*) set dflt sitelib lib/site_$prog/$apiversion ;;
6142 *)       set dflt sitelib lib/$package/site_$prog/$apiversion ;;
6143 esac
6144 eval $prefixit
6145 $cat <<EOM
6146
6147 The installation process will also create a directory for
6148 site-specific extensions and modules.  Some users find it convenient
6149 to place all site-specific files in this directory rather than in the
6150 main distribution directory.
6151
6152 EOM
6153 fn=d~+
6154 rp='Pathname for the site-specific library files?'
6155 . ./getfile
6156 if $test "X$sitelibexp" != "X$ansexp"; then
6157         installsitelib=''
6158 fi
6159 sitelib="$ans"
6160 sitelibexp="$ansexp"
6161 if $afs; then
6162         $cat <<EOM
6163
6164 Since you are running AFS, I need to distinguish the directory in
6165 which site-specific files reside from the directory in which they are
6166 installed (and from which they are presumably copied to the former
6167 directory by occult means).
6168
6169 EOM
6170         case "$installsitelib" in
6171         '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
6172         *) dflt="$installsitelib";;
6173         esac
6174         fn=de~
6175         rp='Where will site-specific files be installed?'
6176         . ./getfile
6177         installsitelib="$ans"
6178 else
6179         installsitelib="$sitelibexp"
6180 fi
6181
6182 : determine where site specific architecture-dependent libraries go.
6183 : sitelib  default is /usr/local/lib/perl5/site_perl/$apiversion
6184 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6185 : sitelib may have an optional trailing /share.
6186 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6187 tdflt="$tdflt/$archname"
6188 set sitearch sitearch none
6189 eval $prefixit
6190 case "$sitearch" in
6191 '')     dflt="$tdflt" ;;
6192 *)      dflt="$sitearch" ;;
6193 esac
6194 $cat <<EOM
6195
6196 The installation process will also create a directory for
6197 architecture-dependent site-specific extensions and modules.
6198
6199 EOM
6200 fn=nd~+
6201 rp='Pathname for the site-specific architecture-dependent library files?'
6202 . ./getfile
6203 if $test "X$sitearchexp" != "X$ansexp"; then
6204         installsitearch=''
6205 fi
6206 sitearch="$ans"
6207 sitearchexp="$ansexp"
6208 if $afs; then
6209         $cat <<EOM
6210
6211 Since you are running AFS, I need to distinguish the directory in
6212 which site-specific architecture-dependent library files reside from
6213 the directory in which they are installed (and from which they are
6214 presumably copied to the former directory by occult means).
6215
6216 EOM
6217         case "$installsitearch" in
6218         '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
6219         *) dflt="$installsitearch";;
6220         esac
6221         fn=de~
6222         rp='Where will site-specific architecture-dependent files be installed?'
6223         . ./getfile
6224         installsitearch="$ans"
6225 else
6226         installsitearch="$sitearchexp"
6227 fi
6228
6229 cat <<EOM
6230
6231 Previous version of $package used the standard IO mechanisms as defined
6232 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6233 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6234 the default.  This abstraction layer can use AT&T's sfio (if you already
6235 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6236 problems with some extension modules.  Using PerlIO with stdio is safe,
6237 but it is slower than plain stdio and therefore is not the default.
6238
6239 If this doesn't make any sense to you, just accept the default 'n'.
6240 EOM
6241 case "$useperlio" in
6242 $define|true|[yY]*)     dflt='y';;
6243 *) dflt='n';;
6244 esac
6245 rp='Use the experimental PerlIO abstraction layer?'
6246 . ./myread
6247 case "$ans" in
6248 y|Y) 
6249         val="$define"
6250         ;;     
6251 *)      
6252         echo "Ok, doing things the stdio way"
6253         val="$undef"
6254         ;;
6255 esac
6256 set useperlio
6257 eval $setvar 
6258
6259 : Check how to convert floats to strings.
6260 if test "X$d_Gconvert" = X; then
6261         echo " "
6262         echo "Checking for an efficient way to convert floats to strings."
6263         $cat >try.c <<'EOP'
6264 #ifdef TRY_gconvert
6265 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6266 char *myname = "gconvert";
6267 #endif
6268 #ifdef TRY_gcvt
6269 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6270 char *myname = "gcvt";
6271 #endif
6272 #ifdef TRY_sprintf
6273 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6274 char *myname = "sprintf";
6275 #endif
6276
6277 #include <stdio.h>
6278
6279 int
6280 checkit(expect, got)
6281 char *expect;
6282 char *got;
6283 {
6284     if (strcmp(expect, got)) {
6285                 printf("%s oddity:  Expected %s, got %s\n",
6286                         myname, expect, got);
6287                 exit(1);
6288         }
6289 }
6290
6291 int main()
6292
6293         char buf[64]; 
6294         buf[63] = '\0';
6295
6296         /* This must be 1st test on (which?) platform */
6297         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6298         Gconvert(0.1, 8, 0, buf);
6299         checkit("0.1", buf);
6300
6301         Gconvert(1.0, 8, 0, buf); 
6302         checkit("1", buf);
6303
6304         Gconvert(0.0, 8, 0, buf); 
6305         checkit("0", buf);
6306
6307         Gconvert(-1.0, 8, 0, buf); 
6308         checkit("-1", buf);
6309
6310         /* Some Linux gcvt's give 1.e+5 here. */
6311         Gconvert(100000.0, 8, 0, buf); 
6312         checkit("100000", buf);
6313         
6314         /* Some Linux gcvt's give -1.e+5 here. */
6315         Gconvert(-100000.0, 8, 0, buf); 
6316         checkit("-100000", buf);
6317
6318         exit(0);
6319 }
6320 EOP
6321         case "$d_Gconvert" in
6322         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6323         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6324         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6325         *) xxx_list='gconvert gcvt sprintf' ;;
6326         esac
6327
6328         for xxx_convert in $xxx_list; do
6329                 echo "Trying $xxx_convert"
6330                 $rm -f try try$_o
6331                 set try -DTRY_$xxx_convert
6332                 if eval $compile; then
6333                         echo "$xxx_convert" found. >&4
6334                         if ./try; then
6335                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6336                                 break;
6337                         else
6338                                 echo "...But $xxx_convert didn't work as I expected."
6339                         fi
6340                 else
6341                         echo "$xxx_convert NOT found." >&4
6342                 fi
6343         done
6344                 
6345         case "$xxx_convert" in
6346         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6347         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6348         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6349         esac
6350 fi
6351
6352 : Initialize h_fcntl
6353 h_fcntl=false
6354
6355 : Initialize h_sysfile
6356 h_sysfile=false
6357
6358 : access call always available on UNIX
6359 set access d_access
6360 eval $inlibc
6361
6362 : locate the flags for 'access()'
6363 case "$d_access" in
6364 "$define")
6365         echo " "
6366         $cat >access.c <<'EOCP'
6367 #include <sys/types.h>
6368 #ifdef I_FCNTL
6369 #include <fcntl.h>
6370 #endif
6371 #ifdef I_SYS_FILE
6372 #include <sys/file.h>
6373 #endif
6374 #ifdef I_UNISTD
6375 #include <unistd.h>
6376 #endif
6377 int main() {
6378         exit(R_OK);
6379 }
6380 EOCP
6381         : check sys/file.h first, no particular reason here
6382         if $test `./findhdr sys/file.h` && \
6383                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
6384                 h_sysfile=true;
6385                 echo "<sys/file.h> defines the *_OK access constants." >&4
6386         elif $test `./findhdr fcntl.h` && \
6387                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
6388                 h_fcntl=true;
6389                 echo "<fcntl.h> defines the *_OK access constants." >&4
6390         elif $test `./findhdr unistd.h` && \
6391                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
6392                 echo "<unistd.h> defines the *_OK access constants." >&4
6393         else
6394                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
6395         fi
6396         ;;
6397 esac
6398 $rm -f access*
6399
6400 : see if accessx exists
6401 set accessx d_accessx
6402 eval $inlibc
6403
6404 : see if alarm exists
6405 set alarm d_alarm
6406 eval $inlibc
6407
6408 : Look for GNU-cc style attribute checking
6409 echo " "
6410 echo "Checking whether your compiler can handle __attribute__ ..." >&4
6411 $cat >attrib.c <<'EOCP'
6412 #include <stdio.h>
6413 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
6414 EOCP
6415 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
6416         if $contains 'warning' attrib.out >/dev/null 2>&1; then
6417                 echo "Your C compiler doesn't fully support __attribute__."
6418                 val="$undef"
6419         else
6420                 echo "Your C compiler supports __attribute__."
6421                 val="$define"
6422         fi
6423 else
6424         echo "Your C compiler doesn't seem to understand __attribute__ at all."
6425         val="$undef"
6426 fi
6427 set d_attribut
6428 eval $setvar
6429 $rm -f attrib*
6430
6431 : see if bcmp exists
6432 set bcmp d_bcmp
6433 eval $inlibc
6434
6435 : see if bcopy exists
6436 set bcopy d_bcopy
6437 eval $inlibc
6438
6439 : see if this is a unistd.h system
6440 set unistd.h i_unistd
6441 eval $inhdr
6442
6443 : see if getpgrp exists
6444 set getpgrp d_getpgrp
6445 eval $inlibc
6446
6447 case "$d_getpgrp" in
6448 "$define")
6449         echo " "
6450         echo "Checking to see which flavor of getpgrp is in use..."
6451         $cat >set.c <<EOP
6452 #$i_unistd I_UNISTD
6453 #include <sys/types.h>
6454 #ifdef I_UNISTD
6455 #  include <unistd.h>
6456 #endif
6457 int main()
6458 {
6459         if (getuid() == 0) {
6460                 printf("(I see you are running Configure as super-user...)\n");
6461                 setuid(1);
6462         }
6463 #ifdef TRY_BSD_PGRP
6464         if (getpgrp(1) == 0)
6465                 exit(0);
6466 #else
6467         if (getpgrp() > 0)
6468                 exit(0);
6469 #endif
6470         exit(1);
6471 }
6472 EOP
6473         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6474                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
6475                 val="$define"
6476         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6477                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
6478                 val="$undef"
6479         else
6480                 echo "I can't seem to compile and run the test program."
6481                 if ./usg; then
6482                         xxx="a USG one, i.e. you use getpgrp()."
6483                 else
6484                         # SVR4 systems can appear rather BSD-ish.
6485                         case "$i_unistd" in
6486                         $undef)
6487                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
6488                                 val="$define"
6489                                 ;;
6490                         $define)
6491                                 xxx="probably a USG one, i.e. you use getpgrp()."
6492                                 val="$undef"
6493                                 ;;
6494                         esac
6495                 fi
6496                 echo "Assuming your getpgrp is $xxx" >&4
6497         fi
6498         ;;
6499 *) val="$undef";;
6500 esac
6501 set d_bsdgetpgrp
6502 eval $setvar
6503 $rm -f set set.c
6504
6505 : see if setpgrp exists
6506 set setpgrp d_setpgrp
6507 eval $inlibc
6508
6509 case "$d_setpgrp" in
6510 "$define")
6511         echo " "
6512         echo "Checking to see which flavor of setpgrp is in use..."
6513         $cat >set.c <<EOP
6514 #$i_unistd I_UNISTD
6515 #include <sys/types.h>
6516 #ifdef I_UNISTD
6517 #  include <unistd.h>
6518 #endif
6519 int main()
6520 {
6521         if (getuid() == 0) {
6522                 printf("(I see you are running Configure as super-user...)\n");
6523                 setuid(1);
6524         }
6525 #ifdef TRY_BSD_PGRP
6526         if (-1 == setpgrp(1, 1))
6527                 exit(0);
6528 #else
6529         if (setpgrp() != -1)
6530                 exit(0);
6531 #endif
6532         exit(1);
6533 }
6534 EOP
6535         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6536                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
6537                 val="$define"
6538         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6539                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
6540                 val="$undef"
6541         else
6542                 echo "(I can't seem to compile and run the test program.)"
6543                 if ./usg; then
6544                         xxx="a USG one, i.e. you use setpgrp()."
6545                 else
6546                         # SVR4 systems can appear rather BSD-ish.
6547                         case "$i_unistd" in
6548                         $undef)
6549                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
6550                                 val="$define"
6551                                 ;;
6552                         $define)
6553                                 xxx="probably a USG one, i.e. you use setpgrp()."
6554                                 val="$undef"
6555                                 ;;
6556                         esac
6557                 fi
6558                 echo "Assuming your setpgrp is $xxx" >&4
6559         fi
6560         ;;
6561 *) val="$undef";;
6562 esac
6563 set d_bsdsetpgrp
6564 eval $setvar
6565 $rm -f set set.c
6566 : see if bzero exists
6567 set bzero d_bzero
6568 eval $inlibc
6569
6570 : check for lengths of integral types
6571 echo " "
6572 case "$intsize" in
6573 '')
6574         echo "Checking to see how big your integers are..." >&4
6575         $cat >intsize.c <<'EOCP'
6576 #include <stdio.h>
6577 int main()
6578 {
6579         printf("intsize=%d;\n", sizeof(int));
6580         printf("longsize=%d;\n", sizeof(long));
6581         printf("shortsize=%d;\n", sizeof(short));
6582         exit(0);
6583 }
6584 EOCP
6585         set intsize
6586         if eval $compile_ok && ./intsize > /dev/null; then
6587                 eval `./intsize`
6588                 echo "Your integers are $intsize bytes long."
6589                 echo "Your long integers are $longsize bytes long."
6590                 echo "Your short integers are $shortsize bytes long."
6591         else
6592                 $cat >&4 <<EOM
6593 !
6594 Help! I can't compile and run the intsize test program: please enlighten me!
6595 (This is probably a misconfiguration in your system or libraries, and
6596 you really ought to fix it.  Still, I'll try anyway.)
6597 !
6598 EOM
6599                 dflt=4
6600                 rp="What is the size of an integer (in bytes)?"
6601                 . ./myread
6602                 intsize="$ans"
6603                 dflt=$intsize
6604                 rp="What is the size of a long integer (in bytes)?"
6605                 . ./myread
6606                 longsize="$ans"
6607                 dflt=2
6608                 rp="What is the size of a short integer (in bytes)?"
6609                 . ./myread
6610                 shortsize="$ans"
6611         fi
6612         ;;
6613 esac
6614 $rm -f intsize intsize.*
6615
6616 : see if signal is declared as pointer to function returning int or void
6617 echo " "
6618 xxx=`./findhdr signal.h`
6619 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
6620 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
6621         echo "You have int (*signal())() instead of void." >&4
6622         val="$undef"
6623 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
6624         echo "You have void (*signal())()." >&4
6625         val="$define"
6626 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
6627         echo "You have int (*signal())() instead of void." >&4
6628         val="$undef"
6629 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
6630         echo "You have void (*signal())()." >&4
6631         val="$define"
6632 else
6633         case "$d_voidsig" in
6634         '')
6635         echo "I can't determine whether signal handler returns void or int..." >&4
6636                 dflt=void
6637                 rp="What type does your signal handler return?"
6638                 . ./myread
6639                 case "$ans" in
6640                 v*) val="$define";;
6641                 *) val="$undef";;
6642                 esac;;
6643         "$define")
6644                 echo "As you already told me, signal handler returns void." >&4
6645                 val="$define"
6646                 ;;
6647         *)      echo "As you already told me, signal handler returns int." >&4
6648                 val="$undef"
6649                 ;;
6650         esac
6651 fi
6652 set d_voidsig
6653 eval $setvar
6654 case "$d_voidsig" in
6655 "$define") signal_t="void";;
6656 *) signal_t="int";;
6657 esac
6658 $rm -f $$.tmp
6659
6660 : check for ability to cast large floats to 32-bit ints.
6661 echo " "
6662 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
6663 if $test "$intsize" -ge 4; then
6664         xxx=int
6665 else
6666         xxx=long
6667 fi
6668 $cat >try.c <<EOCP
6669 #include <stdio.h>
6670 #include <sys/types.h>
6671 #include <signal.h>
6672 $signal_t blech(s) int s; { exit(3); }
6673 int main()
6674 {
6675         $xxx i32;
6676         double f, g;
6677         int result = 0;
6678         char str[16];
6679         signal(SIGFPE, blech);
6680
6681         /* Don't let compiler optimize the test away.  Store the number 
6682            in a writable string for gcc to pass to sscanf under HP/UX.
6683         */
6684         sprintf(str, "2147483647");
6685         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
6686         g = 10 * f;
6687         i32  = ($xxx) g;
6688
6689         /* x86 processors will probably give 0x8000 0000, which is a
6690        sign change.  We don't want that.  We want to mimic SPARC
6691            behavior here, which is to preserve the sign and give
6692            back 0x7fff ffff.
6693         */
6694         if (i32 != ($xxx) f)
6695                 result |= 1;
6696         exit(result);
6697 }
6698 EOCP
6699 set try
6700 if eval $compile_ok; then
6701         ./try
6702         yyy=$?
6703 else
6704         echo "(I can't seem to compile the test program--assuming it can't)"
6705         yyy=1
6706 fi
6707 case "$yyy" in
6708 0)      val="$define"
6709         echo "Yup, it can."
6710         ;;
6711 *)      val="$undef"
6712         echo "Nope, it can't."
6713         ;;
6714 esac
6715 set d_casti32
6716 eval $setvar
6717 $rm -f try try.*
6718
6719 : check for ability to cast negative floats to unsigned
6720 echo " "
6721 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
6722 $cat >try.c <<EOCP
6723 #include <stdio.h>
6724 #include <sys/types.h>
6725 #include <signal.h>
6726 $signal_t blech(s) int s; { exit(7); }
6727 $signal_t blech_in_list(s) int s; { exit(4); }
6728 unsigned long dummy_long(p) unsigned long p; { return p; }
6729 unsigned int dummy_int(p) unsigned int p; { return p; }
6730 unsigned short dummy_short(p) unsigned short p; { return p; }
6731 int main()
6732 {
6733         double f;
6734         unsigned long along;
6735         unsigned int aint;
6736         unsigned short ashort;
6737         int result = 0;
6738         char str[16];
6739         
6740         /* Frustrate gcc-2.7.2's optimizer which failed this test with
6741            a direct f = -123. assignment.  gcc-2.8.0 reportedly
6742            optimized the whole file away
6743         */
6744         /* Store the number in a writable string for gcc to pass to 
6745            sscanf under HP/UX.
6746         */
6747         sprintf(str, "-123");
6748         sscanf(str, "%lf", &f);  /* f = -123.; */
6749
6750         signal(SIGFPE, blech);
6751         along = (unsigned long)f;
6752         aint = (unsigned int)f;
6753         ashort = (unsigned short)f;
6754         if (along != (unsigned long)-123)
6755                 result |= 1;
6756         if (aint != (unsigned int)-123)
6757                 result |= 1;
6758         if (ashort != (unsigned short)-123)
6759                 result |= 1;
6760         sprintf(str, "1073741824.");
6761         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
6762         f = f + f;
6763         along = 0;
6764         along = (unsigned long)f;
6765         if (along != 0x80000000)
6766                 result |= 2;
6767         f -= 1.;
6768         along = 0;
6769         along = (unsigned long)f;
6770         if (along != 0x7fffffff)
6771                 result |= 1;
6772         f += 2.;
6773         along = 0;
6774         along = (unsigned long)f;
6775         if (along != 0x80000001)
6776                 result |= 2;
6777         if (result)
6778                 exit(result);
6779         signal(SIGFPE, blech_in_list);
6780         sprintf(str, "123.");
6781         sscanf(str, "%lf", &f);  /* f = 123.; */
6782         along = dummy_long((unsigned long)f);
6783         aint = dummy_int((unsigned int)f);
6784         ashort = dummy_short((unsigned short)f);
6785         if (along != (unsigned long)123)
6786                 result |= 4;
6787         if (aint != (unsigned int)123)
6788                 result |= 4;
6789         if (ashort != (unsigned short)123)
6790                 result |= 4;
6791         exit(result);
6792
6793 }
6794 EOCP
6795 set try
6796 if eval $compile_ok; then
6797         ./try
6798         castflags=$?
6799 else
6800         echo "(I can't seem to compile the test program--assuming it can't)"
6801         castflags=7
6802 fi
6803 case "$castflags" in
6804 0)      val="$define"
6805         echo "Yup, it can."
6806         ;;
6807 *)      val="$undef"
6808         echo "Nope, it can't."
6809         ;;
6810 esac
6811 set d_castneg
6812 eval $setvar
6813 $rm -f try.*
6814
6815 : see if vprintf exists
6816 echo " "
6817 if set vprintf val -f d_vprintf; eval $csym; $val; then
6818         echo 'vprintf() found.' >&4
6819         val="$define"
6820         $cat >vprintf.c <<'EOF'
6821 #include <varargs.h>
6822
6823 int main() { xxx("foo"); }
6824
6825 xxx(va_alist)
6826 va_dcl
6827 {
6828         va_list args;
6829         char buf[10];
6830
6831         va_start(args);
6832         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
6833 }
6834 EOF
6835         set vprintf
6836         if eval $compile && ./vprintf; then
6837                 echo "Your vsprintf() returns (int)." >&4
6838                 val2="$undef"
6839         else
6840                 echo "Your vsprintf() returns (char*)." >&4
6841                 val2="$define"
6842         fi
6843 else
6844         echo 'vprintf() NOT found.' >&4
6845                 val="$undef"
6846                 val2="$undef"
6847 fi
6848 set d_vprintf
6849 eval $setvar
6850 val=$val2
6851 set d_charvspr
6852 eval $setvar
6853
6854 : see if chown exists
6855 set chown d_chown
6856 eval $inlibc
6857
6858 : see if chroot exists
6859 set chroot d_chroot
6860 eval $inlibc
6861
6862 : see if chsize exists
6863 set chsize d_chsize
6864 eval $inlibc
6865
6866 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
6867 while $test $# -ge 2; do
6868         case "$1" in
6869         $define) echo "#include <$2>";;
6870         esac ;
6871     shift 2;
6872 done > try.c;
6873 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
6874 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6875         val="$define";
6876 else
6877         val="$undef";
6878 fi;
6879 set $varname;
6880 eval $setvar;
6881 $rm -f try.c try.o'
6882
6883 : see if this is a sys/uio.h system
6884 set sys/uio.h i_sysuio
6885 eval $inhdr
6886
6887 echo "Checking to see if your system supports struct iovec..." >&4
6888 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
6889 eval $hasfield
6890 case "$d_iovec_s" in
6891 "$define")      echo "Yup, it does." >&4
6892                 ;;
6893 *)              echo "Nope, it doesn't." >&4
6894                 ;;
6895 esac
6896
6897 socketlib=''
6898 sockethdr=''
6899 : see whether socket exists
6900 echo " "
6901 $echo $n "Hmm... $c" >&4
6902 if set socket val -f d_socket; eval $csym; $val; then
6903         echo "Looks like you have Berkeley networking support." >&4
6904         d_socket="$define"
6905         if set setsockopt val -f; eval $csym; $val; then
6906                 d_oldsock="$undef"
6907         else
6908                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
6909                 d_oldsock="$define"
6910         fi
6911 else
6912         if $contains socklib libc.list >/dev/null 2>&1; then
6913                 echo "Looks like you have Berkeley networking support." >&4
6914                 d_socket="$define"
6915                 : we will have to assume that it supports the 4.2 BSD interface
6916                 d_oldsock="$undef"
6917         else
6918                 echo "You don't have Berkeley networking in libc$_a..." >&4
6919                 if test "X$d_socket" = "X$define"; then
6920                    echo "...but you seem to believe that you have sockets." >&4
6921                 else
6922                         for net in net socket
6923                         do
6924                                 if test -f /usr/lib/lib$net$_a; then
6925                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
6926                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
6927                                         if $contains socket libc.list >/dev/null 2>&1; then
6928                                                 d_socket="$define"
6929                                                 socketlib="-l$net"
6930                                                 case "$net" in
6931                                                 net)
6932                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
6933                                                         sockethdr="-I/usr/netinclude"
6934                                                         ;;
6935                                                 esac
6936                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
6937                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
6938                                                         d_oldsock="$undef"
6939                                                 else
6940                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
6941                                                         d_oldsock="$define"
6942                                                 fi
6943                                                 break
6944                                         fi
6945                                 fi
6946                         done
6947                         if test "X$d_socket" != "X$define"; then
6948                            echo "or anywhere else I see." >&4
6949                            d_socket="$undef"
6950                            d_oldsock="$undef"
6951                         fi
6952                 fi
6953         fi
6954 fi
6955
6956 : see if socketpair exists
6957 set socketpair d_sockpair
6958 eval $inlibc
6959
6960
6961 echo " "
6962 echo "Checking the availability of certain socket constants..." >& 4
6963 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
6964         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
6965         $cat >try.c <<EOF
6966 #include <sys/types.h>
6967 #include <sys/socket.h>
6968 int main() {
6969     int i = $ENUM;
6970 }
6971 EOF
6972         val="$undef"
6973         set try; if eval $compile; then
6974                 val="$define"
6975         fi
6976         set d_${enum}; eval $setvar
6977         $rm -f try.c try
6978 done
6979
6980 set sendmsg d_sendmsg
6981 eval $inlibc
6982
6983 set recvmsg d_recvmsg
6984 eval $inlibc
6985
6986 echo " "
6987 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
6988 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
6989 eval $hasfield
6990 case "$d_msghdr_s" in
6991 "$define")      echo "Yup, it does." >&4
6992                 ;;
6993 *)              echo "Nope, it doesn't." >&4
6994                 ;;
6995 esac
6996
6997 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
6998 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
6999 eval $hasfield
7000 case "$d_cmsghdr_s" in
7001 "$define")      echo "Yup, it does." >&4
7002                 ;;
7003 *)              echo "Nope, it doesn't." >&4
7004                 ;;
7005 esac
7006
7007 : check for const keyword
7008 echo " "
7009 echo 'Checking to see if your C compiler knows about "const"...' >&4
7010 $cat >const.c <<'EOCP'
7011 typedef struct spug { int drokk; } spug;
7012 int main()
7013 {
7014         const char *foo;
7015         const spug y;
7016 }
7017 EOCP
7018 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7019         val="$define"
7020         echo "Yup, it does."
7021 else
7022         val="$undef"
7023         echo "Nope, it doesn't."
7024 fi
7025 set d_const
7026 eval $setvar
7027
7028 : see if crypt exists
7029 echo " "
7030 if set crypt val -f d_crypt; eval $csym; $val; then
7031         echo 'crypt() found.' >&4
7032         val="$define"
7033         cryptlib=''
7034 else
7035         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7036         if $test -z "$cryptlib"; then
7037                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7038         else
7039                 cryptlib=-lcrypt
7040         fi
7041         if $test -z "$cryptlib"; then
7042                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7043         else
7044                 cryptlib=-lcrypt
7045         fi
7046         if $test -z "$cryptlib"; then
7047                 cryptlib=`./loc libcrypt$_a "" $libpth`
7048         else
7049                 cryptlib=-lcrypt
7050         fi
7051         if $test -z "$cryptlib"; then
7052                 echo 'crypt() NOT found.' >&4
7053                 val="$undef"
7054         else
7055                 val="$define"
7056         fi
7057 fi
7058 set d_crypt
7059 eval $setvar
7060
7061 : get csh whereabouts
7062 case "$csh" in
7063 'csh') val="$undef" ;;
7064 *) val="$define" ;;
7065 esac
7066 set d_csh
7067 eval $setvar
7068 : Respect a hint or command line value for full_csh.
7069 case "$full_csh" in
7070 '') full_csh=$csh ;;
7071 esac
7072
7073 : see if cuserid exists
7074 set cuserid d_cuserid
7075 eval $inlibc
7076
7077 : see if this is a limits.h system
7078 set limits.h i_limits
7079 eval $inhdr
7080
7081 : see if this is a float.h system
7082 set float.h i_float
7083 eval $inhdr
7084
7085 : See if number of significant digits in a double precision number is known
7086 echo " "
7087 $cat >dbl_dig.c <<EOM
7088 #$i_limits I_LIMITS
7089 #$i_float I_FLOAT
7090 #ifdef I_LIMITS
7091 #include <limits.h>
7092 #endif
7093 #ifdef I_FLOAT
7094 #include <float.h>
7095 #endif
7096 #ifdef DBL_DIG
7097 printf("Contains DBL_DIG");
7098 #endif
7099 EOM
7100 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7101 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7102         echo "DBL_DIG found." >&4
7103         val="$define"
7104 else
7105         echo "DBL_DIG NOT found." >&4
7106         val="$undef"
7107 fi
7108 $rm -f dbl_dig.?
7109 set d_dbl_dig
7110 eval $setvar
7111
7112
7113 if $test X"$use64bits" = X"$define"; then
7114         : see if dbminit64 exists
7115         set dbminit64 d_dbminit64
7116         eval $inlibc
7117
7118         : see if dbmclose64 exists
7119         set dbmclose64 d_dbmclose64
7120         eval $inlibc
7121
7122         : see if fetch64 exists
7123         set fetch64 d_fetch64
7124         eval $inlibc
7125
7126         : see if store64 exists
7127         set store64 d_store64
7128         eval $inlibc
7129
7130         : see if delete64 exists
7131         set delete64 d_delete64
7132         eval $inlibc
7133
7134         : see if firstkey64 exists
7135         set firstkey64 d_firstkey64
7136         eval $inlibc
7137
7138         : see if nextkey64 exists
7139         set nextkey64 d_nextkey64
7140         eval $inlibc
7141 else
7142         val="$undef"
7143         for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
7144         do
7145                 set $xxx
7146                 eval $setvar
7147         done
7148 fi
7149
7150 : see if difftime exists
7151 set difftime d_difftime
7152 eval $inlibc
7153
7154 : see if sys/stat.h is available
7155 set sys/stat.h i_sysstat
7156 eval $inhdr
7157
7158 : see if this is a dirent system
7159 echo " "
7160 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7161         val="$define"
7162         echo "<dirent.h> found." >&4
7163 else
7164         val="$undef"
7165         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7166                 echo "<sys/dir.h> found." >&4
7167                 echo " "
7168         else
7169                 xinc=`./findhdr sys/ndir.h`
7170         fi
7171         echo "<dirent.h> NOT found." >&4
7172 fi
7173 set i_dirent
7174 eval $setvar
7175
7176 : Look for type of directory structure.
7177 echo " "
7178 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7179
7180 case "$direntrytype" in
7181 ''|' ')
7182         case "$i_dirent" in
7183         $define) guess1='struct dirent' ;;
7184         *) guess1='struct direct'  ;;
7185         esac
7186         ;;
7187 *)      guess1="$direntrytype"
7188         ;;
7189 esac
7190
7191 case "$guess1" in
7192 'struct dirent') guess2='struct direct' ;;
7193 *) guess2='struct dirent' ;;
7194 esac
7195                 
7196 if $contains "$guess1" try.c >/dev/null 2>&1; then
7197         direntrytype="$guess1"
7198         echo "Your directory entries are $direntrytype." >&4
7199 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7200         direntrytype="$guess2"
7201         echo "Your directory entries seem to be $direntrytype." >&4
7202 else
7203         echo "I don't recognize your system's directory entries." >&4
7204         rp="What type is used for directory entries on this system?"
7205         dflt="$guess1"
7206         . ./myread
7207         direntrytype="$ans"
7208 fi
7209 $rm -f try.c
7210
7211
7212 : see if the directory entry stores field length
7213 echo " "
7214 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7215 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7216         echo "Good, your directory entry keeps length information in d_namlen." >&4
7217         val="$define"
7218 else
7219         echo "Your directory entry does not know about the d_namlen field." >&4
7220         val="$undef"
7221 fi
7222 set d_dirnamlen
7223 eval $setvar
7224 $rm -f try.c
7225
7226
7227 if $test X"$use64bits" = X"$define"; then
7228         : see if fstat64 exists
7229         set fstat64 d_fstat64
7230         eval $inlibc
7231
7232         : see if ftruncate64 exists
7233         set ftruncate64 d_ftruncate64
7234         eval $inlibc
7235
7236         : see if lockf64 exists
7237         set lockf64 d_lockf64
7238         eval $inlibc
7239
7240         : see if llseek exists
7241         set llseek d_llseek
7242         eval $inlibc
7243
7244         : see if lseek64 exists
7245         set lseek64 d_lseek64
7246         eval $inlibc
7247
7248         : see if lstat64 exists
7249         set lstat64 d_lstat64
7250         eval $inlibc
7251
7252         : see if open64 exists
7253         set open64 d_open64
7254         eval $inlibc
7255
7256         : see if opendir64 exists
7257         set opendir64 d_opendir64
7258         eval $inlibc
7259
7260         : see if readdir64 exists
7261         set readdir64 d_readdir64
7262         eval $inlibc
7263
7264         : see if seekdir64 exists
7265         set seekdir64 d_seekdir64
7266         eval $inlibc
7267
7268         : see if stat64 exists
7269         set stat64 d_stat64
7270         eval $inlibc
7271
7272         : see if telldir64 exists
7273         set telldir64 d_telldir64
7274         eval $inlibc
7275
7276         : see if truncate64 exists
7277         set truncate64 d_truncate64
7278         eval $inlibc
7279
7280         : check for off64_t
7281         echo " "
7282         echo $n "Checking to see if your system supports off64_t...$c" >&4
7283         $cat >try.c <<EOCP
7284 #include <sys/types.h>
7285 #include <unistd.h>
7286 off64_t foo() { off64_t x; x = 7; return x; }'
7287 EOCP
7288         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7289                 val="$define"
7290                 echo " Yup, it does." >&4
7291         else
7292                 val="$undef"
7293                 echo " Nope, it doesn't." >&4
7294         fi
7295         $rm -f try.*
7296         set d_off64_t
7297         eval $setvar
7298
7299         : check for offset_t
7300         echo " "
7301         echo $n "Checking to see if your system supports offset_t...$c" >&4
7302         $cat >try.c <<EOCP
7303 #include <sys/types.h>
7304 #include <unistd.h>
7305 offset_t foo() { offset_t x; x = 7; return x; }'
7306 EOCP
7307         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7308                 val="$define"
7309                 echo " Yup, it does." >&4
7310         else
7311                 val="$undef"
7312                 echo " Nope, it doesn't." >&4
7313         fi
7314         $rm -f try.*
7315         set d_offset_t
7316         eval $setvar
7317
7318         : check for ino64_t
7319         echo " "
7320         echo $n "Checking to see if your system supports ino64_t...$c" >&4
7321         val="$undef"
7322         case "$i_sysstat" in
7323         "$define" )
7324                 $cat >try.c <<EOCP
7325 #include <sys/types.h>
7326 #include <sys/stat.h>
7327 ino64_t foo() { ino64_t x; x = 7; return x; }'
7328 EOCP
7329                 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7330                         val="$define"
7331                 fi
7332                 $rm -f try.*
7333                 ;;
7334         esac
7335         if $test "X$val" = X"$define"; then
7336                 echo " Yup, it does." >&4
7337         else
7338                 echo " Nope, it doesn't." >&4
7339         fi
7340         set d_ino64_t
7341         eval $setvar
7342
7343         : check for struct flock64
7344         echo " "
7345         echo "Checking to see if your system supports struct flock64..." >&4
7346         if $h_fcntl; then
7347                 set d_flock64_s flock64 l_len define fcntl.h
7348                 eval $hasfield
7349         else
7350                 val="$undef"
7351                 set d_flock64_s
7352                 eval $setvar
7353         fi
7354         case "$d_flock64_s" in
7355         "$define")      echo "Yup, it does." >&4
7356                         ;;
7357         *)              echo "Nope, it doesn't." >&4
7358                         ;;
7359         esac
7360
7361         : check for struct dirent64
7362         echo " "
7363         echo "Checking to see if your system supports struct dirent64..." >&4
7364         set d_dirent64_s dirent64 d_off $i_dirent dirent.h
7365         eval $hasfield
7366         case "$d_dirent64_s" in
7367         "$define")      echo "Yup, it does." >&4
7368                         ;;
7369         *)              echo "Nope, it doesn't." >&4
7370                         ;;
7371         esac
7372
7373 else
7374         val="$undef"
7375         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_off64_t d_offset_t d_ino64_t d_flock64_s d_dirent64_s
7376         do
7377                 set $xxx
7378                 eval $setvar
7379         done
7380 fi
7381
7382 : see if dlerror exists
7383 xxx_runnm="$runnm"
7384 runnm=false
7385 set dlerror d_dlerror
7386 eval $inlibc
7387 runnm="$xxx_runnm"
7388
7389 : see if dlfcn is available
7390 set dlfcn.h i_dlfcn
7391 eval $inhdr
7392
7393 case "$usedl" in
7394 $define|y|true)
7395         $cat << EOM
7396
7397 On a few systems, the dynamically loaded modules that perl generates and uses
7398 will need a different extension than shared libs. The default will probably
7399 be appropriate.
7400
7401 EOM
7402         case "$dlext" in
7403         '')     dflt="$so" ;;
7404         *)      dflt="$dlext" ;;
7405         esac
7406         rp='What is the extension of dynamically loaded modules'
7407         . ./myread
7408         dlext="$ans"
7409         ;;
7410 *)
7411         dlext="none"
7412         ;;
7413 esac
7414
7415 : Check if dlsym need a leading underscore
7416 echo " "
7417 val="$undef"
7418
7419 case "$dlsrc" in
7420 dl_dlopen.xs)
7421         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7422         $cat >dyna.c <<'EOM'
7423 fred () { }
7424 EOM
7425
7426 $cat >fred.c<<EOM
7427
7428 #include <stdio.h>
7429 #$i_dlfcn I_DLFCN
7430 #ifdef I_DLFCN
7431 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7432 #else
7433 #include <sys/types.h>
7434 #include <nlist.h>
7435 #include <link.h>
7436 #endif
7437
7438 extern int fred() ;
7439
7440 int main()
7441 {
7442     void * handle ;
7443     void * symbol ;
7444 #ifndef RTLD_LAZY
7445     int mode = 1 ;
7446 #else
7447     int mode = RTLD_LAZY ;
7448 #endif
7449     handle = dlopen("./dyna.$dlext", mode) ;
7450     if (handle == NULL) {
7451         printf ("1\n") ;
7452         fflush (stdout) ;
7453         exit(0);
7454     }
7455     symbol = dlsym(handle, "fred") ;
7456     if (symbol == NULL) {
7457         /* try putting a leading underscore */
7458         symbol = dlsym(handle, "_fred") ;
7459         if (symbol == NULL) {
7460             printf ("2\n") ;
7461             fflush (stdout) ;
7462             exit(0);
7463         }
7464         printf ("3\n") ;
7465     }
7466     else
7467         printf ("4\n") ;
7468     fflush (stdout) ;
7469     exit(0);
7470 }
7471 EOM
7472         : Call the object file tmp-dyna.o in case dlext=o.
7473         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
7474                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
7475                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
7476                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
7477                 xxx=`./fred`
7478                 case $xxx in
7479                 1)      echo "Test program failed using dlopen." >&4
7480                         echo "Perhaps you should not use dynamic loading." >&4;;
7481                 2)      echo "Test program failed using dlsym." >&4
7482                         echo "Perhaps you should not use dynamic loading." >&4;;
7483                 3)      echo "dlsym needs a leading underscore" >&4
7484                         val="$define" ;;
7485                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
7486                 esac
7487         else
7488                 echo "I can't compile and run the test program." >&4
7489         fi
7490         ;;
7491 esac
7492                 
7493 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
7494
7495 set d_dlsymun
7496 eval $setvar
7497
7498 hasproto='varname=$1; func=$2; shift; shift;
7499 while $test $# -ge 2; do
7500         case "$1" in
7501         $define) echo "#include <$2>";;
7502         esac ;
7503     shift 2;
7504 done > try.c;
7505 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
7506 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
7507         echo "$func() prototype found.";
7508         val="$define";
7509 else
7510         echo "$func() prototype NOT found.";
7511         val="$undef";
7512 fi;
7513 set $varname;
7514 eval $setvar;
7515 $rm -f try.c tryout.c'
7516
7517 : see if prototype for drand48 is available
7518 echo " "
7519 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
7520 eval $hasproto
7521
7522 : see if dup2 exists
7523 set dup2 d_dup2
7524 eval $inlibc
7525
7526 : see if eaccess exists
7527 set eaccess d_eaccess
7528 eval $inlibc
7529
7530 : see if endgrent exists
7531 set endgrent d_endgrent
7532 eval $inlibc
7533
7534 : see if endhostent exists
7535 set endhostent d_endhent
7536 eval $inlibc
7537
7538 : see if endnetent exists
7539 set endnetent d_endnent
7540 eval $inlibc
7541
7542 : see if endprotoent exists
7543 set endprotoent d_endpent
7544 eval $inlibc
7545
7546 : see if endpwent exists
7547 set endpwent d_endpwent
7548 eval $inlibc
7549
7550 : see if endservent exists
7551 set endservent d_endsent
7552 eval $inlibc
7553
7554 : Locate the flags for 'open()'
7555 echo " "
7556 $cat >open3.c <<'EOCP'
7557 #include <sys/types.h>
7558 #ifdef I_FCNTL
7559 #include <fcntl.h>
7560 #endif
7561 #ifdef I_SYS_FILE
7562 #include <sys/file.h>
7563 #endif
7564 int main() {
7565         if(O_RDONLY);
7566 #ifdef O_TRUNC
7567         exit(0);
7568 #else
7569         exit(1);
7570 #endif
7571 }
7572 EOCP
7573 : check sys/file.h first to get FREAD on Sun
7574 if $test `./findhdr sys/file.h` && \
7575                 set open3 -DI_SYS_FILE && eval $compile; then
7576         h_sysfile=true;
7577         echo "<sys/file.h> defines the O_* constants..." >&4
7578         if ./open3; then
7579                 echo "and you have the 3 argument form of open()." >&4
7580                 val="$define"
7581         else
7582                 echo "but not the 3 argument form of open().  Oh, well." >&4
7583                 val="$undef"
7584         fi
7585 elif $test `./findhdr fcntl.h` && \
7586                 set open3 -DI_FCNTL && eval $compile; then
7587         h_fcntl=true;
7588         echo "<fcntl.h> defines the O_* constants..." >&4
7589         if ./open3; then
7590                 echo "and you have the 3 argument form of open()." >&4
7591                 val="$define"
7592         else
7593                 echo "but not the 3 argument form of open().  Oh, well." >&4
7594                 val="$undef"
7595         fi
7596 else
7597         val="$undef"
7598         echo "I can't find the O_* constant definitions!  You got problems." >&4
7599 fi
7600 set d_open3
7601 eval $setvar
7602 $rm -f open3*
7603
7604 : check for non-blocking I/O stuff
7605 case "$h_sysfile" in
7606 true) echo "#include <sys/file.h>" > head.c;;
7607 *)
7608         case "$h_fcntl" in
7609         true) echo "#include <fcntl.h>" > head.c;;
7610         *) echo "#include <sys/fcntl.h>" > head.c;;
7611         esac
7612         ;;
7613 esac
7614 echo " "
7615 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
7616 case "$o_nonblock" in
7617 '')
7618         $cat head.c > try.c
7619         $cat >>try.c <<'EOCP'
7620 int main() {
7621 #ifdef O_NONBLOCK
7622         printf("O_NONBLOCK\n");
7623         exit(0);
7624 #endif
7625 #ifdef O_NDELAY
7626         printf("O_NDELAY\n");
7627         exit(0);
7628 #endif
7629 #ifdef FNDELAY
7630         printf("FNDELAY\n");
7631         exit(0);
7632 #endif
7633         exit(0);
7634 }
7635 EOCP
7636         set try
7637         if eval $compile_ok; then
7638                 o_nonblock=`./try`
7639                 case "$o_nonblock" in
7640                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
7641                 *) echo "Seems like we can use $o_nonblock.";;
7642                 esac
7643         else
7644                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
7645         fi
7646         ;;
7647 *) echo "Using $hint value $o_nonblock.";;
7648 esac
7649 $rm -f try try.* .out core
7650
7651 echo " "
7652 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
7653 case "$eagain" in
7654 '')
7655         $cat head.c > try.c
7656         $cat >>try.c <<EOCP
7657 #include <errno.h>
7658 #include <sys/types.h>
7659 #include <signal.h>
7660 #define MY_O_NONBLOCK $o_nonblock
7661 #ifndef errno  /* XXX need better Configure test */
7662 extern int errno;
7663 #endif
7664 $signal_t blech(x) int x; { exit(3); }
7665 EOCP
7666         $cat >> try.c <<'EOCP'
7667 int main()
7668 {
7669         int pd[2];
7670         int pu[2];
7671         char buf[1];
7672         char string[100];
7673
7674         pipe(pd);       /* Down: child -> parent */
7675         pipe(pu);       /* Up: parent -> child */
7676         if (0 != fork()) {
7677                 int ret;
7678                 close(pd[1]);   /* Parent reads from pd[0] */
7679                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
7680                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
7681                         exit(1);
7682                 signal(SIGALRM, blech);
7683                 alarm(5);
7684                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
7685                         exit(2);
7686                 sprintf(string, "%d\n", ret);
7687                 write(2, string, strlen(string));
7688                 alarm(0);
7689 #ifdef EAGAIN
7690                 if (errno == EAGAIN) {
7691                         printf("EAGAIN\n");
7692                         goto ok;
7693                 }
7694 #endif
7695 #ifdef EWOULDBLOCK
7696                 if (errno == EWOULDBLOCK)
7697                         printf("EWOULDBLOCK\n");
7698 #endif
7699         ok:
7700                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
7701                 sleep(2);                               /* Give it time to close our pipe */
7702                 alarm(5);
7703                 ret = read(pd[0], buf, 1);      /* Should read EOF */
7704                 alarm(0);
7705                 sprintf(string, "%d\n", ret);
7706                 write(3, string, strlen(string));
7707                 exit(0);
7708         }
7709
7710         close(pd[0]);                   /* We write to pd[1] */
7711         close(pu[1]);                   /* We read from pu[0] */
7712         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
7713         close(pd[1]);                   /* Pipe pd is now fully closed! */
7714         exit(0);                                /* Bye bye, thank you for playing! */
7715 }
7716 EOCP
7717         set try
7718         if eval $compile_ok; then
7719                 echo "$startsh" >mtry
7720                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
7721                 chmod +x mtry
7722                 ./mtry >/dev/null 2>&1
7723                 case $? in
7724                 0) eagain=`$cat try.out`;;
7725                 1) echo "Could not perform non-blocking setting!";;
7726                 2) echo "I did a successful read() for something that was not there!";;
7727                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
7728                 *) echo "Something terribly wrong happened during testing.";;
7729                 esac
7730                 rd_nodata=`$cat try.ret`
7731                 echo "A read() system call with no data present returns $rd_nodata."
7732                 case "$rd_nodata" in
7733                 0|-1) ;;
7734                 *)
7735                         echo "(That's peculiar, fixing that to be -1.)"
7736                         rd_nodata=-1
7737                         ;;
7738                 esac
7739                 case "$eagain" in
7740                 '')
7741                         echo "Forcing errno EAGAIN on read() with no data available."
7742                         eagain=EAGAIN
7743                         ;;
7744                 *)
7745                         echo "Your read() sets errno to $eagain when no data is available."
7746                         ;;
7747                 esac
7748                 status=`$cat try.err`
7749                 case "$status" in
7750                 0) echo "And it correctly returns 0 to signal EOF.";;
7751                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
7752                 *) echo "However, your read() returns '$status' on EOF??";;
7753                 esac
7754                 val="$define"
7755                 if test "$status" = "$rd_nodata"; then
7756                         echo "WARNING: you can't distinguish between EOF and no data!"
7757                         val="$undef"
7758                 fi
7759         else
7760                 echo "I can't compile the test program--assuming errno EAGAIN will do."
7761                 eagain=EAGAIN
7762         fi
7763         set d_eofnblk
7764         eval $setvar
7765         ;;
7766 *)
7767         echo "Using $hint value $eagain."
7768         echo "Your read() returns $rd_nodata when no data is present."
7769         case "$d_eofnblk" in
7770         "$define") echo "And you can see EOF because read() returns 0.";;
7771         "$undef") echo "But you can't see EOF status from read() returned value.";;
7772         *)
7773                 echo "(Assuming you can't see EOF status from read anyway.)"
7774                 d_eofnblk=$undef
7775                 ;;
7776         esac
7777         ;;
7778 esac
7779 $rm -f try try.* .out core head.c mtry
7780
7781 : see if fchmod exists
7782 set fchmod d_fchmod
7783 eval $inlibc
7784
7785 : see if fchown exists
7786 set fchown d_fchown
7787 eval $inlibc
7788
7789 : see if this is an fcntl system
7790 set fcntl d_fcntl
7791 eval $inlibc
7792
7793 : see if sys/select.h has to be included
7794 set sys/select.h i_sysselct
7795 eval $inhdr
7796
7797 : see if we should include time.h, sys/time.h, or both
7798 echo " "
7799 if test "X$timeincl" = X; then
7800         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
7801         $echo $n "I'm now running the test program...$c"
7802         $cat >try.c <<'EOCP'
7803 #include <sys/types.h>
7804 #ifdef I_TIME
7805 #include <time.h>
7806 #endif
7807 #ifdef I_SYSTIME
7808 #ifdef SYSTIMEKERNEL
7809 #define KERNEL
7810 #endif
7811 #include <sys/time.h>
7812 #endif
7813 #ifdef I_SYSSELECT
7814 #include <sys/select.h>
7815 #endif
7816 int main()
7817 {
7818         struct tm foo;
7819 #ifdef S_TIMEVAL
7820         struct timeval bar;
7821 #endif
7822 #ifdef S_TIMEZONE
7823         struct timezone tzp;
7824 #endif
7825         if (foo.tm_sec == foo.tm_sec)
7826                 exit(0);
7827 #ifdef S_TIMEVAL
7828         if (bar.tv_sec == bar.tv_sec)
7829                 exit(0);
7830 #endif
7831         exit(1);
7832 }
7833 EOCP
7834         flags=''
7835         for s_timezone in '-DS_TIMEZONE' ''; do
7836         sysselect=''
7837         for s_timeval in '-DS_TIMEVAL' ''; do
7838         for i_systimek in '' '-DSYSTIMEKERNEL'; do
7839         for i_time in '' '-DI_TIME'; do
7840         for i_systime in '-DI_SYSTIME' ''; do
7841                 case "$flags" in
7842                 '') $echo $n ".$c"
7843                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
7844                         if eval $compile; then
7845                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
7846                                 shift
7847                                 flags="$*"
7848                                 echo " "
7849                                 $echo $n "Succeeded with $flags$c"
7850                         fi
7851                         ;;
7852                 esac
7853         done
7854         done
7855         done
7856         done
7857         done
7858         timeincl=''
7859         echo " "
7860         case "$flags" in
7861         *SYSTIMEKERNEL*) i_systimek="$define"
7862                 timeincl=`./findhdr sys/time.h`
7863                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
7864         *) i_systimek="$undef";;
7865         esac
7866         case "$flags" in
7867         *I_TIME*) i_time="$define"
7868                 timeincl=`./findhdr time.h`" $timeincl"
7869                 echo "We'll include <time.h>." >&4;;
7870         *) i_time="$undef";;
7871         esac
7872         case "$flags" in
7873         *I_SYSTIME*) i_systime="$define"
7874                 timeincl=`./findhdr sys/time.h`" $timeincl"
7875                 echo "We'll include <sys/time.h>." >&4;;
7876         *) i_systime="$undef";;
7877         esac
7878         $rm -f try.c try
7879 fi
7880
7881 : check for fd_set items
7882 $cat <<EOM
7883
7884 Checking to see how well your C compiler handles fd_set and friends ...
7885 EOM
7886 $cat >fd_set.c <<EOCP
7887 #$i_systime I_SYS_TIME
7888 #$i_sysselct I_SYS_SELECT
7889 #$d_socket HAS_SOCKET
7890 #include <sys/types.h>
7891 #ifdef HAS_SOCKET
7892 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
7893 #endif
7894 #ifdef I_SYS_TIME
7895 #include <sys/time.h>
7896 #endif
7897 #ifdef I_SYS_SELECT
7898 #include <sys/select.h>
7899 #endif
7900 int main() {
7901         fd_set fds;
7902
7903 #ifdef TRYBITS
7904         if(fds.fds_bits);
7905 #endif
7906
7907 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
7908         exit(0);
7909 #else
7910         exit(1);
7911 #endif
7912 }
7913 EOCP
7914 set fd_set -DTRYBITS
7915 if eval $compile; then
7916         d_fds_bits="$define"
7917         d_fd_set="$define"
7918         echo "Well, your system knows about the normal fd_set typedef..." >&4
7919         if ./fd_set; then
7920                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
7921                 d_fd_macros="$define"
7922         else
7923                 $cat >&4 <<'EOM'
7924 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
7925 EOM
7926                 d_fd_macros="$undef"
7927         fi
7928 else
7929         $cat <<'EOM'
7930 Hmm, your compiler has some difficulty with fd_set.  Checking further...
7931 EOM
7932         set fd_set
7933         if eval $compile; then
7934                 d_fds_bits="$undef"
7935                 d_fd_set="$define"
7936                 echo "Well, your system has some sort of fd_set available..." >&4
7937                 if ./fd_set; then
7938                         echo "and you have the normal fd_set macros." >&4
7939                         d_fd_macros="$define"
7940                 else
7941                         $cat <<'EOM'
7942 but not the normal fd_set macros!  Gross!  More work for me...
7943 EOM
7944                         d_fd_macros="$undef"
7945                 fi
7946         else
7947         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
7948                 d_fd_set="$undef"
7949                 d_fds_bits="$undef"
7950                 d_fd_macros="$undef"
7951         fi
7952 fi
7953 $rm -f fd_set*
7954
7955 : see if fgetpos exists
7956 set fgetpos d_fgetpos
7957 eval $inlibc
7958
7959
7960 if $test X"$use64bits" = X"$define"; then
7961         : see if fgetpos64 exists
7962         set fgetpos64 d_fgetpos64
7963         eval $inlibc
7964
7965         : see if fopen64 exists
7966         set freopen64 d_fopen64
7967         eval $inlibc
7968
7969         : see if freopen64 exists
7970         set freopen64 d_freopen64
7971         eval $inlibc
7972
7973         : see if fseek64 exists
7974         set fseek64 d_fseek64
7975         eval $inlibc
7976
7977         : see if fseeko64 exists
7978         set fseeko64 d_fseeko64
7979         eval $inlibc
7980
7981         : see if fsetpos64 exists
7982         set fsetpos64 d_fsetpos64
7983         eval $inlibc
7984
7985         : see if ftell64 exists
7986         set ftell64 d_ftell64
7987         eval $inlibc
7988
7989         : see if ftello64 exists
7990         set ftello64 d_ftello64
7991         eval $inlibc
7992
7993         : see if tmpfile64 exists
7994         set tmpfile64 d_tmpfile64
7995         eval $inlibc
7996 else
7997         val="$undef"
7998         for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
7999         do
8000                 set $xxx
8001                 eval $setvar
8002         done
8003 fi
8004
8005 : see if flock exists
8006 set flock d_flock
8007 eval $inlibc
8008
8009 : see if fork exists
8010 set fork d_fork
8011 eval $inlibc
8012
8013 : see if pathconf exists
8014 set pathconf d_pathconf
8015 eval $inlibc
8016
8017 : see if fpathconf exists
8018 set fpathconf d_fpathconf
8019 eval $inlibc
8020
8021 : see if fseeko exists
8022 set fseeko d_fseeko
8023 eval $inlibc
8024
8025 : see if fsetpos exists
8026 set fsetpos d_fsetpos
8027 eval $inlibc
8028
8029 : see if this is a sys/param system
8030 set sys/param.h i_sysparam
8031 eval $inhdr
8032
8033 : see if this is a sys/mount.h system
8034 set sys/mount.h i_sysmount
8035 eval $inhdr
8036
8037
8038 : see if statfs exists
8039 set statfs d_statfs
8040 eval $inlibc
8041
8042 : see if fstatfs exists
8043 set fstatfs d_fstatfs
8044 eval $inlibc
8045
8046 : see if statfs knows about mount flags
8047 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8048 eval $hasfield
8049
8050
8051 : see if statvfs exists
8052 set statvfs d_statvfs
8053 eval $inlibc
8054
8055 : see if fstatvfs exists
8056 set fstatvfs d_fstatvfs
8057 eval $inlibc
8058
8059
8060 : see if ftello exists
8061 set ftello d_ftello
8062 eval $inlibc
8063
8064 : see if getgrent exists
8065 set getgrent d_getgrent
8066 eval $inlibc
8067
8068 : see if gethostbyaddr exists
8069 set gethostbyaddr d_gethbyaddr
8070 eval $inlibc
8071
8072 : see if gethostbyname exists
8073 set gethostbyname d_gethbyname
8074 eval $inlibc
8075
8076 : see if gethostent exists
8077 set gethostent d_gethent
8078 eval $inlibc
8079
8080 : see how we will look up host name
8081 echo " "
8082 call=''
8083 if set gethostname val -f d_gethname; eval $csym; $val; then
8084         echo 'gethostname() found.' >&4
8085         d_gethname="$define"
8086         call=gethostname
8087 fi
8088 if set uname val -f d_uname; eval $csym; $val; then
8089         if ./xenix; then
8090                 $cat <<'EOM'
8091 uname() was found, but you're running xenix, and older versions of xenix
8092 have a broken uname(). If you don't really know whether your xenix is old
8093 enough to have a broken system call, use the default answer.
8094
8095 EOM
8096                 dflt=y
8097                 case "$d_uname" in
8098                 "$define") dflt=n;;
8099                 esac
8100                 rp='Is your uname() broken?'
8101                 . ./myread
8102                 case "$ans" in
8103                 n*) d_uname="$define"; call=uname;;
8104                 esac
8105         else
8106                 echo 'uname() found.' >&4
8107                 d_uname="$define"
8108                 case "$call" in
8109                 '') call=uname ;;
8110                 esac
8111         fi
8112 fi
8113 case "$d_gethname" in
8114 '') d_gethname="$undef";;
8115 esac
8116 case "$d_uname" in
8117 '') d_uname="$undef";;
8118 esac
8119 case "$d_uname$d_gethname" in
8120 *define*)
8121         dflt=n
8122         cat <<EOM
8123  
8124 Every now and then someone has a $call() that lies about the hostname
8125 but can't be fixed for political or economic reasons.  If you wish, I can
8126 pretend $call() isn't there and maybe compute hostname at run-time
8127 thanks to the '$phostname' command.
8128
8129 EOM
8130         rp="Shall I ignore $call() from now on?"
8131         . ./myread
8132         case "$ans" in
8133         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8134         esac;;
8135 esac
8136 case "$phostname" in
8137 '') aphostname='';;
8138 *) case "$aphostname" in
8139         /*) ;;
8140         *) set X $phostname
8141                 shift
8142                 file=$1
8143                 shift
8144                 file=`./loc $file $file $pth`
8145                 aphostname=`echo $file $*`
8146                 ;;
8147         esac
8148         ;;
8149 esac
8150 case "$d_uname$d_gethname" in
8151 *define*) ;;
8152 *)
8153         case "$phostname" in
8154         '')
8155                 echo "There will be no way for $package to get your hostname." >&4;;
8156         *)
8157         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8158                 ;;
8159         esac;;
8160 esac
8161 case "$d_phostname" in
8162 '') d_phostname="$undef";;
8163 esac
8164
8165 : see if this is a netdb.h system
8166 set netdb.h i_netdb
8167 eval $inhdr
8168
8169 : see if prototypes for various gethostxxx netdb.h functions are available
8170 echo " "
8171 set d_gethostprotos gethostent $i_netdb netdb.h
8172 eval $hasproto
8173
8174 : see if getlogin exists
8175 set getlogin d_getlogin
8176 eval $inlibc
8177
8178 : see if getmntent exists
8179 set getmntent d_getmntent
8180 eval $inlibc
8181
8182 : see if getnetbyaddr exists
8183 set getnetbyaddr d_getnbyaddr
8184 eval $inlibc
8185
8186 : see if getnetbyname exists
8187 set getnetbyname d_getnbyname
8188 eval $inlibc
8189
8190 : see if getnetent exists
8191 set getnetent d_getnent
8192 eval $inlibc
8193
8194 : see if prototypes for various getnetxxx netdb.h functions are available
8195 echo " "
8196 set d_getnetprotos getnetent $i_netdb netdb.h
8197 eval $hasproto
8198
8199
8200 : see if getprotobyname exists
8201 set getprotobyname d_getpbyname
8202 eval $inlibc
8203
8204 : see if getprotobynumber exists
8205 set getprotobynumber d_getpbynumber
8206 eval $inlibc
8207
8208 : see if getprotoent exists
8209 set getprotoent d_getpent
8210 eval $inlibc
8211
8212 : see if getpgid exists
8213 set getpgid d_getpgid
8214 eval $inlibc
8215
8216 : see if getpgrp2 exists
8217 set getpgrp2 d_getpgrp2
8218 eval $inlibc
8219
8220 : see if getppid exists
8221 set getppid d_getppid
8222 eval $inlibc
8223
8224 : see if getpriority exists
8225 set getpriority d_getprior
8226 eval $inlibc
8227
8228 : see if prototypes for various getprotoxxx netdb.h functions are available
8229 echo " "
8230 set d_getprotoprotos getprotoent $i_netdb netdb.h
8231 eval $hasproto
8232
8233 : see if getpwent exists
8234 set getpwent d_getpwent
8235 eval $inlibc
8236
8237
8238 : see if getservbyname exists
8239 set getservbyname d_getsbyname
8240 eval $inlibc
8241
8242 : see if getservbyport exists
8243 set getservbyport d_getsbyport
8244 eval $inlibc
8245
8246 : see if getservent exists
8247 set getservent d_getsent
8248 eval $inlibc
8249
8250 : see if prototypes for various getservxxx netdb.h functions are available
8251 echo " "
8252 set d_getservprotos getservent $i_netdb netdb.h
8253 eval $hasproto
8254
8255 : see if gettimeofday or ftime exists
8256 set gettimeofday d_gettimeod
8257 eval $inlibc
8258 case "$d_gettimeod" in
8259 "$undef")
8260         set ftime d_ftime 
8261         eval $inlibc
8262         ;;
8263 *)
8264         val="$undef"; set d_ftime; eval $setvar
8265         ;;
8266 esac
8267 case "$d_gettimeod$d_ftime" in
8268 "$undef$undef")
8269         echo " "
8270         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8271         ;;
8272 esac
8273
8274 : see if this is an grp system
8275 set grp.h i_grp
8276 eval $inhdr
8277
8278 case "$i_grp" in
8279 $define)
8280         xxx=`./findhdr grp.h`
8281         $cppstdin $cppflags $cppminus < $xxx >$$.h
8282
8283         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8284                 val="$define"
8285         else
8286                 val="$undef"
8287         fi
8288         set d_grpasswd
8289         eval $setvar
8290
8291         $rm -f $$.h
8292         ;;
8293 *)
8294         val="$undef";
8295         set d_grpasswd; eval $setvar
8296         ;;
8297 esac
8298
8299 : see if hasmntopt exists
8300 set hasmntopt d_hasmntopt
8301 eval $inlibc
8302
8303 : see if this is a netinet/in.h or sys/in.h system
8304 set netinet/in.h i_niin sys/in.h i_sysin
8305 eval $inhdr
8306
8307 : see if arpa/inet.h has to be included
8308 set arpa/inet.h i_arpainet
8309 eval $inhdr
8310
8311 : see if htonl --and friends-- exists
8312 val=''
8313 set htonl val
8314 eval $inlibc
8315
8316 : Maybe they are macros.
8317 case "$val" in
8318 $undef)
8319         $cat >htonl.c <<EOM
8320 #include <stdio.h>
8321 #include <sys/types.h>
8322 #$i_niin I_NETINET_IN
8323 #$i_sysin I_SYS_IN
8324 #$i_arpainet I_ARPA_INET
8325 #ifdef I_NETINET_IN
8326 #include <netinet/in.h>
8327 #endif
8328 #ifdef I_SYS_IN
8329 #include <sys/in.h>
8330 #endif
8331 #ifdef I_ARPA_INET
8332 #include <arpa/inet.h>
8333 #endif
8334 #ifdef htonl
8335 printf("Defined as a macro.");
8336 #endif
8337 EOM
8338         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8339         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8340                 val="$define"
8341                 echo "But it seems to be defined as a macro." >&4
8342         fi
8343         $rm -f htonl.?
8344         ;;
8345 esac
8346 set d_htonl
8347 eval $setvar
8348
8349 : see which of string.h or strings.h is needed
8350 echo " "
8351 strings=`./findhdr string.h`
8352 if $test "$strings" && $test -r "$strings"; then
8353         echo "Using <string.h> instead of <strings.h>." >&4
8354         val="$define"
8355 else
8356         val="$undef"
8357         strings=`./findhdr strings.h`
8358         if $test "$strings" && $test -r "$strings"; then
8359                 echo "Using <strings.h> instead of <string.h>." >&4
8360         else
8361                 echo "No string header found -- You'll surely have problems." >&4
8362         fi
8363 fi
8364 set i_string
8365 eval $setvar
8366 case "$i_string" in
8367 "$undef") strings=`./findhdr strings.h`;;
8368 *)        strings=`./findhdr string.h`;;
8369 esac
8370
8371 : index or strchr
8372 echo " "
8373 if set index val -f; eval $csym; $val; then
8374         if set strchr val -f d_strchr; eval $csym; $val; then
8375                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8376                         val="$define"
8377                         vali="$undef"
8378                         echo "strchr() found." >&4
8379                 else
8380                         val="$undef"
8381                         vali="$define"
8382                         echo "index() found." >&4
8383                 fi
8384         else
8385                 val="$undef"
8386                 vali="$define"
8387                 echo "index() found." >&4
8388         fi
8389 else
8390         if set strchr val -f d_strchr; eval $csym; $val; then
8391                 val="$define"
8392                 vali="$undef"
8393                 echo "strchr() found." >&4
8394         else
8395                 echo "No index() or strchr() found!" >&4
8396                 val="$undef"
8397                 vali="$undef"
8398         fi
8399 fi
8400 set d_strchr; eval $setvar
8401 val="$vali"
8402 set d_index; eval $setvar
8403
8404 : check whether inet_aton exists
8405 set inet_aton d_inetaton
8406 eval $inlibc
8407
8408 : see if inttypes.h is available
8409 : we want a real compile instead of Inhdr because some systems
8410 : have an inttypes.h which includes non-existent headers
8411 echo " "
8412 $cat >try.c <<EOCP
8413 #include <inttypes.h>
8414 int main() {
8415         static int32_t foo32 = 0x12345678;
8416 }
8417 EOCP
8418 set try
8419 if eval $compile; then
8420         echo "<inttypes.h> found." >&4
8421         val="$define"
8422 else
8423         echo "<inttypes.h> NOT found." >&4
8424         val="$undef"
8425 fi
8426 $rm -f try.c try
8427 set i_inttypes
8428 eval $setvar
8429
8430 : check for int64_t
8431 case "$use64bits" in
8432 "$define" )
8433         echo " "
8434         echo $n "Checking to see if your system supports int64_t...$c" >&4
8435         $cat >try.c <<EOCP
8436 #include <sys/types.h>
8437 #$i_inttypes I_INTTYPES
8438 #ifdef I_INTTYPES
8439 #include <inttypes.h>
8440 #endif
8441 int64_t foo() { int64_t x; x = 7; return x; }
8442 EOCP
8443         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8444                 val="$define"
8445                 echo " Yup, it does." >&4
8446         else
8447                 val="$undef"
8448                 echo " Nope, it doesn't." >&4
8449         fi
8450         $rm -f try.*
8451         ;;
8452 *)      val="$undef"
8453         ;;
8454 esac
8455 set d_int64t
8456 eval $setvar
8457
8458
8459 : Look for isascii
8460 echo " "
8461 $cat >isascii.c <<'EOCP'
8462 #include <stdio.h>
8463 #include <ctype.h>
8464 int main() {
8465         int c = 'A';
8466         if (isascii(c))
8467                 exit(0);
8468         else
8469                 exit(1);
8470 }
8471 EOCP
8472 set isascii
8473 if eval $compile; then
8474         echo "isascii() found." >&4
8475         val="$define"
8476 else
8477         echo "isascii() NOT found." >&4
8478         val="$undef"
8479 fi
8480 set d_isascii
8481 eval $setvar
8482 $rm -f isascii*
8483
8484 : see if killpg exists
8485 set killpg d_killpg
8486 eval $inlibc
8487
8488 : see if lchown exists
8489 echo " "
8490 $cat > try.c <<'EOCP'
8491 /* System header to define __stub macros and hopefully few prototypes,
8492     which can conflict with char lchown(); below.  */
8493 #include <assert.h>
8494 /* Override any gcc2 internal prototype to avoid an error.  */
8495 /* We use char because int might match the return type of a gcc2
8496    builtin and then its argument prototype would still apply.  */
8497 char lchown();
8498 int main() {
8499     /*  The GNU C library defines this for functions which it implements
8500         to always fail with ENOSYS.  Some functions are actually named
8501         something starting with __ and the normal name is an alias.  */
8502 #if defined (__stub_lchown) || defined (__stub___lchown)
8503 choke me
8504 #else
8505 lchown();
8506 #endif
8507 ; return 0; }
8508 EOCP
8509 set try
8510 if eval $compile; then
8511     $echo "lchown() found." >&4
8512     val="$define"
8513 else
8514     $echo "lchown() NOT found." >&4
8515     val="$undef"
8516 fi
8517 set d_lchown
8518 eval $setvar
8519
8520 : see if link exists
8521 set link d_link
8522 eval $inlibc
8523
8524 : see if localeconv exists
8525 set localeconv d_locconv
8526 eval $inlibc
8527
8528 : see if lockf exists
8529 set lockf d_lockf
8530 eval $inlibc
8531
8532 : check for length of double
8533 echo " "
8534 case "$doublesize" in
8535 '')
8536         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
8537         $cat >try.c <<'EOCP'
8538 #include <stdio.h>
8539 int main()
8540 {
8541         printf("%d\n", sizeof(double));
8542 }
8543 EOCP
8544         set try
8545         if eval $compile_ok; then
8546                 doublesize=`./try`
8547                 $echo " $doublesize bytes." >&4
8548         else
8549                 dflt='8'
8550                 echo "(I can't seem to compile the test program.  Guessing...)"
8551                 rp="What is the size of a double precision number (in bytes)?"
8552                 . ./myread
8553                 doublesize="$ans"
8554         fi
8555         ;;
8556 esac
8557 $rm -f try.c try
8558
8559 : check for long doubles
8560 echo " "
8561 echo $n "Checking to see if your system supports long doubles...$c" >&4
8562 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
8563 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8564         val="$define"
8565         echo " Yup, it does." >&4
8566 else
8567         val="$undef"
8568         echo " Nope, it doesn't." >&4
8569 fi
8570 $rm try.*
8571 set d_longdbl
8572 eval $setvar
8573
8574 : check for length of long double
8575 case "${d_longdbl}${longdblsize}" in
8576 $define)
8577         echo " "
8578         $echo $n "Checking to see how big your long doubles are...$c" >&4
8579         $cat >try.c <<'EOCP'
8580 #include <stdio.h>
8581 int main()
8582 {
8583         printf("%d\n", sizeof(long double));
8584 }
8585 EOCP
8586         set try
8587         if eval $compile; then
8588                 longdblsize=`./try`
8589                 $echo " $longdblsize bytes." >&4
8590         else
8591                 dflt='8'
8592                 echo " "
8593                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
8594                 rp="What is the size of a long double (in bytes)?"
8595                 . ./myread
8596                 longdblsize="$ans"
8597         fi
8598         if $test "X$doublesize" = "X$longdblsize"; then
8599                 echo "(That isn't any different from an ordinary double.)"
8600         fi      
8601         ;;
8602 esac
8603 $rm -f try.c try
8604
8605 : check for long long
8606 echo " "
8607 echo $n "Checking to see if your system supports long long...$c" >&4
8608 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
8609 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8610         val="$define"
8611         echo " Yup, it does." >&4
8612 else
8613         val="$undef"
8614         echo " Nope, it doesn't." >&4
8615 fi
8616 $rm try.*
8617 set d_longlong
8618 eval $setvar
8619
8620 : check for length of long long
8621 case "${d_longlong}${longlongsize}" in
8622 $define)
8623         echo " "
8624         $echo $n "Checking to see how big your long longs are...$c" >&4
8625         $cat >try.c <<'EOCP'
8626 #include <stdio.h>
8627 int main()
8628 {
8629         printf("%d\n", sizeof(long long));
8630 }
8631 EOCP
8632         set try
8633         if eval $compile_ok; then
8634                 longlongsize=`./try`
8635                 $echo " $longlongsize bytes." >&4
8636         else
8637                 dflt='8'
8638                 echo " "
8639                 echo "(I can't seem to compile the test program.  Guessing...)"
8640                 rp="What is the size of a long long (in bytes)?"
8641                 . ./myread
8642                 longlongsize="$ans"
8643         fi
8644         if $test "X$longsize" = "X$longlongsize"; then
8645                 echo "(That isn't any different from an ordinary long.)"
8646         fi      
8647         ;;
8648 esac
8649 $rm -f try.c try
8650
8651 : see if lstat exists
8652 set lstat d_lstat
8653 eval $inlibc
8654
8655 : see if madvise exists
8656 set madvise d_madvise
8657 eval $inlibc
8658
8659 : see if mblen exists
8660 set mblen d_mblen
8661 eval $inlibc
8662
8663 : see if mbstowcs exists
8664 set mbstowcs d_mbstowcs
8665 eval $inlibc
8666
8667 : see if mbtowc exists
8668 set mbtowc d_mbtowc
8669 eval $inlibc
8670
8671 : see if memcmp exists
8672 set memcmp d_memcmp
8673 eval $inlibc
8674
8675 : see if memcpy exists
8676 set memcpy d_memcpy
8677 eval $inlibc
8678
8679 : see if memmove exists
8680 set memmove d_memmove
8681 eval $inlibc
8682
8683 : see if memset exists
8684 set memset d_memset
8685 eval $inlibc
8686
8687 : see if mkdir exists
8688 set mkdir d_mkdir
8689 eval $inlibc
8690
8691 : see if mkfifo exists
8692 set mkfifo d_mkfifo
8693 eval $inlibc
8694
8695 : see if mktime exists
8696 set mktime d_mktime
8697 eval $inlibc
8698
8699 : see if this is a sys/mman.h system
8700 set sys/mman.h i_sysmman
8701 eval $inhdr
8702
8703 : see if mmap exists
8704 set mmap d_mmap
8705 eval $inlibc
8706 : see what shmat returns
8707 : default to something harmless
8708 mmaptype='void *'
8709 case "$i_sysmman$d_mmap" in
8710 "$define$define")
8711         $cat >mmap.c <<'END'
8712 #include <sys/mman.h>
8713 void *mmap();
8714 END
8715         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
8716                 mmaptype='void *'
8717         else
8718                 mmaptype='caddr_t'
8719         fi
8720         echo "and it returns ($mmaptype)." >&4
8721         ;;
8722 esac
8723
8724
8725
8726 : see if mprotect exists
8727 set mprotect d_mprotect
8728 eval $inlibc
8729
8730 : see if msgctl exists
8731 set msgctl d_msgctl
8732 eval $inlibc
8733
8734 : see if msgget exists
8735 set msgget d_msgget
8736 eval $inlibc
8737
8738 : see if msgsnd exists
8739 set msgsnd d_msgsnd
8740 eval $inlibc
8741
8742 : see if msgrcv exists
8743 set msgrcv d_msgrcv
8744 eval $inlibc
8745
8746 : see how much of the 'msg*(2)' library is present.
8747 h_msg=true
8748 echo " "
8749 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
8750 *"$undef"*) h_msg=false;;
8751 esac
8752 case "$osname" in
8753 freebsd)
8754     case "`ipcs 2>&1`" in
8755     "SVID messages"*"not configured"*)
8756         echo "Your $osname does not have the msg*(2) configured." >&4
8757         h_msg=false
8758         val="$undef"
8759         set msgctl d_msgctl
8760         eval $setvar
8761         set msgget d_msgget
8762         eval $setvar
8763         set msgsnd d_msgsnd
8764         eval $setvar
8765         set msgrcv d_msgrcv
8766         eval $setvar
8767         ;;
8768     esac
8769     ;;
8770 esac
8771 : we could also check for sys/ipc.h ...
8772 if $h_msg && $test `./findhdr sys/msg.h`; then
8773         echo "You have the full msg*(2) library." >&4
8774         val="$define"
8775 else
8776         echo "You don't have the full msg*(2) library." >&4
8777         val="$undef"
8778 fi
8779 set d_msg
8780 eval $setvar
8781
8782 : see if msync exists
8783 set msync d_msync
8784 eval $inlibc
8785
8786 : see if munmap exists
8787 set munmap d_munmap
8788 eval $inlibc
8789
8790 : see if nice exists
8791 set nice d_nice
8792 eval $inlibc
8793
8794 : see if POSIX threads are available
8795 if test "X$usethreads" = "X$define"; then
8796         set pthread.h i_pthread
8797         eval $inhdr
8798 else
8799         i_pthread="$undef"
8800 fi
8801
8802
8803
8804 : how to create joinable pthreads
8805 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
8806         echo " "
8807         echo "Checking what constant to use for creating joinable pthreads..." >&4 
8808         $cat >try.c <<'EOCP'
8809 #include <pthread.h>
8810 int main() {
8811     int detachstate = JOINABLE;
8812 }
8813 EOCP
8814         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
8815         if eval $compile; then
8816                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
8817                 val="$undef" # Yes, undef.
8818                 set d_old_pthread_create_joinable
8819                 eval $setvar
8820                 val=""
8821                 set old_pthread_create_joinable
8822                 eval $setvar
8823         else
8824                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
8825                 if eval $compile; then
8826                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
8827                         val="$define"
8828                         set d_old_pthread_create_joinable
8829                         eval $setvar
8830                         val=PTHREAD_CREATE_UNDETACHED
8831                         set old_pthread_create_joinable
8832                         eval $setvar
8833                 else            
8834                         set try -DJOINABLE=__UNDETACHED
8835                         if eval $compile; then
8836                                 echo "You seem to use __UNDETACHED." >&4
8837                                 val="$define"
8838                                 set d_old_pthread_create_joinable
8839                                 eval $setvar
8840                                 val=__UNDETACHED
8841                                 set old_pthread_create_joinable
8842                                 eval $setvar
8843                         else
8844                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
8845                                 val="$define"
8846                                 set d_old_pthread_create_joinable
8847                                 eval $setvar
8848                                 val=0
8849                                 set old_pthread_create_joinable
8850                                 eval $setvar
8851                         fi
8852                 fi
8853         fi
8854         $rm -f try try.*
8855 else
8856     d_old_pthread_create_joinable="$undef"
8857     old_pthread_create_joinable=""
8858 fi
8859
8860 : see if pause exists
8861 set pause d_pause
8862 eval $inlibc
8863
8864 : see if pipe exists
8865 set pipe d_pipe
8866 eval $inlibc
8867
8868 : see if poll exists
8869 set poll d_poll
8870 eval $inlibc
8871
8872
8873 : see whether the various POSIXish _yields exist
8874 $cat >try.c <<EOP
8875 #include <pthread.h>
8876 #include <stdio.h>
8877 int main() {
8878 #ifdef SCHED_YIELD
8879         sched_yield();
8880 #else
8881 #ifdef PTHREAD_YIELD
8882         pthread_yield();
8883 #else
8884 #ifdef PTHREAD_YIELD_NULL
8885         pthread_yield(NULL);
8886 #endif
8887 #endif
8888 #endif
8889 }
8890 EOP
8891 : see if sched_yield exists
8892 set try -DSCHED_YIELD
8893 if eval $compile; then
8894     val="$define"
8895     sched_yield='sched_yield()'
8896 else
8897     val="$undef"
8898 fi
8899 case "$usethreads" in
8900 $define)
8901         case "$val" in
8902         $define) echo 'sched_yield() found.' >&4        ;;
8903         *)       echo 'sched_yield() NOT found.' >&4    ;;
8904         esac
8905 esac
8906 set d_sched_yield
8907 eval $setvar
8908
8909 : see if pthread_yield exists
8910 set try -DPTHREAD_YIELD
8911 if eval $compile; then
8912     val="$define"
8913     case "$sched_yield" in
8914     '') sched_yield='pthread_yield()' ;;
8915     esac
8916 else
8917     set try -DPTHREAD_YIELD_NULL
8918     if eval $compile; then
8919         val="$define"
8920         case "$sched_yield" in
8921         '') sched_yield='pthread_yield(NULL)' ;;
8922         esac
8923     else
8924         val="$undef"
8925     fi
8926 fi
8927 case "$usethreads" in
8928 $define)
8929         case "$val" in
8930         $define) echo 'pthread_yield() found.' >&4      ;;
8931         *)       echo 'pthread_yield() NOT found.' >&4  ;;
8932         esac
8933         ;;
8934 esac
8935 set d_pthread_yield
8936 eval $setvar
8937
8938 case "$sched_yield" in
8939 '') sched_yield=undef ;;
8940 esac
8941
8942 $rm -f try try.*
8943
8944 : see if this is a pwd.h system
8945 set pwd.h i_pwd
8946 eval $inhdr
8947
8948 case "$i_pwd" in
8949 $define)
8950         xxx=`./findhdr pwd.h`
8951         $cppstdin $cppflags $cppminus < $xxx >$$.h
8952
8953         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
8954                 val="$define"
8955         else
8956                 val="$undef"
8957         fi
8958         set d_pwquota
8959         eval $setvar
8960
8961         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
8962                 val="$define"
8963         else
8964                 val="$undef"
8965         fi
8966         set d_pwage
8967         eval $setvar
8968
8969         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
8970                 val="$define"
8971         else
8972                 val="$undef"
8973         fi
8974         set d_pwchange
8975         eval $setvar
8976
8977         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
8978                 val="$define"
8979         else
8980                 val="$undef"
8981         fi
8982         set d_pwclass
8983         eval $setvar
8984
8985         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
8986                 val="$define"
8987         else
8988                 val="$undef"
8989         fi
8990         set d_pwexpire
8991         eval $setvar
8992
8993         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
8994                 val="$define"
8995         else
8996                 val="$undef"
8997         fi
8998         set d_pwcomment
8999         eval $setvar
9000
9001         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9002                 val="$define"
9003         else
9004                 val="$undef"
9005         fi
9006         set d_pwgecos
9007         eval $setvar
9008
9009         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9010                 val="$define"
9011         else
9012                 val="$undef"
9013         fi
9014         set d_pwpasswd
9015         eval $setvar
9016
9017         $rm -f $$.h
9018         ;;
9019 *)
9020         val="$undef"; 
9021         set d_pwquota; eval $setvar
9022         set d_pwage; eval $setvar
9023         set d_pwchange; eval $setvar
9024         set d_pwclass; eval $setvar
9025         set d_pwexpire; eval $setvar
9026         set d_pwcomment; eval $setvar
9027         set d_pwgecos; eval $setvar
9028         set d_pwpasswd; eval $setvar
9029         ;;
9030 esac
9031
9032 : see if readdir and friends exist
9033 set readdir d_readdir
9034 eval $inlibc
9035 set seekdir d_seekdir
9036 eval $inlibc
9037 set telldir d_telldir
9038 eval $inlibc
9039 set rewinddir d_rewinddir
9040 eval $inlibc
9041
9042 : see if readlink exists
9043 set readlink d_readlink
9044 eval $inlibc
9045
9046 : see if readv exists
9047 set readv d_readv
9048 eval $inlibc
9049
9050 : see if rename exists
9051 set rename d_rename
9052 eval $inlibc
9053
9054 : see if rmdir exists
9055 set rmdir d_rmdir
9056 eval $inlibc
9057
9058 : see if memory.h is available.
9059 val=''
9060 set memory.h val
9061 eval $inhdr
9062
9063 : See if it conflicts with string.h
9064 case "$val" in
9065 $define)
9066         case "$strings" in
9067         '') ;;
9068         *)
9069                 $cppstdin $cppflags $cppminus < $strings > mem.h
9070                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9071                         echo " "
9072                         echo "We won't be including <memory.h>."
9073                         val="$undef"
9074                 fi
9075                 $rm -f mem.h
9076                 ;;
9077         esac
9078 esac
9079 set i_memory
9080 eval $setvar
9081
9082 : can bcopy handle overlapping blocks?
9083 val="$undef"
9084 case "$d_bcopy" in
9085 "$define")
9086         echo " "
9087         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9088         $cat >try.c <<EOCP
9089 #$i_memory I_MEMORY
9090 #$i_stdlib I_STDLIB
9091 #$i_string I_STRING
9092 #$i_unistd I_UNISTD
9093 EOCP
9094         $cat >>try.c <<'EOCP'
9095 #include <stdio.h>
9096 #ifdef I_MEMORY
9097 #  include <memory.h>
9098 #endif
9099 #ifdef I_STDLIB
9100 #  include <stdlib.h>
9101 #endif
9102 #ifdef I_STRING
9103 #  include <string.h>
9104 #else
9105 #  include <strings.h>
9106 #endif
9107 #ifdef I_UNISTD
9108 #  include <unistd.h>  /* Needed for NetBSD */
9109 #endif
9110 int main()
9111 {
9112 char buf[128], abc[128];
9113 char *b;
9114 int len;
9115 int off;
9116 int align;
9117
9118 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9119
9120 for (align = 7; align >= 0; align--) {
9121         for (len = 36; len; len--) {
9122                 b = buf+align;
9123                 bcopy(abc, b, len);
9124                 for (off = 1; off <= len; off++) {
9125                         bcopy(b, b+off, len);
9126                         bcopy(b+off, b, len);
9127                         if (bcmp(b, abc, len))
9128                                 exit(1);
9129                 }
9130         }
9131 }
9132 exit(0);
9133 }
9134 EOCP
9135         set try
9136         if eval $compile_ok; then
9137                 if ./try 2>/dev/null; then
9138                         echo "Yes, it can."
9139                         val="$define"
9140                 else
9141                         echo "It can't, sorry."
9142                         case "$d_memmove" in
9143                         "$define") echo "But that's Ok since you have memmove()." ;;
9144                         esac
9145                 fi
9146         else
9147                 echo "(I can't compile the test program, so we'll assume not...)"
9148                 case "$d_memmove" in
9149                 "$define") echo "But that's Ok since you have memmove()." ;;
9150                 esac
9151         fi
9152         ;;
9153 esac
9154 $rm -f try.* try core
9155 set d_safebcpy
9156 eval $setvar
9157
9158 : can memcpy handle overlapping blocks?
9159 val="$undef"
9160 case "$d_memcpy" in
9161 "$define")
9162         echo " "
9163         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9164         $cat >try.c <<EOCP
9165 #$i_memory I_MEMORY
9166 #$i_stdlib I_STDLIB
9167 #$i_string I_STRING
9168 #$i_unistd I_UNISTD
9169 EOCP
9170         $cat >>try.c <<'EOCP'
9171 #include <stdio.h>
9172 #ifdef I_MEMORY
9173 #  include <memory.h>
9174 #endif
9175 #ifdef I_STDLIB
9176 #  include <stdlib.h>
9177 #endif
9178 #ifdef I_STRING
9179 #  include <string.h>
9180 #else
9181 #  include <strings.h>
9182 #endif
9183 #ifdef I_UNISTD
9184 #  include <unistd.h>  /* Needed for NetBSD */
9185 #endif
9186 int main()
9187 {
9188 char buf[128], abc[128];
9189 char *b;
9190 int len;
9191 int off;
9192 int align;
9193
9194 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9195    try to store the string in read-only memory. */
9196 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9197
9198 for (align = 7; align >= 0; align--) {
9199         for (len = 36; len; len--) {
9200                 b = buf+align;
9201                 memcpy(b, abc, len);
9202                 for (off = 1; off <= len; off++) {
9203                         memcpy(b+off, b, len);
9204                         memcpy(b, b+off, len);
9205                         if (memcmp(b, abc, len))
9206                                 exit(1);
9207                 }
9208         }
9209 }
9210 exit(0);
9211 }
9212 EOCP
9213         set try
9214         if eval $compile_ok; then
9215                 if ./try 2>/dev/null; then
9216                         echo "Yes, it can."
9217                         val="$define"
9218                 else
9219                         echo "It can't, sorry."
9220                         case "$d_memmove" in
9221                         "$define") echo "But that's Ok since you have memmove()." ;;
9222                         esac
9223                 fi
9224         else
9225                 echo "(I can't compile the test program, so we'll assume not...)"
9226                 case "$d_memmove" in
9227                 "$define") echo "But that's Ok since you have memmove()." ;;
9228                 esac
9229         fi
9230         ;;
9231 esac
9232 $rm -f try.* try core
9233 set d_safemcpy
9234 eval $setvar
9235
9236 : can memcmp be trusted to compare relative magnitude?
9237 val="$undef"
9238 case "$d_memcmp" in
9239 "$define")
9240         echo " "
9241         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9242         $cat >try.c <<EOCP
9243 #$i_memory I_MEMORY
9244 #$i_stdlib I_STDLIB
9245 #$i_string I_STRING
9246 #$i_unistd I_UNISTD
9247 EOCP
9248         $cat >>try.c <<'EOCP'
9249 #include <stdio.h>
9250 #ifdef I_MEMORY
9251 #  include <memory.h>
9252 #endif
9253 #ifdef I_STDLIB
9254 #  include <stdlib.h>
9255 #endif
9256 #ifdef I_STRING
9257 #  include <string.h>
9258 #else
9259 #  include <strings.h>
9260 #endif
9261 #ifdef I_UNISTD
9262 #  include <unistd.h>  /* Needed for NetBSD */
9263 #endif
9264 int main()
9265 {
9266 char a = -1;
9267 char b = 0;
9268 if ((a < b) && memcmp(&a, &b, 1) < 0)
9269         exit(1);
9270 exit(0);
9271 }
9272 EOCP
9273         set try
9274         if eval $compile_ok; then
9275                 if ./try 2>/dev/null; then
9276                         echo "Yes, it can."
9277                         val="$define"
9278                 else
9279                         echo "No, it can't (it uses signed chars)."
9280                 fi
9281         else
9282                 echo "(I can't compile the test program, so we'll assume not...)"
9283         fi
9284         ;;
9285 esac
9286 $rm -f try.* try core
9287 set d_sanemcmp
9288 eval $setvar
9289
9290 : see if select exists
9291 set select d_select
9292 eval $inlibc
9293
9294 : see if semctl exists
9295 set semctl d_semctl
9296 eval $inlibc
9297
9298 : see if semget exists
9299 set semget d_semget
9300 eval $inlibc
9301
9302 : see if semop exists
9303 set semop d_semop
9304 eval $inlibc
9305
9306 : see how much of the 'sem*(2)' library is present.
9307 h_sem=true
9308 echo " "
9309 case "$d_semctl$d_semget$d_semop" in
9310 *"$undef"*) h_sem=false;;
9311 esac
9312 case "$osname" in
9313 freebsd)
9314     case "`ipcs 2>&1`" in
9315     "SVID messages"*"not configured"*)
9316         echo "Your $osname does not have the sem*(2) configured." >&4
9317         h_sem=false
9318         val="$undef"
9319         set semctl d_semctl
9320         eval $setvar
9321         set semget d_semget
9322         eval $setvar
9323         set semop d_semop
9324         eval $setvar
9325         ;;
9326     esac
9327     ;;
9328 esac
9329 : we could also check for sys/ipc.h ...
9330 if $h_sem && $test `./findhdr sys/sem.h`; then
9331         echo "You have the full sem*(2) library." >&4
9332         val="$define"
9333 else
9334         echo "You don't have the full sem*(2) library." >&4
9335         val="$undef"
9336 fi
9337 set d_sem
9338 eval $setvar
9339
9340 : see whether sys/sem.h defines union semun
9341 echo " "
9342 $cat > try.c <<'END'
9343 #include <sys/types.h>
9344 #include <sys/ipc.h>
9345 #include <sys/sem.h>
9346 int main () { union semun semun; semun.buf = 0; }
9347 END
9348 set try
9349 if eval $compile; then
9350     echo "You have union semun in <sys/sem.h>." >&4
9351     val="$define"
9352 else
9353     echo "You do not have union semun in <sys/sem.h>." >&4
9354     val="$undef"
9355 fi
9356 $rm -f try try.c try.h
9357 set d_union_semun
9358 eval $setvar
9359
9360 : see how to do semctl IPC_STAT
9361 case "$d_sem" in
9362 $define)
9363     : see whether semctl IPC_STAT can use union semun
9364     echo " "
9365     $cat > try.h <<END
9366 #ifndef S_IRUSR
9367 #   ifdef S_IREAD
9368 #       define S_IRUSR S_IREAD
9369 #       define S_IWUSR S_IWRITE
9370 #       define S_IXUSR S_IEXEC
9371 #   else
9372 #       define S_IRUSR 0400
9373 #       define S_IWUSR 0200
9374 #       define S_IXUSR 0100
9375 #   endif
9376 #   define S_IRGRP (S_IRUSR>>3)
9377 #   define S_IWGRP (S_IWUSR>>3)
9378 #   define S_IXGRP (S_IXUSR>>3)
9379 #   define S_IROTH (S_IRUSR>>6)
9380 #   define S_IWOTH (S_IWUSR>>6)
9381 #   define S_IXOTH (S_IXUSR>>6)
9382 #endif
9383 #ifndef S_IRWXU
9384 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9385 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9386 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9387 #endif
9388 END
9389
9390     $cat > try.c <<END
9391 #include <sys/types.h>
9392 #include <sys/ipc.h>
9393 #include <sys/sem.h>
9394 #include <sys/stat.h>
9395 #include <stdio.h>
9396 #include <errno.h>
9397 #include "try.h"
9398 #ifndef errno
9399 extern int errno;
9400 #endif
9401 #$d_union_semun HAS_UNION_SEMUN
9402 int main() {
9403     union semun
9404 #ifndef HAS_UNION_SEMUN
9405     {
9406         int val;
9407         struct semid_ds *buf;
9408         unsigned short *array;
9409     }
9410 #endif
9411     arg;
9412     int sem, st;
9413
9414 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9415     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9416     if (sem > -1) {
9417         struct semid_ds argbuf;
9418         arg.buf = &argbuf;
9419 #       ifdef IPC_STAT
9420         st = semctl(sem, 0, IPC_STAT, arg);
9421         if (st == 0)
9422             printf("semun\n");
9423         else
9424 #       endif /* IPC_STAT */
9425             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9426 #       ifdef IPC_RMID
9427         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9428 #       endif /* IPC_RMID */
9429             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9430     } else
9431 #endif /* IPC_PRIVATE && ... */
9432         printf("semget failed: errno = %d\n", errno);
9433   return 0;
9434 }
9435 END
9436     val="$undef"
9437     set try
9438     if eval $compile; then
9439         xxx=`./try`
9440         case "$xxx" in
9441         semun) val="$define" ;;
9442         esac
9443     fi
9444     $rm -f try try.c
9445     set d_semctl_semun
9446     eval $setvar
9447     case "$d_semctl_semun" in
9448     $define)
9449         echo "You can use union semun for semctl IPC_STAT." >&4
9450         also='also'
9451         ;;
9452     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9453         also=''
9454         ;;
9455     esac
9456
9457     : see whether semctl IPC_STAT can use struct semid_ds pointer
9458     $cat > try.c <<'END'
9459 #include <sys/types.h>
9460 #include <sys/ipc.h>
9461 #include <sys/sem.h>
9462 #include <sys/stat.h>
9463 #include "try.h"
9464 #include <stdio.h>
9465 #include <errno.h>
9466 #ifndef errno
9467 extern int errno;
9468 #endif
9469 int main() {
9470     struct semid_ds arg;
9471     int sem, st;
9472
9473 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9474     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9475     if (sem > -1) {
9476 #       ifdef IPC_STAT
9477         st = semctl(sem, 0, IPC_STAT, &arg);
9478         if (st == 0)
9479             printf("semid_ds\n");
9480         else
9481 #       endif /* IPC_STAT */
9482             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9483 #       ifdef IPC_RMID
9484         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9485 #       endif /* IPC_RMID */
9486             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9487     } else
9488 #endif /* IPC_PRIVATE && ... */
9489         printf("semget failed: errno = %d\n", errno);
9490
9491     return 0;
9492 }
9493 END
9494     val="$undef"
9495     set try
9496     if eval $compile; then
9497         xxx=`./try`
9498         case "$xxx" in
9499         semid_ds) val="$define" ;;
9500         esac
9501     fi
9502     $rm -f try try.c
9503     set d_semctl_semid_ds
9504     eval $setvar
9505     case "$d_semctl_semid_ds" in
9506     $define)
9507         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9508         ;;
9509     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9510         ;;
9511     esac
9512     $rm -f try.h
9513     ;;
9514 *)  val="$undef"
9515
9516     # We do not have the full sem*(2) library, so assume we can not
9517     # use either.
9518
9519     set d_semctl_semun
9520     eval $setvar
9521
9522     set d_semctl_semid_ds
9523     eval $setvar
9524     ;;
9525 esac
9526
9527 : see if setegid exists
9528 set setegid d_setegid
9529 eval $inlibc
9530
9531 : see if seteuid exists
9532 set seteuid d_seteuid
9533 eval $inlibc
9534
9535 : see if setgrent exists
9536 set setgrent d_setgrent
9537 eval $inlibc
9538
9539 : see if sethostent exists
9540 set sethostent d_sethent
9541 eval $inlibc
9542
9543 : see if setlinebuf exists
9544 set setlinebuf d_setlinebuf
9545 eval $inlibc
9546
9547 : see if setlocale exists
9548 set setlocale d_setlocale
9549 eval $inlibc
9550
9551 : see if setnetent exists
9552 set setnetent d_setnent
9553 eval $inlibc
9554
9555 : see if setprotoent exists
9556 set setprotoent d_setpent
9557 eval $inlibc
9558
9559 : see if setpgid exists
9560 set setpgid d_setpgid
9561 eval $inlibc
9562
9563 : see if setpgrp2 exists
9564 set setpgrp2 d_setpgrp2
9565 eval $inlibc
9566
9567 : see if setpriority exists
9568 set setpriority d_setprior
9569 eval $inlibc
9570
9571 : see if setpwent exists
9572 set setpwent d_setpwent
9573 eval $inlibc
9574
9575 : see if setregid exists
9576 set setregid d_setregid
9577 eval $inlibc
9578 set setresgid d_setresgid
9579 eval $inlibc
9580
9581 : see if setreuid exists
9582 set setreuid d_setreuid
9583 eval $inlibc
9584 set setresuid d_setresuid
9585 eval $inlibc
9586
9587 : see if setrgid exists
9588 set setrgid d_setrgid
9589 eval $inlibc
9590
9591 : see if setruid exists
9592 set setruid d_setruid
9593 eval $inlibc
9594
9595 : see if setservent exists
9596 set setservent d_setsent
9597 eval $inlibc
9598
9599 : see if setsid exists
9600 set setsid d_setsid
9601 eval $inlibc
9602
9603 : see if setvbuf exists
9604 set setvbuf d_setvbuf
9605 eval $inlibc
9606
9607 : see if sfio.h is available
9608 set sfio.h i_sfio
9609 eval $inhdr
9610
9611
9612 : see if sfio library is available
9613 case "$i_sfio" in
9614 $define)
9615         val=''
9616         set sfreserve val
9617         eval $inlibc
9618         ;;
9619 *)
9620         val="$undef"
9621         ;;
9622 esac
9623 : Ok, but do we want to use it.
9624 case "$val" in
9625 $define)
9626         case "$usesfio" in
9627         true|$define|[yY]*) dflt='y';;
9628         *) dflt='n';;
9629         esac
9630         echo "$package can use the sfio library, but it is experimental."
9631         rp="You seem to have sfio available, do you want to try using it?"
9632         . ./myread
9633         case "$ans" in
9634         y|Y) ;;
9635         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
9636                 val="$undef"
9637                 : Remove sfio from list of libraries to use
9638                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
9639                 shift
9640                 libs="$*"
9641                 echo "libs = $libs" >&4
9642                 ;;
9643         esac
9644         ;;
9645 *)      case "$usesfio" in
9646         true|$define|[yY]*)
9647                 echo "Sorry, cannot find sfio on this machine" >&4
9648                 echo "Ignoring your setting of usesfio=$usesfio" >&4
9649                 ;;
9650         esac
9651         ;;
9652 esac
9653 set d_sfio
9654 eval $setvar
9655 case "$d_sfio" in
9656 $define) usesfio='true';;
9657 *) usesfio='false';;
9658 esac
9659
9660 : see if shmctl exists
9661 set shmctl d_shmctl
9662 eval $inlibc
9663
9664 : see if shmget exists
9665 set shmget d_shmget
9666 eval $inlibc
9667
9668 : see if shmat exists
9669 set shmat d_shmat
9670 eval $inlibc
9671 : see what shmat returns
9672 case "$d_shmat" in
9673 "$define")
9674         $cat >shmat.c <<'END'
9675 #include <sys/shm.h>
9676 void *shmat();
9677 END
9678         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
9679                 shmattype='void *'
9680         else
9681                 shmattype='char *'
9682         fi
9683         echo "and it returns ($shmattype)." >&4
9684         : see if a prototype for shmat is available
9685         xxx=`./findhdr sys/shm.h`
9686         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
9687         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
9688                 val="$define"
9689         else
9690                 val="$undef"
9691         fi
9692         $rm -f shmat.[co]
9693         ;;
9694 *)
9695         val="$undef"
9696         ;;
9697 esac
9698 set d_shmatprototype
9699 eval $setvar
9700
9701 : see if shmdt exists
9702 set shmdt d_shmdt
9703 eval $inlibc
9704
9705 : see how much of the 'shm*(2)' library is present.
9706 h_shm=true
9707 echo " "
9708 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
9709 *"$undef"*) h_shm=false;;
9710 esac
9711 case "$osname" in
9712 freebsd)
9713     case "`ipcs 2>&1`" in
9714     "SVID shared memory"*"not configured"*)
9715         echo "Your $osname does not have the shm*(2) configured." >&4
9716         h_shm=false
9717         val="$undef"
9718         set shmctl d_shmctl
9719         evat $setvar
9720         set shmget d_shmget
9721         evat $setvar
9722         set shmat d_shmat
9723         evat $setvar
9724         set shmdt d_shmdt
9725         evat $setvar
9726         ;;
9727     esac
9728     ;;
9729 esac
9730 : we could also check for sys/ipc.h ...
9731 if $h_shm && $test `./findhdr sys/shm.h`; then
9732         echo "You have the full shm*(2) library." >&4
9733         val="$define"
9734 else
9735         echo "You don't have the full shm*(2) library." >&4
9736         val="$undef"
9737 fi
9738 set d_shm
9739 eval $setvar
9740
9741 echo " "
9742 : see if we have sigaction
9743 if set sigaction val -f d_sigaction; eval $csym; $val; then
9744         echo 'sigaction() found.' >&4
9745         $cat > try.c <<'EOP'
9746 #include <stdio.h>
9747 #include <sys/types.h>
9748 #include <signal.h>
9749 int main()
9750 {
9751     struct sigaction act, oact;
9752 }
9753 EOP
9754         set try
9755         if eval $compile_ok; then
9756                 val="$define"
9757         else
9758                 echo "But you don't seem to have a useable struct sigaction." >&4
9759                 val="$undef"
9760         fi
9761 else
9762         echo 'sigaction NOT found.' >&4
9763         val="$undef"
9764 fi
9765 set d_sigaction; eval $setvar
9766 $rm -f try try$_o try.c
9767
9768 : see if sigsetjmp exists
9769 echo " "
9770 case "$d_sigsetjmp" in
9771 '')
9772         $cat >try.c <<'EOP'
9773 #include <setjmp.h>
9774 sigjmp_buf env;
9775 int set = 1;
9776 int main()
9777 {
9778         if (sigsetjmp(env,1))
9779                 exit(set);
9780         set = 0;
9781         siglongjmp(env, 1);
9782         exit(1);
9783 }
9784 EOP
9785         set try
9786         if eval $compile; then
9787                 if ./try >/dev/null 2>&1; then
9788                         echo "POSIX sigsetjmp found." >&4
9789                         val="$define"
9790                 else
9791                         $cat >&4 <<EOM
9792 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
9793 I'll ignore them.
9794 EOM
9795                         val="$undef"
9796                 fi
9797         else
9798                 echo "sigsetjmp not found." >&4
9799                 val="$undef"
9800         fi
9801         ;;
9802 *) val="$d_sigsetjmp"
9803         case "$d_sigsetjmp" in
9804         $define) echo "POSIX sigsetjmp found." >&4;;
9805         $undef) echo "sigsetjmp not found." >&4;;
9806         esac
9807         ;;
9808 esac
9809 set d_sigsetjmp
9810 eval $setvar
9811 $rm -f try.c try
9812
9813 : see if stat knows about block sizes
9814 echo " "
9815 set d_statblks stat st_blocks $i_sysstat sys/stat.h
9816 eval $hasfield
9817
9818 : see if _ptr and _cnt from stdio act std
9819 echo " "
9820 if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
9821         echo "(Looks like you have stdio.h from Linux.)"
9822         case "$stdio_ptr" in
9823         '') stdio_ptr='((fp)->_IO_read_ptr)'
9824                 ptr_lval=$define
9825                 ;;
9826         *)      ptr_lval=$d_stdio_ptr_lval;;
9827         esac
9828         case "$stdio_cnt" in
9829         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
9830                 cnt_lval=$undef
9831                 ;;
9832         *)      cnt_lval=$d_stdio_cnt_lval;;
9833         esac
9834         case "$stdio_base" in
9835         '') stdio_base='((fp)->_IO_read_base)';;
9836         esac
9837         case "$stdio_bufsiz" in
9838         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
9839         esac
9840 else
9841         case "$stdio_ptr" in
9842         '') stdio_ptr='((fp)->_ptr)'
9843                 ptr_lval=$define
9844                 ;;
9845         *)      ptr_lval=$d_stdio_ptr_lval;;
9846         esac
9847         case "$stdio_cnt" in
9848         '') stdio_cnt='((fp)->_cnt)'
9849                 cnt_lval=$define
9850                 ;;
9851         *)      cnt_lval=$d_stdio_cnt_lval;;
9852         esac
9853         case "$stdio_base" in
9854         '') stdio_base='((fp)->_base)';;
9855         esac
9856         case "$stdio_bufsiz" in
9857         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
9858         esac
9859 fi
9860 : test whether _ptr and _cnt really work
9861 echo "Checking how std your stdio is..." >&4
9862 $cat >try.c <<EOP
9863 #include <stdio.h>
9864 #define FILE_ptr(fp)    $stdio_ptr
9865 #define FILE_cnt(fp)    $stdio_cnt
9866 int main() {
9867         FILE *fp = fopen("try.c", "r");
9868         char c = getc(fp);
9869         if (
9870                 18 <= FILE_cnt(fp) &&
9871                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
9872         )
9873                 exit(0);
9874         exit(1);
9875 }
9876 EOP
9877 val="$undef"
9878 set try
9879 if eval $compile; then
9880         if ./try; then
9881                 echo "Your stdio acts pretty std."
9882                 val="$define"
9883         else
9884                 echo "Your stdio isn't very std."
9885         fi
9886 else
9887         echo "Your stdio doesn't appear very std."
9888 fi
9889 $rm -f try.c try
9890 set d_stdstdio
9891 eval $setvar
9892
9893 : Can _ptr be used as an lvalue?
9894 case "$d_stdstdio$ptr_lval" in
9895 $define$define) val=$define ;;
9896 *) val=$undef ;;
9897 esac
9898 set d_stdio_ptr_lval
9899 eval $setvar
9900
9901 : Can _cnt be used as an lvalue?
9902 case "$d_stdstdio$cnt_lval" in
9903 $define$define) val=$define ;;
9904 *) val=$undef ;;
9905 esac
9906 set d_stdio_cnt_lval
9907 eval $setvar
9908
9909 : see if _base is also standard
9910 val="$undef"
9911 case "$d_stdstdio" in
9912 $define)
9913         $cat >try.c <<EOP
9914 #include <stdio.h>
9915 #define FILE_base(fp)   $stdio_base
9916 #define FILE_bufsiz(fp) $stdio_bufsiz
9917 int main() {
9918         FILE *fp = fopen("try.c", "r");
9919         char c = getc(fp);
9920         if (
9921                 19 <= FILE_bufsiz(fp) &&
9922                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
9923         )
9924                 exit(0);
9925         exit(1);
9926 }
9927 EOP
9928         set try
9929         if eval $compile; then
9930                 if ./try; then
9931                         echo "And its _base field acts std."
9932                         val="$define"
9933                 else
9934                         echo "But its _base field isn't std."
9935                 fi
9936         else
9937                 echo "However, it seems to be lacking the _base field."
9938         fi
9939         $rm -f try.c try
9940         ;;
9941 esac
9942 set d_stdiobase
9943 eval $setvar
9944
9945 : see if strcoll exists
9946 set strcoll d_strcoll
9947 eval $inlibc
9948
9949 : check for structure copying
9950 echo " "
9951 echo "Checking to see if your C compiler can copy structs..." >&4
9952 $cat >try.c <<'EOCP'
9953 int main()
9954 {
9955         struct blurfl {
9956                 int dyick;
9957         } foo, bar;
9958
9959         foo = bar;
9960 }
9961 EOCP
9962 if $cc -c try.c >/dev/null 2>&1 ; then
9963         val="$define"
9964         echo "Yup, it can."
9965 else
9966         val="$undef"
9967         echo "Nope, it can't."
9968 fi
9969 set d_strctcpy
9970 eval $setvar
9971 $rm -f try.*
9972
9973 : see if strerror and/or sys_errlist[] exist
9974 echo " "
9975 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
9976     if set strerror val -f d_strerror; eval $csym; $val; then
9977                 echo 'strerror() found.' >&4
9978                 d_strerror="$define"
9979                 d_strerrm='strerror(e)'
9980                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
9981                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
9982                         d_syserrlst="$define"
9983                 else
9984                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
9985                         d_syserrlst="$undef"
9986                 fi
9987     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
9988                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
9989                 echo 'strerror() found in string header.' >&4
9990                 d_strerror="$define"
9991                 d_strerrm='strerror(e)'
9992                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
9993                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
9994                                 d_syserrlst="$define"
9995                 else
9996                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
9997                         d_syserrlst="$undef"
9998                 fi
9999     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10000                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10001                 d_strerror="$undef"
10002                 d_syserrlst="$define"
10003                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10004     else
10005                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10006                 d_strerror="$undef"
10007                 d_syserrlst="$undef"
10008                 d_strerrm='"unknown"'
10009     fi
10010 fi
10011
10012 : see if strtod exists
10013 set strtod d_strtod
10014 eval $inlibc
10015
10016 : see if strtol exists
10017 set strtol d_strtol
10018 eval $inlibc
10019
10020 : see if strtoul exists
10021 set strtoul d_strtoul
10022 eval $inlibc
10023
10024 : see if strxfrm exists
10025 set strxfrm d_strxfrm
10026 eval $inlibc
10027
10028 : see if symlink exists
10029 set symlink d_symlink
10030 eval $inlibc
10031
10032 : see if syscall exists
10033 set syscall d_syscall
10034 eval $inlibc
10035
10036 : see if sysconf exists
10037 set sysconf d_sysconf
10038 eval $inlibc
10039
10040 : see if system exists
10041 set system d_system
10042 eval $inlibc
10043
10044 : see if tcgetpgrp exists
10045 set tcgetpgrp d_tcgetpgrp
10046 eval $inlibc
10047
10048 : see if tcsetpgrp exists
10049 set tcsetpgrp d_tcsetpgrp
10050 eval $inlibc
10051
10052 : see if sys/types.h has to be included
10053 set sys/types.h i_systypes
10054 eval $inhdr
10055
10056 : see if prototype for telldir is available
10057 echo " "
10058 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10059 eval $hasproto
10060
10061 : define an is-a-typedef? function
10062 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10063 case "$inclist" in
10064 "") inclist="sys/types.h";;
10065 esac;
10066 eval "varval=\$$var";
10067 case "$varval" in
10068 "")
10069         $rm -f temp.c;
10070         for inc in $inclist; do
10071                 echo "#include <$inc>" >>temp.c;
10072         done;
10073         echo "#ifdef $type" >> temp.c;
10074         echo "printf(\"We have $type\");" >> temp.c;
10075         echo "#endif" >> temp.c;
10076         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10077         if $contains $type temp.E >/dev/null 2>&1; then
10078                 eval "$var=\$type";
10079         else
10080                 eval "$var=\$def";
10081         fi;
10082         $rm -f temp.?;;
10083 *) eval "$var=\$varval";;
10084 esac'
10085
10086 : define an is-a-typedef? function that prompts if the type is not available.
10087 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10088 case "$inclist" in
10089 "") inclist="sys/types.h";;
10090 esac;
10091 eval "varval=\$$var";
10092 case "$varval" in
10093 "")
10094         $rm -f temp.c;
10095         for inc in $inclist; do
10096                 echo "#include <$inc>" >>temp.c;
10097         done;
10098         echo "#ifdef $type" >> temp.c;
10099         echo "printf(\"We have $type\");" >> temp.c;
10100         echo "#endif" >> temp.c;
10101         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10102         echo " " ;
10103         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10104         if $contains $type temp.E >/dev/null 2>&1; then
10105                 echo "$type found." >&4;
10106                 eval "$var=\$type";
10107         else
10108                 echo "$type NOT found." >&4;
10109                 dflt="$def";
10110                 . ./myread ;
10111                 eval "$var=\$ans";
10112         fi;
10113         $rm -f temp.?;;
10114 *) eval "$var=\$varval";;
10115 esac'
10116
10117 : see if this is a sys/times.h system
10118 set sys/times.h i_systimes
10119 eval $inhdr
10120
10121 : see if times exists
10122 echo " "
10123 if set times val -f d_times; eval $csym; $val; then
10124         echo 'times() found.' >&4
10125         d_times="$define"
10126         inc=''
10127         case "$i_systimes" in
10128         "$define") inc='sys/times.h';;
10129         esac
10130         rp="What is the type returned by times() on this system?"
10131         set clock_t clocktype long stdio.h sys/types.h $inc
10132         eval $typedef_ask
10133 else
10134         echo 'times() NOT found, hope that will do.' >&4
10135         d_times="$undef"
10136         clocktype='int'
10137 fi
10138
10139 : see if truncate exists
10140 set truncate d_truncate
10141 eval $inlibc
10142
10143 : see if tzname[] exists
10144 echo " "
10145 if set tzname val -a d_tzname; eval $csym; $val; then
10146         val="$define"
10147         echo 'tzname[] found.' >&4
10148 else
10149         val="$undef"
10150         echo 'tzname[] NOT found.' >&4
10151 fi
10152 set d_tzname
10153 eval $setvar
10154
10155 : see if umask exists
10156 set umask d_umask
10157 eval $inlibc
10158
10159 : backward compatibility for d_hvfork
10160 if test X$d_hvfork != X; then
10161         d_vfork="$d_hvfork"
10162         d_hvfork=''
10163 fi
10164 : see if there is a vfork
10165 val=''
10166 set vfork val
10167 eval $inlibc
10168
10169 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10170 : perl on Solaris 2.x, and probably elsewhere.
10171 case "$val" in
10172 $define)
10173         echo " "
10174         case "$usevfork" in
10175         false) dflt='n';;
10176         *) dflt='y';;
10177         esac
10178         cat <<'EOM'
10179  
10180 Perl can only use a vfork() that doesn't suffer from strict
10181 restrictions on calling functions or modifying global data in
10182 the child.  For example, glibc-2.1 contains such a vfork()
10183 that is unsuitable.  If your system provides a proper fork()
10184 call, chances are that you do NOT want perl to use vfork().
10185
10186 EOM
10187         rp="Do you still want to use vfork()?"
10188         . ./myread
10189         case "$ans" in
10190         y|Y) ;;
10191         *)
10192                 echo "Ok, we won't use vfork()."
10193                 val="$undef"
10194                 ;;
10195         esac
10196         ;;
10197 esac
10198 set d_vfork
10199 eval $setvar
10200 case "$d_vfork" in
10201 $define) usevfork='true';;
10202 *) usevfork='false';;
10203 esac
10204
10205 : see if this is an sysdir system
10206 set sys/dir.h i_sysdir
10207 eval $inhdr
10208
10209 : see if this is an sysndir system
10210 set sys/ndir.h i_sysndir
10211 eval $inhdr
10212
10213 : see if closedir exists
10214 set closedir d_closedir
10215 eval $inlibc
10216
10217 case "$d_closedir" in
10218 "$define")
10219         echo " "
10220         echo "Checking whether closedir() returns a status..." >&4
10221         cat > closedir.c <<EOM
10222 #$i_dirent I_DIRENT             /**/
10223 #$i_sysdir I_SYS_DIR            /**/
10224 #$i_sysndir I_SYS_NDIR          /**/
10225 #$i_systypes I_SYS_TYPES        /**/
10226
10227 #if defined(I_SYS_TYPES)
10228 #include <sys/types.h>
10229 #endif
10230 #if defined(I_DIRENT)
10231 #include <dirent.h>
10232 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10233 #include <sys/dir.h>
10234 #endif
10235 #else
10236 #ifdef I_SYS_NDIR
10237 #include <sys/ndir.h>
10238 #else
10239 #ifdef I_SYS_DIR
10240 #ifdef hp9000s500
10241 #include <ndir.h>       /* may be wrong in the future */
10242 #else
10243 #include <sys/dir.h>
10244 #endif
10245 #endif
10246 #endif
10247 #endif 
10248 int main() { return closedir(opendir(".")); }
10249 EOM
10250         set closedir
10251         if eval $compile_ok; then
10252                 if ./closedir > /dev/null 2>&1 ; then
10253                         echo "Yes, it does."
10254                         val="$undef"
10255                 else
10256                         echo "No, it doesn't."
10257                         val="$define"
10258                 fi
10259         else
10260                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10261                 val="$define"
10262         fi
10263         ;;
10264 *)
10265         val="$undef";
10266         ;;
10267 esac
10268 set d_void_closedir
10269 eval $setvar
10270 $rm -f closedir*
10271 : check for volatile keyword
10272 echo " "
10273 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10274 $cat >try.c <<'EOCP'
10275 int main()
10276 {
10277         typedef struct _goo_struct goo_struct;
10278         goo_struct * volatile goo = ((goo_struct *)0);
10279         struct _goo_struct {
10280                 long long_int;
10281                 int reg_int;
10282                 char char_var;
10283         };
10284         typedef unsigned short foo_t;
10285         char *volatile foo;
10286         volatile int bar;
10287         volatile foo_t blech;
10288         foo = foo;
10289 }
10290 EOCP
10291 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10292         val="$define"
10293         echo "Yup, it does."
10294 else
10295         val="$undef"
10296         echo "Nope, it doesn't."
10297 fi
10298 set d_volatile
10299 eval $setvar
10300 $rm -f try.*
10301
10302 : see if there is a wait4
10303 set wait4 d_wait4
10304 eval $inlibc
10305
10306 : see if waitpid exists
10307 set waitpid d_waitpid
10308 eval $inlibc
10309
10310 : see if wcstombs exists
10311 set wcstombs d_wcstombs
10312 eval $inlibc
10313
10314 : see if wctomb exists
10315 set wctomb d_wctomb
10316 eval $inlibc
10317
10318 : see if writev exists
10319 set writev d_writev
10320 eval $inlibc
10321
10322 : preserve RCS keywords in files with variable substitution, grrr
10323 Date='$Date'
10324 Id='$Id'
10325 Log='$Log'
10326 RCSfile='$RCSfile'
10327 Revision='$Revision'
10328
10329 case "$crosscompile" in
10330 ''|[nN]*) crosscompile="$undef" ;;
10331 esac
10332
10333 case "$osname" in
10334 next|rhapsody) multiarch="$define" ;;
10335 esac
10336 case "$multiarch" in
10337 ''|[nN]*) multiarch="$undef" ;;
10338 esac
10339
10340 : check for alignment requirements
10341 echo " "
10342 case "$crosscompile$multiarch" in
10343 *$define*)
10344         $cat <<EOM
10345 You seem to be either cross-compiling or doing a multiarchitecture build,
10346 skipping the memory alignment check.
10347
10348 EOM
10349         case "$alignbytes" in
10350         '') alignbytes=8 ;;
10351         esac
10352         ;;
10353 *)
10354         case "$alignbytes" in
10355         '') echo "Checking alignment constraints..." >&4
10356                 $cat >try.c <<'EOCP'
10357 struct foobar {
10358         char foo;
10359         double bar;
10360 } try_algn;
10361 int main()
10362 {
10363         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10364 }
10365 EOCP
10366                 set try
10367                 if eval $compile_ok; then
10368                         dflt=`./try`
10369                 else
10370                         dflt='8'
10371                         echo "(I can't seem to compile the test program...)"
10372                 fi
10373                 ;;
10374         *) dflt="$alignbytes"
10375                 ;;
10376         esac
10377         rp="Doubles must be aligned on a how-many-byte boundary?"
10378         . ./myread
10379         alignbytes="$ans"
10380         $rm -f try.c try
10381         ;;
10382 esac
10383
10384
10385 : check for ordering of bytes in a long
10386 echo " "
10387 case "$crosscompile$multiarch" in
10388 *$define*)
10389         $cat <<EOM
10390 You seem to be either cross-compiling or doing a multiarchitecture build,
10391 skipping the byteorder check.
10392
10393 EOM
10394         byteorder=''
10395         ;;
10396 *)
10397         case "$byteorder" in
10398         '')
10399                 $cat <<'EOM'
10400 In the following, larger digits indicate more significance.  A big-endian
10401 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10402 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10403 machines may have weird orders like 3412.  A Cray will report 87654321. If
10404 the test program works the default is probably right.
10405 I'm now running the test program...
10406 EOM
10407                 $cat >try.c <<'EOCP'
10408 #include <stdio.h>
10409 int main()
10410 {
10411         int i;
10412         union {
10413                 unsigned long l;
10414                 char c[sizeof(long)];
10415         } u;
10416
10417         if (sizeof(long) > 4)
10418                 u.l = (0x08070605L << 32) | 0x04030201L;
10419         else
10420                 u.l = 0x04030201L;
10421         for (i = 0; i < sizeof(long); i++)
10422                 printf("%c", u.c[i]+'0');
10423         printf("\n");
10424         exit(0);
10425 }
10426 EOCP
10427                 xxx_prompt=y
10428                 set try
10429                 if eval $compile && ./try > /dev/null; then
10430                         dflt=`./try`
10431                         case "$dflt" in
10432                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10433                                 echo "(The test program ran ok.)"
10434                                 echo "byteorder=$dflt"
10435                                 xxx_prompt=n
10436                         ;;
10437                         ????|????????) echo "(The test program ran ok.)" ;;
10438                         *) echo "(The test program didn't run right for some reason.)" ;;
10439                         esac
10440                 else
10441                         dflt='4321'
10442                         cat <<'EOM'
10443 (I can't seem to compile the test program.  Guessing big-endian...)
10444 EOM
10445                 fi
10446                 case "$xxx_prompt" in
10447                 y)
10448                         rp="What is the order of bytes in a long?"
10449                         . ./myread
10450                         byteorder="$ans"
10451                         ;;
10452                 *)      byteorder=$dflt
10453                         ;;
10454                 esac
10455                 ;;
10456         esac
10457         $rm -f try.c try
10458         ;;
10459 esac
10460
10461
10462 : how do we catenate cpp tokens here?
10463 echo " "
10464 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10465 $cat >cpp_stuff.c <<'EOCP'
10466 #define RCAT(a,b)a/**/b
10467 #define ACAT(a,b)a ## b
10468 RCAT(Rei,ser)
10469 ACAT(Cir,cus)
10470 EOCP
10471 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10472 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10473         echo "Oh!  Smells like ANSI's been here." >&4
10474         echo "We can catify or stringify, separately or together!"
10475         cpp_stuff=42
10476 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10477         echo "Ah, yes!  The good old days!" >&4
10478         echo "However, in the good old days we don't know how to stringify and"
10479         echo "catify at the same time."
10480         cpp_stuff=1
10481 else
10482         $cat >&4 <<EOM
10483 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10484 to have to edit the values of CAT[2-5] in config.h...
10485 EOM
10486         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10487 fi
10488 $rm -f cpp_stuff.*
10489
10490 : see if this is a db.h system
10491 set db.h i_db
10492 eval $inhdr
10493
10494 case "$i_db" in
10495 $define)
10496         : Check db version.
10497         echo " "
10498         echo "Checking Berkeley DB version ..." >&4
10499         $cat >try.c <<EOCP
10500 #$d_const HASCONST
10501 #ifndef HASCONST
10502 #define const
10503 #endif
10504 #include <sys/types.h>
10505 #include <stdio.h>
10506 #include <db.h>
10507 int main()
10508 {
10509 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10510     int Major, Minor, Patch ;
10511     unsigned long Version ;
10512     (void)db_version(&Major, &Minor, &Patch) ;
10513     printf("You have Berkeley DB Version 2 or greater\n");
10514
10515     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10516                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10517     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10518                 Major, Minor, Patch) ;
10519
10520     /* check that db.h & libdb are compatible */
10521     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
10522         printf("db.h and libdb are incompatible\n") ;
10523         exit(3);        
10524     }
10525
10526     printf("db.h and libdb are compatible\n") ;
10527
10528     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
10529                 + DB_VERSION_PATCH ;
10530
10531     /* needs to be >= 2.3.4 */
10532     if (Version < 2003004) {
10533     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
10534         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
10535         exit(2);        
10536     }
10537
10538     exit(0);
10539 #else
10540 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
10541     printf("You have Berkeley DB Version 1\n");
10542     exit(0);    /* DB version < 2: the coast is clear. */
10543 #else
10544     exit(1);    /* <db.h> not Berkeley DB? */
10545 #endif
10546 #endif
10547 }
10548 EOCP
10549         set try
10550         if eval $compile && ./try; then
10551                 echo 'Looks OK.' >&4
10552         else
10553                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
10554                 i_db=$undef
10555                 case " $libs " in
10556                 *"-ldb "*)
10557                         : Remove db from list of libraries to use
10558                         echo "Removing unusable -ldb from library list" >&4
10559                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
10560                         shift
10561                         libs="$*"
10562                         echo "libs = $libs" >&4
10563                         ;;
10564                 esac
10565         fi
10566         $rm -f try.*
10567         ;;
10568 esac
10569
10570 case "$i_db" in
10571 define)
10572         : Check the return type needed for hash 
10573         echo " "
10574         echo "Checking return type needed for hash for Berkeley DB ..." >&4
10575         $cat >try.c <<EOCP
10576 #$d_const HASCONST
10577 #ifndef HASCONST
10578 #define const
10579 #endif
10580 #include <sys/types.h>
10581 #include <db.h>
10582
10583 #ifndef DB_VERSION_MAJOR
10584 u_int32_t hash_cb (ptr, size)
10585 const void *ptr;
10586 size_t size;
10587 {
10588 }
10589 HASHINFO info;
10590 int main()
10591 {
10592         info.hash = hash_cb;
10593 }
10594 #endif
10595 EOCP
10596         if $cc $ccflags -c try.c >try.out 2>&1 ; then
10597                 if $contains warning try.out >>/dev/null 2>&1 ; then
10598                         db_hashtype='int'
10599                 else
10600                         db_hashtype='u_int32_t'
10601                 fi
10602         else
10603                 : XXX Maybe we should just give up here.
10604                 db_hashtype=u_int32_t
10605                 $cat try.out >&4
10606                 echo "Help:  I can't seem to compile the db test program." >&4
10607                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
10608         fi
10609         $rm -f try.*
10610         echo "Your version of Berkeley DB uses $db_hashtype for hash."
10611         ;;
10612 *)      db_hashtype=u_int32_t
10613         ;;
10614 esac
10615 case "$i_db" in
10616 define)
10617         : Check the return type needed for prefix 
10618         echo " "
10619         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
10620         cat >try.c <<EOCP
10621 #$d_const HASCONST
10622 #ifndef HASCONST
10623 #define const
10624 #endif
10625 #include <sys/types.h>
10626 #include <db.h>
10627
10628 #ifndef DB_VERSION_MAJOR
10629 size_t prefix_cb (key1, key2)
10630 const DBT *key1;
10631 const DBT *key2;
10632 {
10633 }
10634 BTREEINFO info;
10635 int main()
10636 {
10637         info.prefix = prefix_cb;
10638 }
10639 #endif
10640 EOCP
10641         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
10642                 if $contains warning try.out >>/dev/null 2>&1 ; then
10643                         db_prefixtype='int'
10644                 else
10645                         db_prefixtype='size_t'
10646                 fi
10647         else
10648                 db_prefixtype='size_t'
10649                 : XXX Maybe we should just give up here.
10650                 $cat try.out >&4
10651                 echo "Help:  I can't seem to compile the db test program." >&4
10652                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
10653         fi
10654         $rm -f try.*
10655         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
10656         ;;
10657 *)      db_prefixtype='size_t'
10658         ;;
10659 esac
10660
10661 : check for void type
10662 echo " "
10663 echo "Checking to see how well your C compiler groks the void type..." >&4
10664 case "$voidflags" in
10665 '')
10666         $cat >try.c <<'EOCP'
10667 #if TRY & 1
10668 void sub() {
10669 #else
10670 sub() {
10671 #endif
10672         extern void moo();      /* function returning void */
10673         void (*goo)();          /* ptr to func returning void */
10674 #if TRY & 8
10675         void *hue;              /* generic ptr */
10676 #endif
10677 #if TRY & 2
10678         void (*foo[10])();
10679 #endif
10680
10681 #if TRY & 4
10682         if(goo == moo) {
10683                 exit(0);
10684         }
10685 #endif
10686         exit(0);
10687 }
10688 int main() { sub(); }
10689 EOCP
10690         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
10691                 voidflags=$defvoidused
10692         echo "Good.  It appears to support void to the level $package wants.">&4
10693                 if $contains warning .out >/dev/null 2>&1; then
10694                         echo "However, you might get some warnings that look like this:"
10695                         $cat .out
10696                 fi
10697         else
10698 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
10699                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
10700                         echo "It supports 1..."
10701                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
10702                                 echo "It also supports 2..."
10703                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
10704                                         voidflags=7
10705                                         echo "And it supports 4 but not 8 definitely."
10706                                 else
10707                                         echo "It doesn't support 4..."
10708                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
10709                                                 voidflags=11
10710                                                 echo "But it supports 8."
10711                                         else
10712                                                 voidflags=3
10713                                                 echo "Neither does it support 8."
10714                                         fi
10715                                 fi
10716                         else
10717                                 echo "It does not support 2..."
10718                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
10719                                         voidflags=13
10720                                         echo "But it supports 4 and 8."
10721                                 else
10722                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
10723                                                 voidflags=5
10724                                                 echo "And it supports 4 but has not heard about 8."
10725                                         else
10726                                                 echo "However it supports 8 but not 4."
10727                                         fi
10728                                 fi
10729                         fi
10730                 else
10731                         echo "There is no support at all for void."
10732                         voidflags=0
10733                 fi
10734         fi
10735 esac
10736 case "$voidflags" in
10737 "$defvoidused") ;;
10738 *)      $cat >&4 <<'EOM'
10739   Support flag bits are:
10740     1: basic void declarations.
10741     2: arrays of pointers to functions returning void.
10742     4: operations between pointers to and addresses of void functions.
10743     8: generic void pointers.
10744 EOM
10745         dflt="$voidflags";
10746         rp="Your void support flags add up to what?"
10747         . ./myread
10748         voidflags="$ans"
10749         ;;
10750 esac
10751 $rm -f try.* .out
10752
10753
10754 : How can we generate normalized random numbers ?
10755 echo " "
10756 echo "Looking for a random number function..." >&4
10757 case "$randfunc" in
10758 '')
10759         if set drand48 val -f; eval $csym; $val; then
10760                 dflt="drand48"
10761                 echo "Good, found drand48()." >&4
10762         elif set random val -f; eval $csym; $val; then
10763                 dflt="random"
10764                 echo "OK, found random()." >&4
10765         else
10766                 dflt="rand"
10767                 echo "Yick, looks like I have to use rand()." >&4
10768         fi
10769         echo " "
10770         ;;
10771 *)
10772         dflt="$randfunc"
10773         ;;
10774 esac
10775 cont=true
10776
10777 case "$ccflags" in
10778 *-Dmy_rand=*|*-Dmy_srand=*)
10779         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
10780         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
10781         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
10782         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
10783         ;;
10784 esac
10785
10786 while $test "$cont"; do
10787         rp="Use which function to generate random numbers?"
10788         . ./myread
10789         if $test "$ans" = "$dflt"; then
10790                 : null
10791         else
10792                 randbits=''
10793         fi
10794         randfunc="$ans"
10795         if set $ans val -f; eval $csym; $val; then
10796                 cont=''
10797         else
10798                 dflt=y
10799                 rp="I cannot find function $ans. Use that name anyway?"
10800                 . ./myread
10801                 dflt=rand
10802                 case "$ans" in
10803                         [yY]*) cont='';;
10804                 esac
10805         fi
10806         case "$cont" in
10807         '')
10808                 case "$randfunc" in
10809                 drand48)
10810                         drand01="drand48()"
10811                         seedfunc="srand48"
10812                         randbits=48
10813                         randseedtype=long
10814                         ;;
10815                 rand|random)
10816                         case "$randbits" in
10817                         '')
10818 echo "Checking to see how many bits your $randfunc() function produces..." >&4
10819                                 $cat >try.c <<EOCP
10820 #$i_unistd I_UNISTD
10821 #$i_stdlib I_STDLIB
10822 #include <stdio.h>
10823 #ifdef I_UNISTD
10824 #  include <unistd.h>
10825 #endif
10826 #ifdef I_STDLIB
10827 #  include <stdlib.h>
10828 #endif
10829 int main()
10830 {
10831         register int i;
10832         register unsigned long tmp;
10833         register unsigned long max = 0L;
10834
10835         for (i = 1000; i; i--) {
10836                 tmp = (unsigned long) $randfunc();
10837                 if (tmp > max) max = tmp;
10838         }
10839         for (i = 0; max; i++)
10840                 max /= 2;
10841         printf("%d\n",i);
10842 }
10843 EOCP
10844                                 set try
10845                                 if eval $compile_ok; then
10846                                         dflt=`try`
10847                                 else
10848                                         dflt='?'
10849                                         echo "(I can't seem to compile the test program...)"
10850                                 fi
10851                                 ;;
10852                         *)
10853                                 dflt="$randbits"
10854                                 ;;
10855                         esac
10856                         rp="How many bits does your $randfunc() function produce?"
10857                         . ./myread
10858                         randbits="$ans"
10859                         $rm -f try.c try
10860                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10861                         seedfunc="s$randfunc"
10862                         randseedtype=unsigned
10863                         ;;
10864                 *)
10865                         dflt="31"
10866                         rp="How many bits does your $randfunc() function produce?"
10867                         . ./myread
10868                         randbits="$ans"
10869                         seedfunc="s$randfunc"
10870                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10871                         if set $seedfunc val -f; eval $csym; $val; then
10872                                 echo "(Using $seedfunc() to seed random generator)"
10873                         else
10874                                 echo "(Warning: no $seedfunc() to seed random generator)"
10875                                 seedfunc=rand
10876                         fi
10877                         randseedtype=unsigned
10878                         ;;
10879                 esac
10880                 ;;
10881         esac
10882 done
10883
10884 echo " "
10885 echo "Determining whether or not we are on an EBCDIC system..." >&4
10886 $cat >tebcdic.c <<'EOM'
10887 int main()
10888 {
10889   if ('M'==0xd4) return 0;
10890   return 1;
10891 }
10892 EOM
10893
10894 val=$undef
10895 set tebcdic
10896 if eval $compile_ok; then
10897         if ./tebcdic; then
10898                 echo "You have EBCDIC." >&4
10899                 val="$define"
10900         else
10901                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin." >&4
10902         fi
10903 else
10904         echo "I'm unable to compile the test program." >&4
10905         echo "I'll assume ASCII or some ISO Latin." >&4
10906 fi
10907 $rm -f tebcdic.c tebcdic
10908 set ebcdic
10909 eval $setvar
10910
10911 : see what type file positions are declared as in the library
10912 rp="What is the type for file position used by fsetpos()?"
10913 set fpos_t fpostype long stdio.h sys/types.h
10914 eval $typedef_ask
10915
10916 : Store the full pathname to the ar program for use in the C program
10917 : Respect a hint or command line value for full_ar.
10918 case "$full_ar" in
10919 '') full_ar=$ar ;;
10920 esac
10921
10922 : Store the full pathname to the sed program for use in the C program
10923 full_sed=$sed
10924
10925 : see what type gids are declared as in the kernel
10926 echo " "
10927 echo "Looking for the type for group ids returned by getgid()."
10928 set gid_t gidtype xxx stdio.h sys/types.h
10929 eval $typedef
10930 case "$gidtype" in
10931 xxx)
10932         xxx=`./findhdr sys/user.h`
10933         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
10934         case $1 in
10935         unsigned) dflt="$1 $2" ;;
10936         *) dflt="$1" ;;
10937         esac
10938         ;;
10939 *) dflt="$gidtype";;
10940 esac
10941 case "$gidtype" in
10942 gid_t) echo "gid_t found." ;;
10943 *)      rp="What is the type for group ids returned by getgid()?"
10944         . ./myread
10945         gidtype="$ans"
10946         ;;
10947 esac
10948
10949 : see if getgroups exists
10950 set getgroups d_getgrps
10951 eval $inlibc
10952
10953 : see if setgroups exists
10954 set setgroups d_setgrps
10955 eval $inlibc
10956
10957
10958 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
10959 echo " "
10960 case "$d_getgrps$d_setgrps" in
10961 *define*)
10962         case "$groupstype" in
10963         '') dflt="$gidtype" ;;
10964         *)  dflt="$groupstype" ;;
10965         esac
10966         $cat <<EOM
10967 What type of pointer is the second argument to getgroups() and setgroups()?
10968 Usually this is the same as group ids, $gidtype, but not always.
10969
10970 EOM
10971         rp='What type pointer is the second argument to getgroups() and setgroups()?'
10972         . ./myread
10973         groupstype="$ans"
10974         ;;
10975 *)  groupstype="$gidtype";;
10976 esac
10977
10978 : see what type lseek is declared as in the kernel
10979 rp="What is the type used for lseek's offset on this system?"
10980 set off_t lseektype long stdio.h sys/types.h
10981 eval $typedef_ask
10982
10983 echo " "
10984 $echo $n "Checking to see how big your file offsets are...$c" >&4
10985 $cat >try.c <<EOCP
10986 #include <sys/types.h>
10987 #include <stdio.h>
10988 int main()
10989 {
10990         printf("%d\n", sizeof($lseektype));
10991 }
10992 EOCP
10993 set try
10994 if eval $compile_ok; then
10995         lseeksize=`./try`
10996         $echo " $lseeksize bytes." >&4
10997 else
10998         dflt='4'
10999         echo " "
11000         echo "(I can't seem to compile the test program.  Guessing...)"
11001         rp="What is the size of your file offsets (in bytes)?"
11002         . ./myread
11003         lseeksize="$ans"
11004 fi
11005 $rm -f try.c try
11006
11007 echo " "
11008 echo "Checking if your $make program sets \$(MAKE)..." >&4
11009 case "$make_set_make" in
11010 '')
11011         $sed 's/^X //' > testmake.mak << 'EOF'
11012 Xall:
11013 X       @echo 'maketemp="$(MAKE)"'
11014 EOF
11015         case "`$make -f testmake.mak 2>/dev/null`" in
11016         *maketemp=*) make_set_make='#' ;;
11017         *)      make_set_make="MAKE=$make" ;;
11018         esac
11019         $rm -f testmake.mak
11020         ;;
11021 esac
11022 case "$make_set_make" in
11023 '#') echo "Yup, it does.";;
11024 *) echo "Nope, it doesn't.";;
11025 esac
11026
11027 : see what type is used for mode_t
11028 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11029 set mode_t modetype int stdio.h sys/types.h
11030 eval $typedef_ask
11031
11032 : define a fucntion to check prototypes
11033 $cat > protochk <<EOSH
11034 $startsh
11035 cc="$cc"
11036 optimize="$optimize"
11037 ccflags="$ccflags"
11038 prototype="$prototype"
11039 define="$define"
11040 rm=$rm
11041 EOSH
11042
11043 $cat >> protochk <<'EOSH'
11044
11045 $rm -f try.c
11046 foo="$1"
11047 shift
11048 while test $# -ge 2; do
11049         case "$1" in
11050                 $define) echo "#include <$2>" >> try.c ;;
11051                 literal) echo "$2" >> try.c ;;
11052         esac
11053     shift 2
11054 done
11055 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11056 cat >> try.c <<'EOCP'
11057 #ifdef CAN_PROTOTYPE
11058 #define _(args) args
11059 #else
11060 #define _(args) ()
11061 #endif
11062 EOCP
11063 echo "$foo" >> try.c
11064 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11065 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11066 status=$?
11067 $rm -f try.[co]
11068 exit $status
11069 EOSH
11070 chmod +x protochk
11071 $eunicefix protochk
11072
11073 : see what type is used for size_t
11074 rp="What is the type used for the length parameter for string functions?"
11075 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11076 eval $typedef_ask
11077
11078 : check for type of arguments to gethostbyaddr. 
11079 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11080         case "$d_gethbyaddr" in
11081         $define)
11082                 $cat <<EOM
11083
11084 Checking to see what type of arguments are accepted by gethostbyaddr().
11085 EOM
11086                 hdrs="$define sys/types.h
11087                         $d_socket sys/socket.h 
11088                         $i_niin netinet/in.h 
11089                         $i_netdb netdb.h
11090                         $i_unistd unistd.h"
11091                 : The first arg can 'char *' or 'void *'
11092                 : The second arg is some of integral type
11093                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11094                         for yyy in size_t long int; do
11095                                 case "$netdb_host_type" in
11096                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11097                                         if ./protochk "$try" $hdrs; then
11098                                                 echo "Your system accepts $xxx for the first arg."
11099                                                 echo "...and $yyy for the second arg."
11100                                                 netdb_host_type="$xxx"
11101                                                 netdb_hlen_type="$yyy"
11102                                         fi
11103                                         ;;
11104                                 esac
11105                         done
11106                 done
11107                 : In case none of those worked, prompt the user.
11108                 case "$netdb_host_type" in
11109                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11110                         dflt='char *'
11111                         . ./myread
11112                         netdb_host_type=$ans
11113                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11114                         dflt="$sizetype"
11115                         . ./myread
11116                         netdb_hlen_type=$ans
11117                         ;;
11118                 esac
11119                 ;;
11120         *)      : no gethostbyaddr, so pick harmless defaults
11121                 netdb_host_type='char *'
11122                 netdb_hlen_type="$sizetype"
11123                 ;;
11124         esac
11125         # Remove the "const" if needed. -- but then we'll have a 
11126         # prototype clash!
11127         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11128 fi
11129
11130 : check for type of argument to gethostbyname. 
11131 if test "X$netdb_name_type" = X ; then
11132         case "$d_gethbyname" in
11133         $define)
11134                 $cat <<EOM
11135
11136 Checking to see what type of argument is accepted by gethostbyname().
11137 EOM
11138                 hdrs="$define sys/types.h
11139                         $d_socket sys/socket.h 
11140                         $i_niin netinet/in.h 
11141                         $i_netdb netdb.h
11142                         $i_unistd unistd.h"
11143                 for xxx in "const char *" "char *"; do
11144                         case "$netdb_name_type" in
11145                         '')     try="extern struct hostent *gethostbyname($xxx);"
11146                                 if ./protochk "$try" $hdrs; then
11147                                         echo "Your system accepts $xxx."
11148                                         netdb_name_type="$xxx"
11149                                 fi
11150                                 ;;
11151                         esac
11152                 done
11153                 : In case none of those worked, prompt the user.
11154                 case "$netdb_name_type" in
11155                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11156                         dflt='char *'
11157                         . ./myread
11158                         netdb_name_type=$ans
11159                         ;;
11160                 esac
11161                 ;;
11162         *)      : no gethostbyname, so pick harmless default
11163                 netdb_name_type='char *'
11164                 ;;
11165         esac
11166 fi
11167
11168 : check for type of 1st argument to getnetbyaddr. 
11169 if test "X$netdb_net_type" = X ; then
11170         case "$d_getnbyaddr" in
11171         $define)
11172                 $cat <<EOM
11173
11174 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11175 EOM
11176                 hdrs="$define sys/types.h
11177                         $d_socket sys/socket.h 
11178                         $i_niin netinet/in.h 
11179                         $i_netdb netdb.h
11180                         $i_unistd unistd.h"
11181                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11182                         case "$netdb_net_type" in
11183                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11184                                 if ./protochk "$try" $hdrs; then
11185                                         echo "Your system accepts $xxx."
11186                                         netdb_net_type="$xxx"
11187                                 fi
11188                                 ;;
11189                         esac
11190                 done
11191                 : In case none of those worked, prompt the user.
11192                 case "$netdb_net_type" in
11193                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11194                         dflt='long'
11195                         . ./myread
11196                         netdb_net_type=$ans
11197                         ;;
11198                 esac
11199                 ;;
11200         *)      : no getnetbyaddr, so pick harmless default
11201                 netdb_net_type='long'
11202                 ;;
11203         esac
11204 fi
11205 : locate the preferred pager for this system
11206 case "$pager" in
11207 '')
11208         dflt=''
11209         case "$pg" in
11210         /*) dflt=$pg;;
11211         esac
11212         case "$more" in
11213         /*) dflt=$more;;
11214         esac
11215         case "$less" in
11216         /*) dflt=$less;;
11217         esac
11218         case "$dflt" in
11219         '') dflt=/usr/ucb/more;;
11220         esac
11221         ;;
11222 *) dflt="$pager";;
11223 esac
11224 echo " "
11225 fn=f/
11226 rp='What pager is used on your system?'
11227 . ./getfile
11228 pager="$ans"
11229
11230 : see what type pids are declared as in the kernel
11231 rp="What is the type of process ids on this system?"
11232 set pid_t pidtype int stdio.h sys/types.h
11233 eval $typedef_ask
11234
11235 : check for length of pointer
11236 echo " "
11237 case "$ptrsize" in
11238 '')
11239         $echo $n "Checking to see how big your pointers are...$c" >&4
11240         if test "$voidflags" -gt 7; then
11241                 echo '#define VOID_PTR char *' > try.c
11242         else
11243                 echo '#define VOID_PTR void *' > try.c
11244         fi
11245         $cat >>try.c <<'EOCP'
11246 #include <stdio.h>
11247 int main()
11248 {
11249         printf("%d\n", sizeof(VOID_PTR));
11250         exit(0);
11251 }
11252 EOCP
11253         set try
11254         if eval $compile_ok; then
11255                 ptrsize=`./try`
11256                 $echo " $ptrsize bytes." >&4
11257         else
11258                 dflt='4'
11259                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11260                 rp="What is the size of a pointer (in bytes)?"
11261                 . ./myread
11262                 ptrsize="$ans"
11263         fi
11264         ;;
11265 esac
11266 $rm -f try.c try
11267
11268 : see if ar generates random libraries by itself
11269 echo " "
11270 echo "Checking how to generate random libraries on your machine..." >&4
11271 echo 'int bar1() { return bar2(); }' > bar1.c
11272 echo 'int bar2() { return 2; }' > bar2.c
11273 $cat > foo.c <<'EOP'
11274 int main() { printf("%d\n", bar1()); exit(0); }
11275 EOP
11276 $cc $ccflags -c bar1.c >/dev/null 2>&1
11277 $cc $ccflags -c bar2.c >/dev/null 2>&1
11278 $cc $ccflags -c foo.c >/dev/null 2>&1
11279 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11280 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11281         ./foobar >/dev/null 2>&1; then
11282         echo "$ar appears to generate random libraries itself."
11283         orderlib=false
11284         ranlib=":"
11285 elif $ar ts bar$_a >/dev/null 2>&1 &&
11286         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11287         ./foobar >/dev/null 2>&1; then
11288                 echo "a table of contents needs to be added with '$ar ts'."
11289                 orderlib=false
11290                 ranlib="$ar ts"
11291 else
11292         case "$ranlib" in
11293         :) ranlib='';;
11294         '')
11295                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11296                 $test -f $ranlib || ranlib=''
11297                 ;;
11298         esac
11299         if $test -n "$ranlib"; then
11300                 echo "your system has '$ranlib'; we'll use that."
11301                 orderlib=false
11302         else
11303                 echo "your system doesn't seem to support random libraries"
11304                 echo "so we'll use lorder and tsort to order the libraries."
11305                 orderlib=true
11306                 ranlib=":"
11307         fi
11308 fi
11309 $rm -f foo* bar* 
11310
11311 : check for type of arguments to select. 
11312 case "$selecttype" in
11313 '') case "$d_select" in
11314         $define)
11315                 $cat <<EOM
11316 Checking to see what type of arguments are accepted by select().
11317 EOM
11318                 hdrs="$define sys/types.h
11319                         $i_systime sys/time.h 
11320                         $i_sysselct sys/select.h
11321                         $d_socket sys/socket.h"
11322                 : The first arg can be int, unsigned, or size_t
11323                 : The last arg may or may not be 'const'
11324                 val=''
11325                 : void pointer has been seen but using that
11326                 : breaks the selectminbits test
11327                 for xxx in 'fd_set *' 'int *'; do
11328                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
11329                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
11330                                         case "$val" in
11331                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
11332                                                 if ./protochk "$try" $hdrs; then
11333                                                         echo "Your system accepts $xxx."
11334                                                         val="$xxx"
11335                                                 fi
11336                                                 ;;
11337                                         esac
11338                                 done
11339                         done
11340                 done
11341                 case "$val" in
11342                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
11343                         case "$d_fd_set" in
11344                                 $define) dflt="fd_set *" ;;
11345                                 *)              dflt="int *" ;;
11346                         esac
11347                         . ./myread
11348                         val=$ans
11349                         ;;
11350                 esac
11351                 selecttype="$val"
11352                 ;;
11353         *)      : no select, so pick a harmless default
11354                 selecttype='int *'
11355                 ;;
11356         esac
11357         ;;
11358 esac
11359
11360 : check for the select 'width'
11361 case "$selectminbits" in
11362 '') case "$d_select" in
11363         $define)
11364                 $cat <<EOM
11365
11366 Checking to see on how many bits at a time your select() operates...
11367 EOM
11368                 $cat >try.c <<EOCP
11369 #include <sys/types.h>
11370 #$i_time I_TIME
11371 #$i_systime I_SYS_TIME
11372 #$i_systimek I_SYS_TIME_KERNEL
11373 #ifdef I_TIME
11374 #   include <time.h>
11375 #endif
11376 #ifdef I_SYS_TIME
11377 #   ifdef I_SYS_TIME_KERNEL
11378 #       define KERNEL
11379 #   endif
11380 #   include <sys/time.h>
11381 #   ifdef I_SYS_TIME_KERNEL
11382 #       undef KERNEL
11383 #   endif
11384 #endif
11385 #$i_sysselct I_SYS_SELECT
11386 #ifdef I_SYS_SELECT
11387 #include <sys/select.h>
11388 #endif
11389 #include <stdio.h>
11390 $selecttype b;
11391 #define S sizeof(*(b))
11392 #define MINBITS 64
11393 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
11394 #define NBITS  (NBYTES * 8)
11395 int main() {
11396     char s[NBYTES];
11397     struct timeval t;
11398     int i;
11399     FILE* fp;
11400     int fd;
11401
11402     fclose(stdin);
11403     fp = fopen("try.c", "r");
11404     if (fp == 0)
11405       exit(1);
11406     fd = fileno(fp);
11407     if (fd < 0)
11408       exit(2);
11409     b = ($selecttype)s;
11410     for (i = 0; i < NBITS; i++)
11411         FD_SET(i, b);
11412     t.tv_sec  = 0;
11413     t.tv_usec = 0;
11414     select(fd + 1, b, 0, 0, &t);
11415     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
11416     printf("%d\n", i + 1);
11417     return 0;
11418 }
11419 EOCP
11420                 set try
11421                 if eval $compile_ok; then
11422                         selectminbits=`./try`
11423                         case "$selectminbits" in
11424                         '')     cat >&4 <<EOM
11425 Cannot figure out on how many bits at a time your select() operates.
11426 I'll play safe and guess it is 32 bits.
11427 EOM
11428                                 selectminbits=32
11429                                 bits="32 bits"
11430                                 ;;
11431                         1)      bits="1 bit" ;;
11432                         *)      bits="$selectminbits bits" ;;
11433                         esac
11434                         echo "Your select() operates on $bits at a time." >&4
11435                 else
11436                         rp='What is the minimum number of bits your select() operates on?'
11437                         case "$byteorder" in
11438                         1234|12345678)  dflt=32 ;;
11439                         *)              dflt=1  ;;
11440                         esac
11441                         . ./myread
11442                         val=$ans
11443                         selectminbits="$val"
11444                 fi
11445                 $rm -f try.* try
11446                 ;;
11447         *)      : no select, so pick a harmless default
11448                 selectminbits='32'
11449                 ;;
11450         esac
11451         ;;
11452 esac
11453
11454 : Trace out the files included by signal.h, then look for SIGxxx names.
11455 : Remove SIGARRAYSIZE used by HPUX.
11456 : Remove SIGTYP void lines used by OS2.
11457 xxx=`echo '#include <signal.h>' |
11458         $cppstdin $cppminus $cppflags 2>/dev/null |
11459         $grep '^[       ]*#.*include' | 
11460         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
11461 : Check this list of files to be sure we have parsed the cpp output ok.
11462 : This will also avoid potentially non-existent files, such 
11463 : as ../foo/bar.h
11464 xxxfiles=''
11465 for xx in $xxx /dev/null ; do
11466         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
11467 done
11468 : If we have found no files, at least try signal.h
11469 case "$xxxfiles" in
11470 '')     xxxfiles=`./findhdr signal.h` ;;
11471 esac
11472 xxx=`awk '
11473 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ {
11474         print substr($2, 4, 20)
11475 }
11476 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
11477         print substr($3, 4, 20)
11478 }' $xxxfiles`
11479 : Append some common names just in case the awk scan failed.
11480 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
11481 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
11482 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
11483 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
11484 : generate a few handy files for later
11485 $cat > signal.c <<'EOCP'
11486 #include <sys/types.h>
11487 #include <signal.h>
11488 #include <stdio.h>
11489 int main() {
11490
11491 /* Strange style to avoid deeply-nested #if/#else/#endif */
11492 #ifndef NSIG
11493 #  ifdef _NSIG
11494 #    define NSIG (_NSIG)
11495 #  endif
11496 #endif
11497
11498 #ifndef NSIG
11499 #  ifdef SIGMAX
11500 #    define NSIG (SIGMAX+1)
11501 #  endif
11502 #endif
11503
11504 #ifndef NSIG
11505 #  ifdef SIG_MAX
11506 #    define NSIG (SIG_MAX+1)
11507 #  endif
11508 #endif
11509
11510 #ifndef NSIG
11511 #  ifdef MAXSIG
11512 #    define NSIG (MAXSIG+1)
11513 #  endif
11514 #endif
11515
11516 #ifndef NSIG
11517 #  ifdef MAX_SIG
11518 #    define NSIG (MAX_SIG+1)
11519 #  endif
11520 #endif
11521
11522 #ifndef NSIG
11523 #  ifdef SIGARRAYSIZE
11524 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
11525 #  endif
11526 #endif
11527
11528 #ifndef NSIG
11529 #  ifdef _sys_nsig
11530 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
11531 #  endif
11532 #endif
11533
11534 /* Default to some arbitrary number that's big enough to get most
11535    of the common signals.
11536 */
11537 #ifndef NSIG
11538 #    define NSIG 50
11539 #endif
11540
11541 printf("NSIG %d\n", NSIG);
11542
11543 #ifndef JUST_NSIG
11544
11545 EOCP
11546
11547 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
11548 {
11549         printf "#ifdef SIG"; printf $1; printf "\n"
11550         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
11551         printf $1; printf ");\n"
11552         printf "#endif\n"
11553 }
11554 END {
11555         printf "#endif /* JUST_NSIG */\n";
11556         printf "}\n";
11557 }
11558 ' >>signal.c
11559 $cat >signal.awk <<'EOP'
11560 BEGIN { ndups = 0 }
11561 $1 ~ /^NSIG$/ { nsig = $2 }
11562 ($1 !~ /^NSIG$/) && (NF == 2) {
11563     if ($2 > maxsig) { maxsig = $2 }
11564     if (sig_name[$2]) {
11565         dup_name[ndups] = $1
11566         dup_num[ndups] = $2
11567         ndups++ 
11568     }
11569     else {
11570         sig_name[$2] = $1
11571         sig_num[$2] = $2
11572     }
11573
11574 }
11575 END { 
11576     if (nsig == 0) { nsig = maxsig + 1 }
11577         for (n = 1; n < nsig; n++) {
11578                 if (sig_name[n]) {
11579                         printf("%s %d\n", sig_name[n], sig_num[n])
11580                 }
11581                 else {
11582                         printf("NUM%d %d\n", n, n) 
11583                 }
11584         }
11585     for (n = 0; n < ndups; n++) {
11586                 printf("%s %d\n", dup_name[n], dup_num[n])
11587     }
11588 }
11589 EOP
11590 $cat >signal_cmd <<EOS
11591 $startsh
11592 if $test -s signal.lst; then
11593     echo "Using your existing signal.lst file"
11594         exit 0
11595 fi
11596 xxx="$xxx"
11597 EOS
11598 $cat >>signal_cmd <<'EOS'
11599
11600 set signal
11601 if eval $compile_ok; then
11602         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
11603 else
11604         echo "(I can't seem be able to compile the whole test program)" >&4
11605         echo "(I'll try it in little pieces.)" >&4
11606         set signal -DJUST_NSIG
11607         if eval $compile_ok; then
11608                 ./signal$_exe > signal.nsg
11609                 $cat signal.nsg
11610         else
11611                 echo "I can't seem to figure out how many signals you have." >&4
11612                 echo "Guessing 50." >&4
11613                 echo 'NSIG 50' > signal.nsg
11614         fi
11615         : Now look at all the signal names, one at a time.
11616         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
11617                 $cat > signal.c <<EOCP
11618 #include <sys/types.h>
11619 #include <signal.h>
11620 #include <stdio.h>
11621 int main() {
11622 printf("$xx %d\n", SIG${xx});
11623 return 0;
11624 }
11625 EOCP
11626                 set signal
11627                 if eval $compile; then
11628                         echo "SIG${xx} found."
11629                         ./signal$_exe  >> signal.ls1
11630                 else
11631                         echo "SIG${xx} NOT found."
11632                 fi
11633         done
11634         if $test -s signal.ls1; then
11635                 $cat signal.nsg signal.ls1 |
11636                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
11637         fi
11638
11639 fi
11640 if $test -s signal.lst; then
11641         :
11642 else
11643         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
11644         echo 'kill -l' >signal
11645         set X `csh -f <signal`
11646         $rm -f signal
11647         shift
11648         case $# in
11649         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
11650         esac
11651         echo $@ | $tr ' ' $trnl | \
11652                 $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
11653 fi
11654 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
11655 EOS
11656 chmod a+x signal_cmd
11657 $eunicefix signal_cmd
11658
11659 : generate list of signal names
11660 echo " "
11661 case "$sig_name_init" in
11662 '') doinit=yes ;;
11663 *)  case "$sig_num_init" in
11664     ''|*,*) doinit=yes ;;
11665     esac ;;
11666 esac
11667 case "$doinit" in
11668 yes)
11669         echo "Generating a list of signal names and numbers..." >&4
11670         . ./signal_cmd
11671         sig_name=`$awk '{printf "%s ", $1}' signal.lst`
11672         sig_name="ZERO $sig_name"
11673         sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
11674                                                 { printf "\"%s\", ", $1 }
11675                                                 END { printf "0\n" }' signal.lst`
11676         sig_num=`$awk '{printf "%d ", $2}' signal.lst`
11677         sig_num="0 $sig_num"
11678         sig_num_init=`$awk 'BEGIN { printf "0, " }
11679                                         { printf "%d, ", $2}
11680                                         END { printf "0\n"}' signal.lst`
11681         ;;
11682 esac
11683 echo "The following signals are available:"
11684 echo " "
11685 echo $sig_name | $awk \
11686 'BEGIN { linelen = 0 }
11687 {
11688         for (i = 1; i <= NF; i++) {
11689                 name = "SIG" $i " "
11690                 linelen = linelen + length(name)
11691                 if (linelen > 70) {
11692                         printf "\n"
11693                         linelen = length(name)
11694                 }
11695                 printf "%s", name
11696         }
11697         printf "\n"
11698 }'
11699 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
11700
11701 : see what type is used for signed size_t
11702 set ssize_t ssizetype int stdio.h sys/types.h
11703 eval $typedef
11704 dflt="$ssizetype"
11705 $cat > ssize.c <<EOM
11706 #include <stdio.h>
11707 #include <sys/types.h>
11708 #define Size_t $sizetype
11709 #define SSize_t $dflt
11710 int main()
11711 {
11712         if (sizeof(Size_t) == sizeof(SSize_t))
11713                 printf("$dflt\n");
11714         else if (sizeof(Size_t) == sizeof(int))
11715                 printf("int\n");
11716         else 
11717                 printf("long\n");
11718         exit(0);
11719 }
11720 EOM
11721 echo " "
11722 set ssize
11723 if eval $compile_ok && ./ssize > /dev/null; then
11724         ssizetype=`./ssize`
11725         echo "I'll be using $ssizetype for functions returning a byte count." >&4
11726 else
11727         $cat >&4 <<EOM
11728 Help! I can't compile and run the ssize_t test program: please enlighten me!
11729 (This is probably a misconfiguration in your system or libraries, and
11730 you really ought to fix it.  Still, I'll try anyway.)
11731
11732 I need a type that is the same size as $sizetype, but is guaranteed to
11733 be signed.  Common values are ssize_t, int and long.
11734
11735 EOM
11736         rp="What signed type is the same size as $sizetype?"
11737         . ./myread
11738         ssizetype="$ans"
11739 fi
11740 $rm -f ssize ssize.*
11741
11742 : see what type of char stdio uses.
11743 echo " "
11744 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11745         echo "Your stdio uses unsigned chars." >&4
11746         stdchar="unsigned char"
11747 else
11748         echo "Your stdio uses signed chars." >&4
11749         stdchar="char"
11750 fi
11751
11752 : see if time exists
11753 echo " "
11754 if test "X$d_time" = X -o X"$timetype" = X; then
11755     if set time val -f d_time; eval $csym; $val; then
11756                 echo 'time() found.' >&4
11757                 val="$define"
11758                 rp="What is the type returned by time() on this system?"
11759                 set time_t timetype long stdio.h sys/types.h
11760                 eval $typedef_ask
11761     else
11762                 echo 'time() not found, hope that will do.' >&4
11763                 val="$undef"
11764                 timetype='int';
11765     fi
11766     set d_time
11767     eval $setvar
11768 fi
11769
11770 : see what type uids are declared as in the kernel
11771 echo " "
11772 echo "Looking for the type for user ids returned by getuid()."
11773 set uid_t uidtype xxx stdio.h sys/types.h
11774 eval $typedef
11775 case "$uidtype" in
11776 xxx)
11777         xxx=`./findhdr sys/user.h`
11778         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
11779         case $1 in
11780         unsigned) dflt="$1 $2" ;;
11781         *) dflt="$1" ;;
11782         esac
11783         ;;
11784 *) dflt="$uidtype";;
11785 esac
11786 case "$uidtype" in
11787 uid_t)  echo "uid_t found." ;;
11788 *)      rp="What is the type for user ids returned by getuid()?"
11789         . ./myread
11790         uidtype="$ans"
11791         ;;
11792 esac
11793
11794 : see if dbm.h is available
11795 : see if dbmclose exists
11796 set dbmclose d_dbmclose
11797 eval $inlibc
11798
11799 case "$d_dbmclose" in
11800 $define)
11801         set dbm.h i_dbm
11802         eval $inhdr
11803         case "$i_dbm" in
11804         $define)
11805                 val="$undef"
11806                 set i_rpcsvcdbm
11807                 eval $setvar
11808                 ;;
11809         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11810                 eval $inhdr
11811                 ;;
11812         esac
11813         ;;
11814 *)      echo "We won't be including <dbm.h>"
11815         val="$undef"
11816         set i_dbm
11817         eval $setvar
11818         val="$undef"
11819         set i_rpcsvcdbm
11820         eval $setvar
11821         ;;
11822 esac
11823
11824 : see if this is a sys/file.h system
11825 val=''
11826 set sys/file.h val
11827 eval $inhdr
11828
11829 : do we need to include sys/file.h ?
11830 case "$val" in
11831 "$define")
11832         echo " "
11833         if $h_sysfile; then
11834                 val="$define"
11835                 echo "We'll be including <sys/file.h>." >&4
11836         else
11837                 val="$undef"
11838                 echo "We won't be including <sys/file.h>." >&4
11839         fi
11840         ;;
11841 *)
11842         h_sysfile=false
11843         ;;
11844 esac
11845 set i_sysfile
11846 eval $setvar
11847
11848 : see if fcntl.h is there
11849 val=''
11850 set fcntl.h val
11851 eval $inhdr
11852
11853 : see if we can include fcntl.h
11854 case "$val" in
11855 "$define")
11856         echo " "
11857         if $h_fcntl; then
11858                 val="$define"
11859                 echo "We'll be including <fcntl.h>." >&4
11860         else
11861                 val="$undef"
11862                 if $h_sysfile; then
11863         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11864                 else
11865                         echo "We won't be including <fcntl.h>." >&4
11866                 fi
11867         fi
11868         ;;
11869 *)
11870         h_fcntl=false
11871         val="$undef"
11872         ;;
11873 esac
11874 set i_fcntl
11875 eval $setvar
11876
11877 : see if locale.h is available
11878 set locale.h i_locale
11879 eval $inhdr
11880
11881 : see if mach cthreads are available
11882 if test "X$usethreads" = "X$define"; then
11883         set mach/cthreads.h i_machcthr
11884         eval $inhdr
11885 else
11886         i_machcthr="$undef"
11887 fi
11888
11889
11890
11891 : see if this is a math.h system
11892 set math.h i_math
11893 eval $inhdr
11894
11895 : see if this is a mntent.h system
11896 set mntent.h i_mntent
11897 eval $inhdr
11898
11899 : see if ndbm.h is available
11900 set ndbm.h t_ndbm
11901 eval $inhdr
11902 case "$t_ndbm" in
11903 $define)
11904         : see if dbm_open exists
11905         set dbm_open d_dbm_open
11906         eval $inlibc
11907         case "$d_dbm_open" in
11908         $undef)
11909                 t_ndbm="$undef"
11910                 echo "We won't be including <ndbm.h>"
11911                 ;;
11912         esac
11913         ;;
11914 esac
11915 val="$t_ndbm"
11916 set i_ndbm
11917 eval $setvar
11918
11919 : see if net/errno.h is available
11920 val=''
11921 set net/errno.h val
11922 eval $inhdr
11923
11924 : Unfortunately, it causes problems on some systems.  Arrgh.
11925 case "$val" in
11926 $define)
11927         cat > try.c <<'EOM'
11928 #include <stdio.h>
11929 #include <errno.h>
11930 #include <net/errno.h>
11931 int func()
11932 {
11933         return ENOTSOCK;
11934 }
11935 EOM
11936         if $cc $ccflags -c try.c >/dev/null 2>&1; then
11937                 echo "We'll be including <net/errno.h>." >&4
11938         else
11939                 echo "We won't be including <net/errno.h>." >&4
11940                 val="$undef"
11941         fi
11942         $rm -f try.* try
11943         ;;
11944 esac
11945 set i_neterrno
11946 eval $setvar
11947
11948 : see if this is a poll.h system
11949 set poll.h i_poll
11950 eval $inhdr
11951
11952 : get C preprocessor symbols handy
11953 echo " "
11954 $echo $n "Hmm... $c"
11955 echo $al | $tr ' ' $trnl >Cppsym.know
11956 $cat <<EOSS >Cppsym
11957 $startsh
11958 case "\$1" in
11959 -l) list=true
11960         shift
11961         ;;
11962 esac
11963 unknown=''
11964 case "\$list\$#" in
11965 1|2)
11966         for sym do
11967                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
11968                         exit 0
11969                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
11970                         :
11971                 else
11972                         unknown="\$unknown \$sym"
11973                 fi
11974         done
11975         set X \$unknown
11976         shift
11977         ;;
11978 esac
11979 case \$# in
11980 0) exit 1;;
11981 esac
11982 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
11983 #ifdef \1\\
11984 exit 0; _ _ _ _\1\\      \1\\
11985 #endif\\
11986 /' >Cppsym\$\$
11987 echo "exit 1; _ _ _" >>Cppsym\$\$
11988 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
11989 case "\$list" in
11990 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
11991 *)
11992         sh Cppsym2\$\$
11993         status=\$?
11994         ;;
11995 esac
11996 $rm -f Cppsym\$\$ Cppsym2\$\$
11997 exit \$status
11998 EOSS
11999 chmod +x Cppsym
12000 $eunicefix Cppsym
12001 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12002
12003 : now check the C compiler for additional symbols
12004 postprocess_cc_v=''
12005 case "$osname" in
12006 aix) postprocess_cc_v="|$tr , ' '" ;;
12007 esac
12008 $cat >ccsym <<EOS
12009 $startsh
12010 $cat >tmp.c <<EOF
12011 extern int foo;
12012 EOF
12013 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12014 do
12015         case "\$i" in
12016         -D*) echo "\$i" | $sed 's/^-D//';;
12017         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12018         esac
12019 done
12020 $rm -f try.c
12021 EOS
12022 postprocess_cc_v=''
12023 chmod +x ccsym
12024 $eunicefix ccsym
12025 ./ccsym > ccsym1.raw
12026 if $test -s ccsym1.raw; then
12027        $sort ccsym1.raw | $uniq >ccsym.raw
12028 else
12029        mv ccsym1.raw ccsym.raw
12030 fi
12031
12032 $awk '/\=/ { print $0; next }
12033         { print $0"=1" }' ccsym.raw >ccsym.list
12034 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12035 $comm -13 ccsym.true ccsym.list >ccsym.own
12036 $comm -12 ccsym.true ccsym.list >ccsym.com
12037 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12038 also=''
12039 if $test -z ccsym.raw; then
12040         echo "Your C compiler doesn't seem to define any symbols!" >&4
12041         echo " "
12042         echo "However, your C preprocessor defines the following symbols:"
12043         $cat Cppsym.true
12044         ccsymbols=''
12045         cppsymbols=`$cat Cppsym.true`
12046         cppsymbols=`echo $cppsymbols`
12047         cppccsymbols="$cppsymbols"
12048 else
12049         if $test -s ccsym.com; then
12050                 echo "Your C compiler and pre-processor define these symbols:"
12051                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12052                 also='also '
12053                 symbols='ones'
12054                 cppccsymbols=`$cat ccsym.com`
12055                 cppccsymbols=`echo $cppccsymbols`
12056                 $test "$silent" || sleep 1
12057         fi
12058         if $test -s ccsym.cpp; then
12059                 $test "$also" && echo " "
12060                 echo "Your C pre-processor ${also}defines the following symbols:"
12061                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12062                 also='further '
12063                 cppsymbols=`$cat ccsym.cpp`
12064                 cppsymbols=`echo $cppsymbols`
12065                 $test "$silent" || sleep 1
12066         fi
12067         if $test -s ccsym.own; then
12068                 $test "$also" && echo " "
12069                 echo "Your C compiler ${also}defines the following cpp symbols:"
12070                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12071                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12072                 ccsymbols=`$cat ccsym.own`
12073                 ccsymbols=`echo $ccsymbols`
12074                 $test "$silent" || sleep 1
12075         fi
12076 fi
12077 $rm -f ccsym*
12078
12079 : see if this is a termio system
12080 val="$undef"
12081 val2="$undef"
12082 val3="$undef"
12083 if $test `./findhdr termios.h`; then
12084         set tcsetattr i_termios
12085         eval $inlibc
12086         val3="$i_termios"
12087 fi
12088 echo " "
12089 case "$val3" in
12090 "$define") echo "You have POSIX termios.h... good!" >&4;;
12091 *) if ./Cppsym pyr; then
12092                 case "`/bin/universe`" in
12093                 ucb) if $test `./findhdr sgtty.h`; then
12094                                 val2="$define"
12095                                 echo "<sgtty.h> found." >&4
12096                         else
12097                                 echo "System is pyramid with BSD universe."
12098                                 echo "<sgtty.h> not found--you could have problems." >&4
12099                         fi;;
12100                 *) if $test `./findhdr termio.h`; then
12101                                 val="$define"
12102                                 echo "<termio.h> found." >&4
12103                         else
12104                                 echo "System is pyramid with USG universe."
12105                                 echo "<termio.h> not found--you could have problems." >&4
12106                         fi;;
12107                 esac
12108         elif ./usg; then
12109                 if $test `./findhdr termio.h`; then
12110                         echo "<termio.h> found." >&4
12111                         val="$define"
12112                 elif $test `./findhdr sgtty.h`; then
12113                         echo "<sgtty.h> found." >&4
12114                         val2="$define"
12115                 else
12116 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12117                 fi
12118         else
12119                 if $test `./findhdr sgtty.h`; then
12120                         echo "<sgtty.h> found." >&4
12121                         val2="$define"
12122                 elif $test `./findhdr termio.h`; then
12123                         echo "<termio.h> found." >&4
12124                         val="$define"
12125                 else
12126 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12127                 fi
12128         fi;;
12129 esac
12130 set i_termio; eval $setvar
12131 val=$val2; set i_sgtty; eval $setvar
12132 val=$val3; set i_termios; eval $setvar
12133
12134 : see if stdarg is available
12135 echo " "
12136 if $test `./findhdr stdarg.h`; then
12137         echo "<stdarg.h> found." >&4
12138         valstd="$define"
12139 else
12140         echo "<stdarg.h> NOT found." >&4
12141         valstd="$undef"
12142 fi
12143
12144 : see if varags is available
12145 echo " "
12146 if $test `./findhdr varargs.h`; then
12147         echo "<varargs.h> found." >&4
12148 else
12149         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12150 fi
12151
12152 : set up the varargs testing programs
12153 $cat > varargs.c <<EOP
12154 #ifdef I_STDARG
12155 #include <stdarg.h>
12156 #endif
12157 #ifdef I_VARARGS
12158 #include <varargs.h>
12159 #endif
12160
12161 #ifdef I_STDARG
12162 int f(char *p, ...)
12163 #else
12164 int f(va_alist)
12165 va_dcl
12166 #endif
12167 {
12168         va_list ap;
12169 #ifndef I_STDARG
12170         char *p;
12171 #endif
12172 #ifdef I_STDARG
12173         va_start(ap,p);
12174 #else
12175         va_start(ap);
12176         p = va_arg(ap, char *);
12177 #endif
12178         va_end(ap);
12179 }
12180 EOP
12181 $cat > varargs <<EOP
12182 $startsh
12183 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12184         echo "true"
12185 else
12186         echo "false"
12187 fi
12188 $rm -f varargs$_o
12189 EOP
12190 chmod +x varargs
12191
12192 : now check which varargs header should be included
12193 echo " "
12194 i_varhdr=''
12195 case "$valstd" in
12196 "$define")
12197         if `./varargs I_STDARG`; then
12198                 val='stdarg.h'
12199         elif `./varargs I_VARARGS`; then
12200                 val='varargs.h'
12201         fi
12202         ;;
12203 *)
12204         if `./varargs I_VARARGS`; then
12205                 val='varargs.h'
12206         fi
12207         ;;
12208 esac
12209 case "$val" in
12210 '')
12211 echo "I could not find the definition for va_dcl... You have problems..." >&4
12212         val="$undef"; set i_stdarg; eval $setvar
12213         val="$undef"; set i_varargs; eval $setvar
12214         ;;
12215 *) 
12216         set i_varhdr
12217         eval $setvar
12218         case "$i_varhdr" in
12219         stdarg.h)
12220                 val="$define"; set i_stdarg; eval $setvar
12221                 val="$undef"; set i_varargs; eval $setvar
12222                 ;;
12223         varargs.h)
12224                 val="$undef"; set i_stdarg; eval $setvar
12225                 val="$define"; set i_varargs; eval $setvar
12226                 ;;
12227         esac
12228         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12229 esac
12230 $rm -f varargs*
12231
12232 : see if stddef is available
12233 set stddef.h i_stddef
12234 eval $inhdr
12235
12236 : see if sys/access.h is available
12237 set sys/access.h i_sysaccess
12238 eval $inhdr
12239
12240 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12241 set sys/filio.h i_sysfilio
12242 eval $inhdr
12243 echo " "
12244 if $test `./findhdr sys/ioctl.h`; then
12245         val="$define"
12246         echo '<sys/ioctl.h> found.' >&4
12247 else
12248         val="$undef"
12249         if $test $i_sysfilio = "$define"; then
12250             echo '<sys/ioctl.h> NOT found.' >&4
12251         else
12252                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12253                 $test $i_termio = "$define" && xxx="termio.h"
12254                 $test $i_termios = "$define" && xxx="termios.h"
12255 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12256         fi
12257 fi
12258 set i_sysioctl
12259 eval $setvar
12260
12261 : see if sys/resource.h has to be included
12262 set sys/resource.h i_sysresrc
12263 eval $inhdr
12264
12265 : see if sys/security.h is available
12266 set sys/security.h i_syssecrt
12267 eval $inhdr
12268
12269 : see if this is a sys/statvfs.h system
12270 set sys/statvfs.h i_sysstatvfs
12271 eval $inhdr
12272
12273 : see if this is a sys/un.h system
12274 set sys/un.h i_sysun
12275 eval $inhdr
12276
12277 : see if this is a syswait system
12278 set sys/wait.h i_syswait
12279 eval $inhdr
12280
12281 : see if this is an utime system
12282 set utime.h i_utime
12283 eval $inhdr
12284
12285 : see if this is a values.h system
12286 set values.h i_values
12287 eval $inhdr
12288
12289 : see if this is a vfork system
12290 case "$d_vfork" in
12291 "$define")
12292         set vfork.h i_vfork
12293         eval $inhdr
12294         ;;
12295 *)
12296         i_vfork="$undef"
12297         ;;
12298 esac
12299
12300 : see if gdbm.h is available
12301 set gdbm.h t_gdbm
12302 eval $inhdr
12303 case "$t_gdbm" in
12304 $define)
12305         : see if gdbm_open exists
12306         set gdbm_open d_gdbm_open
12307         eval $inlibc
12308         case "$d_gdbm_open" in
12309         $undef)
12310                 t_gdbm="$undef"
12311                 echo "We won't be including <gdbm.h>"
12312                 ;;
12313         esac
12314         ;;
12315 esac
12316 val="$t_gdbm"
12317 set i_gdbm
12318 eval $setvar
12319
12320 echo " "
12321 echo "Looking for extensions..." >&4
12322 tdir=`pwd`
12323 cd $rsrc/ext
12324 : If we are using the old config.sh, known_extensions may contain
12325 : old or inaccurate or duplicate values.
12326 known_extensions=''
12327 nonxs_extensions=''
12328 : We do not use find because it might not be available.
12329 : We do not just use MANIFEST because the user may have dropped
12330 : some additional extensions into the source tree and expect them
12331 : to be built.
12332 for xxx in * ; do
12333         case "$xxx" in
12334         DynaLoader|dynaload) ;;
12335         *)      if $test -f $xxx/$xxx.xs; then
12336                         known_extensions="$known_extensions $xxx"
12337                 elif $test -f $xxx/Makefile.PL; then
12338                         nonxs_extensions="$nonxs_extensions $xxx"
12339                 else
12340                         if $test -d $xxx; then
12341                                 # Look for nested extensions, eg. Devel/Dprof.
12342                                 cd $xxx
12343                                 for yyy in * ; do
12344                                 if $test -f $yyy/$yyy.xs; then
12345                                         known_extensions="$known_extensions $xxx/$yyy"
12346                                 elif $test -f $yyy/Makefile.PL; then
12347                                         nonxs_extensions="$nonxs_extensions $xxx/$yyy"
12348                                 fi
12349                                 done
12350                                 cd ..
12351                         fi
12352                 fi 
12353                 ;;
12354         esac
12355 done
12356 set X $nonxs_extensions
12357 shift
12358 nonxs_extensions="$*"
12359 set X $known_extensions
12360 shift
12361 known_extensions="$*"
12362 cd $tdir
12363
12364 : Now see which are supported on this system.
12365 avail_ext=''
12366 for xxx in $known_extensions ; do
12367         case "$xxx" in
12368         DB_File|db_file)
12369                 case "$i_db" in
12370                 $define) avail_ext="$avail_ext $xxx" ;;
12371                 esac
12372                 ;;
12373         GDBM_File|gdbm_fil)
12374                 case "$i_gdbm" in 
12375                 $define) avail_ext="$avail_ext $xxx" ;;
12376                 esac
12377                 ;;
12378         NDBM_File|ndbm_fil)
12379                 case "$i_ndbm" in
12380                 $define) avail_ext="$avail_ext $xxx" ;;
12381                 esac
12382                 ;;
12383         ODBM_File|odbm_fil) 
12384                 case "${i_dbm}${i_rpcsvcdbm}" in
12385                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12386                 esac
12387                 ;;
12388         POSIX|posix)
12389                 case "$useposix" in
12390                 true|define|y) avail_ext="$avail_ext $xxx" ;;
12391                 esac
12392                 ;;
12393         Opcode|opcode)
12394                 case "$useopcode" in
12395                 true|define|y) avail_ext="$avail_ext $xxx" ;;
12396                 esac
12397                 ;;
12398         Socket|socket)
12399                 case "$d_socket" in 
12400                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12401                 esac
12402                 ;;
12403         Thread|thread)
12404                 case "$usethreads" in 
12405                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12406                 esac
12407                 ;;
12408         IPC/SysV|ipc/sysv)
12409                 : XXX Do we need a useipcsysv variable here
12410                 case "${d_msg}${d_sem}${d_shm}" in 
12411                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12412                 esac
12413                 ;;
12414         *)      avail_ext="$avail_ext $xxx"
12415                 ;;
12416         esac
12417 done
12418
12419 set X $avail_ext
12420 shift
12421 avail_ext="$*"
12422
12423 : Now see which nonxs extensions are supported on this system.
12424 : For now assume all are.
12425 nonxs_ext=''
12426 for xxx in $nonxs_extensions ; do
12427         case "$xxx" in
12428         *)      nonxs_ext="$nonxs_ext $xxx"
12429                 ;;
12430         esac
12431 done
12432
12433 set X $nonxs_ext
12434 shift
12435 nonxs_ext="$*"
12436
12437 case $usedl in
12438 $define)
12439         $cat <<EOM
12440 A number of extensions are supplied with $package.  You may choose to
12441 compile these extensions for dynamic loading (the default), compile
12442 them into the $package executable (static loading), or not include
12443 them at all.  Answer "none" to include no extensions.
12444 Note that DynaLoader is always built and need not be mentioned here.
12445
12446 EOM
12447         case "$dynamic_ext" in
12448         '') dflt="$avail_ext" ;;
12449         *)      dflt="$dynamic_ext"
12450                 # Perhaps we are reusing an old out-of-date config.sh.
12451                 case "$hint" in
12452                 previous)
12453                         if test X"$dynamic_ext" != X"$avail_ext"; then
12454                                 $cat <<EOM
12455 NOTICE:  Your previous config.sh list may be incorrect. 
12456 The extensions now available to you are 
12457         ${avail_ext}
12458 but the default list from your previous config.sh is
12459         ${dynamic_ext} 
12460
12461 EOM
12462                         fi
12463                         ;;
12464                 esac
12465                 ;;
12466         esac
12467         case "$dflt" in
12468         '')     dflt=none;;
12469         esac
12470         rp="What extensions do you wish to load dynamically?"
12471         . ./myread
12472         case "$ans" in
12473         none) dynamic_ext=' ' ;;
12474         *) dynamic_ext="$ans" ;;
12475         esac
12476
12477         case "$static_ext" in
12478         '')
12479                 : Exclude those already listed in dynamic linking
12480                 dflt=''
12481                 for xxx in $avail_ext; do
12482                         case " $dynamic_ext " in
12483                         *" $xxx "*) ;;
12484                         *) dflt="$dflt $xxx" ;;
12485                         esac
12486                 done
12487                 set X $dflt
12488                 shift
12489                 dflt="$*"
12490                 ;;
12491         *)  dflt="$static_ext" 
12492                 ;;
12493         esac
12494
12495         case "$dflt" in
12496         '')     dflt=none;;
12497         esac
12498         rp="What extensions do you wish to load statically?"
12499         . ./myread
12500         case "$ans" in
12501         none) static_ext=' ' ;;
12502         *) static_ext="$ans" ;;
12503         esac
12504         ;;
12505 *)
12506         $cat <<EOM
12507 A number of extensions are supplied with $package.  Answer "none" 
12508 to include no extensions. 
12509 Note that DynaLoader is always built and need not be mentioned here.
12510
12511 EOM
12512         case "$static_ext" in
12513         '') dflt="$avail_ext" ;;
12514         *)      dflt="$static_ext"
12515                 # Perhaps we are reusing an old out-of-date config.sh.
12516                 case "$hint" in
12517                 previous)
12518                         if test X"$static_ext" != X"$avail_ext"; then
12519                                 $cat <<EOM
12520 NOTICE:  Your previous config.sh list may be incorrect. 
12521 The extensions now available to you are 
12522         ${avail_ext}
12523 but the default list from your previous config.sh is
12524         ${static_ext} 
12525
12526 EOM
12527                         fi
12528                         ;;
12529                 esac
12530                 ;;
12531         esac
12532         : Exclude those that are not xs extensions
12533         case "$dflt" in
12534         '')     dflt=none;;
12535         esac
12536         rp="What extensions do you wish to include?"
12537         . ./myread
12538         case "$ans" in
12539         none) static_ext=' ' ;;
12540         *) static_ext="$ans" ;;
12541         esac
12542         ;;
12543 esac
12544
12545 set X $dynamic_ext $static_ext $nonxs_ext
12546 shift
12547 extensions="$*"
12548
12549 : Remove build directory name from cppstdin so it can be used from
12550 : either the present location or the final installed location.
12551 echo " "
12552 : Get out of the UU directory to get correct path name.
12553 cd ..
12554 case "$cppstdin" in
12555 `pwd`/cppstdin)
12556         echo "Stripping down cppstdin path name"
12557         cppstdin=cppstdin
12558         ;;
12559 esac
12560 cd UU
12561
12562 : end of configuration questions
12563 echo " "
12564 echo "End of configuration questions."
12565 echo " "
12566
12567 : back to where it started
12568 if test -d ../UU; then
12569         cd ..
12570 fi
12571
12572 : configuration may be patched via a 'config.over' file
12573 if $test -f config.over; then
12574         echo " "
12575         dflt=y
12576         rp='I see a config.over file.  Do you wish to load it?'
12577         . UU/myread
12578         case "$ans" in
12579         n*) echo "OK, I'll ignore it.";;
12580         *)      . ./config.over
12581                 echo "Configuration override changes have been loaded."
12582                 ;;
12583         esac
12584 fi
12585
12586 : in case they want portability, strip down executable paths
12587 case "$d_portable" in
12588 "$define")
12589         echo " "
12590         echo "Stripping down executable paths..." >&4
12591         for file in $loclist $trylist; do
12592                 if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
12593                         eval $file="\$file"
12594                 fi
12595         done
12596         ;;
12597 esac
12598
12599 : create config.sh file
12600 echo " "
12601 echo "Creating config.sh..." >&4
12602 $spitshell <<EOT >config.sh
12603 $startsh
12604 #
12605 # This file was produced by running the Configure script. It holds all the
12606 # definitions figured out by Configure. Should you modify one of these values,
12607 # do not forget to propagate your changes by running "Configure -der". You may
12608 # instead choose to run each of the .SH files by yourself, or "Configure -S".
12609 #
12610
12611 # Package name      : $package
12612 # Source directory  : $src
12613 # Configuration time: $cf_time
12614 # Configured by     : $cf_by
12615 # Target system     : $myuname
12616
12617 Author='$Author'
12618 Date='$Date'
12619 Header='$Header'
12620 Id='$Id'
12621 Locker='$Locker'
12622 Log='$Log'
12623 Mcc='$Mcc'
12624 RCSfile='$RCSfile'
12625 Revision='$Revision'
12626 Source='$Source'
12627 State='$State'
12628 _a='$_a'
12629 _exe='$_exe'
12630 _o='$_o'
12631 afs='$afs'
12632 alignbytes='$alignbytes'
12633 ansi2knr='$ansi2knr'
12634 aphostname='$aphostname'
12635 apiversion='$apiversion'
12636 ar='$ar'
12637 archlib='$archlib'
12638 archlibexp='$archlibexp'
12639 archname64='$archname64'
12640 archname='$archname'
12641 archobjs='$archobjs'
12642 awk='$awk'
12643 baserev='$baserev'
12644 bash='$bash'
12645 bin='$bin'
12646 binexp='$binexp'
12647 bison='$bison'
12648 byacc='$byacc'
12649 byteorder='$byteorder'
12650 c='$c'
12651 castflags='$castflags'
12652 cat='$cat'
12653 cc='$cc'
12654 cccdlflags='$cccdlflags'
12655 ccdlflags='$ccdlflags'
12656 ccflags='$ccflags'
12657 ccsymbols='$ccsymbols'
12658 cf_by='$cf_by'
12659 cf_email='$cf_email'
12660 cf_time='$cf_time'
12661 chgrp='$chgrp'
12662 chmod='$chmod'
12663 chown='$chown'
12664 clocktype='$clocktype'
12665 comm='$comm'
12666 compress='$compress'
12667 contains='$contains'
12668 cp='$cp'
12669 cpio='$cpio'
12670 cpp='$cpp'
12671 cpp_stuff='$cpp_stuff'
12672 cppccsymbols='$cppccsymbols'
12673 cppflags='$cppflags'
12674 cpplast='$cpplast'
12675 cppminus='$cppminus'
12676 cpprun='$cpprun'
12677 cppstdin='$cppstdin'
12678 cppsymbols='$cppsymbols'
12679 crosscompile='$crosscompile'
12680 cryptlib='$cryptlib'
12681 csh='$csh'
12682 d_Gconvert='$d_Gconvert'
12683 d_access='$d_access'
12684 d_accessx='$d_accessx'
12685 d_alarm='$d_alarm'
12686 d_archlib='$d_archlib'
12687 d_attribut='$d_attribut'
12688 d_bcmp='$d_bcmp'
12689 d_bcopy='$d_bcopy'
12690 d_bsd='$d_bsd'
12691 d_bsdgetpgrp='$d_bsdgetpgrp'
12692 d_bsdsetpgrp='$d_bsdsetpgrp'
12693 d_bzero='$d_bzero'
12694 d_casti32='$d_casti32'
12695 d_castneg='$d_castneg'
12696 d_charvspr='$d_charvspr'
12697 d_chown='$d_chown'
12698 d_chroot='$d_chroot'
12699 d_chsize='$d_chsize'
12700 d_closedir='$d_closedir'
12701 d_cmsghdr_s='$d_cmsghdr_s'
12702 d_const='$d_const'
12703 d_crypt='$d_crypt'
12704 d_csh='$d_csh'
12705 d_cuserid='$d_cuserid'
12706 d_dbl_dig='$d_dbl_dig'
12707 d_dbmclose64='$d_dbmclose64'
12708 d_dbminit64='$d_dbminit64'
12709 d_delete64='$d_delete64'
12710 d_difftime='$d_difftime'
12711 d_dirent64_s='$d_dirent64_s'
12712 d_dirnamlen='$d_dirnamlen'
12713 d_dlerror='$d_dlerror'
12714 d_dlopen='$d_dlopen'
12715 d_dlsymun='$d_dlsymun'
12716 d_dosuid='$d_dosuid'
12717 d_drand48proto='$d_drand48proto'
12718 d_dup2='$d_dup2'
12719 d_eaccess='$d_eaccess'
12720 d_endgrent='$d_endgrent'
12721 d_endhent='$d_endhent'
12722 d_endnent='$d_endnent'
12723 d_endpent='$d_endpent'
12724 d_endpwent='$d_endpwent'
12725 d_endsent='$d_endsent'
12726 d_eofnblk='$d_eofnblk'
12727 d_eunice='$d_eunice'
12728 d_fchmod='$d_fchmod'
12729 d_fchown='$d_fchown'
12730 d_fcntl='$d_fcntl'
12731 d_fd_macros='$d_fd_macros'
12732 d_fd_set='$d_fd_set'
12733 d_fds_bits='$d_fds_bits'
12734 d_fetch64='$d_fetch64'
12735 d_fgetpos64='$d_fgetpos64'
12736 d_fgetpos='$d_fgetpos'
12737 d_firstkey64='$d_firstkey64'
12738 d_flexfnam='$d_flexfnam'
12739 d_flock64_s='$d_flock64_s'
12740 d_flock='$d_flock'
12741 d_fopen64='$d_fopen64'
12742 d_fork='$d_fork'
12743 d_fpathconf='$d_fpathconf'
12744 d_freopen64='$d_freopen64'
12745 d_fseek64='$d_fseek64'
12746 d_fseeko64='$d_fseeko64'
12747 d_fseeko='$d_fseeko'
12748 d_fsetpos64='$d_fsetpos64'
12749 d_fsetpos='$d_fsetpos'
12750 d_fstat64='$d_fstat64'
12751 d_fstatfs='$d_fstatfs'
12752 d_fstatvfs='$d_fstatvfs'
12753 d_ftell64='$d_ftell64'
12754 d_ftello64='$d_ftello64'
12755 d_ftello='$d_ftello'
12756 d_ftime='$d_ftime'
12757 d_ftruncate64='$d_ftruncate64'
12758 d_getgrent='$d_getgrent'
12759 d_getgrps='$d_getgrps'
12760 d_gethbyaddr='$d_gethbyaddr'
12761 d_gethbyname='$d_gethbyname'
12762 d_gethent='$d_gethent'
12763 d_gethname='$d_gethname'
12764 d_gethostprotos='$d_gethostprotos'
12765 d_getlogin='$d_getlogin'
12766 d_getmntent='$d_getmntent'
12767 d_getnbyaddr='$d_getnbyaddr'
12768 d_getnbyname='$d_getnbyname'
12769 d_getnent='$d_getnent'
12770 d_getnetprotos='$d_getnetprotos'
12771 d_getpbyname='$d_getpbyname'
12772 d_getpbynumber='$d_getpbynumber'
12773 d_getpent='$d_getpent'
12774 d_getpgid='$d_getpgid'
12775 d_getpgrp2='$d_getpgrp2'
12776 d_getpgrp='$d_getpgrp'
12777 d_getppid='$d_getppid'
12778 d_getprior='$d_getprior'
12779 d_getprotoprotos='$d_getprotoprotos'
12780 d_getpwent='$d_getpwent'
12781 d_getsbyname='$d_getsbyname'
12782 d_getsbyport='$d_getsbyport'
12783 d_getsent='$d_getsent'
12784 d_getservprotos='$d_getservprotos'
12785 d_gettimeod='$d_gettimeod'
12786 d_gnulibc='$d_gnulibc'
12787 d_grpasswd='$d_grpasswd'
12788 d_hasmntopt='$d_hasmntopt'
12789 d_htonl='$d_htonl'
12790 d_index='$d_index'
12791 d_inetaton='$d_inetaton'
12792 d_ino64_t='$d_ino64_t'
12793 d_int64t='$d_int64t'
12794 d_iovec_s='$d_iovec_s'
12795 d_isascii='$d_isascii'
12796 d_killpg='$d_killpg'
12797 d_lchown='$d_lchown'
12798 d_link='$d_link'
12799 d_llseek='$d_llseek'
12800 d_locconv='$d_locconv'
12801 d_lockf64='$d_lockf64'
12802 d_lockf='$d_lockf'
12803 d_longdbl='$d_longdbl'
12804 d_longlong='$d_longlong'
12805 d_lseek64='$d_lseek64'
12806 d_lstat64='$d_lstat64'
12807 d_lstat='$d_lstat'
12808 d_madvise='$d_madvise'
12809 d_mblen='$d_mblen'
12810 d_mbstowcs='$d_mbstowcs'
12811 d_mbtowc='$d_mbtowc'
12812 d_memcmp='$d_memcmp'
12813 d_memcpy='$d_memcpy'
12814 d_memmove='$d_memmove'
12815 d_memset='$d_memset'
12816 d_mkdir='$d_mkdir'
12817 d_mkfifo='$d_mkfifo'
12818 d_mktime='$d_mktime'
12819 d_mmap='$d_mmap'
12820 d_mprotect='$d_mprotect'
12821 d_msg='$d_msg'
12822 d_msg_ctrunc='$d_msg_ctrunc'
12823 d_msg_dontroute='$d_msg_dontroute'
12824 d_msg_oob='$d_msg_oob'
12825 d_msg_peek='$d_msg_peek'
12826 d_msg_proxy='$d_msg_proxy'
12827 d_msgctl='$d_msgctl'
12828 d_msgget='$d_msgget'
12829 d_msghdr_s='$d_msghdr_s'
12830 d_msgrcv='$d_msgrcv'
12831 d_msgsnd='$d_msgsnd'
12832 d_msync='$d_msync'
12833 d_munmap='$d_munmap'
12834 d_mymalloc='$d_mymalloc'
12835 d_nextkey64='$d_nextkey64'
12836 d_nice='$d_nice'
12837 d_off64_t='$d_off64_t'
12838 d_offset_t='$d_offset_t'
12839 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
12840 d_oldpthreads='$d_oldpthreads'
12841 d_oldsock='$d_oldsock'
12842 d_open3='$d_open3'
12843 d_open64='$d_open64'
12844 d_opendir64='$d_opendir64'
12845 d_pathconf='$d_pathconf'
12846 d_pause='$d_pause'
12847 d_phostname='$d_phostname'
12848 d_pipe='$d_pipe'
12849 d_poll='$d_poll'
12850 d_portable='$d_portable'
12851 d_pthread_yield='$d_pthread_yield'
12852 d_pwage='$d_pwage'
12853 d_pwchange='$d_pwchange'
12854 d_pwclass='$d_pwclass'
12855 d_pwcomment='$d_pwcomment'
12856 d_pwexpire='$d_pwexpire'
12857 d_pwgecos='$d_pwgecos'
12858 d_pwpasswd='$d_pwpasswd'
12859 d_pwquota='$d_pwquota'
12860 d_readdir64='$d_readdir64'
12861 d_readdir='$d_readdir'
12862 d_readlink='$d_readlink'
12863 d_readv='$d_readv'
12864 d_recvmsg='$d_recvmsg'
12865 d_rename='$d_rename'
12866 d_rewinddir='$d_rewinddir'
12867 d_rmdir='$d_rmdir'
12868 d_safebcpy='$d_safebcpy'
12869 d_safemcpy='$d_safemcpy'
12870 d_sanemcmp='$d_sanemcmp'
12871 d_sched_yield='$d_sched_yield'
12872 d_scm_rights='$d_scm_rights'
12873 d_seekdir64='$d_seekdir64'
12874 d_seekdir='$d_seekdir'
12875 d_select='$d_select'
12876 d_sem='$d_sem'
12877 d_semctl='$d_semctl'
12878 d_semctl_semid_ds='$d_semctl_semid_ds'
12879 d_semctl_semun='$d_semctl_semun'
12880 d_semget='$d_semget'
12881 d_semop='$d_semop'
12882 d_sendmsg='$d_sendmsg'
12883 d_setegid='$d_setegid'
12884 d_seteuid='$d_seteuid'
12885 d_setgrent='$d_setgrent'
12886 d_setgrps='$d_setgrps'
12887 d_sethent='$d_sethent'
12888 d_setlinebuf='$d_setlinebuf'
12889 d_setlocale='$d_setlocale'
12890 d_setnent='$d_setnent'
12891 d_setpent='$d_setpent'
12892 d_setpgid='$d_setpgid'
12893 d_setpgrp2='$d_setpgrp2'
12894 d_setpgrp='$d_setpgrp'
12895 d_setprior='$d_setprior'
12896 d_setpwent='$d_setpwent'
12897 d_setregid='$d_setregid'
12898 d_setresgid='$d_setresgid'
12899 d_setresuid='$d_setresuid'
12900 d_setreuid='$d_setreuid'
12901 d_setrgid='$d_setrgid'
12902 d_setruid='$d_setruid'
12903 d_setsent='$d_setsent'
12904 d_setsid='$d_setsid'
12905 d_setvbuf='$d_setvbuf'
12906 d_sfio='$d_sfio'
12907 d_shm='$d_shm'
12908 d_shmat='$d_shmat'
12909 d_shmatprototype='$d_shmatprototype'
12910 d_shmctl='$d_shmctl'
12911 d_shmdt='$d_shmdt'
12912 d_shmget='$d_shmget'
12913 d_sigaction='$d_sigaction'
12914 d_sigsetjmp='$d_sigsetjmp'
12915 d_socket='$d_socket'
12916 d_sockpair='$d_sockpair'
12917 d_stat64='$d_stat64'
12918 d_statblks='$d_statblks'
12919 d_statfs='$d_statfs'
12920 d_statfsflags='$d_statfsflags'
12921 d_statvfs='$d_statvfs'
12922 d_stdio_cnt_lval='$d_stdio_cnt_lval'
12923 d_stdio_ptr_lval='$d_stdio_ptr_lval'
12924 d_stdiobase='$d_stdiobase'
12925 d_stdstdio='$d_stdstdio'
12926 d_store64='$d_store64'
12927 d_strchr='$d_strchr'
12928 d_strcoll='$d_strcoll'
12929 d_strctcpy='$d_strctcpy'
12930 d_strerrm='$d_strerrm'
12931 d_strerror='$d_strerror'
12932 d_strtod='$d_strtod'
12933 d_strtol='$d_strtol'
12934 d_strtoul='$d_strtoul'
12935 d_strxfrm='$d_strxfrm'
12936 d_suidsafe='$d_suidsafe'
12937 d_symlink='$d_symlink'
12938 d_syscall='$d_syscall'
12939 d_sysconf='$d_sysconf'
12940 d_sysernlst='$d_sysernlst'
12941 d_syserrlst='$d_syserrlst'
12942 d_system='$d_system'
12943 d_tcgetpgrp='$d_tcgetpgrp'
12944 d_tcsetpgrp='$d_tcsetpgrp'
12945 d_telldir64='$d_telldir64'
12946 d_telldir='$d_telldir'
12947 d_telldirproto='$d_telldirproto'
12948 d_time='$d_time'
12949 d_times='$d_times'
12950 d_tmpfile64='$d_tmpfile64'
12951 d_truncate64='$d_truncate64'
12952 d_truncate='$d_truncate'
12953 d_tzname='$d_tzname'
12954 d_umask='$d_umask'
12955 d_uname='$d_uname'
12956 d_union_semun='$d_union_semun'
12957 d_vfork='$d_vfork'
12958 d_void_closedir='$d_void_closedir'
12959 d_voidsig='$d_voidsig'
12960 d_voidtty='$d_voidtty'
12961 d_volatile='$d_volatile'
12962 d_vprintf='$d_vprintf'
12963 d_wait4='$d_wait4'
12964 d_waitpid='$d_waitpid'
12965 d_wcstombs='$d_wcstombs'
12966 d_wctomb='$d_wctomb'
12967 d_writev='$d_writev'
12968 d_xenix='$d_xenix'
12969 date='$date'
12970 db_hashtype='$db_hashtype'
12971 db_prefixtype='$db_prefixtype'
12972 defvoidused='$defvoidused'
12973 direntrytype='$direntrytype'
12974 dlext='$dlext'
12975 dlsrc='$dlsrc'
12976 doublesize='$doublesize'
12977 drand01='$drand01'
12978 dynamic_ext='$dynamic_ext'
12979 eagain='$eagain'
12980 ebcdic='$ebcdic'
12981 echo='$echo'
12982 egrep='$egrep'
12983 emacs='$emacs'
12984 eunicefix='$eunicefix'
12985 exe_ext='$exe_ext'
12986 expr='$expr'
12987 extensions='$extensions'
12988 find='$find'
12989 firstmakefile='$firstmakefile'
12990 flex='$flex'
12991 fpostype='$fpostype'
12992 freetype='$freetype'
12993 full_ar='$full_ar'
12994 full_csh='$full_csh'
12995 full_sed='$full_sed'
12996 gccversion='$gccversion'
12997 gidtype='$gidtype'
12998 glibpth='$glibpth'
12999 grep='$grep'
13000 groupcat='$groupcat'
13001 groupstype='$groupstype'
13002 gzip='$gzip'
13003 h_fcntl='$h_fcntl'
13004 h_sysfile='$h_sysfile'
13005 hint='$hint'
13006 hostcat='$hostcat'
13007 huge='$huge'
13008 i_arpainet='$i_arpainet'
13009 i_bsdioctl='$i_bsdioctl'
13010 i_db='$i_db'
13011 i_dbm='$i_dbm'
13012 i_dirent='$i_dirent'
13013 i_dld='$i_dld'
13014 i_dlfcn='$i_dlfcn'
13015 i_fcntl='$i_fcntl'
13016 i_float='$i_float'
13017 i_gdbm='$i_gdbm'
13018 i_grp='$i_grp'
13019 i_inttypes='$i_inttypes'
13020 i_limits='$i_limits'
13021 i_locale='$i_locale'
13022 i_machcthr='$i_machcthr'
13023 i_malloc='$i_malloc'
13024 i_math='$i_math'
13025 i_memory='$i_memory'
13026 i_mntent='$i_mntent'
13027 i_ndbm='$i_ndbm'
13028 i_netdb='$i_netdb'
13029 i_neterrno='$i_neterrno'
13030 i_niin='$i_niin'
13031 i_poll='$i_poll'
13032 i_pthread='$i_pthread'
13033 i_pwd='$i_pwd'
13034 i_rpcsvcdbm='$i_rpcsvcdbm'
13035 i_sfio='$i_sfio'
13036 i_sgtty='$i_sgtty'
13037 i_stdarg='$i_stdarg'
13038 i_stddef='$i_stddef'
13039 i_stdlib='$i_stdlib'
13040 i_string='$i_string'
13041 i_sysaccess='$i_sysaccess'
13042 i_sysdir='$i_sysdir'
13043 i_sysfile='$i_sysfile'
13044 i_sysfilio='$i_sysfilio'
13045 i_sysin='$i_sysin'
13046 i_sysioctl='$i_sysioctl'
13047 i_sysmman='$i_sysmman'
13048 i_sysmount='$i_sysmount'
13049 i_sysndir='$i_sysndir'
13050 i_sysparam='$i_sysparam'
13051 i_sysresrc='$i_sysresrc'
13052 i_syssecrt='$i_syssecrt'
13053 i_sysselct='$i_sysselct'
13054 i_syssockio='$i_syssockio'
13055 i_sysstat='$i_sysstat'
13056 i_sysstatvfs='$i_sysstatvfs'
13057 i_systime='$i_systime'
13058 i_systimek='$i_systimek'
13059 i_systimes='$i_systimes'
13060 i_systypes='$i_systypes'
13061 i_sysuio='$i_sysuio'
13062 i_sysun='$i_sysun'
13063 i_syswait='$i_syswait'
13064 i_termio='$i_termio'
13065 i_termios='$i_termios'
13066 i_time='$i_time'
13067 i_unistd='$i_unistd'
13068 i_utime='$i_utime'
13069 i_values='$i_values'
13070 i_varargs='$i_varargs'
13071 i_varhdr='$i_varhdr'
13072 i_vfork='$i_vfork'
13073 ignore_versioned_solibs='$ignore_versioned_solibs'
13074 incpath='$incpath'
13075 inews='$inews'
13076 installarchlib='$installarchlib'
13077 installbin='$installbin'
13078 installman1dir='$installman1dir'
13079 installman3dir='$installman3dir'
13080 installprivlib='$installprivlib'
13081 installscript='$installscript'
13082 installsitearch='$installsitearch'
13083 installsitelib='$installsitelib'
13084 installusrbinperl='$installusrbinperl'
13085 intsize='$intsize'
13086 known_extensions='$known_extensions'
13087 ksh='$ksh'
13088 large='$large'
13089 ld='$ld'
13090 lddlflags='$lddlflags'
13091 ldflags='$ldflags'
13092 less='$less'
13093 lib_ext='$lib_ext'
13094 libc='$libc'
13095 libperl='$libperl'
13096 libpth='$libpth'
13097 libs='$libs'
13098 libswanted='$libswanted'
13099 line='$line'
13100 lint='$lint'
13101 lkflags='$lkflags'
13102 ln='$ln'
13103 lns='$lns'
13104 locincpth='$locincpth'
13105 loclibpth='$loclibpth'
13106 longdblsize='$longdblsize'
13107 longlongsize='$longlongsize'
13108 longsize='$longsize'
13109 lp='$lp'
13110 lpr='$lpr'
13111 ls='$ls'
13112 lseeksize='$lseeksize'
13113 lseektype='$lseektype'
13114 mail='$mail'
13115 mailx='$mailx'
13116 make='$make'
13117 make_set_make='$make_set_make'
13118 mallocobj='$mallocobj'
13119 mallocsrc='$mallocsrc'
13120 malloctype='$malloctype'
13121 man1dir='$man1dir'
13122 man1direxp='$man1direxp'
13123 man1ext='$man1ext'
13124 man3dir='$man3dir'
13125 man3direxp='$man3direxp'
13126 man3ext='$man3ext'
13127 medium='$medium'
13128 mips='$mips'
13129 mips_type='$mips_type'
13130 mkdir='$mkdir'
13131 mmaptype='$mmaptype'
13132 models='$models'
13133 modetype='$modetype'
13134 more='$more'
13135 multiarch='$multiarch'
13136 mv='$mv'
13137 myarchname='$myarchname'
13138 mydomain='$mydomain'
13139 myhostname='$myhostname'
13140 myuname='$myuname'
13141 n='$n'
13142 netdb_hlen_type='$netdb_hlen_type'
13143 netdb_host_type='$netdb_host_type'
13144 netdb_name_type='$netdb_name_type'
13145 netdb_net_type='$netdb_net_type'
13146 nm='$nm'
13147 nm_opt='$nm_opt'
13148 nm_so_opt='$nm_so_opt'
13149 nonxs_ext='$nonxs_ext'
13150 nroff='$nroff'
13151 o_nonblock='$o_nonblock'
13152 obj_ext='$obj_ext'
13153 old_pthread_create_joinable='$old_pthread_create_joinable'
13154 optimize='$optimize'
13155 orderlib='$orderlib'
13156 osname='$osname'
13157 osvers='$osvers'
13158 package='$package'
13159 pager='$pager'
13160 passcat='$passcat'
13161 patchlevel='$patchlevel'
13162 path_sep='$path_sep'
13163 perl='$perl'
13164 perladmin='$perladmin'
13165 perlpath='$perlpath'
13166 pg='$pg'
13167 phostname='$phostname'
13168 pidtype='$pidtype'
13169 plibpth='$plibpth'
13170 pmake='$pmake'
13171 pr='$pr'
13172 prefix='$prefix'
13173 prefixexp='$prefixexp'
13174 privlib='$privlib'
13175 privlibexp='$privlibexp'
13176 prototype='$prototype'
13177 ptrsize='$ptrsize'
13178 randbits='$randbits'
13179 randfunc='$randfunc'
13180 randseedtype='$randseedtype'
13181 ranlib='$ranlib'
13182 rd_nodata='$rd_nodata'
13183 rm='$rm'
13184 rmail='$rmail'
13185 runnm='$runnm'
13186 sched_yield='$sched_yield'
13187 scriptdir='$scriptdir'
13188 scriptdirexp='$scriptdirexp'
13189 sed='$sed'
13190 seedfunc='$seedfunc'
13191 selectminbits='$selectminbits'
13192 selecttype='$selecttype'
13193 sendmail='$sendmail'
13194 sh='$sh'
13195 shar='$shar'
13196 sharpbang='$sharpbang'
13197 shmattype='$shmattype'
13198 shortsize='$shortsize'
13199 shrpenv='$shrpenv'
13200 shsharp='$shsharp'
13201 sig_name='$sig_name'
13202 sig_name_init='$sig_name_init'
13203 sig_num='$sig_num'
13204 sig_num_init='$sig_num_init'
13205 signal_t='$signal_t'
13206 sitearch='$sitearch'
13207 sitearchexp='$sitearchexp'
13208 sitelib='$sitelib'
13209 sitelibexp='$sitelibexp'
13210 sizetype='$sizetype'
13211 sleep='$sleep'
13212 smail='$smail'
13213 small='$small'
13214 so='$so'
13215 sockethdr='$sockethdr'
13216 socketlib='$socketlib'
13217 sort='$sort'
13218 spackage='$spackage'
13219 spitshell='$spitshell'
13220 split='$split'
13221 src='$src'
13222 ssizetype='$ssizetype'
13223 startperl='$startperl'
13224 startsh='$startsh'
13225 static_ext='$static_ext'
13226 stdchar='$stdchar'
13227 stdio_base='$stdio_base'
13228 stdio_bufsiz='$stdio_bufsiz'
13229 stdio_cnt='$stdio_cnt'
13230 stdio_filbuf='$stdio_filbuf'
13231 stdio_ptr='$stdio_ptr'
13232 strings='$strings'
13233 submit='$submit'
13234 subversion='$subversion'
13235 sysman='$sysman'
13236 tail='$tail'
13237 tar='$tar'
13238 tbl='$tbl'
13239 tee='$tee'
13240 test='$test'
13241 timeincl='$timeincl'
13242 timetype='$timetype'
13243 touch='$touch'
13244 tr='$tr'
13245 trnl='$trnl'
13246 troff='$troff'
13247 uidtype='$uidtype'
13248 uname='$uname'
13249 uniq='$uniq'
13250 use64bits='$use64bits'
13251 usedl='$usedl'
13252 usemultiplicity='$usemultiplicity'
13253 usemymalloc='$usemymalloc'
13254 usenm='$usenm'
13255 useopcode='$useopcode'
13256 useperlio='$useperlio'
13257 useposix='$useposix'
13258 usesfio='$usesfio'
13259 useshrplib='$useshrplib'
13260 usethreads='$usethreads'
13261 usevfork='$usevfork'
13262 usrinc='$usrinc'
13263 uuname='$uuname'
13264 version='$version'
13265 vi='$vi'
13266 voidflags='$voidflags'
13267 xlibpth='$xlibpth'
13268 zcat='$zcat'
13269 zip='$zip'
13270 EOT
13271
13272 : Add in command line options if available
13273 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
13274
13275 : add special variables
13276 $test -f $src/patchlevel.h && \
13277 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
13278 echo "CONFIGDOTSH=true" >>config.sh
13279
13280 : propagate old symbols
13281 if $test -f UU/config.sh; then
13282         <UU/config.sh sort | uniq >UU/oldconfig.sh
13283         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
13284         sort | uniq -u >UU/oldsyms
13285         set X `cat UU/oldsyms`
13286         shift
13287         case $# in
13288         0) ;;
13289         *)
13290                 cat <<EOM
13291 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
13292 EOM
13293                 echo "# Variables propagated from previous config.sh file." >>config.sh
13294                 for sym in `cat UU/oldsyms`; do
13295                         echo "    Propagating $hint variable "'$'"$sym..."
13296                         eval 'tmp="$'"${sym}"'"'
13297                         echo "$tmp" | \
13298                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
13299                 done
13300                 ;;
13301         esac
13302 fi
13303
13304 : Finish up by extracting the .SH files
13305 case "$alldone" in
13306 exit)
13307         $rm -rf UU
13308         echo "Done."
13309         exit 0
13310         ;;
13311 cont)
13312         ;;
13313 '')
13314         dflt=''
13315         nostick=true
13316         $cat <<EOM
13317
13318 If you'd like to make any changes to the config.sh file before I begin
13319 to configure things, do it as a shell escape now (e.g. !vi config.sh).
13320
13321 EOM
13322         rp="Press return or use a shell escape to edit config.sh:"
13323         . UU/myread
13324         nostick=''
13325         case "$ans" in
13326         '') ;;
13327         *) : in case they cannot read
13328                 sh 1>&4 -c "$ans";;
13329         esac
13330         ;;
13331 esac
13332
13333 : if this fails, just run all the .SH files by hand
13334 . ./config.sh
13335
13336 echo " "
13337 exec 1>&4
13338 . ./UU/extract
13339
13340 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
13341         dflt=y
13342         case "$silent" in
13343         true) ;;
13344         *)
13345                 $cat <<EOM
13346
13347 Now you need to generate make dependencies by running "$make depend".
13348 You might prefer to run it in background: "$make depend > makedepend.out &"
13349 It can take a while, so you might not want to run it right now.
13350
13351 EOM
13352                 ;;
13353         esac
13354         rp="Run $make depend now?"
13355         . UU/myread
13356         case "$ans" in
13357         y*)
13358                 $make depend && echo "Now you must run a $make."
13359                 ;;
13360         *)
13361                 echo "You must run '$make depend' then '$make'."
13362                 ;;
13363         esac
13364 elif test -f [Mm]akefile; then
13365         echo " "
13366         echo "Now you must run a $make."
13367 else
13368         echo "Done."
13369 fi
13370
13371 if $test -f Policy.sh; then
13372     $cat <<EOM
13373
13374 If you compile $package on a different machine or from a different object
13375 directory, copy the Policy.sh file from this object directory to the
13376 new one before you run Configure -- this will help you with most of
13377 the policy defaults.
13378
13379 EOM
13380 fi
13381 if $test -f config.msg; then
13382     echo "Hmm.  I also noted the following information while running:"
13383     echo " "
13384     $cat config.msg >&4
13385     $rm -f config.msg
13386 fi
13387 $rm -f kit*isdone ark*isdone
13388 $rm -rf UU
13389
13390 : End of Configure
13391