xref: /original-bsd/contrib/perl-4.036/Configure (revision bf410196)
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, I would
7# suggest you cut out the prototypical config.h from the end of Configure
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# $RCSfile: Configure,v $$Revision: 4.0.1.9 $$Date: 92/06/23 12:28:33 $
12#
13# Yes, you may rip this off to use in other distribution packages.
14# (Note: this Configure script was generated automatically.  Rather than
15# working with this copy of Configure, you may wish to get metaconfig.)
16
17cat >/tmp/c1$$ <<EOF
18ARGGGHHHH!!!!!
19
20Your csh still thinks true is false.  Write to your vendor today and tell
21them that next year Configure ought to "rm /bin/csh" unless they fix their
22blasted shell. :-)
23
24[End of diatribe.  We now return you to your regularly scheduled
25programming...]
26
27EOF
28cat >/tmp/c2$$ <<EOF
29OOPS!  You naughty creature!  You didn't run Configure with sh!
30I will attempt to remedy the situation by running sh for you...
31
32EOF
33
34true || cat /tmp/c1$$ /tmp/c2$$
35true || exec sh $0
36
37export PATH || cat /tmp/c2$$
38export PATH || exec sh $0
39rm -f /tmp/c1$$ /tmp/c2$$
40
41PATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin"
42
43if test ! -t 0; then
44    echo "Say 'sh Configure', not 'sh <Configure'"
45    exit 1
46fi
47
48(alias) >/dev/null 2>&1 && \
49    echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
50    echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
51
52unset CDPATH
53if test ! -d ../UU; then
54    if test ! -d UU; then
55	mkdir UU
56    fi
57    cd UU
58fi
59
60case "$1" in
61-d) shift; fastread='yes';;
62esac
63
64d_eunice=''
65define=''
66eunicefix=''
67loclist=''
68expr=''
69sed=''
70echo=''
71cat=''
72rm=''
73mv=''
74cp=''
75tail=''
76tr=''
77mkdir=''
78sort=''
79uniq=''
80grep=''
81trylist=''
82test=''
83inews=''
84egrep=''
85more=''
86pg=''
87Mcc=''
88vi=''
89mailx=''
90mail=''
91cpp=''
92perl=''
93emacs=''
94ls=''
95rmail=''
96sendmail=''
97shar=''
98smail=''
99tbl=''
100troff=''
101nroff=''
102uname=''
103uuname=''
104line=''
105chgrp=''
106chmod=''
107lint=''
108sleep=''
109pr=''
110tar=''
111ln=''
112lpr=''
113lp=''
114touch=''
115make=''
116date=''
117csh=''
118bash=''
119ksh=''
120lex=''
121flex=''
122bison=''
123Log=''
124Header=''
125Id=''
126lastuname=''
127alignbytes=''
128bin=''
129installbin=''
130byteorder=''
131contains=''
132cppstdin=''
133cppminus=''
134d_bcmp=''
135d_bcopy=''
136d_safebcpy=''
137d_bzero=''
138d_castneg=''
139castflags=''
140d_charsprf=''
141d_chsize=''
142d_crypt=''
143cryptlib=''
144d_csh=''
145d_dosuid=''
146d_dup2=''
147d_fchmod=''
148d_fchown=''
149d_fcntl=''
150d_flexfnam=''
151d_flock=''
152d_getgrps=''
153d_gethent=''
154d_getpgrp=''
155d_getpgrp2=''
156d_getprior=''
157d_htonl=''
158d_index=''
159d_isascii=''
160d_killpg=''
161d_lstat=''
162d_memcmp=''
163d_memcpy=''
164d_safemcpy=''
165d_memmove=''
166d_memset=''
167d_mkdir=''
168d_msg=''
169d_msgctl=''
170d_msgget=''
171d_msgrcv=''
172d_msgsnd=''
173d_ndbm=''
174d_odbm=''
175d_open3=''
176d_readdir=''
177d_rename=''
178d_rewindir=''
179d_rmdir=''
180d_seekdir=''
181d_select=''
182d_sem=''
183d_semctl=''
184d_semget=''
185d_semop=''
186d_setegid=''
187d_seteuid=''
188d_setpgrp=''
189d_setpgrp2=''
190d_setprior=''
191d_setregid=''
192d_setresgid=''
193d_setreuid=''
194d_setresuid=''
195d_setrgid=''
196d_setruid=''
197d_shm=''
198d_shmat=''
199d_voidshmat=''
200d_shmctl=''
201d_shmdt=''
202d_shmget=''
203d_socket=''
204d_sockpair=''
205d_oldsock=''
206socketlib=''
207d_statblks=''
208d_stdstdio=''
209d_strctcpy=''
210d_strerror=''
211d_symlink=''
212d_syscall=''
213d_telldir=''
214d_truncate=''
215d_vfork=''
216d_voidsig=''
217d_tosignal=''
218d_volatile=''
219d_vprintf=''
220d_charvspr=''
221d_wait4=''
222d_waitpid=''
223gidtype=''
224groupstype=''
225i_fcntl=''
226i_gdbm=''
227i_grp=''
228i_niin=''
229i_sysin=''
230i_pwd=''
231d_pwquota=''
232d_pwage=''
233d_pwchange=''
234d_pwclass=''
235d_pwexpire=''
236d_pwcomment=''
237i_sys_file=''
238i_sysioctl=''
239i_time=''
240i_sys_time=''
241i_sys_select=''
242d_systimekernel=''
243i_utime=''
244i_varargs=''
245i_vfork=''
246intsize=''
247libc=''
248nm_opts=''
249libndir=''
250i_my_dir=''
251i_ndir=''
252i_sys_ndir=''
253i_dirent=''
254i_sys_dir=''
255d_dirnamlen=''
256ndirc=''
257ndiro=''
258mallocsrc=''
259mallocobj=''
260d_mymalloc=''
261mallocptrtype=''
262mansrc=''
263manext=''
264models=''
265split=''
266small=''
267medium=''
268large=''
269huge=''
270optimize=''
271ccflags=''
272cppflags=''
273ldflags=''
274cc=''
275nativegcc=''
276libs=''
277n=''
278c=''
279package=''
280randbits=''
281scriptdir=''
282installscr=''
283sig_name=''
284spitshell=''
285shsharp=''
286sharpbang=''
287startsh=''
288stdchar=''
289uidtype=''
290usrinclude=''
291inclPath=''
292void=''
293voidhave=''
294voidwant=''
295w_localtim=''
296w_s_timevl=''
297w_s_tm=''
298yacc=''
299lib=''
300privlib=''
301installprivlib=''
302CONFIG=''
303: get the name of the package
304package=perl
305: Here we go...
306echo " "
307echo "Beginning of configuration questions for $package kit."
308: Eunice requires " " instead of "", can you believe it
309echo " "
310
311define='define'
312undef='undef'
313: change the next line if compiling for Xenix/286 on Xenix/386
314xlibpth='/usr/lib/386 /lib/386'
315
316: the hints files may add more components to libpth
317test -d /usr/cs/lib		&& libpth="$libpth /usr/cs/lib"
318test -d /usr/ccs/lib		&& libpth="$libpth /usr/ccs/lib"
319test -d /usr/lib		&& libpth="$libpth /usr/lib"
320test -d /usr/ucblib		&& libpth="$libpth /usr/ucblib"
321test -d /usr/local/lib		&& libpth="$libpth /usr/local/lib"
322test -d /usr/lib/large		&& libpth="$libpth /usr/lib/large"
323test -d /lib			&& libpth="$libpth /lib"
324				   libpth="$libpth $xlibpth"
325test -d /lib/large		&& libpth="$libpth /lib/large"
326test -d /usr/lib/small		&& libpth="$libpth /usr/lib/small"
327test -d /lib/small		&& libpth="$libpth /lib/small"
328test -d /usr/lib/cmplrs/cc	&& libpth="$libpth /usr/lib/cmplrs/cc"
329
330smallmach='pdp11 i8086 z8000 i80286 iAPX286'
331trap 'echo " "; exit 1' 1 2 3
332
333: We must find out about Eunice early
334eunicefix=':'
335if test -f /etc/unixtovms; then
336    eunicefix=/etc/unixtovms
337fi
338if test -f /etc/unixtovms.exe; then
339    eunicefix=/etc/unixtovms.exe
340fi
341
342attrlist="DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__"
343attrlist="$attrlist __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
344attrlist="$attrlist hp9000s300 hp9000s500 hp9000s800 hpux"
345attrlist="$attrlist i186 i386 i8086 iAPX286 ibm interdata"
346attrlist="$attrlist m68k m88k mc300 mc500 mc68000 mc68k mc700 mert"
347attrlist="$attrlist ns16000 ns32000 nsc32000 os pdp11 posix pyr sinix"
348attrlist="$attrlist sparc sun tower tower32 tower32_600 tower32_800 tss"
349attrlist="$attrlist u3b2 u3b20 u3b200 u3b5 ultrix unix vax venix xenix"
350attrlist="$attrlist z8000"
351boPATH=""
352eoPATH="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb /bsd43/usr/bin /usr/ccs/lib /opt/SUNWste/bin /usr/opt/SUNWste/bin"
353d_newshome="/usr/NeWS"
354errnolist=errnolist
355h_fcntl=false
356h_sys_file=false
357serve_shm=""
358serve_msg="$undef"
359serve_inet_udp=""
360serve_inet_tcp=""
361serve_unix_udp=""
362serve_unix_tcp=""
363d_ndir=ndir
364voidwant=1
365voidwant=7
366libswanted="c_s net_s net socket nsl_s nsl nm ndir dir ndbm dbm PW malloc sun m bsd BSD x posix ucb"
367inclwanted='/usr/include /usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan /usr/ucbinclude'
368
369: Now test for existence of everything in MANIFEST
370
371echo "First let's make sure your kit is complete.  Checking..."
372awk '$1 !~ /PACKINGLIST/ {print $1}' ../MANIFEST | split -100
373rm -f missing
374for filelist in x??; do
375    (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
376done
377if test -s missing; then
378    echo "WARNING: the following files are missing:"
379    cat missing
380    echo "INTERRUPT NOW, OR HIT RETURN TO PROCEED AT YOUR OWN RISK"
381    read junk
382else
383    echo "Looks good..."
384fi
385
386: some greps do not return status, grrr.
387echo "grimblepritz" >contains.txt
388if grep blurfldyick contains.txt >/dev/null 2>&1 ; then
389    contains=contains
390elif grep grimblepritz contains.txt >/dev/null 2>&1 ; then
391    contains=grep
392else
393    contains=contains
394fi
395: the following should work in any shell
396case "$contains" in
397contains*)
398    echo " "
399    echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
400    cat >contains <<'EOSS'
401grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
402EOSS
403chmod +x contains
404esac
405
406: see if sh knows # comments
407echo " "
408echo "Checking your sh to see if it knows about # comments..."
409if sh -c '#' >/dev/null 2>&1 ; then
410    echo "Your sh handles # comments correctly."
411    shsharp=true
412    spitshell=cat
413    echo " "
414    echo "Okay, let's see if #! works on this system..."
415    if test -f /bsd43/bin/echo; then
416	echo "#!/bsd43/bin/echo hi" > spit.sh
417    else
418	echo "#!/bin/echo hi" > spit.sh
419    fi
420    $eunicefix spit.sh
421    chmod +x spit.sh
422    ./spit.sh > today
423    if $contains hi today >/dev/null 2>&1; then
424	echo "It does."
425	sharpbang='#!'
426    else
427	echo "#! /bin/echo hi" > spit.sh
428	$eunicefix spit.sh
429	chmod +x spit.sh
430	./spit.sh > today
431	if test -s today; then
432	    echo "It does."
433	    sharpbang='#! '
434	else
435	    echo "It doesn't."
436	    sharpbang=': use '
437	fi
438    fi
439else
440    echo "Your sh doesn't grok # comments--I will strip them later on."
441    shsharp=false
442    echo "exec grep -v '^#'" >spitshell
443    chmod +x spitshell
444    $eunicefix spitshell
445    spitshell=`pwd`/spitshell
446    echo "I presume that if # doesn't work, #! won't work either!"
447    sharpbang=': use '
448fi
449
450: figure out how to guarantee sh startup
451echo " "
452echo "Checking out how to guarantee sh startup..."
453startsh=$sharpbang'/bin/sh'
454echo "Let's see if '$startsh' works..."
455cat >start.sh <<EOSS
456$startsh
457set abc
458test "$?abc" != 1
459EOSS
460
461chmod +x start.sh
462$eunicefix start.sh
463if ./start.sh; then
464    echo "Yup, it does."
465else
466    echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
467fi
468
469: first determine how to suppress newline on echo command
470echo "Checking echo to see how to suppress newlines..."
471(echo "hi there\c" ; echo " ") >echotmp
472if $contains c echotmp >/dev/null 2>&1 ; then
473    echo "...using -n."
474    n='-n'
475    c=''
476else
477    cat <<'EOM'
478...using \c
479EOM
480    n=''
481    c='\c'
482fi
483echo $n "Type carriage return to continue.  Your cursor should be here-->$c"
484read ans
485
486: now set up to do reads with possible shell escape and default assignment
487cat <<EOSC >myread
488case "\$fastread" in
489yes) ans=''; echo " " ;;
490*) ans='!';;
491esac
492while expr "X\$ans" : "X!" >/dev/null; do
493    read ans
494    case "\$ans" in
495    !)
496	sh
497	echo " "
498	echo $n "\$rp $c"
499	;;
500    !*)
501	set \`expr "X\$ans" : "X!\(.*\)\$"\`
502	sh -c "\$*"
503	echo " "
504	echo $n "\$rp $c"
505	;;
506    esac
507done
508rp='Your answer:'
509case "\$ans" in
510'') ans="\$dflt";;
511esac
512EOSC
513
514: general instructions
515cat <<EOH
516 
517This installation shell script will examine your system and ask you questions
518to determine how the $package package should be installed.  If you get stuck
519on a question, you may use a ! shell escape to start a subshell or execute
520a command.  Many of the questions will have default answers in square
521brackets--typing carriage return will give you the default.
522
523On some of the questions which ask for file or directory names you are
524allowed to use the ~name construct to specify the login directory belonging
525to "name", even if you don't have a shell which knows about that.  Questions
526where this is allowed will be marked "(~name ok)".
527
528EOH
529rp="[Type carriage return to continue]"
530echo $n "$rp $c"
531. myread
532cat <<EOH
533
534Much effort has been expended to ensure that this shell script will run on any
535Unix system.  If despite that it blows up on you, your best bet is to edit
536Configure and run it again. Also, let me (lwall@netlabs.com)
537know how I blew it.  If you can't run Configure for some reason, you'll have
538to generate a config.sh file by hand.
539
540This installation script affects things in two ways: 1) it may do direct
541variable substitutions on some of the files included in this kit, and
5422) it builds a config.h file for inclusion in C programs.  You may edit
543any of these files as the need arises after running this script.
544
545If you make a mistake on a question, there is no easy way to back up to it
546currently.  The easiest thing to do is to edit config.sh and rerun all the
547SH files.  Configure will offer to let you do this before it runs the SH files.
548
549EOH
550rp="[Type carriage return to continue]"
551echo $n "$rp $c"
552. myread
553
554: find out where common programs are
555echo " "
556echo "Locating common programs..."
557cat <<EOSC >loc
558$startsh
559case \$# in
5600) exit 1;;
561esac
562thing=\$1
563shift
564dflt=\$1
565shift
566for dir in \$*; do
567    case "\$thing" in
568    .)
569	if test -d \$dir/\$thing; then
570	    echo \$dir
571	    exit 0
572	fi
573	;;
574    *)
575	if test -f \$dir/\$thing; then
576	    echo \$dir/\$thing
577	    exit 0
578	elif test -f \$dir/\$thing.exe; then
579	    : on Eunice apparently
580	    echo \$dir/\$thing
581	    exit 0
582	fi
583	;;
584    esac
585done
586echo \$dflt
587exit 1
588EOSC
589chmod +x loc
590$eunicefix loc
591loclist="
592cat
593cp
594echo
595expr
596grep
597mkdir
598mv
599rm
600sed
601sort
602tr
603uniq
604"
605trylist="
606Mcc
607bison
608cpp
609csh
610egrep
611line
612nroff
613perl
614test
615uname
616yacc
617"
618pth=`echo :$boPATH:$PATH:$eoPATH: | sed -e 's/:/ /g'`
619for file in $loclist; do
620    xxx=`./loc $file $file $pth`
621    eval $file=$xxx
622    eval _$file=$xxx
623    case "$xxx" in
624    /*)
625	echo $file is in $xxx.
626	;;
627    *)
628	echo "I don't know where $file is.  I hope it's in everyone's PATH."
629	;;
630    esac
631done
632echo " "
633echo "Don't worry if any of the following aren't found..."
634ans=offhand
635for file in $trylist; do
636    xxx=`./loc $file $file $pth`
637    eval $file=$xxx
638    eval _$file=$xxx
639    case "$xxx" in
640    /*)
641	echo $file is in $xxx.
642	;;
643    *)
644	echo "I don't see $file out there, $ans."
645	ans=either
646	;;
647    esac
648done
649case "$egrep" in
650egrep)
651    echo "Substituting grep for egrep."
652    egrep=$grep
653    ;;
654esac
655case "$test" in
656test)
657    echo "Hopefully test is built into your sh."
658    ;;
659/bin/test)
660    if sh -c "PATH= test true" >/dev/null 2>&1; then
661	echo "Using the test built into your sh."
662	test=test
663    fi
664    ;;
665*)
666    test=test
667    ;;
668esac
669case "$echo" in
670echo)
671    echo "Hopefully echo is built into your sh."
672    ;;
673/bin/echo)
674    echo " "
675    echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
676    $echo $n "hi there$c" >Loc1.txt
677    echo $n "hi there$c" >Loc2.txt
678    if cmp Loc1.txt Loc2.txt >/dev/null 2>&1; then
679	echo "They are compatible.  In fact, they may be identical."
680    else
681	case "$n" in
682	'-n') n='' c='\c' ans='\c' ;;
683	*) n='-n' c='' ans='-n' ;;
684	esac
685	cat <<FOO
686They are not compatible!  You are probably running ksh on a non-USG system.
687I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
688have echo built in and we may have to run some Bourne shell scripts.  That
689means I'll have to use $ans to suppress newlines now.  Life is ridiculous.
690
691FOO
692	rp="Your cursor should be here-->"
693	$echo $n "$rp$c"
694	. myread
695    fi
696    ;;
697*)
698    : cross your fingers
699    echo=echo
700    ;;
701esac
702
703: set up shell script to do ~ expansion
704cat >filexp <<EOSS
705$startsh
706: expand filename
707case "\$1" in
708 ~/*|~)
709    echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
710    ;;
711 ~*)
712    if $test -f /bin/csh; then
713	/bin/csh -f -c "glob \$1"
714	echo ""
715    else
716	name=\`$expr x\$1 : '..\([^/]*\)'\`
717	dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
718	if $test ! -d "\$dir"; then
719	    me=\`basename \$0\`
720	    echo "\$me: can't locate home directory for: \$name" >&2
721	    exit 1
722	fi
723	case "\$1" in
724	*/*)
725	    echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
726	    ;;
727	*)
728	    echo \$dir
729	    ;;
730	esac
731    fi
732    ;;
733*)
734    echo \$1
735    ;;
736esac
737EOSS
738chmod +x filexp
739$eunicefix filexp
740
741: get old answers, if there is a config file out there
742hint=default
743if test -f ../config.sh; then
744    echo " "
745    eval "`grep lastuname ../config.sh`"
746    tmp=`(uname -a) 2>&1`
747    if test "X$tmp" = "X$lastuname"; then
748	dflt=y
749    else
750	dflt=n
751    fi
752    lastuname="$tmp"
753    rp="I see a config.sh file.  Did Configure make it on THIS system? [$dflt]"
754    echo $n "$rp $c"
755    . myread
756    case "$ans" in
757    n*) echo "OK, I'll ignore it."; mv ../config.sh ../config.sh.old;;
758    *)  echo "Fetching default answers from your old config.sh file..."
759	tmp="$n"
760	ans="$c"
761        . ../config.sh
762	n="$tmp"
763	c="$ans"
764	hint=previous
765	;;
766    esac
767else
768    lastuname=`(uname -a) 2>&1`
769fi
770if test -d ../hints && test ! -f ../config.sh; then
771    echo ' '
772    echo "First time through, eh?  I have some defaults handy for the following systems:"
773    (cd ../hints; ls -C *.sh | sed 's/\.sh/   /g')
774    dflt=''
775    : Half the following guesses are probably wrong...
776    test -f /irix && dflt="$dflt sgi"
777    test -f /xenix && dflt="$dflt sco_xenix"
778    test -f /dynix && dflt="$dflt dynix"
779    test -f /dnix && dflt="$dflt dnix"
780    test -f /bin/mips && /bin/mips && dflt="$dflt mips"
781    test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next"
782    if test -f /bin/uname || test -f /usr/bin/uname; then
783	set `uname -a | tr '[A-Z]' '[a-z]'`
784
785	test -f "../hints/$5.sh" && dflt="$dflt $5"
786
787	case "$5" in
788	3b2) dflt="$dflt 3b2";;
789	fps*) dflt="$dflt fps";;
790	mips*) dflt="$dflt mips";;
791	[23]100) dflt="$dflt mips";;
792	next*) dflt="$dflt next" ;;
793	6000) dflt="$dflt mc6000";;
794	esac
795
796	test -f "../hints/$1.sh" && dflt="$dflt $1"
797
798	case "$1" in
799	aix) dflt="$dflt aix_rs" ;;
800	sunos) case "$3" in
801	    3.4) dflt="$dflt sunos_3_4" ;;
802	    3.5) dflt="$dflt sunos_3_5" ;;
803	    4.0.1) dflt="$dflt sunos_4_0_1" ;;
804	    4.0.2) dflt="$dflt sunos_4_0_2" ;;
805	    esac
806	    ;;
807	hp*ux) dflt="$dflt hpux"
808	    extra_hints="hp"`echo $5 | sed -e s#/#_#g -e s/..$/00/`
809	    if test -f ../hints/$extra_hints.sh; then
810		dflt="$dflt $extra_hints"
811	    fi;;
812	irix) dflt="$dflt sgi" ;;
813	ultrix) case "$3" in
814	    1*) dflt="$dflt ultrix_1" ;;
815	    3*) dflt="$dflt ultrix_3" ;;
816	    4*) dflt="$dflt ultrix_4" ;;
817	    esac
818	    ;;
819	uts) dflt="$dflt uts" ;;
820	$2) if test -f /etc/systemid; then
821		set `echo $3 | sed 's/\./ /'` $4
822		if test -f ../hints/sco_$1_$2_$3.sh; then
823		    dflt="$dflt sco_$1_$2_$3"
824		elif test -f ../hints/sco_$1_$2.sh; then
825		    dflt="$dflt sco_$1_$2"
826		elif test -f ../hints/sco_$1.sh; then
827		    dflt="$dflt sco_$1"
828		fi
829	    fi
830	    ;;
831	esac
832    fi
833    set X `echo $dflt | tr ' ' '\012' | sort | uniq`
834    shift
835    dflt=${1+"$@"}
836    case "$dflt" in
837    '') dflt=none;;
838    esac
839    echo '(You may give one or more space-separated answers, or "none" if appropriate.'
840    echo 'If your OS version has no hints, do not give a wrong version--say "none".)'
841    rp="Which of these apply, if any? [$dflt]"
842    echo $n "$rp $c"
843    . myread
844    for file in $ans; do
845	if test -f ../hints/$file.sh; then
846	    . ../hints/$file.sh
847	    cat ../hints/$file.sh >>../config.sh
848	    hint=recommended
849	fi
850    done
851fi
852
853cat >whoa <<'EOF'
854eval "was=\$$2"
855dflt=y
856echo ' '
857echo "*** WHOA THERE!!! ***"
858echo "    The $hint value for \$$2 on this machine was \"$was\"!"
859rp="    Keep the $hint value? [y]"
860echo $n "$rp $c"
861. myread
862case "$ans" in
863y) td=$was; tu=$was;;
864esac
865EOF
866
867setvar='td=$define; tu=$undef; set X $1; eval "was=\$$2";
868case "$val$was" in
869defineundef) . whoa; eval "$2=\$td";;
870undefdefine) . whoa; eval "$2=\$tu";;
871*) eval "$2=$val";;
872esac'
873
874: determine where manual pages go
875$cat <<EOM
876  
877$package has manual pages available in source form.
878EOM
879case "$nroff" in
880'nroff')
881    echo "However, you don't have nroff, so they're probably useless to you."
882    case "$mansrc" in
883    '')
884	mansrc="none"
885	;;
886    esac
887esac
888echo "If you don't want the manual sources installed, answer 'none'."
889case "$mansrc" in
890'')
891    dflt=`./loc . none /usr/man/local/man1 /usr/man/man.L /usr/man/manl /usr/man/mann /usr/man/u_man/man1 /usr/man/man1 /usr/local/man/man1`
892    ;;
893*)  dflt="$mansrc"
894    ;;
895esac
896cont=true
897while $test "$cont" ; do
898    echo " "
899    rp="Where do the manual pages (source) go (~name ok)? [$dflt]"
900    $echo $n "$rp $c"
901    . myread
902    case "$ans" in
903    'none')
904	mansrc=''
905	cont=''
906	;;
907    *)
908        mansrc=`./filexp "$ans"`
909        if $test -d "$mansrc"; then
910	    cont=''
911        else
912	    if $test "$fastread" = yes; then
913	        dflt=y
914	    else
915	        dflt=n
916	    fi
917	    rp="Directory $mansrc doesn't exist.  Use that name anyway? [$dflt]"
918	    $echo $n "$rp $c"
919	    . myread
920	    dflt=''
921	    case "$ans" in
922	    y*) cont='';;
923	    esac
924        fi
925	;;
926    esac
927done
928case "$mansrc" in
929'')
930    manext=''
931    ;;
932*l)
933    manext=l
934    ;;
935*n)
936    manext=n
937    ;;
938*o)
939    manext=l
940    ;;
941*p)
942    manext=n
943    ;;
944*C)
945    manext=C
946    ;;
947*L)
948    manext=L
949    ;;
950*)
951    manext=1
952    ;;
953esac
954
955: Sigh.  Well, at least the box is fast...
956echo " "
957$echo $n "Hmm...  $c"
958case "$usrinclude" in
959'') dflt='/usr/include';;
960*) dflt=$usrinclude;;
961esac
962inclPath=''
963if $test -f /bin/mips && /bin/mips; then
964    echo "Looks like a MIPS system..."
965    $cat >usrinclude.c <<'EOCP'
966#ifdef SYSTYPE_BSD43
967/bsd43
968#endif
969EOCP
970    if cc -E usrinclude.c > usrinclude.out && $contains / usrinclude.out >/dev/null 2>&1 ; then
971	echo "and you're compiling with the BSD43 compiler and libraries."
972	dflt='/bsd43/usr/include'
973	inclPath='/bsd43'
974    else
975	echo "and you're compiling with the SysV compiler and libraries."
976    fi
977else
978    echo "Doesn't look like a MIPS system."
979    echo "exit 1" >mips
980    chmod +x mips
981    $eunicefix mips
982fi
983
984cont=true
985while $test "$cont" ; do
986    echo " "
987    rp="Where are the include files you want to use? [$dflt]"
988    $echo $n "$rp $c"
989    . myread
990    usrinclude="$ans"
991    if $test -d $ans; then
992	cont=''
993    else
994	if $test "$fastread" = yes; then
995	    dflt=y
996	else
997	    dflt=n
998	fi
999	rp="Directory $ans doesn't exist.  Use that name anyway? [$dflt]"
1000	$echo $n "$rp $c"
1001	. myread
1002	dflt=''
1003	case "$ans" in
1004	y*) cont='';;
1005	esac
1006    fi
1007done
1008
1009: make some quick guesses about what we are up against
1010echo " "
1011echo exit 1 >bsd
1012echo exit 1 >usg
1013echo exit 1 >v7
1014echo exit 1 >osf1
1015echo exit 1 >eunice
1016echo exit 1 >xenix
1017echo exit 1 >venix
1018cat $usrinclude/signal.h $usrinclude/sys/signal.h >guess.txt 2>/dev/null
1019if test "$usrinclude" = "/bsd43/usr/include" ; then
1020    echo "Looks kind of like a SysV MIPS running BSD, but we'll see..."
1021    echo exit 0 >bsd
1022elif test -f /osf_boot || $contains "OSF/1" /usr/include/ctype.h; then
1023    echo "Looks like an OSF/1 system, but we'll see..."
1024    echo exit 0 >osf1
1025elif test `echo abc | tr a-z A-Z` = Abc ; then
1026    echo "Looks kind of like a USG system, but we'll see..."
1027    echo exit 0 >usg
1028elif $contains SIGTSTP guess.txt >/dev/null 2>&1 ; then
1029    echo "Looks kind of like a BSD system, but we'll see..."
1030    echo exit 0 >bsd
1031else
1032    echo "Looks kind of like a version 7 system, but we'll see..."
1033    echo exit 0 >v7
1034fi
1035case "$eunicefix" in
1036*unixtovms*)
1037    cat <<'EOI'
1038There is, however, a strange, musty smell in the air that reminds me of
1039something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
1040EOI
1041    echo "exit 0" >eunice
1042    d_eunice="$define"
1043    ;;
1044*)
1045    echo " "
1046    echo "Congratulations.  You aren't running Eunice."
1047    d_eunice="$undef"
1048    ;;
1049esac
1050if test -f /xenix; then
1051    echo "Actually, this looks more like a XENIX system..."
1052    echo "exit 0" >xenix
1053else
1054    echo " "
1055    echo "It's not Xenix..."
1056fi
1057chmod +x xenix
1058$eunicefix xenix
1059if test -f /venix; then
1060    echo "Actually, this looks more like a VENIX system..."
1061    echo "exit 0" >venix
1062else
1063    echo " "
1064    if xenix; then
1065	: null
1066    else
1067	echo "Nor is it Venix..."
1068    fi
1069fi
1070chmod +x bsd usg v7 osf1 eunice venix
1071$eunicefix bsd usg v7 eunice venix
1072
1073: see what memory models we can support
1074case "$models" in
1075'')
1076    : We may not use Cppsym or we get a circular dependency through cc.
1077    : But this should work regardless of which cc we eventually use.
1078    cat >pdp11.c <<'EOP'
1079main() {
1080#ifdef pdp11
1081    exit(0);
1082#else
1083    exit(1);
1084#endif
1085}
1086EOP
1087    cc -o pdp11 pdp11.c >/dev/null 2>&1
1088    if pdp11 2>/dev/null; then
1089	dflt='unsplit split'
1090    else
1091	ans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1092	case "$ans" in
1093	X) dflt='none';;
1094	*)  if $test -d /lib/small || $test -d /usr/lib/small; then
1095		dflt='small'
1096	    else
1097		dflt=''
1098	    fi
1099	    if $test -d /lib/medium || $test -d /usr/lib/medium; then
1100		dflt="$dflt medium"
1101	    fi
1102	    if $test -d /lib/large || $test -d /usr/lib/large; then
1103		dflt="$dflt large"
1104	    fi
1105	    if $test -d /lib/huge || $test -d /usr/lib/huge; then
1106		dflt="$dflt huge"
1107	    fi
1108	esac
1109    fi
1110    ;;
1111*)  dflt="$models" ;;
1112esac
1113$cat <<EOM
1114
1115Some systems have different model sizes.  On most systems they are called
1116small, medium, large, and huge.  On the PDP11 they are called unsplit and
1117split.  If your system doesn't support different memory models, say "none".
1118If you wish to force everything to one memory model, say "none" here and
1119put the appropriate flags later when it asks you for other cc and ld flags.
1120Venix systems may wish to put "none" and let the compiler figure things out.
1121(In the following question multiple model names should be space separated.)
1122
1123EOM
1124rp="Which models are supported? [$dflt]"
1125$echo $n "$rp $c"
1126. myread
1127models="$ans"
1128
1129case "$models" in
1130none)
1131    small=''
1132    medium=''
1133    large=''
1134    huge=''
1135    unsplit=''
1136    split=''
1137    ;;
1138*split)
1139    case "$split" in
1140    '')
1141	if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
1142	   $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
1143	    dflt='-i'
1144	else
1145	    dflt='none'
1146	fi
1147	;;
1148    *) dflt="$split";;
1149    esac
1150    rp="What flag indicates separate I and D space? [$dflt]"
1151    $echo $n "$rp $c"
1152    . myread
1153    case "$ans" in
1154    none) ans='';;
1155    esac
1156    split="$ans"
1157    unsplit=''
1158    ;;
1159*large*|*small*|*medium*|*huge*)
1160    case "$models" in
1161    *large*)
1162	case "$large" in
1163	'') dflt='-Ml';;
1164	*) dflt="$large";;
1165	esac
1166	rp="What flag indicates large model? [$dflt]"
1167	$echo $n "$rp $c"
1168	. myread
1169	case "$ans" in
1170	none) ans='';
1171	esac
1172	large="$ans"
1173	;;
1174    *) large='';;
1175    esac
1176    case "$models" in
1177    *huge*)
1178	case "$huge" in
1179	'') dflt='-Mh';;
1180	*) dflt="$huge";;
1181	esac
1182	rp="What flag indicates huge model? [$dflt]"
1183	$echo $n "$rp $c"
1184	. myread
1185	case "$ans" in
1186	none) ans='';
1187	esac
1188	huge="$ans"
1189	;;
1190    *) huge="$large";;
1191    esac
1192    case "$models" in
1193    *medium*)
1194	case "$medium" in
1195	'') dflt='-Mm';;
1196	*) dflt="$medium";;
1197	esac
1198	rp="What flag indicates medium model? [$dflt]"
1199	$echo $n "$rp $c"
1200	. myread
1201	case "$ans" in
1202	none) ans='';
1203	esac
1204	medium="$ans"
1205	;;
1206    *) medium="$large";;
1207    esac
1208    case "$models" in
1209    *small*)
1210	case "$small" in
1211	'') dflt='none';;
1212	*) dflt="$small";;
1213	esac
1214	rp="What flag indicates small model? [$dflt]"
1215	$echo $n "$rp $c"
1216	. myread
1217	case "$ans" in
1218	none) ans='';
1219	esac
1220	small="$ans"
1221	;;
1222    *) small='';;
1223    esac
1224    ;;
1225*)
1226    echo "Unrecognized memory models--you may have to edit Makefile.SH"
1227    ;;
1228esac
1229
1230: see if we need a special compiler
1231echo " "
1232if usg; then
1233    case "$cc" in
1234    '')
1235	case "$Mcc" in
1236	/*) dflt='Mcc'
1237	    ;;
1238	*)
1239	    case "$large" in
1240	    -M*)
1241		dflt='cc'
1242		;;
1243	    *)
1244		if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1245		    dflt='cc -M'
1246		else
1247		    dflt='cc'
1248		fi
1249		;;
1250	    esac
1251	    ;;
1252	esac
1253	;;
1254    *)  dflt="$cc";;
1255    esac
1256    $cat <<'EOM'
1257
1258On some systems the default C compiler will not resolve multiple global
1259references that happen to have the same name.  On some such systems the
1260"Mcc" command may be used to force these to be resolved.  On other systems
1261a "cc -M" command is required.  (Note that the -M flag on other systems
1262indicates a memory model to use!)  If you have the Gnu C compiler, you
1263might wish to use that instead.  What command will force resolution on
1264EOM
1265    $echo $n "this system? [$dflt] $c"
1266    rp="Command to resolve multiple refs? [$dflt]"
1267    . myread
1268    cc="$ans"
1269else
1270    case "$cc" in
1271    '') dflt=cc;;
1272    *) dflt="$cc";;
1273    esac
1274    rp="Use which C compiler? [$dflt]"
1275    $echo $n "$rp $c"
1276    . myread
1277    cc="$ans"
1278fi
1279case "$cc" in
1280*gcc*) cpp=`./loc gcc-cpp $cpp $pth`
1281    case "$nativegcc" in
1282    '') case "$ccflags" in
1283	*-fpcc-struct-return*) dflt=n;;
1284	*) dflt=y;;
1285	esac
1286	;;
1287    undef) dflt=n;;
1288    *) dflt=y;;
1289    esac
1290    echo " "
1291    rp="Are your system (especially dbm) libraries compiled with gcc? [$dflt]"
1292    $echo $n "$rp $c"
1293    . myread
1294    case "$ans" in
1295    n*) nativegcc="$undef"; gccflags='-fpcc-struct-return';;
1296    *) nativegcc="$define"; gccflags='';;
1297    esac
1298    case "$gccflags" in
1299    *-ansi*) ;;
1300    *-traditional*) ;;
1301    *) gccflags="$gccflags -traditional -Dvolatile=__volatile__" ;;
1302    esac
1303    ;;
1304esac
1305
1306: determine optimize, if desired, or use for debug flag also
1307case "$optimize" in
1308' ') dflt="none"
1309     ;;
1310'') dflt="-O";
1311    ;;
1312*)  dflt="$optimize"
1313    ;;
1314esac
1315cat <<EOH
1316
1317Some C compilers have problems with their optimizers, by default, $package
1318compiles with the -O flag to use the optimizer.  Alternately, you might
1319want to use the symbolic debugger, which uses the -g flag (on traditional
1320Unix systems).  Either flag can be specified here.  To use neither flag,
1321specify the word "none".
1322  
1323EOH
1324rp="What optimizer/debugger flag should be used? [$dflt]"
1325$echo $n "$rp $c"
1326. myread
1327optimize="$ans"
1328case "$optimize" in
1329'none') optimize=" "
1330     ;;
1331esac
1332
1333case "$ccflags" in
1334'') case "$cc" in
1335    *gcc*) dflt="$gccflags";;
1336    *) dflt='';;
1337    esac
1338    ;;
1339*-fpcc-struct-return*) dflt="$ccflags";;
1340*) case "$cc" in
1341    *gcc*) dflt="$ccflags $gccflags";;
1342    *) dflt="$ccflags";;
1343    esac
1344    ;;
1345esac
1346for thisincl in $inclwanted; do
1347    if test -d $thisincl; then
1348	if test "x$thisincl" != "x$usrinclude"; then
1349	    case "$dflt" in
1350	    *$thisincl*);;
1351	    *) dflt="$dflt -I$thisincl";;
1352	    esac
1353	fi
1354    fi
1355done
1356case "$optimize" in
1357-g*)
1358    case "$dflt" in
1359    *DEBUGGING*);;
1360    *) dflt="$dflt -DDEBUGGING";;
1361    esac
1362    ;;
1363esac
1364if $contains 'LANGUAGE_C' $usrinclude/signal.h >/dev/null 2>&1; then
1365    case "$dflt" in
1366    *LANGUAGE_C*);;
1367    *) dflt="$dflt -DLANGUAGE_C";;
1368    *) if osf1; then
1369          dflt="$dflt -D__LANGUAGE_C__"
1370       else
1371          dflt="$dflt -DLANGUAGE_C"
1372       fi
1373       ;;
1374    esac
1375fi
1376if $contains '_NO_PROTO' $usrinclude/signal.h >/dev/null 2>&1; then
1377    case "$dflt" in
1378    *_NO_PROTO*);;
1379    *) osf1 || dflt="$dflt -D_NO_PROTO";;
1380    esac
1381fi
1382case "$dflt" in
1383'') dflt=none;;
1384esac
1385cat <<EOH
1386
1387Your C compiler may want other flags.  For this question you should
1388include -I/whatever and -DWHATEVER flags and any other flags used by
1389the C compiler, but you should NOT include libraries or ld flags like
1390-lwhatever.  For instance, this would be a good place to specify
1391-DDEBUGGING.  To use no flags, specify the word "none".
1392  
1393EOH
1394rp="Any additional cc flags? [$dflt]"
1395$echo $n "$rp $c"
1396. myread
1397case "$ans" in
1398none) ans='';
1399esac
1400ccflags="$ans"
1401
1402: the following weeds options from ccflags that are of no interest to cpp
1403cppflags="$ccflags"
1404case "$cc" in
1405*gcc*) cppflags="$cppflags -D__GNUC__";;
1406esac
1407case "$cppflags" in
1408'');;
1409*)  set X $cppflags
1410    cppflags=''
1411    for flag do
1412	case $flag in
1413	-D*|-U*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
1414	esac
1415    done
1416    case "$cppflags" in
1417    *-*)  echo "(C preprocessor flags: $cppflags)";;
1418    esac
1419    ;;
1420esac
1421
1422case "$ldflags" in
1423'') if venix; then
1424	dflt='-i -z'
1425    else
1426	dflt='none'
1427    fi
1428    ;;
1429*) dflt="$ldflags";;
1430esac
1431echo " "
1432rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1433$echo $n "$rp $c"
1434. myread
1435case "$ans" in
1436none) ans='';
1437esac
1438ldflags="$ans"
1439
1440echo " "
1441echo "Checking for optional libraries..."
1442case "$libs" in
1443'') dflt=' ';;
1444*) dflt="$libs ";;
1445esac
1446case "$libswanted" in
1447'') libswanted='c_s';;
1448esac
1449for thislib in $libswanted; do
1450    case "$thislib" in
1451    dbm) thatlib=ndbm;;
1452    *_s) thatlib=NONE;;
1453    *) thatlib="${thislib}_s";;
1454    *) thatlib=NONE;;
1455    esac
1456    xxx=`./loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1457    if test -f $xxx; then
1458	echo "Found -l$thislib."
1459	case "$dflt" in
1460	*-l$thislib\ *|*-l$thatlib\ *);;
1461	*) dflt="$dflt -l$thislib ";;
1462	esac
1463    else
1464	xxx=`./loc lib$thislib.a X $libpth`
1465	if test -f $xxx; then
1466	    echo "Found $xxx."
1467	    case "$dflt" in
1468	    *"$xxx "*);;
1469	    *) dflt="$dflt $xxx ";;
1470	    esac
1471	else
1472	    xxx=`./loc Slib$thislib.a X $xlibpth`
1473	    if test -f $xxx; then
1474		echo "Found -l$thislib."
1475		case "$dflt" in
1476		*-l$thislib\ *|*-l$thatlib\ *);;
1477		*) dflt="$dflt -l$thislib ";;
1478		esac
1479	    else
1480		xxx=`./loc lib$thislib.so X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1481		if test -f $xxx; then
1482		    echo "Found -l$thislib as a shared object only."
1483		    case "$dflt" in
1484		    *-l$thislib\ *|*-l$thatlib\ *);;
1485		    *) dflt="$dflt -l$thislib ";;
1486		    esac
1487		else
1488		    echo "No -l$thislib."
1489		fi
1490	    fi
1491	fi
1492    fi
1493done
1494set X $dflt
1495shift
1496dflt="$*"
1497case "$dflt" in
1498'') dflt='none';;
1499esac
1500
1501$cat <<EOM
1502 
1503Some versions of Unix support shared libraries, which make
1504executables smaller but make load time slightly longer.
1505
1506On some systems, mostly newer Unix System V's, the shared library
1507is included by putting the option "-lc_s" as the last thing on the
1508cc command line when linking.  Other systems use shared libraries
1509by default.  There may be other libraries needed to compile $package
1510on your machine as well.  If your system needs the "-lc_s" option,
1511include it here.  Include any other special libraries here as well.
1512Say "none" for none.
1513EOM
1514
1515echo " "
1516rp="Any additional libraries? [$dflt]"
1517$echo $n "$rp $c"
1518. myread
1519case "$ans" in
1520none) ans='';
1521esac
1522libs="$ans"
1523
1524: check for size of random number generator
1525echo " "
1526case "$alignbytes" in
1527'')
1528    echo "Checking alignment constraints..."
1529    $cat >try.c <<'EOCP'
1530struct foobar {
1531    char foo;
1532    double bar;
1533} try;
1534main()
1535{
1536    printf("%d\n", (char*)&try.bar - (char*)&try.foo);
1537}
1538EOCP
1539    if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
1540	dflt=`./try`
1541    else
1542	dflt='?'
1543	echo "(I can't seem to compile the test program...)"
1544    fi
1545    ;;
1546*)
1547    dflt="$alignbytes"
1548    ;;
1549esac
1550rp="Doubles must be aligned on a how-many-byte boundary? [$dflt]"
1551$echo $n "$rp $c"
1552. myread
1553alignbytes="$ans"
1554$rm -f try.c try
1555
1556: determine where public executables go
1557cat <<EOF
1558 
1559The following questions distinguish the directory in which executables
1560reside from the directory in which they are installed (and from which they
1561are presumably copied to the former directory by occult means).  This
1562distinction is often necessary under afs.  On most other systems, however,
1563the two directories are the same.
1564 
1565EOF
1566case "$bin" in
1567'')
1568    dflt=`./loc . /usr/local/bin /usr/local/bin /usr/lbin /usr/local /usr/bin /bin`
1569    ;;
1570*)  dflt="$bin"
1571    ;;
1572esac
1573cont=true
1574while $test "$cont" ; do
1575    rp="In which directory will public executables reside (~name ok)? [$dflt]"
1576    $echo "In which directory will public executables reside (~name ok)?"
1577    $echo $n "[$dflt] $c"
1578    . myread
1579    bin="$ans"
1580    bin=`./filexp $bin`
1581    if test -d $bin; then
1582	cont=''
1583    else
1584	case "$fastread" in
1585	yes) dflt=y;;
1586	*) dflt=n;;
1587	esac
1588	rp="Directory $bin doesn't exist.  Use that name anyway? [$dflt]"
1589	$echo $n "$rp $c"
1590	. myread
1591	dflt=''
1592	case "$ans" in
1593	y*) cont='';;
1594	esac
1595    fi
1596done
1597
1598case "$bin" in
1599  ?????????????????????????)
1600    cat <<EOF
1601
1602NOTE: you have a fairly long path name there.  Some systems have trouble
1603executing a script if the #! line ends up longer than 32 characters.  If
1604you have this trouble you may have to reinstall somewhere else, or make
1605a symbolic link from someplace with a shorter name.
1606
1607EOF
1608    ;;
1609esac
1610
1611case "$installbin" in
1612'')
1613    dflt=`echo $bin | sed 's#^/afs/#/afs/.#'`
1614    test -d $dflt || dflt="$bin"
1615    ;;
1616*)  dflt="$installbin"
1617    ;;
1618esac
1619cont=true
1620while $test "$cont" ; do
1621    rp="In which directory will public executables be installed (~name ok)? [$dflt]"
1622    $echo "In which directory will public executables be installed (~name ok)?"
1623    $echo $n "[$dflt] $c"
1624    . myread
1625    installbin="$ans"
1626    installbin=`./filexp $installbin`
1627    if test -d $installbin; then
1628	cont=''
1629    else
1630	case "$fastread" in
1631	yes) dflt=y;;
1632	*) dflt=n;;
1633	esac
1634	rp="Directory $installbin doesn't exist.  Use that name anyway? [$dflt]"
1635	$echo $n "$rp $c"
1636	. myread
1637	dflt=''
1638	case "$ans" in
1639	y*) cont='';;
1640	esac
1641    fi
1642done
1643
1644: check for ordering of bytes in a long
1645case "$byteorder" in
1646'')
1647cat <<'EOM'
1648
1649In the following, larger digits indicate more significance.  A big-endian
1650machine like a Pyramid or a Motorola 680?0 chip will come out to 4321.  A
1651little-endian machine like a Vax or an Intel 80?86 chip would be 1234.  Other
1652machines may have weird orders like 3412.  A Cray will report 87654321.  If
1653the test program works the default is probably right.
1654I'm now running the test program...
1655EOM
1656    $cat >byteorder.c <<'EOCP'
1657#include <stdio.h>
1658main()
1659{
1660    int i;
1661    union {
1662	unsigned long l;
1663	char c[sizeof(long)];
1664    } u;
1665
1666    if (sizeof(long) > 4)
1667	u.l = (0x08070605L << 32) | 0x04030201L;
1668    else
1669	u.l = 0x04030201L;
1670    for (i=0; i < sizeof(long); i++)
1671	printf("%c",u.c[i]+'0');
1672    printf("\n");
1673}
1674EOCP
1675    if $cc byteorder.c -o byteorder >/dev/null 2>&1 ; then
1676	dflt=`./byteorder`
1677	case "$dflt" in
1678	????|????????) echo "(The test program ran ok.)";;
1679	*) echo "(The test program didn't run right for some reason.)";;
1680	esac
1681    else
1682	dflt='4321'
1683	echo "(I can't seem to compile the test program.  Guessing big-endian...)"
1684    fi
1685    ;;
1686*)
1687    echo " "
1688    dflt="$byteorder"
1689    ;;
1690esac
1691rp="What is the order of bytes in a long? [$dflt]"
1692$echo $n "$rp $c"
1693. myread
1694byteorder="$ans"
1695
1696: check for ability to cast negative floats to unsigned
1697echo " "
1698echo 'Checking to see if your C compiler can cast weird floats to unsigned'
1699$cat >try.c <<'EOCP'
1700#include <signal.h>
1701
1702blech() { exit(3); }
1703
1704main()
1705{
1706	double f = -123;
1707	unsigned long along;
1708	unsigned int aint;
1709	unsigned short ashort;
1710	int result = 0;
1711
1712	signal(SIGFPE, blech);
1713	along = (unsigned long)f;
1714	aint = (unsigned int)f;
1715	ashort = (unsigned short)f;
1716	if (along != (unsigned long)-123)
1717	    result |= 1;
1718	if (aint != (unsigned int)-123)
1719	    result |= 1;
1720	if (ashort != (unsigned short)-123)
1721	    result |= 1;
1722	f = (double)0x40000000;
1723	f = f + f;
1724	along = 0;
1725	along = (unsigned long)f;
1726	if (along != 0x80000000)
1727	    result |= 2;
1728	f -= 1;
1729	along = 0;
1730	along = (unsigned long)f;
1731	if (along != 0x7fffffff)
1732	    result |= 1;
1733	f += 2;
1734	along = 0;
1735	along = (unsigned long)f;
1736	if (along != 0x80000001)
1737	    result |= 2;
1738	exit(result);
1739}
1740EOCP
1741if $cc -o try $ccflags try.c >/dev/null 2>&1; then
1742    ./try
1743    castflags=$?
1744else
1745    castflags=3
1746fi
1747case "$castflags" in
17480)  val="$define"
1749    echo "Yup, it does."
1750    ;;
1751*)  val="$undef"
1752    echo "Nope, it doesn't."
1753    ;;
1754esac
1755set d_castneg
1756eval $setvar
1757$rm -f try.*
1758
1759: see how we invoke the C preprocessor
1760echo " "
1761echo "Now, how can we feed standard input to your C preprocessor..."
1762cat <<'EOT' >testcpp.c
1763#define ABC abc
1764#define XYZ xyz
1765ABC.XYZ
1766EOT
1767
1768cd ..
1769echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
1770chmod 755 cppstdin
1771wrapper=cppstdin
1772
1773case "$cppstdin" in
1774/*cppstdin) cppstdin=cppstdin;;
1775esac
1776cp cppstdin UU
1777cd UU
1778
1779if test "X$cppstdin" != "X" && \
1780  $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
1781  $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1782    echo "You used to use $cppstdin $cppminus so we'll use that again."
1783elif test "$cc" = gcc && \
1784  (echo "Using gcc, eh?  We'll try to force gcc -E using a wrapper..."; \
1785  $wrapper <testcpp.c >testcpp.out 2>&1; \
1786  $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
1787    echo "Yup, we can."
1788    cppstdin="$wrapper"
1789    cppminus='';
1790elif echo 'Maybe "'"$cc"' -E" will work...'; \
1791  $cc -E <testcpp.c >testcpp.out 2>&1; \
1792  $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1793    echo "Yup, it does."
1794    cppstdin="$cc -E"
1795    cppminus='';
1796elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
1797  $cc -E - <testcpp.c >testcpp.out 2>&1; \
1798  $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1799    echo "Yup, it does."
1800    cppstdin="$cc -E"
1801    cppminus='-';
1802elif echo 'No such luck, maybe "'$cpp'" will work...'; \
1803  $cpp <testcpp.c >testcpp.out 2>&1; \
1804  $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1805    echo "It works!"
1806    cppstdin="$cpp"
1807    cppminus='';
1808elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
1809  $cpp - <testcpp.c >testcpp.out 2>&1; \
1810  $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1811    echo "Hooray, it works!  I was beginning to wonder."
1812    cppstdin="$cpp"
1813    cppminus='-';
1814elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
1815  $wrapper <testcpp.c >testcpp.out 2>&1; \
1816  $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1817    cppstdin="$wrapper"
1818    cppminus=''
1819    echo "Eureka!."
1820elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
1821  $cc -P <testcpp.c >testcpp.out 2>&1; \
1822  $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1823    echo "Yipee, that works!"
1824    cppstdin="$cc -P"
1825    cppminus='';
1826elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
1827  $cc -P - <testcpp.c >testcpp.out 2>&1; \
1828  $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1829    echo "At long last!"
1830    cppstdin="$cc -P"
1831    cppminus='-';
1832else
1833    dflt=blurfl
1834    $echo $n "No dice.  I can't find a C preprocessor.  Name one: $c"
1835    rp='Name a C preprocessor:'
1836    . myread
1837    cppstdin="$ans"
1838    $cppstdin <testcpp.c >testcpp.out 2>&1
1839    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1840	echo "OK, that will do."
1841    else
1842	echo "Sorry, I can't get that to work.  Go find one and rerun Configure."
1843	exit 1
1844    fi
1845fi
1846
1847: get list of predefined functions in a handy place
1848echo " "
1849case "$libc" in
1850'') libc=unknown;;
1851esac
1852case "$nm_opts" in
1853'') if test -f /mach_boot; then
1854	nm_opts=''
1855    elif test -d /usr/ccs/lib; then
1856	nm_opts='-p'
1857    else
1858	nm_opts=''
1859    fi
1860    ;;
1861esac
1862: on mips, we DO NOT want /lib, and we want inclPath/usr/lib
1863case "$libpth" in
1864'') if mips; then
1865	libpth='$inclPath/usr/lib /usr/local/lib'
1866	nm_opts="-B"
1867    else
1868	libpth='/usr/ccs/lib /lib /usr/lib /usr/ucblib /usr/local/lib'
1869    fi
1870    ;;
1871esac
1872case "$libs" in
1873*-lc_s*) libc=`./loc libc_s.a $libc $libpth`
1874esac
1875libnames='';
1876case "$libs" in
1877'') ;;
1878*)  for thislib in $libs; do
1879	case "$thislib" in
1880	-l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
1881	    try=`./loc lib$thislib.a blurfl/dyick $libpth`
1882	    if test ! -f $try; then
1883		try=`./loc lib$thislib blurfl/dyick $libpth`
1884		if test ! -f $try; then
1885		    try=`./loc $thislib blurfl/dyick $libpth`
1886		    if test ! -f $try; then
1887			try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
1888			if test ! -f $try; then
1889			    try=''
1890			fi
1891		    fi
1892		fi
1893	    fi
1894	    libnames="$libnames $try"
1895	    ;;
1896	*) libnames="$libnames $thislib" ;;
1897	esac
1898    done
1899    ;;
1900esac
1901set /usr/ccs/lib/libc.so
1902test -f $1 || set /usr/lib/libc.so
1903test -f $1 || set /usr/shlib/libc.so
1904test -f $1 || set /usr/lib/libc.so.[0-9]*
1905test -f $1 || set /lib/libsys_s.a
1906eval set \$$#
1907if test -f "$1"; then
1908    echo "Your (shared) C library seems to be in $1."
1909    libc="$1"
1910elif test -f "$libc"; then
1911    echo "Your C library seems to be in $libc."
1912elif test -f /lib/libc.a; then
1913    echo "Your C library seems to be in /lib/libc.a.  You're normal."
1914    libc=/lib/libc.a
1915else
1916    if   ans=`./loc libc.a  blurfl/dyick $libpth`; test -f "$ans"; then
1917	:
1918    elif ans=`./loc libc    blurfl/dyick $libpth`; test -f "$ans"; then
1919	    libnames="$libnames "`./loc clib blurfl/dyick $libpth`
1920    elif ans=`./loc clib    blurfl/dyick $libpth`; test -f "$ans"; then
1921	:
1922    elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1923	:
1924    elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1925	:
1926    elif ans=`./loc Llibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1927	:
1928    fi
1929    if test -f "$ans"; then
1930	echo "Your C library seems to be in $ans, of all places."
1931	libc=$ans
1932    else
1933	cat <<EOM
1934
1935I can't seem to find your C library.  I've looked in the following places:
1936
1937	$libpth
1938
1939None of these seems to contain your C library.  What is the full name
1940EOM
1941	dflt=None
1942	$echo $n "of your C library? $c"
1943	rp='C library full name?'
1944	. myread
1945	libc="$ans"
1946    fi
1947fi
1948echo " "
1949if test $libc = "/lib/libc"; then
1950    libc="$libc /lib/clib"
1951fi
1952cat <<END
1953
1954If the guess above is wrong (which it might be if you're using a strange
1955compiler, or your machine supports multiple models), you can override it here.
1956END
1957dflt="$libc";
1958rp="Your C library is where? [$dflt]"
1959$echo $n "$rp $c"
1960. myread
1961libc="$ans"
1962echo " "
1963echo $libc $libnames | tr ' ' '\012' | sort | uniq >libnames
1964$echo "Extracting names from the following files for later perusal:"
1965sed 's/^/	/' libnames
1966echo $n "This may take a while...$c"
1967set X `cat libnames`
1968shift
1969nm $nm_opts $* 2>/dev/null >libc.tmp
1970$sed -n -e 's/^.* [ATDS]  *[_.]*//p' -e 's/^.* [ATDS] //p' <libc.tmp >libc.list
1971if $contains '^printf$' libc.list >/dev/null 2>&1; then
1972    echo done
1973elif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \
1974	<libc.tmp >libc.list; \
1975  $contains '^printf$' libc.list >/dev/null 2>&1; then
1976    echo done
1977elif $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list; \
1978  $contains '^printf$' libc.list >/dev/null 2>&1; then
1979    echo done
1980elif $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list; \
1981  $contains '^printf$' libc.list >/dev/null 2>&1; then
1982    echo done
1983elif $sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' \
1984		<libc.tmp >libc.list; \
1985  $contains '^printf$' libc.list >/dev/null 2>&1; then
1986    echo done
1987elif $grep '|' <libc.tmp | $sed -n -e '/|COMMON/d' -e '/|DATA/d' -e '/ file/d' \
1988                                   -e 's/^\([^     ]*\).*/\1/p' >libc.list
1989  $contains '^printf$' libc.list >/dev/null 2>&1; then
1990    echo done
1991elif $sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p' \
1992	   <libc.tmp >libc.list; \
1993  $contains '^printf$' libc.list >/dev/null 2>&1; then
1994    echo done
1995elif $sed -n -e 's/^[         ]*[0-9][0-9a-f]*[       ]*Def. Text[    ]*//p' \
1996	   < libc.tmp | $sed -e 's/\[.*\]//' > libc.list; \
1997  $contains '^printf$' libc.list >/dev/null 2>&1; then
1998      echo done
1999else
2000    nm -p $* 2>/dev/null >libc.tmp
2001    $sed -n -e 's/^.* [AT]  *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
2002    if $contains '^printf$' libc.list >/dev/null 2>&1; then
2003	nm_opts='-p'
2004	echo "done"
2005    else
2006	echo " "
2007	echo "nm didn't seem to work right."
2008	echo "Trying ar instead..."
2009	if ar t $libc > libc.tmp; then
2010	    for thisname in $libnames; do
2011		ar t $thisname >>libc.tmp
2012	    done
2013	    $sed -e 's/\.o$//' < libc.tmp > libc.list
2014	    echo "Ok."
2015	else
2016	    echo "ar didn't seem to work right."
2017	    echo "Maybe this is a Cray...trying bld instead..."
2018	    if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
2019		for thisname in $libnames; do
2020		    bld t $libnames | \
2021			$sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
2022		    ar t $thisname >>libc.tmp
2023		done
2024		echo "Ok."
2025	    else
2026		echo "That didn't work either.  Giving up."
2027		exit 1
2028	    fi
2029	fi
2030    fi
2031fi
2032if test -f /lib/syscalls.exp; then
2033    echo "Also extracting names from /lib/syscalls.exp for good ole AIX..."
2034    sed -n 's/^\([^ 	]*\)[ 	]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
2035fi
2036
2037inlibc='echo " "; td=$define; tu=$undef;
2038if $contains "^$1\$" libc.list >/dev/null 2>&1;
2039then echo "$1() found";
2040  eval "case \"\$$2\" in undef) . whoa; esac"; eval "$2=\$td";
2041else echo "$1() NOT found";
2042  eval "case \"\$$2\" in define) . whoa; esac"; eval "$2=\$tu"; fi'
2043
2044: see if bcmp exists
2045set bcmp d_bcmp
2046eval $inlibc
2047
2048: see if bcopy exists
2049set bcopy d_bcopy
2050eval $inlibc
2051
2052case "$d_safebcpy" in
2053'')
2054    : assume the worst
2055    d_safebcpy=undef
2056    case "$d_bcopy" in
2057    define)
2058	echo "Checking to see if your bcopy() can do overlapping copies..."
2059	$cat >safebcpy.c <<'EOCP'
2060main()
2061{
2062    char buf[128];
2063    register char *b;
2064    register int len;
2065    register int off;
2066    register int align;
2067
2068    for (align = 7; align >= 0; align--) {
2069	for (len = 36; len; len--) {
2070	    b = buf+align;
2071	    bcopy("abcdefghijklmnopqrstuvwxyz0123456789", b, len);
2072	    for (off = 1; off <= len; off++) {
2073		bcopy(b, b+off, len);
2074		bcopy(b+off, b, len);
2075		if (bcmp(b, "abcdefghijklmnopqrstuvwxyz0123456789", len))
2076		    exit(1);
2077	    }
2078	}
2079    }
2080    exit(0);
2081}
2082EOCP
2083	if $cc safebcpy.c -o safebcpy $ccflags $libs >/dev/null 2>&1 ; then
2084	    if ./safebcpy; then
2085		echo "It can."
2086		d_safebcpy=define
2087	    else
2088		echo "It can't."
2089	    fi
2090	else
2091	    echo "(I can't compile the test program, so we'll assume not...)"
2092	fi
2093	;;
2094    esac
2095    ;;
2096esac
2097
2098: see if bzero exists
2099set bzero d_bzero
2100eval $inlibc
2101
2102: see if sprintf is declared as int or pointer to char
2103echo " "
2104cat >ucbsprf.c <<'EOF'
2105#include <stdio.h>
2106main()
2107{
2108    int sprintf();
2109    char buf[10];
2110    exit((unsigned long)sprintf(buf,"%s","foo") > 10L);
2111}
2112EOF
2113if $cc $ccflags ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then
2114    echo "Your sprintf() returns (int)."
2115    val="$undef"
2116else
2117    echo "Your sprintf() returns (char*)."
2118    val="$define"
2119fi
2120set d_charsprf
2121eval $setvar
2122
2123: see if vprintf exists
2124echo " "
2125if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
2126    echo 'vprintf() found.'
2127    val="$define"
2128    cat >vprintf.c <<'EOF'
2129#include <varargs.h>
2130
2131main() { xxx("foo"); }
2132
2133xxx(va_alist)
2134va_dcl
2135{
2136    va_list args;
2137    char buf[10];
2138
2139    va_start(args);
2140    exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
2141}
2142EOF
2143    if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
2144	echo "Your vsprintf() returns (int)."
2145	val2="$undef"
2146    else
2147	echo "Your vsprintf() returns (char*)."
2148	val2="$define"
2149    fi
2150else
2151    echo 'vprintf() NOT found.'
2152    val="$undef"
2153    val2="$undef"
2154fi
2155set d_vprintf
2156eval $setvar
2157val=$val2
2158set d_charvspr
2159eval $setvar
2160
2161: see if chsize exists
2162set chsize d_chsize
2163eval $inlibc
2164
2165: see if crypt exists
2166echo " "
2167if $contains '^crypt$' libc.list >/dev/null 2>&1; then
2168    echo 'crypt() found.'
2169    val="$define"
2170    cryptlib=''
2171else
2172    cryptlib=`./loc Slibcrypt.a "" $xlibpth`
2173    if $test -z "$cryptlib"; then
2174	cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
2175    else
2176	cryptlib=-lcrypt
2177    fi
2178    if $test -z "$cryptlib"; then
2179	cryptlib=`./loc Llibcrypt.a "" $xlibpth`
2180    else
2181	cryptlib=-lcrypt
2182    fi
2183    if $test -z "$cryptlib"; then
2184	cryptlib=`./loc libcrypt.a "" $libpth`
2185    else
2186	cryptlib=-lcrypt
2187    fi
2188    if $test -z "$cryptlib"; then
2189	echo 'crypt() NOT found.'
2190	val="$undef"
2191    else
2192	val="$define"
2193    fi
2194fi
2195set d_crypt
2196eval $setvar
2197
2198: get csh whereabouts
2199case "$csh" in
2200'csh') val="$undef" ;;
2201*)     val="$define" ;;
2202esac
2203set d_csh
2204eval $setvar
2205
2206: see if readdir exists
2207set readdir d_readdir
2208eval $inlibc
2209
2210: see if there are directory access routines out there
2211echo " "
2212xxx=`./loc ndir.h x $usrinclude /usr/local/include $inclwanted`
2213case "$xxx" in
2214x)
2215    xxx=`./loc sys/ndir.h x $usrinclude /usr/local/include $inclwanted`
2216    ;;
2217esac
2218D_dirnamlen="$undef"
2219I_dirent="$undef"
2220I_sys_dir="$undef"
2221I_my_dir="$undef"
2222I_ndir="$undef"
2223I_sys_ndir="$undef"
2224libndir=''
2225ndirc=''
2226ndiro=''
2227if $test -r $usrinclude/dirent.h; then
2228    echo "dirent.h found."
2229    if $contains 'd_namlen' $usrinclude/dirent.h >/dev/null 2>&1; then
2230	D_dirnamlen="$define"
2231    fi
2232    I_dirent="$define"
2233elif $test -r $xxx; then
2234    echo "You seem to use <$xxx>,"
2235    if $test "$d_readdir" = "$define"; then
2236	echo "and I can get readdir() from your C library."
2237    elif $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a; then
2238	echo "and I'll get the routines using -lndir ."
2239	libndir='-lndir'
2240    else
2241	ans=`./loc libndir.a x $libpth`
2242	case "$ans" in
2243	x)
2244	    echo "but I can't find the ndir library!"
2245	    ;;
2246	*)
2247	    echo "and I found the directory library in $ans."
2248	    libndir="$ans"
2249	    ;;
2250	esac
2251    fi
2252    if $contains 'd_namlen' $xxx >/dev/null 2>&1; then
2253	D_dirnamlen="$define"
2254    fi
2255    case "$xxx" in
2256    sys/)
2257	I_sys_ndir="$define"
2258	;;
2259    *)
2260	I_ndir="$define"
2261	;;
2262    esac
2263else
2264    : The next line used to require this to be a bsd system.
2265    if $contains '^readdir$' libc.list >/dev/null 2>&1 ; then
2266	echo "No ndir library found, but you have readdir() so we'll use that."
2267	if $contains 'd_namlen' $usrinclude/sys/dir.h >/dev/null 2>&1; then
2268	    D_dirnamlen="$define"
2269	fi
2270	I_sys_dir="$define"
2271    else
2272	echo "No ndir library found--using ./$d_ndir.c."
2273: This will lose since $d_ndir.h is in another directory.
2274: I doubt we can rely on it being in ../$d_ndir.h .
2275: At least it will fail in a conservative manner.
2276	if $contains 'd_namlen' $d_ndir.h >/dev/null 2>&1; then
2277	    D_dirnamlen="$define"
2278	fi
2279	I_my_dir="$define"
2280	ndirc="$d_ndir.c"
2281	ndiro="$d_ndir.o"
2282    fi
2283fi
2284val=$D_dirnamlen;	set d_dirnamlen;	eval $setvar
2285val=$I_dirent;		set i_dirent;		eval $setvar
2286val=$I_sys_dir;		set i_sys_dir;		eval $setvar
2287val=$I_my_dir;		set i_my_dir;		eval $setvar
2288val=$I_ndir;		set i_ndir;		eval $setvar
2289val=$I_sys_ndir;	set i_sys_ndir;		eval $setvar
2290
2291: now see if they want to do setuid emulation
2292case "$d_dosuid" in
2293'') dflt=n;;
2294*undef*) dflt=n;;
2295*) dflt=y;;
2296esac
2297cat <<EOM
2298 
2299Some sites have disabled setuid #! scripts because of a bug in the kernel
2300that prevents them from being secure.  If you are on such a system, the
2301setuid/setgid bits on scripts are currently useless.  It is possible for
2302$package to detect those bits and emulate setuid/setgid in a secure fashion
2303until a better solution is devised for the kernel problem.
2304
2305EOM
2306rp="Do you want to do setuid/setgid emulation? [$dflt]"
2307$echo $n "$rp $c"
2308. myread
2309case "$ans" in
2310'') $ans="$dflt";;
2311esac
2312case "$ans" in
2313y*)  d_dosuid="$define";;
2314*) d_dosuid="$undef";;
2315esac
2316
2317: see if dup2 exists
2318set dup2 d_dup2
2319eval $inlibc
2320
2321: see if fchmod exists
2322set fchmod d_fchmod
2323eval $inlibc
2324
2325: see if fchown exists
2326set fchown d_fchown
2327eval $inlibc
2328
2329: see if this is an fcntl system
2330set fcntl d_fcntl
2331eval $inlibc
2332
2333: see if we can have long filenames
2334echo " "
2335rm -f 123456789abcde
2336if (echo hi >123456789abcdef) 2>/dev/null; then
2337    : not version 8
2338    if test -f 123456789abcde; then
2339	echo 'You cannot have filenames longer than 14 characters.  Sigh.'
2340	val="$undef"
2341    else
2342	echo 'You can have filenames longer than 14 characters.'
2343	val="$define"
2344    fi
2345else
2346    : version 8 probably
2347    echo "You can't have filenames longer than 14 chars.  You can't even think about them!"
2348    val="$undef"
2349fi
2350set d_flexfnam
2351eval $setvar
2352
2353: see if flock exists
2354set flock d_flock
2355eval $inlibc
2356
2357: see if getgroups exists
2358set getgroups d_getgrps
2359eval $inlibc
2360
2361: see if gethostent exists
2362set gethostent d_gethent
2363eval $inlibc
2364
2365: see if getpgrp exists
2366set getpgrp d_getpgrp
2367eval $inlibc
2368
2369: see if getpgrp2 exists
2370set getpgrp2 d_getpgrp2
2371eval $inlibc
2372
2373: see if getpriority exists
2374set getpriority d_getprior
2375eval $inlibc
2376
2377: see if htonl exists
2378set htonl d_htonl
2379eval $inlibc
2380
2381: index or strcpy
2382echo " "
2383case "$d_index" in
2384undef) dflt=y;;
2385define) dflt=n;;
2386*)  if $test -f /unix; then
2387	dflt=n
2388    else
2389	dflt=y
2390    fi
2391    ;;
2392esac
2393if $contains '^index$' libc.list >/dev/null 2>&1 ; then
2394    if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2395	echo "Your system has both index() and strchr().  Shall I use"
2396	rp="index() rather than strchr()? [$dflt]"
2397	$echo $n "$rp $c"
2398	. myread
2399	case "$ans" in
2400	    n*) d_index="$define" ;;
2401	    *)  d_index="$undef" ;;
2402	esac
2403    else
2404	d_index="$undef"
2405	echo "index() found."
2406    fi
2407else
2408    if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2409	d_index="$define"
2410	echo "strchr() found."
2411    else
2412	echo "No index() or strchr() found!"
2413	d_index="$undef"
2414    fi
2415fi
2416
2417: see if isascii exists
2418set isascii d_isascii
2419eval $inlibc
2420
2421: see if killpg exists
2422set killpg d_killpg
2423eval $inlibc
2424
2425: see if lstat exists
2426set lstat d_lstat
2427eval $inlibc
2428
2429: see if memcmp exists
2430set memcmp d_memcmp
2431eval $inlibc
2432
2433: see if memcpy exists
2434set memcpy d_memcpy
2435eval $inlibc
2436
2437case "$d_safemcpy" in
2438'')
2439    : assume the worst
2440    d_safemcpy=undef
2441    case "$d_memcpy" in
2442    define)
2443	echo "Checking to see if your memcpy() can do overlapping copies..."
2444	$cat >safemcpy.c <<'EOCP'
2445main()
2446{
2447    char buf[128];
2448    register char *b;
2449    register int len;
2450    register int off;
2451    register int align;
2452
2453    for (align = 7; align >= 0; align--) {
2454	for (len = 36; len; len--) {
2455	    b = buf+align;
2456	    memcpy(b,"abcdefghijklmnopqrstuvwxyz0123456789", len);
2457	    for (off = 1; off <= len; off++) {
2458		memcpy(b+off, b, len);
2459		memcpy(b, b+off, len);
2460		if (memcmp(b, "abcdefghijklmnopqrstuvwxyz0123456789", len))
2461		    exit(1);
2462	    }
2463	}
2464    }
2465    exit(0);
2466}
2467EOCP
2468	if $cc safemcpy.c -o safemcpy $ccflags $libs >/dev/null 2>&1 ; then
2469	    if ./safemcpy; then
2470		echo "It can."
2471		d_safemcpy=define
2472	    else
2473		echo "It can't."
2474	    fi
2475	else
2476	    echo "(I can't compile the test program, so we'll assume not...)"
2477	fi
2478	;;
2479    esac
2480    ;;
2481esac
2482
2483: see if memmove exists
2484set memmove d_memmove
2485eval $inlibc
2486
2487: see if memset exists
2488set memset d_memset
2489eval $inlibc
2490
2491: see if mkdir exists
2492set mkdir d_mkdir
2493eval $inlibc
2494
2495: see if msgctl exists
2496set msgctl d_msgctl
2497eval $inlibc
2498
2499: see if msgget exists
2500set msgget d_msgget
2501eval $inlibc
2502
2503: see if msgsnd exists
2504set msgsnd d_msgsnd
2505eval $inlibc
2506
2507: see if msgrcv exists
2508set msgrcv d_msgrcv
2509eval $inlibc
2510
2511: see how much of the 'msg*(2)' library is present.
2512h_msg=true
2513echo " "
2514case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
2515*undef*) h_msg=false;;
2516esac
2517: we could also check for sys/ipc.h ...
2518if $h_msg && $test -r $usrinclude/sys/msg.h; then
2519    echo "You have the full msg*(2) library."
2520    val="$define"
2521else
2522    echo "You don't have the full msg*(2) library."
2523    val="$undef"
2524fi
2525set d_msg
2526eval $setvar
2527
2528: determine which malloc to compile in
2529echo " "
2530case "$d_mymalloc" in
2531'')
2532    case "$usemymalloc" in
2533    '')
2534	if bsd || v7; then
2535	    dflt='y'
2536	else
2537	    dflt='n'
2538	fi
2539	;;
2540    n*) dflt=n;;
2541    *)  dflt=y;;
2542    esac
2543    ;;
2544define)  dflt="y"
2545    ;;
2546*)  dflt="n"
2547    ;;
2548esac
2549rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
2550$echo $n "$rp $c"
2551. myread
2552case "$ans" in
2553'') ans=$dflt;;
2554esac
2555case "$ans" in
2556y*) mallocsrc='malloc.c'; mallocobj='malloc.o'
2557    libs=`echo $libs | sed 's/-lmalloc//'`
2558    val="$define"
2559    case "$mallocptrtype" in
2560    '')
2561	cat >usemymalloc.c <<'END'
2562#ifdef __STDC__
2563#include <stdlib.h>
2564#else
2565#include <malloc.h>
2566#endif
2567void *malloc();
2568END
2569	if $cc $ccflags -c usemymalloc.c >/dev/null 2>&1; then
2570	    mallocptrtype=void
2571	else
2572	    mallocptrtype=char
2573	fi
2574	;;
2575    esac
2576    echo " "
2577    echo "Your system wants malloc to return $mallocptrtype*, it would seem."
2578    ;;
2579*)  mallocsrc='';
2580    mallocobj='';
2581    mallocptrtype=void
2582    val="$undef"
2583    ;;
2584esac
2585set d_mymalloc
2586eval $setvar
2587
2588: see if ndbm is available
2589echo " "
2590xxx=`./loc ndbm.h x $usrinclude /usr/local/include $inclwanted`
2591if test -f $xxx; then
2592    val="$define"
2593    echo "ndbm.h found."
2594else
2595    val="$undef"
2596    echo "ndbm.h NOT found."
2597fi
2598set d_ndbm
2599eval $setvar
2600
2601: see if we have the old dbm
2602echo " "
2603xxx=`./loc dbm.h x $usrinclude /usr/local/include $inclwanted`
2604if test -f $xxx; then
2605    val="$define"
2606    echo "dbm.h found."
2607else
2608    val="$undef"
2609    echo "dbm.h NOT found."
2610fi
2611set d_odbm
2612eval $setvar
2613
2614: see whether socket exists
2615echo " "
2616socketlib=''
2617if $contains socket libc.list >/dev/null 2>&1; then
2618    echo "Looks like you have Berkeley networking support."
2619    val="$define"
2620    : now check for advanced features
2621    if $contains setsockopt libc.list >/dev/null 2>&1; then
2622	val2="$undef"
2623    else
2624	echo "...but it uses the old 4.1c interface, rather than 4.2"
2625	val2="$define"
2626    fi
2627else
2628    : hpux, for one, puts all the socket stuff in socklib.o
2629    if $contains socklib libc.list >/dev/null 2>&1; then
2630	echo "Looks like you have Berkeley networking support."
2631	val="$define"
2632	: we will have to assume that it supports the 4.2 BSD interface
2633	val2="$undef"
2634    else
2635	echo "Hmmm...you don't have Berkeley networking in libc.a..."
2636	: look for an optional networking library
2637	if test -f /usr/lib/libnet.a; then
2638	    (ar t /usr/lib/libnet.a ||
2639		nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
2640	    if $contains socket libc.list >/dev/null 2>&1; then
2641		echo "but the Wollongong group seems to have hacked it in."
2642		socketlib="-lnet -lnsl_s"
2643		val="$define"
2644		: now check for advanced features
2645		if $contains setsockopt libc.list >/dev/null 2>&1; then
2646		    val2="$undef"
2647		else
2648		    echo "...using the old 4.1c interface, rather than 4.2"
2649		    val2="$define"
2650		fi
2651	    else
2652		echo "or even in libnet.a, which is peculiar."
2653		val="$undef"
2654		val2="$undef"
2655	    fi
2656	else
2657	    echo "or anywhere else I see."
2658	    val="$undef"
2659	    val2="$undef"
2660	fi
2661    fi
2662fi
2663set d_socket
2664eval $setvar
2665
2666if $contains socketpair libc.list >/dev/null 2>&1; then
2667    val="$define"
2668else
2669    val="$undef"
2670fi
2671set d_sockpair
2672eval $setvar
2673val=$val2
2674set d_oldsock
2675eval $setvar
2676
2677: Locate the flags for 'open()'
2678echo " "
2679$cat >open3.c <<'EOCP'
2680#include <sys/types.h>
2681#ifdef I_FCNTL
2682#include <fcntl.h>
2683#endif
2684#ifdef I_SYS_FILE
2685#include <sys/file.h>
2686#endif
2687main() {
2688
2689	if(O_RDONLY);
2690
2691#ifdef O_TRUNC
2692	exit(0);
2693#else
2694	exit(1);
2695#endif
2696}
2697EOCP
2698: check sys/file.h first to get FREAD on Sun
2699if $test -r $usrinclude/sys/file.h && \
2700   $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
2701    h_sys_file=true;
2702    echo "sys/file.h defines the O_* constants..."
2703    if ./open3; then
2704	echo "and you have the 3 argument form of open()."
2705	val="$define"
2706    else
2707	echo "but not the 3 argument form of open().  Oh, well."
2708	val="$undef"
2709    fi
2710elif $test -r $usrinclude/fcntl.h && \
2711   $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
2712    h_fcntl=true;
2713    echo "fcntl.h defines the O_* constants..."
2714    if ./open3; then
2715	echo "and you have the 3 argument form of open()."
2716	val="$define"
2717    else
2718	echo "but not the 3 argument form of open().  Oh, well."
2719	val="$undef"
2720    fi
2721else
2722    val="$undef"
2723    echo "I can't find the O_* constant definitions!  You got problems."
2724fi
2725set d_open3
2726eval $setvar
2727
2728: see if how pwd stuff is defined
2729echo " "
2730if $test -r $usrinclude/pwd.h ; then
2731    i_pwd="$define"
2732    echo "pwd.h found."
2733    $cppstdin $cppflags $cppminus <$usrinclude/pwd.h | \
2734	sed -n '/struct[ 	][ 	]*passwd/,/^};/p' >pwd.txt
2735    if $contains 'pw_quota' pwd.txt >/dev/null 2>&1; then
2736	d_pwquota="$define"
2737    else
2738	d_pwquota="$undef"
2739    fi
2740    if $contains 'pw_age' pwd.txt >/dev/null 2>&1; then
2741	d_pwage="$define"
2742    else
2743	d_pwage="$undef"
2744    fi
2745    if $contains 'pw_change' pwd.txt >/dev/null 2>&1; then
2746	d_pwchange="$define"
2747    else
2748	d_pwchange="$undef"
2749    fi
2750    if $contains 'pw_class' pwd.txt >/dev/null 2>&1; then
2751	d_pwclass="$define"
2752    else
2753	d_pwclass="$undef"
2754    fi
2755    if $contains 'pw_expire' pwd.txt >/dev/null 2>&1; then
2756	d_pwexpire="$define"
2757    else
2758	d_pwexpire="$undef"
2759    fi
2760    if $contains 'pw_comment' pwd.txt >/dev/null 2>&1; then
2761	d_pwcomment="$define"
2762    else
2763	d_pwcomment="$undef"
2764    fi
2765else
2766    i_pwd="$undef"
2767    d_pwquota="$undef"
2768    d_pwage="$undef"
2769    d_pwchange="$undef"
2770    d_pwclass="$undef"
2771    d_pwexpire="$undef"
2772    d_pwcomment="$undef"
2773    echo "No pwd.h found."
2774fi
2775
2776: see if rename exists
2777set rename d_rename
2778eval $inlibc
2779
2780: see if rewindir exists
2781set rewinddir d_rewindir
2782eval $inlibc
2783
2784: see if rmdir exists
2785set rmdir d_rmdir
2786eval $inlibc
2787
2788: see if seekdir exists
2789set seekdir d_seekdir
2790eval $inlibc
2791
2792: see if select exists
2793set select d_select
2794eval $inlibc
2795
2796: see if semctl exists
2797set semctl d_semctl
2798eval $inlibc
2799
2800: see if semget exists
2801set semget d_semget
2802eval $inlibc
2803
2804: see if semop exists
2805set semop d_semop
2806eval $inlibc
2807
2808: see how much of the 'sem*(2)' library is present.
2809h_sem=true
2810echo " "
2811case "$d_semctl$d_semget$d_semop" in
2812*undef*) h_sem=false;;
2813esac
2814: we could also check for sys/ipc.h ...
2815if $h_sem && $test -r $usrinclude/sys/sem.h; then
2816    echo "You have the full sem*(2) library."
2817    val="$define"
2818else
2819    echo "You don't have the full sem*(2) library."
2820    val="$undef"
2821fi
2822set d_sem
2823eval $setvar
2824
2825: see if setegid exists
2826set setegid d_setegid
2827eval $inlibc
2828
2829: see if seteuid exists
2830set seteuid d_seteuid
2831eval $inlibc
2832
2833: see if setpgrp exists
2834set setpgrp d_setpgrp
2835eval $inlibc
2836
2837: see if setpgrp2 exists
2838set setpgrp2 d_setpgrp2
2839eval $inlibc
2840
2841: see if setpriority exists
2842set setpriority d_setprior
2843eval $inlibc
2844
2845: see if setregid exists
2846set setregid d_setregid
2847eval $inlibc
2848set setresgid d_setresgid
2849eval $inlibc
2850
2851: see if setreuid exists
2852set setreuid d_setreuid
2853eval $inlibc
2854set setresuid d_setresuid
2855eval $inlibc
2856
2857: see if setrgid exists
2858set setrgid d_setrgid
2859eval $inlibc
2860
2861: see if setruid exists
2862set setruid d_setruid
2863eval $inlibc
2864
2865: see if shmctl exists
2866set shmctl d_shmctl
2867eval $inlibc
2868
2869: see if shmget exists
2870set shmget d_shmget
2871eval $inlibc
2872
2873: see if shmat exists
2874set shmat d_shmat
2875eval $inlibc
2876
2877d_voidshmat="$undef"
2878case "$d_shmat" in
2879define)
2880    $cppstdin $cppflags $cppminus < $usrinclude/sys/shm.h >voidshmat.txt 2>/dev/null
2881    if $contains "void.*shmat" voidshmat.txt >/dev/null 2>&1; then
2882	echo "and shmat returns (void*)"
2883	d_voidshmat="$define"
2884    else
2885	echo "and shmat returns (char*)"
2886    fi
2887    ;;
2888esac
2889
2890: see if shmdt exists
2891set shmdt d_shmdt
2892eval $inlibc
2893
2894: see how much of the 'shm*(2)' library is present.
2895h_shm=true
2896echo " "
2897case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
2898*undef*) h_shm=false;;
2899esac
2900: we could also check for sys/ipc.h ...
2901if $h_shm && $test -r $usrinclude/sys/shm.h; then
2902    echo "You have the full shm*(2) library."
2903    val="$define"
2904else
2905    echo "You don't have the full shm*(2) library."
2906    val="$undef"
2907fi
2908set d_shm
2909eval $setvar
2910
2911: see if stat knows about block sizes
2912echo " "
2913if $contains 'st_blocks;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2914    if $contains 'st_blksize;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2915	echo "Your stat knows about block sizes."
2916	val="$define"
2917    else
2918	echo "Your stat doesn't know about block sizes."
2919	val="$undef"
2920    fi
2921else
2922    echo "Your stat doesn't know about block sizes."
2923    val="$undef"
2924fi
2925set d_statblks
2926eval $setvar
2927
2928: see if stdio is really std
2929echo " "
2930if $contains 'char.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2931    if $contains '_cnt;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2932	echo "Your stdio is pretty std."
2933	val="$define"
2934    else
2935	echo "Your stdio isn't very std."
2936	val="$undef"
2937    fi
2938else
2939    echo "Your stdio isn't very std."
2940    val="$undef"
2941fi
2942set d_stdstdio
2943eval $setvar
2944
2945: check for structure copying
2946echo " "
2947echo "Checking to see if your C compiler can copy structs..."
2948$cat >strctcpy.c <<'EOCP'
2949main()
2950{
2951	struct blurfl {
2952	    int dyick;
2953	} foo, bar;
2954
2955	foo = bar;
2956}
2957EOCP
2958if $cc -c strctcpy.c >/dev/null 2>&1 ; then
2959    val="$define"
2960    echo "Yup, it can."
2961else
2962    val="$undef"
2963    echo "Nope, it can't."
2964fi
2965set d_strctcpy
2966eval $setvar
2967
2968: see if strerror exists
2969set strerror d_strerror
2970eval $inlibc
2971
2972: see if symlink exists
2973set symlink d_symlink
2974eval $inlibc
2975
2976: see if syscall exists
2977set syscall d_syscall
2978eval $inlibc
2979
2980: set if package uses struct tm
2981w_s_tm=1
2982
2983: set if package uses struct timeval
2984case "$d_select" in
2985define) w_s_timevl=1 ;;
2986esac
2987
2988: set if package uses localtime function
2989w_localtim=1
2990
2991: see which of time.h, sys/time.h, and sys/select should be included.
2992idefs=''
2993cat <<'EOM'
2994
2995Testing to see which of <time.h>, <sys/time.h>, and <sys/select.h>
2996should be included, because this application wants:
2997
2998EOM
2999case "$w_s_itimer" in
30001)
3001    echo "	struct itimerval"
3002    idefs="-DS_ITIMERVAL $idefs"
3003    ;;
3004esac
3005case "$w_s_timevl" in
30061)
3007    echo "	struct timeval"
3008    idefs="-DS_TIMEVAL $idefs"
3009    ;;
3010esac
3011case "$w_s_tm" in
30121)
3013    echo "	struct tm"
3014    idefs="-DS_TM $idefs"
3015    ;;
3016esac
3017case "$w_localtim" in
30181)
3019    echo "	ctime(3) declarations"
3020    idefs="-DD_CTIME $idefs"
3021    ;;
3022esac
3023case "$idefs" in
3024'')
3025    echo "	(something I don't know about)"
3026    ;;
3027esac
3028echo " "
3029echo "I'm now running the test program..."
3030$cat >i_time.c <<'EOCP'
3031#include <sys/types.h>
3032#ifdef I_TIME
3033#include <time.h>
3034#endif
3035#ifdef I_SYS_TIME
3036#ifdef SYSTIMEKERNEL
3037#define KERNEL
3038#endif
3039#include <sys/time.h>
3040#endif
3041#ifdef I_SYS_SELECT
3042#include <sys/select.h>
3043#endif
3044main()
3045{
3046    struct tm foo;
3047    struct tm *tmp;
3048#ifdef S_TIMEVAL
3049    struct timeval bar;
3050#endif
3051#ifdef S_ITIMERVAL
3052    struct itimerval baz;
3053#endif
3054
3055    if (foo.tm_sec == foo.tm_sec)
3056	exit(0);
3057#ifdef S_TIMEVAL
3058    if (bar.tv_sec == bar.tv_sec)
3059	exit(0);
3060#endif
3061#ifdef S_ITIMERVAL
3062    if (baz.it_interval == baz.it_interval)
3063	exit(0);
3064#endif
3065#ifdef S_TIMEVAL
3066    if (bar.tv_sec == bar.tv_sec)
3067	exit(0);
3068#endif
3069#ifdef D_CTIME
3070    /* this might not do anything for us... */
3071    tmp = localtime((time_t *)0);
3072#endif
3073    exit(1);
3074}
3075EOCP
3076flags=''
3077for i_sys_select in '' '-DI_SYS_SELECT'; do
3078    for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
3079	for i_time in '' '-DI_TIME'; do
3080	    for i_systime in '-DI_SYS_TIME' ''; do
3081		case "$flags" in
3082		'') echo Trying $i_time $i_systime $d_systimekernel $i_sys_select
3083		    if $cc $ccflags $idefs \
3084			    $i_time $i_systime $d_systimekernel $i_sys_select \
3085			    i_time.c -o i_time >/dev/null 2>&1 ; then
3086			set X $i_time $i_systime $d_systimekernel $i_sys_select
3087			shift
3088			flags="$*"
3089			echo Succeeded with $flags
3090		    fi
3091		    ;;
3092		esac
3093	    done
3094	done
3095    done
3096done
3097case "$flags" in
3098*SYSTIMEKERNEL*) val="$define";;
3099*) val="$undef";;
3100esac
3101set d_systimekernel
3102eval $setvar
3103case "$flags" in
3104*I_TIME*) val="$define";;
3105*) val="$undef";;
3106esac
3107set i_time
3108eval $setvar
3109case "$flags" in
3110*I_SYS_SELECT*) val="$define";;
3111*) val="$undef";;
3112esac
3113set i_sys_select
3114eval $setvar
3115case "$flags" in
3116*I_SYS_TIME*) val="$define";;
3117*) val="$undef";;
3118esac
3119set i_sys_time
3120eval $setvar
3121case "$flags$i_sys_time$i_time" in
3122undefundef) i_sys_time="$define"; i_time="$define";
3123    echo "ICK, NOTHING WORKED!!!  You may have to diddle the includes.";;
3124esac
3125
3126: see if telldir exists
3127set telldir d_telldir
3128eval $inlibc
3129
3130: see if signal is declared as pointer to function returning int or void
3131echo " "
3132$cppstdin $cppflags $cppminus < $usrinclude/signal.h >d_voidsig.txt
3133if $contains 'int[^A-Za-z]*signal' d_voidsig.txt >/dev/null 2>&1 ; then
3134    echo "You have int (*signal())() instead of void."
3135    val="$undef"
3136else
3137    echo "You have void (*signal())() instead of int."
3138    val="$define"
3139fi
3140set d_voidsig
3141eval $setvar
3142case $voidsig in
3143define) d_tosignal=void;;
3144*) d_tosignal=int;;
3145esac
3146
3147: see if truncate exists
3148set truncate d_truncate
3149eval $inlibc
3150
3151: see if there is a vfork
3152set vfork d_vfork
3153eval $inlibc
3154
3155: check for volatile keyword
3156echo " "
3157echo 'Checking to see if your C compiler knows about "volatile"...'
3158$cat >try.c <<'EOCP'
3159main()
3160{
3161	typedef unsigned short foo_t;
3162	char *volatile foo;
3163	volatile int bar;
3164	volatile foo_t blech;
3165	foo = foo;
3166}
3167EOCP
3168if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
3169    val="$define"
3170    echo "Yup, it does."
3171else
3172    val="$undef"
3173    echo "Nope, it doesn't."
3174fi
3175set d_volatile
3176eval $setvar
3177$rm -f try.*
3178
3179: see if there is a wait4
3180set wait4 d_wait4
3181eval $inlibc
3182
3183: see if there is a waitpid
3184set waitpid d_waitpid
3185eval $inlibc
3186
3187: see what type gids are declared as in the kernel
3188case "$gidtype" in
3189'')
3190    if $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3191	dflt='gid_t';
3192    else
3193	set `grep '_rgid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3194	case $1 in
3195	unsigned) dflt="$1 $2" ;;
3196	*) dflt="$1" ;;
3197	esac
3198    fi
3199    ;;
3200*)  dflt="$gidtype"
3201    ;;
3202esac
3203cont=true
3204echo " "
3205rp="What type are groups ids returned by getgid(), etc.? [$dflt]"
3206$echo $n "$rp $c"
3207. myread
3208gidtype="$ans"
3209
3210: see what type gids are returned by getgroups
3211echo " "
3212case "$groupstype" in
3213'')
3214    if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
3215	dflt='short'
3216    elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
3217	dflt='int'
3218    elif $contains 'getgroups.*short' /usr/include/libc.h >/dev/null 2>&1; then
3219	dflt='short'
3220    elif $contains 'getgroups.*int' /usr/include/libc.h >/dev/null 2>&1; then
3221	dflt='int'
3222    elif $contains 'getgroups.*short' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
3223	dflt='short'
3224    elif $contains 'getgroups.*int' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
3225	dflt='int'
3226    elif $contains 'int.*gidset' /usr/man/man2/getgroups.2 >/dev/null 2>&1; then
3227	dflt='int'
3228    elif $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3229	dflt='gid_t'
3230    else
3231	set `grep 'groups\[NGROUPS\];' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3232	case $1 in
3233	unsigned) dflt="$1 $2" ;;
3234	*) dflt="$1" ;;
3235	esac
3236    fi
3237    ;;
3238*)  dflt="$groupstype"
3239    ;;
3240esac
3241cont=true
3242echo "(The following only matters if you have getgroups().)"
3243rp="What type are the group ids returned by getgroups()? [$dflt]"
3244$echo $n "$rp $c"
3245. myread
3246groupstype="$ans"
3247
3248: check for length of integer
3249echo " "
3250case "$intsize" in
3251'')
3252    echo "Checking to see how big your integers are..."
3253    $cat >intsize.c <<'EOCP'
3254#include <stdio.h>
3255main()
3256{
3257    printf("%d\n", sizeof(int));
3258}
3259EOCP
3260    if $cc intsize.c -o intsize >/dev/null 2>&1 ; then
3261	dflt=`./intsize`
3262    else
3263	dflt='4'
3264	echo "(I can't seem to compile the test program.  Guessing...)"
3265    fi
3266    ;;
3267*)
3268    dflt="$intsize"
3269    ;;
3270esac
3271rp="What is the size of an integer (in bytes)? [$dflt]"
3272$echo $n "$rp $c"
3273. myread
3274intsize="$ans"
3275
3276: determine where private executables go
3277case "$privlib" in
3278'')
3279    dflt=/usr/lib/$package
3280    test -d /usr/local/lib && dflt=/usr/local/lib/$package
3281    ;;
3282*)  dflt="$privlib"
3283    ;;
3284esac
3285$cat <<EOM
3286
3287The $package package has some auxiliary files that should be reside in a library
3288that is accessible by everyone.  Where should these "private" but accessible
3289EOM
3290$echo $n "files reside? (~name ok) [$dflt] $c"
3291rp="Private files will reside where? [$dflt]"
3292. myread
3293privlib=`./filexp "$ans"`
3294
3295case "$installprivlib" in
3296'')
3297    dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'`
3298    test -d $dflt || dflt="$privlib"
3299    ;;
3300*)  dflt="$installprivlib"
3301    ;;
3302esac
3303$cat <<EOM
3304
3305On some systems (such as afs) you have to install the library files in a
3306different directory to get them to go to the right place.  Where should the
3307EOM
3308$echo $n "library files be installed? (~name ok) [$dflt] $c"
3309rp="Install private files where? [$dflt]"
3310. myread
3311installprivlib=`./filexp "$ans"`
3312
3313: check for size of random number generator
3314echo " "
3315case "$randbits" in
3316'')
3317    echo "Checking to see how many bits your rand function produces..."
3318    $cat >randbits.c <<'EOCP'
3319#include <stdio.h>
3320main()
3321{
3322    register int i;
3323    register unsigned long tmp;
3324    register unsigned long max = 0L;
3325
3326    for (i=1000; i; i--) {
3327	tmp = (unsigned long)rand();
3328	if (tmp > max) max = tmp;
3329    }
3330    for (i=0; max; i++)
3331	max /= 2;
3332    printf("%d\n",i);
3333}
3334EOCP
3335    if $cc randbits.c -o randbits >/dev/null 2>&1 ; then
3336	dflt=`./randbits`
3337    else
3338	dflt='?'
3339	echo "(I can't seem to compile the test program...)"
3340    fi
3341    ;;
3342*)
3343    dflt="$randbits"
3344    ;;
3345esac
3346rp="How many bits does your rand() function produce? [$dflt]"
3347$echo $n "$rp $c"
3348. myread
3349randbits="$ans"
3350
3351: determine where publicly executable scripts go
3352case "$scriptdir" in
3353'')
3354    dflt="$bin"
3355    : guess some guesses
3356    test -d /usr/share/scripts && dflt=/usr/share/scripts
3357    test -d /usr/share/bin && dflt=/usr/share/bin
3358    ;;
3359*)  dflt="$scriptdir"
3360    ;;
3361esac
3362cont=true
3363$cat <<EOM
3364 
3365Some installations have a separate directory just for executable scripts so
3366that they can mount it across multiple architectures but keep the scripts in
3367one spot.  You might, for example, have a subdirectory of /usr/share for this.
3368Or you might just lump your scripts in with all your other executables.
3369 
3370EOM
3371while $test "$cont" ; do
3372    rp="Where will publicly executable scripts reside (~name ok)? [$dflt]"
3373    $echo $n "$rp $c"
3374    . myread
3375    scriptdir="$ans"
3376    scriptdir=`./filexp "$scriptdir"`
3377    if test -d $scriptdir; then
3378	cont=''
3379    else
3380	case "$fastread" in
3381	yes) dflt=y;;
3382	*) dflt=n;;
3383	esac
3384	rp="Directory $scriptdir doesn't exist.  Use that name anyway? [$dflt]"
3385	$echo $n "$rp $c"
3386	. myread
3387	dflt=''
3388	case "$ans" in
3389	y*) cont='';;
3390	esac
3391    fi
3392done
3393
3394case "$installscr" in
3395'')
3396    dflt=`echo $scriptdir | sed 's#^/afs/#/afs/.#'`
3397    test -d $dflt || dflt="$scriptdir"
3398    ;;
3399*)  dflt="$scriptdir"
3400    ;;
3401esac
3402cont=true
3403$cat <<EOM
3404 
3405Some installations must install scripts in a different directory than where
3406they will eventually reside.  On most systems they're the same directory.
3407EOM
3408while $test "$cont" ; do
3409    rp="Where do you install publicly executable scripts (~name ok)? [$dflt]"
3410    $echo $n "$rp $c"
3411    . myread
3412    installscr="$ans"
3413    installscr=`./filexp "$installscr"`
3414    if test -d $installscr; then
3415	cont=''
3416    else
3417	case "$fastread" in
3418	yes) dflt=y;;
3419	*) dflt=n;;
3420	esac
3421	rp="Directory $installscr doesn't exist.  Use that name anyway? [$dflt]"
3422	$echo $n "$rp $c"
3423	. myread
3424	dflt=''
3425	case "$ans" in
3426	y*) cont='';;
3427	esac
3428    fi
3429done
3430
3431: generate list of signal names
3432echo " "
3433case "$sig_name" in
3434'')
3435    echo "Generating a list of signal names..."
3436    set X `cat $usrinclude/signal.h $usrinclude/sys/signal.h 2>&1 | awk '
3437$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
3438    sig[$3] = substr($2,4,20)
3439    if (max < $3 && $3 < 60) {
3440	max = $3
3441    }
3442}
3443
3444END {
3445    for (i=1; i<=max; i++) {
3446	if (sig[i] == "")
3447	    printf "%d", i
3448	else
3449	    printf "%s", sig[i]
3450	if (i < max)
3451	    printf " "
3452    }
3453    printf "\n"
3454}
3455'`
3456    shift
3457    case $# in
3458    0)  echo 'kill -l' >/tmp/foo$$
3459	set X `$csh -f </tmp/foo$$`
3460	shift
3461	case $# in
3462	0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
3463	    ;;
3464	esac
3465	;;
3466    esac
3467    sig_name="ZERO $*"
3468    ;;
3469esac
3470echo "Signals are: $sig_name"
3471
3472: see what type of char stdio uses.
3473echo " "
3474if $contains 'unsigned.*char.*\*.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
3475    echo "Your stdio uses unsigned chars."
3476    stdchar="unsigned char"
3477else
3478    echo "Your stdio uses signed chars."
3479    stdchar="char"
3480fi
3481
3482: see what type uids are declared as in the kernel
3483case "$uidtype" in
3484'')
3485    if $contains 'uid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3486	dflt='uid_t';
3487    else
3488	set `grep '_ruid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3489	case $1 in
3490	unsigned) dflt="$1 $2" ;;
3491	*) dflt="$1" ;;
3492	esac
3493    fi
3494    ;;
3495*)  dflt="$uidtype"
3496    ;;
3497esac
3498cont=true
3499echo " "
3500rp="What type are user ids returned by getuid(), etc.? [$dflt]"
3501$echo $n "$rp $c"
3502. myread
3503uidtype="$ans"
3504
3505: check for void type
3506echo " "
3507$cat <<EOM
3508Checking to see how well your C compiler groks the void type...
3509
3510  Support flag bits are:
3511    1: basic void declarations.
3512    2: arrays of pointers to functions returning void.
3513    4: operations between pointers to and addresses of void functions.
3514
3515EOM
3516case "$voidhave" in
3517'')
3518    $cat >void.c <<'EOCP'
3519#if TRY & 1
3520void main() {
3521#else
3522main() {
3523#endif
3524	extern void moo();	/* function returning void */
3525	void (*goo)();		/* ptr to func returning void */
3526#if TRY & 2
3527	void (*foo[10])();
3528#endif
3529
3530#if TRY & 4
3531	if(goo == moo) {
3532		exit(0);
3533	}
3534#endif
3535	exit(0);
3536}
3537EOCP
3538    if $cc -c -DTRY=$voidwant void.c >void.out 2>&1 ; then
3539	voidhave=$voidwant
3540	echo "It appears to support void to the level $package wants ($voidwant)."
3541	if $contains warning void.out >/dev/null 2>&1; then
3542	    echo "However, you might get some warnings that look like this:"
3543	    $cat void.out
3544	fi
3545    else
3546	echo "Hmm, your compiler has some difficulty with void.  Checking further..."
3547	if $cc -c -DTRY=1 void.c >/dev/null 2>&1 ; then
3548	    echo "It supports 1..."
3549	    if $cc -c -DTRY=3 void.c >/dev/null 2>&1 ; then
3550		voidhave=3
3551		echo "And it supports 2 but not 4."
3552	    else
3553		echo "It doesn't support 2..."
3554		if $cc -c -DTRY=5 void.c >/dev/null 2>&1 ; then
3555		    voidhave=5
3556		    echo "But it supports 4."
3557		else
3558		    voidhave=1
3559		    echo "And it doesn't support 4."
3560		fi
3561	    fi
3562	else
3563	    echo "There is no support at all for void."
3564	    voidhave=0
3565	fi
3566    fi
3567esac
3568dflt="$voidhave";
3569rp="Your void support flags add up to what? [$dflt]"
3570$echo $n "$rp $c"
3571. myread
3572voidhave="$ans"
3573
3574: preserve RCS keywords in files with variable substitution, grrr
3575Log='$Log'
3576Header='$Header'
3577Id='$Id'
3578Author='$Author'
3579Date='$Date'
3580Locker='$Locker'
3581RCSfile='$RCSfile'
3582Revision='$Revision'
3583Source='$Source'
3584State='$State'
3585
3586
3587: determine compiler compiler
3588case "$yacc" in
3589'') if xenix; then
3590	dflt=yacc
3591    else
3592	dflt='yacc -Sm25000'
3593    fi
3594    ;;
3595*)  dflt="$yacc";;
3596esac
3597cont=true
3598    echo " "
3599rp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]"
3600$echo $n "$rp $c"
3601. myread
3602case "$ans" in
3603'') ans="$dflt";;
3604esac
3605yacc="$ans"
3606
3607: see if we can include fcntl.h
3608echo " "
3609if $h_fcntl; then
3610    val="$define"
3611    echo "We'll be including <fcntl.h>."
3612else
3613    val="$undef"
3614    if $h_sys_file; then
3615	echo "We don't need to <fcntl.h> if we include <sys/file.h>."
3616    else
3617	echo "We won't be including <fcntl.h>."
3618    fi
3619fi
3620set i_fcntl
3621eval $setvar
3622
3623: see if gdbm is available
3624echo " "
3625xxx=`./loc gdbm.h x $usrinclude /usr/local/include $inclwanted`
3626if test -f $xxx; then
3627    val="$define"
3628    echo "gdbm.h found."
3629else
3630    val="$undef"
3631    echo "gdbm.h NOT found."
3632fi
3633set i_gdbm
3634eval $setvar
3635
3636: see if this is an grp system
3637echo " "
3638if $test -r $usrinclude/grp.h ; then
3639    val="$define"
3640    echo "grp.h found."
3641else
3642    val="$undef"
3643    echo "No grp.h found."
3644fi
3645set i_grp
3646eval $setvar
3647
3648: see if this is a netinet/in.h or sys/in.h system
3649echo " "
3650xxx=`./loc netinet/in.h x $usrinclude /usr/local/include $inclwanted`
3651if test -f $xxx; then
3652    val="$define"
3653    val2="$undef"
3654    echo "netinet/in.h found."
3655else
3656    val="$undef"
3657    echo "No netinet/in.h found, ..."
3658    xxx=`./loc sys/in.h x $usrinclude /usr/local/include $inclwanted`
3659    if test -f $xxx; then
3660	val2="$define"
3661	echo "but I found sys/in.h instead."
3662    else
3663	val2="$undef"
3664	echo "and I didn't find sys/in.h either."
3665    fi
3666fi
3667set i_niin
3668eval $setvar
3669val=$val2
3670set i_sysin
3671eval $setvar
3672
3673: Do we need to #include <sys/file.h> ?
3674echo " "
3675if $h_sys_file; then
3676    val="$define"
3677    echo "We'll be including <sys/file.h>."
3678else
3679    val="$undef"
3680    echo "We won't be including <sys/file.h>."
3681fi
3682set i_sys_file
3683eval $setvar
3684
3685: see if ioctl defs are in sgtty/termio or sys/ioctl
3686echo " "
3687if $test -r $usrinclude/sys/ioctl.h ; then
3688    val="$define"
3689    echo "sys/ioctl.h found."
3690else
3691    val="$undef"
3692    echo "sys/ioctl.h NOT found, assuming ioctl args are defined in sgtty.h."
3693fi
3694set i_sysioctl
3695eval $setvar
3696
3697: see if we should include utime.h
3698echo " "
3699if $test -r $usrinclude/utime.h ; then
3700    val="$define"
3701    echo "utime.h found."
3702else
3703    val="$undef"
3704    echo "No utime.h found, but that's ok."
3705fi
3706set i_utime
3707eval $setvar
3708
3709: see if this is a varargs system
3710echo " "
3711if $test -r $usrinclude/varargs.h ; then
3712    val="$define"
3713    echo "varargs.h found."
3714else
3715    val="$undef"
3716    echo "No varargs.h found, but that's ok (I hope)."
3717fi
3718set i_varargs
3719eval $setvar
3720
3721: see if this is a vfork system
3722echo " "
3723if $test -r $usrinclude/vfork.h ; then
3724    val="$define"
3725    echo "vfork.h found."
3726else
3727    val="$undef"
3728    echo "No vfork.h found."
3729fi
3730set i_vfork
3731eval $setvar
3732
3733: end of configuration questions
3734echo " "
3735echo "End of configuration questions."
3736echo " "
3737
3738: create config.sh file
3739echo " "
3740if test -d ../UU; then
3741    cd ..
3742fi
3743echo "Creating config.sh..."
3744test -f config.sh && cp config.sh UU/oldconfig.sh
3745$spitshell <<EOT >config.sh
3746$startsh
3747# config.sh
3748# This file was produced by running the Configure script.
3749d_eunice='$d_eunice'
3750define='$define'
3751eunicefix='$eunicefix'
3752loclist='$loclist'
3753expr='$expr'
3754sed='$sed'
3755echo='$echo'
3756cat='$cat'
3757rm='$rm'
3758mv='$mv'
3759cp='$cp'
3760tail='$tail'
3761tr='$tr'
3762mkdir='$mkdir'
3763sort='$sort'
3764uniq='$uniq'
3765grep='$grep'
3766trylist='$trylist'
3767test='$test'
3768inews='$inews'
3769egrep='$egrep'
3770more='$more'
3771pg='$pg'
3772Mcc='$Mcc'
3773vi='$vi'
3774mailx='$mailx'
3775mail='$mail'
3776cpp='$cpp'
3777perl='$perl'
3778emacs='$emacs'
3779ls='$ls'
3780rmail='$rmail'
3781sendmail='$sendmail'
3782shar='$shar'
3783smail='$smail'
3784tbl='$tbl'
3785troff='$troff'
3786nroff='$nroff'
3787uname='$uname'
3788uuname='$uuname'
3789line='$line'
3790chgrp='$chgrp'
3791chmod='$chmod'
3792lint='$lint'
3793sleep='$sleep'
3794pr='$pr'
3795tar='$tar'
3796ln='$ln'
3797lpr='$lpr'
3798lp='$lp'
3799touch='$touch'
3800make='$make'
3801date='$date'
3802csh='$csh'
3803bash='$bash'
3804ksh='$ksh'
3805lex='$lex'
3806flex='$flex'
3807bison='$bison'
3808Log='$Log'
3809Header='$Header'
3810Id='$Id'
3811lastuname='$lastuname'
3812alignbytes='$alignbytes'
3813bin='$bin'
3814installbin='$installbin'
3815byteorder='$byteorder'
3816contains='$contains'
3817cppstdin='$cppstdin'
3818cppminus='$cppminus'
3819d_bcmp='$d_bcmp'
3820d_bcopy='$d_bcopy'
3821d_safebcpy='$d_safebcpy'
3822d_bzero='$d_bzero'
3823d_castneg='$d_castneg'
3824castflags='$castflags'
3825d_charsprf='$d_charsprf'
3826d_chsize='$d_chsize'
3827d_crypt='$d_crypt'
3828cryptlib='$cryptlib'
3829d_csh='$d_csh'
3830d_dosuid='$d_dosuid'
3831d_dup2='$d_dup2'
3832d_fchmod='$d_fchmod'
3833d_fchown='$d_fchown'
3834d_fcntl='$d_fcntl'
3835d_flexfnam='$d_flexfnam'
3836d_flock='$d_flock'
3837d_getgrps='$d_getgrps'
3838d_gethent='$d_gethent'
3839d_getpgrp='$d_getpgrp'
3840d_getpgrp2='$d_getpgrp2'
3841d_getprior='$d_getprior'
3842d_htonl='$d_htonl'
3843d_index='$d_index'
3844d_isascii='$d_isascii'
3845d_killpg='$d_killpg'
3846d_lstat='$d_lstat'
3847d_memcmp='$d_memcmp'
3848d_memcpy='$d_memcpy'
3849d_safemcpy='$d_safemcpy'
3850d_memmove='$d_memmove'
3851d_memset='$d_memset'
3852d_mkdir='$d_mkdir'
3853d_msg='$d_msg'
3854d_msgctl='$d_msgctl'
3855d_msgget='$d_msgget'
3856d_msgrcv='$d_msgrcv'
3857d_msgsnd='$d_msgsnd'
3858d_ndbm='$d_ndbm'
3859d_odbm='$d_odbm'
3860d_open3='$d_open3'
3861d_readdir='$d_readdir'
3862d_rename='$d_rename'
3863d_rewindir='$d_rewindir'
3864d_rmdir='$d_rmdir'
3865d_seekdir='$d_seekdir'
3866d_select='$d_select'
3867d_sem='$d_sem'
3868d_semctl='$d_semctl'
3869d_semget='$d_semget'
3870d_semop='$d_semop'
3871d_setegid='$d_setegid'
3872d_seteuid='$d_seteuid'
3873d_setpgrp='$d_setpgrp'
3874d_setpgrp2='$d_setpgrp2'
3875d_setprior='$d_setprior'
3876d_setregid='$d_setregid'
3877d_setresgid='$d_setresgid'
3878d_setreuid='$d_setreuid'
3879d_setresuid='$d_setresuid'
3880d_setrgid='$d_setrgid'
3881d_setruid='$d_setruid'
3882d_shm='$d_shm'
3883d_shmat='$d_shmat'
3884d_voidshmat='$d_voidshmat'
3885d_shmctl='$d_shmctl'
3886d_shmdt='$d_shmdt'
3887d_shmget='$d_shmget'
3888d_socket='$d_socket'
3889d_sockpair='$d_sockpair'
3890d_oldsock='$d_oldsock'
3891socketlib='$socketlib'
3892d_statblks='$d_statblks'
3893d_stdstdio='$d_stdstdio'
3894d_strctcpy='$d_strctcpy'
3895d_strerror='$d_strerror'
3896d_symlink='$d_symlink'
3897d_syscall='$d_syscall'
3898d_telldir='$d_telldir'
3899d_truncate='$d_truncate'
3900d_vfork='$d_vfork'
3901d_voidsig='$d_voidsig'
3902d_tosignal='$d_tosignal'
3903d_volatile='$d_volatile'
3904d_vprintf='$d_vprintf'
3905d_charvspr='$d_charvspr'
3906d_wait4='$d_wait4'
3907d_waitpid='$d_waitpid'
3908gidtype='$gidtype'
3909groupstype='$groupstype'
3910i_fcntl='$i_fcntl'
3911i_gdbm='$i_gdbm'
3912i_grp='$i_grp'
3913i_niin='$i_niin'
3914i_sysin='$i_sysin'
3915i_pwd='$i_pwd'
3916d_pwquota='$d_pwquota'
3917d_pwage='$d_pwage'
3918d_pwchange='$d_pwchange'
3919d_pwclass='$d_pwclass'
3920d_pwexpire='$d_pwexpire'
3921d_pwcomment='$d_pwcomment'
3922i_sys_file='$i_sys_file'
3923i_sysioctl='$i_sysioctl'
3924i_time='$i_time'
3925i_sys_time='$i_sys_time'
3926i_sys_select='$i_sys_select'
3927d_systimekernel='$d_systimekernel'
3928i_utime='$i_utime'
3929i_varargs='$i_varargs'
3930i_vfork='$i_vfork'
3931intsize='$intsize'
3932libc='$libc'
3933nm_opts='$nm_opts'
3934libndir='$libndir'
3935i_my_dir='$i_my_dir'
3936i_ndir='$i_ndir'
3937i_sys_ndir='$i_sys_ndir'
3938i_dirent='$i_dirent'
3939i_sys_dir='$i_sys_dir'
3940d_dirnamlen='$d_dirnamlen'
3941ndirc='$ndirc'
3942ndiro='$ndiro'
3943mallocsrc='$mallocsrc'
3944mallocobj='$mallocobj'
3945d_mymalloc='$d_mymalloc'
3946mallocptrtype='$mallocptrtype'
3947mansrc='$mansrc'
3948manext='$manext'
3949models='$models'
3950split='$split'
3951small='$small'
3952medium='$medium'
3953large='$large'
3954huge='$huge'
3955optimize='$optimize'
3956ccflags='$ccflags'
3957cppflags='$cppflags'
3958ldflags='$ldflags'
3959cc='$cc'
3960nativegcc='$nativegcc'
3961libs='$libs'
3962n='$n'
3963c='$c'
3964package='$package'
3965randbits='$randbits'
3966scriptdir='$scriptdir'
3967installscr='$installscr'
3968sig_name='$sig_name'
3969spitshell='$spitshell'
3970shsharp='$shsharp'
3971sharpbang='$sharpbang'
3972startsh='$startsh'
3973stdchar='$stdchar'
3974uidtype='$uidtype'
3975usrinclude='$usrinclude'
3976inclPath='$inclPath'
3977void='$void'
3978voidhave='$voidhave'
3979voidwant='$voidwant'
3980w_localtim='$w_localtim'
3981w_s_timevl='$w_s_timevl'
3982w_s_tm='$w_s_tm'
3983yacc='$yacc'
3984lib='$lib'
3985privlib='$privlib'
3986installprivlib='$installprivlib'
3987EOT
3988
3989test -f patchlevel.h && awk '{printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
3990echo "CONFIG=true" >>config.sh
3991
3992if test -f UU/oldconfig.sh; then
3993    sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
3994      sort | uniq -u >UU/oldsyms
3995    set X `cat UU/oldsyms`
3996    shift
3997    case $# in
3998    0) ;;
3999    *)  echo "Hmm...You had some extra variables I don't know about...I'll try to keep 'em..."
4000	for sym in `cat UU/oldsyms`; do
4001	    echo "    Propagating $hint variable "'$'"$sym..."
4002	    eval 'tmp="$'"${sym}"'"'
4003	    echo "$tmp" | \
4004	      sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
4005	done
4006	;;
4007    esac
4008fi
4009
4010: Finish up
4011CONFIG=true
4012
4013echo " "
4014dflt=''
4015fastread=''
4016echo "If you didn't make any mistakes, then just type a carriage return here."
4017rp="If you need to edit config.sh, do it as a shell escape here:"
4018$echo $n "$rp $c"
4019. UU/myread
4020case "$ans" in
4021'') ;;
4022*) : in case they cannot read
4023    eval $ans;;
4024esac
4025chmod +x doSH
4026./doSH
4027
4028if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
4029    dflt=n
4030    $cat <<EOM
4031
4032Now you need to generate make dependencies by running "make depend".
4033You might prefer to run it in background: "make depend > makedepend.out &"
4034It can take a while, so you might not want to run it right now.
4035
4036EOM
4037    rp="Run make depend now? [$dflt]"
4038    $echo $n "$rp $c"
4039    . UU/myread
4040    case "$ans" in
4041    y*) make depend && echo "Now you must run a make."
4042	;;
4043    *)  echo "You must run 'make depend' then 'make'."
4044	;;
4045    esac
4046elif test -f [Mm]akefile; then
4047    echo " "
4048    echo "Now you must run a make."
4049else
4050    echo "Done."
4051fi
4052
4053$rm -f kit*isdone
4054$rm -rf UU
4055: end of Configure
4056