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.
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.)
11 # $Header: Configure,v 1.0.1.5 88/01/30 09:21:20 root Exp $
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.)
18 PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc'
19 export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$)
22 echo "Say 'sh Configure', not 'sh <Configure'"
26 (alias) >/dev/null 2>&1 && \
27 echo "(I see you are using the Korn shell. Some ksh's blow up on Configure," && \
28 echo "especially on exotic machines. If yours does, try the Bourne shell instead.)"
30 if test ! -d ../UU; then
111 echo "Beginning of configuration questions for $package kit."
112 : Eunice requires " " instead of "", can you believe it
117 libpth='/usr/lib /usr/local/lib /lib'
118 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
119 rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
120 trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
121 attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
122 attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
123 attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
124 pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib"
127 : some greps do not return status, grrr.
128 echo "grimblepritz" >grimble
129 if grep blurfldyick grimble >/dev/null 2>&1 ; then
131 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
137 : the following should work in any shell
141 echo "AGH! Grep doesn't return a status. Attempting remedial action."
142 cat >contains <<'EOSS'
143 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
148 : first determine how to suppress newline on echo command
149 echo "Checking echo to see how to suppress newlines..."
150 (echo "hi there\c" ; echo " ") >.echotmp
151 if $contains c .echotmp >/dev/null 2>&1 ; then
162 echo $n "Type carriage return to continue. Your cursor should be here-->$c"
166 : now set up to do reads with possible shell escape and default assignment
169 while expr "X\$ans" : "X!" >/dev/null; do
178 set \`expr "X\$ans" : "X!\(.*\)\$"\`
191 : general instructions
194 This installation shell script will examine your system and ask you questions
195 to determine how the $package package should be installed. If you get stuck
196 on a question, you may use a ! shell escape to start a subshell or execute
197 a command. Many of the questions will have default answers in square
198 brackets--typing carriage return will give you the default.
200 On some of the questions which ask for file or directory names you are
201 allowed to use the ~name construct to specify the login directory belonging
202 to "name", even if you don't have a shell which knows about that. Questions
203 where this is allowed will be marked "(~name ok)".
206 rp="[Type carriage return to continue]"
211 Much effort has been expended to ensure that this shell script will run
212 on any Unix system. If despite that it blows up on you, your best bet is
213 to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
214 know how I blew it. If you can't run Configure for some reason, you'll have
215 to generate a config.sh file by hand.
217 This installation script affects things in two ways: 1) it may do direct
218 variable substitutions on some of the files included in this kit, and
219 2) it builds a config.h file for inclusion in C programs. You may edit
220 any of these files as the need arises after running this script.
222 If you make a mistake on a question, there is no easy way to back up to it
223 currently. The easiest thing to do is to edit config.sh and rerun all the
224 SH files. Configure will offer to let you do this before it runs the SH files.
227 rp="[Type carriage return to continue]"
231 : get old answers, if there is a config file out there
232 if test -f ../config.sh; then
235 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
239 n*) echo "OK, I'll ignore it.";;
240 *) echo "Fetching default answers from your old config.sh file..."
250 : find out where common programs are
252 echo "Locating common programs..."
265 if test -d \$dir/\$thing; then
271 if test -f \$dir/\$thing; then
302 for file in $loclist; do
303 xxx=`loc $file $file $pth`
308 echo $file is in $xxx.
311 echo "I don't know where $file is. I hope it's in everyone's PATH."
316 echo "Don't worry if any of the following aren't found..."
318 for file in $trylist; do
319 xxx=`loc $file $file $pth`
324 echo $file is in $xxx.
327 echo "I don't see $file out there, $ans."
334 echo "Substituting grep for egrep."
340 echo "Hopefully test is built into your sh."
345 rp="Is your "'"'"test"'"'" built into sh? [$dflt] (OK to guess)"
358 echo "Hopefully echo is built into your sh."
362 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
363 $echo $n "hi there$c" >foo1
364 echo $n "hi there$c" >foo2
365 if cmp foo1 foo2 >/dev/null 2>&1; then
366 echo "They are compatible. In fact, they may be identical."
369 '-n') n='' c='\c' ans='\c' ;;
370 *) n='-n' c='' ans='-n' ;;
373 They are not compatible! You are probably running ksh on a non-USG system.
374 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
375 have echo built in and we may have to run some Bourne shell scripts. That
376 means I'll have to use $ans to suppress newlines now. Life is ridiculous.
379 rp="Your cursor should be here-->"
392 : get list of predefined functions in a handy place
394 if test -f /lib/libc.a; then
395 echo "Your C library is in /lib/libc.a. You're normal."
398 ans=`loc libc.a blurfl/dyick $libpth`
399 if test -f $ans; then
400 echo "Your C library is in $ans, of all places."
403 if test -f "$libc"; then
404 echo "Your C library is in $libc, like you said before."
408 I can't seem to find your C library. I've looked in the following places:
412 None of these seems to contain your C library. What is the full name
415 $echo $n "of your C library? $c"
416 rp='C library full name?'
423 $echo $n "Extracting names from $libc for later perusal...$c"
424 if ar t $libc > libc.list; then
428 echo "The archiver doesn't think $libc is a reasonable library."
429 echo "Trying nm instead..."
430 if nm -g $libc > libc.list; then
431 echo "Done. Maybe this is Unicos, or an Apollo?"
433 echo "That didn't work either. Giving up."
437 rmlist="$rmlist libc.list"
439 : make some quick guesses about what we are up against
442 if $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then
443 echo "Looks kind of like a BSD system, but we'll see..."
447 elif $contains fcntl libc.list >/dev/null 2>&1 ; then
448 echo "Looks kind of like a USG system, but we'll see..."
453 echo "Looks kind of like a version 7 system, but we'll see..."
458 if $contains vmssystem libc.list >/dev/null 2>&1 ; then
460 There is, however, a strange, musty smell in the air that reminds me of
461 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
463 echo "exit 0" >eunice
466 : it so happens the Eunice I know will not run shell scripts in Unix format
469 echo "Congratulations. You aren't running Eunice."
472 echo "exit 1" >eunice
474 if test -f /xenix; then
475 echo "Actually, this looks more like a XENIX system..."
479 echo "It's not Xenix..."
483 if test -f /venix; then
484 echo "Actually, this looks more like a VENIX system..."
491 echo "Nor is it Venix..."
495 chmod 755 bsd usg v7 eunice venix xenix
496 $eunicefix bsd usg v7 eunice venix xenix
497 rmlist="$rmlist bsd usg v7 eunice venix xenix"
499 : see if sh knows # comments
501 echo "Checking your sh to see if it knows about # comments..."
502 if sh -c '#' >/dev/null 2>&1 ; then
503 echo "Your sh handles # comments correctly."
507 echo "Okay, let's see if #! works on this system..."
508 echo "#!/bin/echo hi" > try
512 if test -s today; then
516 echo "#! /bin/echo hi" > try
520 if test -s today; then
529 echo "Your sh doesn't grok # comments--I will strip them later on."
531 echo "exec grep -v '^#'" >spitshell
534 spitshell=`pwd`/spitshell
535 echo "I presume that if # doesn't work, #! won't work either!"
539 : figure out how to guarantee sh startup
541 echo "Checking out how to guarantee sh startup..."
542 startsh=$sharpbang'/bin/sh'
543 echo "Let's see if '$startsh' works..."
555 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
559 : see how we invoke the C preprocessor
561 echo "Now, how can we feed standard input to your C preprocessor..."
562 cat <<'EOT' >testcpp.c
567 echo 'Maybe "/lib/cpp" will work...'
568 /lib/cpp <testcpp.c >testcpp.out 2>&1
569 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
574 echo 'Nope, maybe "/lib/cpp -" will work...'
575 /lib/cpp - <testcpp.c >testcpp.out 2>&1
576 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
581 echo 'No such luck...maybe "cc -E" will work...'
582 cc -E <testcpp.c >testcpp.out 2>&1
583 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
588 echo 'Nixed again...maybe "cc -E -" will work...'
589 cc -E - <testcpp.c >testcpp.out 2>&1
590 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
591 echo "Hooray, it works! I was beginning to wonder."
595 echo 'Nope...maybe "cc -P" will work...'
596 cc -P <testcpp.c >testcpp.out 2>&1
597 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
598 echo "Yup, that does."
602 echo 'Nope...maybe "cc -P -" will work...'
603 cc -P - <testcpp.c >testcpp.out 2>&1
604 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
605 echo "Yup, that does."
609 echo 'Hmm...perhaps you already told me...'
612 *) $cpp $cppminus <testcpp.c >testcpp.out 2>&1;;
614 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
615 echo "Hooray, you did! I was beginning to wonder."
617 echo 'Uh-uh. Time to get fancy...'
618 echo 'Trying (cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)'
619 cpp='(cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)'
621 $cpp <testcpp.c >testcpp.out 2>&1
622 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
626 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
627 rp='Name a C preprocessor:'
630 $cpp <testcpp.c >testcpp.out 2>&1
631 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
632 echo "OK, that will do."
634 echo "Sorry, I can't get that to work. Go find one."
645 rm -f testcpp.c testcpp.out
647 : see if bcopy exists
649 if $contains bcopy libc.list >/dev/null 2>&1; then
650 echo 'bcopy() found.'
653 echo 'bcopy() not found.'
657 : see if sprintf is declared as int or pointer to char
659 if $contains 'char.*sprintf' /usr/include/stdio.h >/dev/null 2>&1 ; then
660 echo "Your sprintf() returns (char*)."
663 echo "Your sprintf() returns (int)."
670 if $contains index libc.list >/dev/null 2>&1 ; then
671 echo "Your system appears to use index() and rindex() rather than strchr()"
672 $echo $n "and strrchr(). Is this correct? [$dflt] $c"
673 rp='index() rather than strchr()? [$dflt]'
676 n*|f*) d_index="$define" ;;
677 *) d_index="$undef" ;;
680 echo "Your system appears to use strchr() and strrchr() rather than index()"
681 $echo $n "and rindex(). Is this correct? [$dflt] $c"
682 rp='strchr() rather than index()? [$dflt]'
685 n*|f*) d_index="$undef" ;;
686 *) d_index="$define" ;;
690 : see if stat knows about block sizes
692 if $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
693 if $contains 'st_blksize;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
694 echo "Your stat knows about block sizes."
697 echo "Your stat doesn't know about block sizes."
701 echo "Your stat doesn't know about block sizes."
705 : see if stdio is really std
707 if $contains 'char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
708 if $contains '_cnt;' /usr/include/stdio.h >/dev/null 2>&1 ; then
709 echo "Your stdio is pretty std."
712 echo "Your stdio isn't very std."
716 echo "Your stdio isn't very std."
720 : check for structure copying
722 echo "Checking to see if your C compiler can copy structs..."
733 if cc -c try.c >/dev/null 2>&1 ; then
738 echo "Nope, it can't."
742 : see if struct tm is defined in sys/time.h
744 if $contains 'struct tm' /usr/include/time.h >/dev/null 2>&1 ; then
745 echo "You have struct tm defined in <time.h> rather than <sys/time.h>."
748 echo "You have struct tm defined in <sys/time.h> rather than <time.h>."
752 : see if there is a vfork
754 if $contains vfork libc.list >/dev/null 2>&1 ; then
755 echo "vfork() found."
758 echo "No vfork() found--will use fork() instead."
762 : see if signal is declared as pointer to function returning int or void
764 if $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 ; then
765 echo "You have void (*signal())() instead of int."
768 echo "You have int (*signal())() instead of void."
772 : check for void type
775 Checking to see how well your C compiler groks the void type...
777 Support flag bits are:
778 1: basic void declarations.
779 2: arrays of pointers to functions returning void.
780 4: operations between pointers to and addresses of void functions.
805 if cc -S -DTRY=7 try.c >.out 2>&1 ; then
807 echo "It appears to support void fully."
808 if $contains warning .out >/dev/null 2>&1; then
809 echo "However, you might get some warnings that look like this:"
813 echo "Hmm, you compiler has some difficulty with void. Checking further..."
814 if cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
815 echo "It supports 1..."
816 if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
818 echo "And it supports 2 but not 4."
820 echo "It doesn't support 2..."
821 if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
823 echo "But it supports 4."
826 echo "And it doesn't support 4."
830 echo "There is no support at all for void."
836 rp="Your void support flags add up to what? [$dflt]"
842 : see what type of char stdio uses.
844 if $contains 'unsigned.*char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
845 echo "Your stdio uses unsigned chars."
846 stdchar="unsigned char"
848 echo "Your stdio uses signed chars."
852 : preserve RCS keywords in files with variable substitution, grrr
856 : set up shell script to do ~ expansion
862 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
865 if $test -f /bin/csh; then
866 /bin/csh -f -c "glob \$1"
869 name=\`$expr x\$1 : '..\([^/]*\)'\`
870 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
871 if $test ! -d "\$dir"; then
873 echo "\$me: can't locate home directory for: \$name" >&2
878 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
894 : determine where public executables go
897 dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
903 while $test "$cont" ; do
905 rp="Where do you want to put the public executables? [$dflt]"
910 if test -d $bin; then
914 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
924 : determine where manual pages go
927 dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1`
933 while $test "$cont" ; do
935 rp="Where do the manual pages (source) go? [$dflt]"
938 mansrc=`filexp "$ans"`
939 if test -d $mansrc; then
943 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
964 : get C preprocessor symbols handy
966 echo $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know
978 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
980 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
983 unknown="\$unknown \$sym"
993 echo \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\
995 exit 0; _ _ _ _\1\\ \1\\
998 echo exit 1 >>/tmp/Cppsym\$\$
999 $cpp $cppminus </tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$
1001 true) awk 'NF > 5 {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;
1007 $rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
1012 echo "Your C preprocessor defines the following symbols:"
1013 Cppsym -l $attrlist >Cppsym.true
1015 rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
1017 : see what memory models we can support
1020 if Cppsym pdp11; then
1021 dflt='unsplit split'
1023 ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1026 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1031 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1034 if $test -d /lib/large || $test -d /usr/lib/large; then
1037 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1043 *) dflt="$models" ;;
1047 Some systems have different model sizes. On most systems they are called
1048 small, medium, large, and huge. On the PDP11 they are called unsplit and
1049 split. If your system doesn't support different memory models, say "none".
1050 If you wish to force everything to one memory model, say "none" here and
1051 put the appropriate flags later when it asks you for other cc and ld flags.
1052 Venix systems may wish to put "none" and let the compiler figure things out.
1053 (In the following question multiple model names should be space separated.)
1056 rp="Which models are supported? [$dflt]"
1073 if $contains '-i' $mansrc/ld.1 >/dev/null 2>&1 || \
1074 $contains '-i' $mansrc/cc.1 >/dev/null 2>&1; then
1082 rp="What flag indicates separate I and D space? [$dflt]"
1091 *large*|*small*|*medium*|*huge*)
1098 rp="What flag indicates large model? [$dflt]"
1114 rp="What flag indicates huge model? [$dflt]"
1130 rp="What flag indicates medium model? [$dflt]"
1138 *) medium="$large";;
1146 rp="What flag indicates small model? [$dflt]"
1158 echo "Unrecognized memory models--you may have to edit Makefile.SH"
1164 *) dflt="$ccflags";;
1167 rp="Any additional cc flags? [$dflt]"
1182 *) dflt="$ldflags";;
1185 rp="Any additional ld flags? [$dflt]"
1193 : see if we need a special compiler
1207 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1221 On some systems the default C compiler will not resolve multiple global
1222 references that happen to have the same name. On some such systems the
1223 "Mcc" command may be used to force these to be resolved. On other systems
1224 a "cc -M" command is required. (Note that the -M flag on other systems
1225 indicates a memory model to use!) What command will force resolution on
1227 $echo $n "this system? [$dflt] $c"
1228 rp="Command to resolve multiple refs? [$dflt]"
1232 echo "Not a USG system--assuming cc can resolve multiple definitions."
1236 : see if we should include -lnm
1238 if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
1239 echo "New math library found."
1242 ans=`loc libnm.a x $libpth`
1245 echo "No nm library found--the normal math library will have to do."
1249 echo "New math library found in $ans."
1255 : determine which malloc to compile in
1257 case "$usemymalloc" in
1265 *) dflt="$usemymalloc"
1268 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
1276 y*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
1277 *) mallocsrc=''; mallocobj='';;
1281 echo "End of configuration questions."
1284 : create config.sh file
1286 if test -d ../UU; then
1289 echo "Creating config.sh..."
1290 $spitshell <<EOT >config.sh
1293 # This file was produced by running the Configure script.
1295 d_eunice='$d_eunice'
1296 eunicefix='$eunicefix'
1326 contains='$contains'
1328 cppminus='$cppminus'
1330 d_charsprf='$d_charsprf'
1332 d_statblks='$d_statblks'
1333 d_stdstdio='$d_stdstdio'
1334 d_strctcpy='$d_strctcpy'
1335 d_tminsys='$d_tminsys'
1337 d_voidsig='$d_voidsig'
1340 mallocsrc='$mallocsrc'
1341 mallocobj='$mallocobj'
1342 usemymalloc='$usemymalloc'
1356 spitshell='$spitshell'
1358 sharpbang='$sharpbang'
1361 voidflags='$voidflags'
1362 defvoidused='$defvoidused'
1370 echo "If you didn't make any mistakes, then just type a carriage return here."
1371 rp="If you need to edit config.sh, do it as a shell escape here:"
1376 *) : in case they cannot read
1381 echo "Doing variable substitutions on .SH files..."
1382 set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
1385 0) set x *.SH; shift;;
1387 if test ! -f $1; then
1393 dir=`$expr X$file : 'X\(.*\)/'`
1394 file=`$expr X$file : 'X.*/\(.*\)'`
1395 (cd $dir && . $file)
1402 if test -f config.h.SH; then
1403 if test ! -f config.h; then
1404 : oops, they left it out of MANIFEST, probably, so do it anyway.
1409 if $contains '^depend:' Makefile >/dev/null 2>&1; then
1413 Now you need to generate make dependencies by running "make depend".
1414 You might prefer to run it in background: "make depend > makedepend.out &"
1415 It can take a while, so you might not want to run it right now.
1418 rp="Run make depend now? [$dflt]"
1423 echo "Now you must run a make."
1425 *) echo "You must run 'make depend' then 'make'."
1428 elif test -f Makefile; then
1430 echo "Now you must run a make."
1436 cd UU && $rm -f $rmlist