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 3.0.1.4 89/12/21 18:57:00 lwall Locked $
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:/usr/new:/usr/new/bin:/usr/nbin:$PATH"
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
38 -d) shift; fastread='yes';;
221 echo "Beginning of configuration questions for $package kit."
222 : Eunice requires " " instead of "", can you believe it
227 : change the next line if compiling for Xenix/286 on Xenix/386
228 xlibpth='/usr/lib/386 /lib/386'
229 libpth='/usr/lib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
230 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
231 rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
232 trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
234 : We must find out about Eunice early
236 if test -f /etc/unixtovms; then
237 eunicefix=/etc/unixtovms
239 if test -f /etc/unixtovms.exe; then
240 eunicefix=/etc/unixtovms.exe
243 : Now test for existence of everything in MANIFEST
245 echo "First let's make sure your kit is complete. Checking..."
246 (cd ..; awk '' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$)
249 attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
250 attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
251 attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
252 attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
253 attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
254 attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
255 attrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__"
256 pth="/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"
257 d_newshome="/usr/NeWS"
259 libswanted="net_s net nsl_s nsl socket nm ndir ndbm dbm sun bsd x c_s"
260 inclwanted='/usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan'
261 : some greps do not return status, grrr.
262 echo "grimblepritz" >grimble
263 if grep blurfldyick grimble >/dev/null 2>&1 ; then
265 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
271 : the following should work in any shell
275 echo "AGH! Grep doesn't return a status. Attempting remedial action."
276 cat >contains <<'EOSS'
277 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
282 : see if sh knows # comments
284 echo "Checking your sh to see if it knows about # comments..."
285 if sh -c '#' >/dev/null 2>&1 ; then
286 echo "Your sh handles # comments correctly."
290 echo "Okay, let's see if #! works on this system..."
291 echo "#!/bin/echo hi" > try
295 if $contains hi today >/dev/null 2>&1; then
299 echo "#! /bin/echo hi" > try
303 if test -s today; then
312 echo "Your sh doesn't grok # comments--I will strip them later on."
314 echo "exec grep -v '^#'" >spitshell
317 spitshell=`pwd`/spitshell
318 echo "I presume that if # doesn't work, #! won't work either!"
322 : figure out how to guarantee sh startup
324 echo "Checking out how to guarantee sh startup..."
325 startsh=$sharpbang'/bin/sh'
326 echo "Let's see if '$startsh' works..."
338 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
342 : first determine how to suppress newline on echo command
343 echo "Checking echo to see how to suppress newlines..."
344 (echo "hi there\c" ; echo " ") >.echotmp
345 if $contains c .echotmp >/dev/null 2>&1 ; then
356 echo $n "Type carriage return to continue. Your cursor should be here-->$c"
360 : now set up to do reads with possible shell escape and default assignment
363 yes) ans=''; echo " " ;;
366 while expr "X\$ans" : "X!" >/dev/null; do
375 set \`expr "X\$ans" : "X!\(.*\)\$"\`
388 : general instructions
391 This installation shell script will examine your system and ask you questions
392 to determine how the $package package should be installed. If you get stuck
393 on a question, you may use a ! shell escape to start a subshell or execute
394 a command. Many of the questions will have default answers in square
395 brackets--typing carriage return will give you the default.
397 On some of the questions which ask for file or directory names you are
398 allowed to use the ~name construct to specify the login directory belonging
399 to "name", even if you don't have a shell which knows about that. Questions
400 where this is allowed will be marked "(~name ok)".
403 rp="[Type carriage return to continue]"
408 Much effort has been expended to ensure that this shell script will run
409 on any Unix system. If despite that it blows up on you, your best bet is
410 to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
411 know how I blew it. If you can't run Configure for some reason, you'll have
412 to generate a config.sh file by hand.
414 This installation script affects things in two ways: 1) it may do direct
415 variable substitutions on some of the files included in this kit, and
416 2) it builds a config.h file for inclusion in C programs. You may edit
417 any of these files as the need arises after running this script.
419 If you make a mistake on a question, there is no easy way to back up to it
420 currently. The easiest thing to do is to edit config.sh and rerun all the
421 SH files. Configure will offer to let you do this before it runs the SH files.
424 rp="[Type carriage return to continue]"
428 : get old answers, if there is a config file out there
429 if test -f ../config.sh; then
432 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
436 n*) echo "OK, I'll ignore it.";;
437 *) echo "Fetching default answers from your old config.sh file..."
447 : find out where common programs are
449 echo "Locating common programs..."
462 if test -d \$dir/\$thing; then
468 if test -f \$dir/\$thing; then
471 elif test -f \$dir/\$thing.exe; then
472 : on Eunice apparently
505 for file in $loclist; do
506 xxx=`loc $file $file $pth`
511 echo $file is in $xxx.
514 echo "I don't know where $file is. I hope it's in everyone's PATH."
519 echo "Don't worry if any of the following aren't found..."
521 for file in $trylist; do
522 xxx=`loc $file $file $pth`
527 echo $file is in $xxx.
530 echo "I don't see $file out there, $ans."
537 echo "Substituting grep for egrep."
543 echo "Hopefully test is built into your sh."
546 if sh -c "PATH= test true" >/dev/null 2>&1; then
547 echo "Using the test built into your sh."
557 echo "Hopefully echo is built into your sh."
561 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
562 $echo $n "hi there$c" >foo1
563 echo $n "hi there$c" >foo2
564 if cmp foo1 foo2 >/dev/null 2>&1; then
565 echo "They are compatible. In fact, they may be identical."
568 '-n') n='' c='\c' ans='\c' ;;
569 *) n='-n' c='' ans='-n' ;;
572 They are not compatible! You are probably running ksh on a non-USG system.
573 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
574 have echo built in and we may have to run some Bourne shell scripts. That
575 means I'll have to use $ans to suppress newlines now. Life is ridiculous.
578 rp="Your cursor should be here-->"
591 : set up shell script to do ~ expansion
597 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
600 if $test -f /bin/csh; then
601 /bin/csh -f -c "glob \$1"
604 name=\`$expr x\$1 : '..\([^/]*\)'\`
605 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
606 if $test ! -d "\$dir"; then
608 echo "\$me: can't locate home directory for: \$name" >&2
613 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
629 : determine where public executables go
632 dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
638 while $test "$cont" ; do
640 rp="Where do you want to put the public executables? [$dflt]"
645 if test -d $bin; then
652 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
662 : determine where manual pages go
665 $package has manual pages that need to be installed in source form.
669 dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1 /usr/man/man.L`
675 while $test "$cont" ; do
677 rp="Where do the manual pages (source) go? [$dflt]"
680 mansrc=`filexp "$ans"`
681 if $test -d "$mansrc"; then
684 if $test "$fastread" = yes; then
689 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
722 : make some quick guesses about what we are up against
725 cat /usr/include/signal.h /usr/include/sys/signal.h >foo
726 if test `echo abc | tr a-z A-Z` = Abc ; then
727 echo "Looks kind of like a USG system, but we'll see..."
731 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
732 echo "Looks kind of like a BSD system, but we'll see..."
737 echo "Looks kind of like a version 7 system, but we'll see..."
745 There is, however, a strange, musty smell in the air that reminds me of
746 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
748 echo "exit 0" >eunice
753 echo "Congratulations. You aren't running Eunice."
755 echo "exit 1" >eunice
758 if test -f /xenix; then
759 echo "Actually, this looks more like a XENIX system..."
763 echo "It's not Xenix..."
768 if test -f /venix; then
769 echo "Actually, this looks more like a VENIX system..."
776 echo "Nor is it Venix..."
780 chmod +x bsd usg v7 eunice venix
781 $eunicefix bsd usg v7 eunice venix
783 rmlist="$rmlist bsd usg v7 eunice venix xenix"
785 : see what memory models we can support
788 : We may not use Cppsym or we get a circular dependency through cc.
789 : But this should work regardless of which cc we eventually use.
799 cc -o pdp11 pdp11.c >/dev/null 2>&1
800 if pdp11 2>/dev/null; then
803 ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
806 *) if $test -d /lib/small || $test -d /usr/lib/small; then
811 if $test -d /lib/medium || $test -d /usr/lib/medium; then
814 if $test -d /lib/large || $test -d /usr/lib/large; then
817 if $test -d /lib/huge || $test -d /usr/lib/huge; then
827 Some systems have different model sizes. On most systems they are called
828 small, medium, large, and huge. On the PDP11 they are called unsplit and
829 split. If your system doesn't support different memory models, say "none".
830 If you wish to force everything to one memory model, say "none" here and
831 put the appropriate flags later when it asks you for other cc and ld flags.
832 Venix systems may wish to put "none" and let the compiler figure things out.
833 (In the following question multiple model names should be space separated.)
836 rp="Which models are supported? [$dflt]"
853 if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
854 $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
862 rp="What flag indicates separate I and D space? [$dflt]"
871 *large*|*small*|*medium*|*huge*)
878 rp="What flag indicates large model? [$dflt]"
894 rp="What flag indicates huge model? [$dflt]"
910 rp="What flag indicates medium model? [$dflt]"
926 rp="What flag indicates small model? [$dflt]"
938 echo "Unrecognized memory models--you may have to edit Makefile.SH"
942 : see if we need a special compiler
956 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
970 On some systems the default C compiler will not resolve multiple global
971 references that happen to have the same name. On some such systems the
972 "Mcc" command may be used to force these to be resolved. On other systems
973 a "cc -M" command is required. (Note that the -M flag on other systems
974 indicates a memory model to use!) If you have the Gnu C compiler, you
975 might wish to use that instead. What command will force resolution on
977 $echo $n "this system? [$dflt] $c"
978 rp="Command to resolve multiple refs? [$dflt]"
986 rp="Use which C compiler? [$dflt]"
992 gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
995 : determine optimize, if desired, or use for debug flag also
1006 Some C compilers have problems with their optimizers, by default, $package
1007 compiles with the -O flag to use the optimizer. Alternately, you might
1008 want to use the symbolic debugger, which uses the -g flag (on traditional
1009 Unix systems). Either flag can be specified here. To use neither flag,
1010 specify the word "none".
1013 rp="What optimizer/debugger flag should be used? [$dflt]"
1018 'none') optimize=" "
1024 *gcc*) dflt='-fpcc-struct-return';;
1028 *) dflt="$ccflags";;
1030 for thisincl in $inclwanted; do
1031 if test -d $thisincl; then
1034 *) dflt="$dflt -I$thisincl";;
1042 *) dflt="$dflt -DDEBUGGING";;
1051 Your C compiler may want other flags. For this question you should
1052 include -I/whatever and -DWHATEVER flags and any other flags used by
1053 the C compiler, but you should NOT include libraries or ld flags like
1054 -lwhatever. To use no flags, specify the word "none".
1057 rp="Any additional cc flags? [$dflt]"
1065 : the following weeds options from ccflags that are of no interest to cpp
1068 *gcc*) cppflags="$cppflags -D__GNUC__";;
1076 -D*|-I*) cppflags="$cppflags $flag";;
1080 *-*) echo "(C preprocessor flags: $cppflags)";;
1092 *) dflt="$ldflags";;
1095 rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1102 rmlist="$rmlist pdp11"
1105 echo "Checking for optional libraries..."
1110 case "$libswanted" in
1111 '') libswanted='c_s';;
1113 for thislib in $libswanted; do
1117 *) thatlib="${thislib}_s";;
1120 xxx=`loc lib$thislib.a X /usr/lib /usr/local/lib /lib`
1121 if test -f $xxx; then
1122 echo "Found -l$thislib."
1124 *-l$thislib*|*-l$thatlib*);;
1125 *) dflt="$dflt -l$thislib";;
1128 xxx=`loc lib$thislib.a X $libpth`
1129 if test -f $xxx; then
1133 *) dflt="$dflt $xxx";;
1136 xxx=`loc Slib$thislib.a X $xlibpth`
1137 if test -f $xxx; then
1138 echo "Found -l$thislib."
1140 *-l$thislib*|*-l$thatlib*);;
1141 *) dflt="$dflt -l$thislib";;
1144 echo "No -l$thislib."
1158 Some versions of Unix support shared libraries, which make
1159 executables smaller but make load time slightly longer.
1161 On some systems, mostly newer Unix System V's, the shared library
1162 is included by putting the option "-lc_s" as the last thing on the
1163 cc command line when linking. Other systems use shared libraries
1164 by default. There may be other libraries needed to compile $package
1165 on your machine as well. If your system needs the "-lc_s" option,
1166 include it here. Include any other special libraries here as well.
1167 Say "none" for none.
1171 rp="Any additional libraries? [$dflt]"
1179 : check for ordering of bytes in a long
1180 case "$byteorder" in
1184 In the following, larger digits indicate more significance. A big-endian
1185 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
1186 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
1187 machines may have weird orders like 3412. A Cray will report 87654321. If
1188 the test program works the default is probably right.
1189 I'm now running the test program...
1191 $cat >try.c <<'EOCP'
1198 char c[sizeof(long)];
1201 if (sizeof(long) > 4)
1202 u.l = 0x0807060504030201;
1205 for (i=0; i < sizeof(long); i++)
1206 printf("%c",u.c[i]+'0');
1210 if $cc try.c -o try >/dev/null 2>&1 ; then
1213 ????|????????) echo "(The test program ran ok.)";;
1214 *) echo "(The test program didn't run right for some reason.)";;
1218 echo "(I can't seem to compile the test program. Guessing big-endian...)"
1226 rp="What is the order of bytes in a long? [$dflt]"
1232 : see how we invoke the C preprocessor
1234 echo "Now, how can we feed standard input to your C preprocessor..."
1235 cat <<'EOT' >testcpp.c
1240 echo 'Maybe "'"$cc"' -E" will work...'
1241 $cc -E <testcpp.c >testcpp.out 2>&1
1242 : try to force gcc preprocessor if that is the compiler they are using
1244 0) cppstdin="$cc -E";;
1248 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1249 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1251 cppstdin=`pwd`/cppstdin
1254 $cppstdin <testcpp.c >testcpp.out 2>&1
1259 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1260 echo "Yup, it does."
1264 echo 'Nope, maybe "'$cpp'" will work...'
1265 $cpp <testcpp.c >testcpp.out 2>&1
1266 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1267 echo "Yup, it does."
1271 echo 'No such luck...maybe "'$cpp' -" will work...'
1272 $cpp - <testcpp.c >testcpp.out 2>&1
1273 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1278 echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
1279 $cc -E - <testcpp.c >testcpp.out 2>&1
1280 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1281 echo "Hooray, it works! I was beginning to wonder."
1285 echo 'Nope...maybe "'"$cc"' -P" will work...'
1286 $cc -P <testcpp.c >testcpp.out 2>&1
1287 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1288 echo "Yup, that does."
1292 echo 'Nope...maybe "'"$cc"' -P -" will work...'
1293 $cc -P - <testcpp.c >testcpp.out 2>&1
1294 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1295 echo "Yup, that does."
1299 echo 'Hmm...perhaps you already told me...'
1302 *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
1304 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1305 echo "Hooray, you did! I was beginning to wonder."
1307 echo 'Uh-uh. Time to get fancy...'
1309 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1310 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1312 cppstdin=`pwd`/cppstdin
1315 $cppstdin <testcpp.c >testcpp.out 2>&1
1316 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1320 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
1321 rp='Name a C preprocessor:'
1324 $cppstdin <testcpp.c >testcpp.out 2>&1
1325 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1326 echo "OK, that will do."
1328 echo "Sorry, I can't get that to work. Go find one."
1339 rm -f testcpp.c testcpp.out
1341 : get list of predefined functions in a handy place
1347 '') libpth='/lib /usr/lib /usr/local/lib';;
1350 *-lc_s*) libc=`loc libc_s.a $libc $libpth`
1355 *) for thislib in $libs; do
1357 -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
1358 try=`loc lib$thislib.a blurfl/dyick $libpth`
1359 if test ! -f $try; then
1360 try=`loc lib$thislib blurfl/dyick $libpth`
1361 if test ! -f $try; then
1362 try=`loc $thislib blurfl/dyick $libpth`
1363 if test ! -f $try; then
1364 try=`loc Slib$thislib.a blurfl/dyick $xlibpth`
1365 if test ! -f $try; then
1371 libnames="$libnames $try"
1373 *) libnames="$libnames $thislib" ;;
1378 set /usr/lib/libc.so.[0-9]*
1380 if test -f "$1"; then
1381 echo "Your shared C library is in $1."
1383 elif test -f $libc; then
1384 echo "Your C library is in $libc, like you said before."
1385 elif test -f /lib/libc.a; then
1386 echo "Your C library is in /lib/libc.a. You're normal."
1389 ans=`loc libc.a blurfl/dyick $libpth`
1390 if test ! -f "$ans"; then
1391 ans=`loc libc blurfl/dyick $libpth`
1393 if test ! -f "$ans"; then
1394 ans=`loc clib blurfl/dyick $libpth`
1396 if test ! -f "$ans"; then
1397 ans=`loc Slibc.a blurfl/dyick $xlibpth`
1399 if test ! -f "$ans"; then
1400 ans=`loc Mlibc.a blurfl/dyick $xlibpth`
1402 if test ! -f "$ans"; then
1403 ans=`loc Llibc.a blurfl/dyick $xlibpth`
1405 if test -f "$ans"; then
1406 echo "Your C library is in $ans, of all places."
1411 I can't seem to find your C library. I've looked in the following places:
1415 None of these seems to contain your C library. What is the full name
1418 $echo $n "of your C library? $c"
1419 rp='C library full name?'
1426 $echo $n "Extracting names from $* for later perusal...$c"
1427 nm $* 2>/dev/null >libc.tmp
1428 $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
1429 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1432 $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
1433 $contains '^printf$' libc.list >/dev/null 2>&1 || \
1434 $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list
1435 $contains '^printf$' libc.list >/dev/null 2>&1 || \
1436 $sed -n -e 's/^_//' \
1437 -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
1438 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1442 echo "nm didn't seem to work right."
1443 echo "Trying ar instead..."
1444 if ar t $libc > libc.tmp; then
1445 for thisname in $libnames; do
1446 ar t $thisname >>libc.tmp
1448 $sed -e 's/\.o$//' < libc.tmp > libc.list
1451 echo "ar didn't seem to work right."
1452 echo "Maybe this is a Cray...trying bld instead..."
1453 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
1454 for thisname in $libnames; do
1456 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
1457 ar t $thisname >>libc.tmp
1461 echo "That didn't work either. Giving up."
1469 if $contains "^$1\$" libc.list >/dev/null 2>&1;
1470 then echo "$1() found"; eval "$2=$define";
1471 else echo "$1() not found"; eval "$2=$undef"; fi'
1473 rmlist="$rmlist libc.tmp libc.list"
1475 : see if bcmp exists
1479 : see if bcopy exists
1483 : see if bzero exists
1487 : see if sprintf is declared as int or pointer to char
1489 cat >.ucbsprf.c <<'EOF'
1490 main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
1492 if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1493 echo "Your sprintf() returns (int)."
1496 echo "Your sprintf() returns (char*)."
1497 d_charsprf="$define"
1499 /bin/rm -f .ucbsprf.c .ucbsprf
1501 : see if vprintf exists
1503 if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
1504 echo 'vprintf() found.'
1506 cat >.ucbsprf.c <<'EOF'
1507 #include <varargs.h>
1509 main() { xxx("foo"); }
1518 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
1521 if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1522 echo "Your vsprintf() returns (int)."
1525 echo "Your vsprintf() returns (char*)."
1526 d_charvspr="$define"
1528 /bin/rm -f .ucbsprf.c .ucbsprf
1530 echo 'vprintf() not found.'
1535 : see if crypt exists
1537 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
1538 echo 'crypt() found.'
1542 cryptlib=`loc Slibcrypt.a "" $xlibpth`
1543 if $test -z "$cryptlib"; then
1544 cryptlib=`loc Mlibcrypt.a "" $xlibpth`
1548 if $test -z "$cryptlib"; then
1549 cryptlib=`loc Llibcrypt.a "" $xlibpth`
1553 if $test -z "$cryptlib"; then
1554 cryptlib=`loc libcrypt.a "" $libpth`
1558 if $test -z "$cryptlib"; then
1559 echo 'crypt() not found.'
1566 : get csh whereabouts
1568 'csh') d_csh="$undef" ;;
1569 *) d_csh="$define" ;;
1572 : see if this is a dirent system
1574 if $test -r /usr/include/dirent.h ; then
1576 echo "dirent.h found."
1577 if $contains 'd_namlen' /usr/include/sys/dirent.h >/dev/null 2>&1; then
1578 d_dirnamlen="$define"
1580 d_dirnamlen="$undef"
1584 if $contains 'd_namlen' /usr/include/sys/dir.h >/dev/null 2>&1; then
1585 d_dirnamlen="$define"
1587 d_dirnamlen="$undef"
1589 echo "No dirent.h found."
1592 : now see if they want to do setuid emulation
1600 Some sites have disabled setuid #! scripts because of a bug in the kernel
1601 that prevents them from being secure. If you are on such a system, the
1602 setuid/setgid bits on scripts are currently useless. It is possible for
1603 $package to detect those bits and emulate setuid/setgid in a secure fashion
1604 until a better solution is devised for the kernel problem.
1607 rp="Do you want to do setuid/setgid emulation? [$dflt]"
1614 y*) d_dosuid="$define";;
1615 *) d_dosuid="$undef";;
1618 : see if dup2 exists
1622 : see if fchmod exists
1626 : see if fchown exists
1630 : see if this is an fcntl system
1632 if $test -r /usr/include/fcntl.h ; then
1634 echo "fcntl.h found."
1637 echo "No fcntl.h found, but that's ok."
1640 : see if flock exists
1644 : see if getgroups exists
1645 set getgroups d_getgrps
1648 : see if gethostent exists
1649 set gethostent d_gethent
1652 : see if getpgrp exists
1653 set getpgrp d_getpgrp
1656 : see if getpgrp2 exists
1657 set getpgrp2 d_getpgrp2
1660 : see if getpriority exists
1661 set getpriority d_getprior
1664 : see if htonl exists
1674 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
1675 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1676 echo "Your system has both index() and strchr(). Shall I use"
1677 rp="index() rather than strchr()? [$dflt]"
1681 n*) d_index="$define" ;;
1682 *) d_index="$undef" ;;
1686 echo "index() found."
1689 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1691 echo "strchr() found."
1693 echo "No index() or strchr() found!"
1698 : see if ioctl defs are in sgtty/termio or sys/ioctl
1700 if $test -r /usr/include/sys/ioctl.h ; then
1702 echo "sys/ioctl.h found."
1705 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
1708 : see if killpg exists
1712 : see if lstat exists
1716 : see if memcmp exists
1720 : see if memcpy exists
1724 : see if mkdir exists
1728 : see if ndbm is available
1730 xxx=`loc ndbm.h x /usr/include /usr/local/include $inclwanted`
1731 if test -f $xxx; then
1733 echo "ndbm.h found."
1736 echo "ndbm.h not found."
1739 : see if we have the old dbm
1741 xxx=`loc dbm.h x /usr/include /usr/local/include $inclwanted`
1742 if test -f $xxx; then
1747 echo "dbm.h not found."
1750 : see if this is a pwd system
1752 if $test -r /usr/include/pwd.h ; then
1755 $cppstdin $cppflags </usr/include/pwd.h >$$.h
1756 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
1761 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
1766 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
1767 d_pwchange="$define"
1771 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
1776 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
1777 d_pwexpire="$define"
1789 echo "No pwd.h found."
1792 : see if readdir exists
1793 set readdir d_readdir
1796 : see if rename exists
1800 : see if rmdir exists
1804 : see if setegid exists
1805 set setegid d_setegid
1808 : see if seteuid exists
1809 set seteuid d_seteuid
1812 : see if setpgrp exists
1813 set setpgrp d_setpgrp
1816 : see if setpgrp2 exists
1817 set setpgrp2 d_setpgrp2
1820 : see if setpriority exists
1821 set setpriority d_setprior
1824 : see if setregid exists
1825 set setregid d_setregid
1827 set setresgid d_setresgid
1830 : see if setreuid exists
1831 set setreuid d_setreuid
1833 set setresuid d_setresuid
1836 : see if setrgid exists
1837 set setrgid d_setrgid
1840 : see if setruid exists
1841 set setruid d_setruid
1845 : see whether socket exists
1847 if $contains socket libc.list >/dev/null 2>&1; then
1848 echo "Looks like you have Berkeley networking support."
1850 : now check for advanced features
1851 if $contains setsockopt libc.list >/dev/null 2>&1; then
1854 echo "...but it uses the old 4.1c interface, rather than 4.2"
1858 : hpux, for one, puts all the socket stuff in socklib.o
1859 if $contains socklib libc.list >/dev/null 2>&1; then
1860 echo "Looks like you have Berkeley networking support."
1862 : we will have to assume that it supports the 4.2 BSD interface
1865 echo "Hmmm...you don't have Berkeley networking in libc.a..."
1866 : look for an optional networking library
1867 if test -f /usr/lib/libnet.a; then
1868 (ar t /usr/lib/libnet.a ||
1869 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
1870 if $contains socket libc.list >/dev/null 2>&1; then
1871 echo "but the Wollongong group seems to have hacked it in."
1874 : now check for advanced features
1875 if $contains setsockopt libc.list >/dev/null 2>&1; then
1878 echo "...using the old 4.1c interface, rather than 4.2"
1882 echo "or even in libnet.a, which is peculiar."
1887 echo "or anywhere else I see."
1893 if $contains socketpair libc.list >/dev/null 2>&1; then
1894 d_sockpair="$define"
1899 : see if stat knows about block sizes
1901 if $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1902 if $contains 'st_blksize;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1903 echo "Your stat knows about block sizes."
1904 d_statblks="$define"
1906 echo "Your stat doesn't know about block sizes."
1910 echo "Your stat doesn't know about block sizes."
1914 : see if stdio is really std
1916 if $contains 'char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1917 if $contains '_cnt;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1918 echo "Your stdio is pretty std."
1919 d_stdstdio="$define"
1921 echo "Your stdio isn't very std."
1925 echo "Your stdio isn't very std."
1929 : check for structure copying
1931 echo "Checking to see if your C compiler can copy structs..."
1932 $cat >try.c <<'EOCP'
1942 if $cc -c try.c >/dev/null 2>&1 ; then
1943 d_strctcpy="$define"
1947 echo "Nope, it can't."
1951 : see if strerror exists
1952 set strerror d_strerror
1955 : see if symlink exists
1956 set symlink d_symlink
1959 : see if syscall exists
1960 set syscall d_syscall
1963 : see if we should include time.h, sys/time.h, or both
1966 Testing to see if we should include <time.h>, <sys/time.h> or both.
1967 I'm now running the test program...
1969 $cat >try.c <<'EOCP'
1974 #ifdef SYSTIMEKERNEL
1977 #include <sys/time.h>
1985 if (foo.tm_sec == foo.tm_sec)
1988 if (bar.tv_sec == bar.tv_sec)
1995 for s_timeval in '-DS_TIMEVAL' ''; do
1996 for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
1997 for i_time in '' '-DI_TIME'; do
1998 for i_systime in '-DI_SYSTIME' ''; do
2000 '') echo Trying $i_time $i_systime $d_systimekernel $s_timeval
2001 if $cc try.c $ccflags \
2002 $i_time $i_systime $d_systimekernel $s_timeval \
2003 -o try >/dev/null 2>&1 ; then
2004 set X $i_time $i_systime $d_systimekernel $s_timeval
2007 echo Succeeded with $flags
2016 *SYSTIMEKERNEL*) d_systimekernel="$define";;
2017 *) d_systimekernel="$undef";;
2020 *I_TIME*) i_time="$define";;
2021 *) i_time="$undef";;
2024 *I_SYSTIME*) i_systime="$define";;
2025 *) i_systime="$undef";;
2029 : see if this is a varargs system
2031 if $test -r /usr/include/varargs.h ; then
2033 echo "varargs.h found."
2036 echo "No varargs.h found, but that's ok (I hope)."
2039 : see if there is a vfork
2043 : see if signal is declared as pointer to function returning int or void
2045 $cppstdin $cppflags < /usr/include/signal.h >$$.tmp
2046 if $contains 'void.*signal' $$.tmp >/dev/null 2>&1 ; then
2047 echo "You have void (*signal())() instead of int."
2050 echo "You have int (*signal())() instead of void."
2055 : see if there is a wait4
2059 : check for void type
2062 Checking to see how well your C compiler groks the void type...
2064 Support flag bits are:
2065 1: basic void declarations.
2066 2: arrays of pointers to functions returning void.
2067 4: operations between pointers to and addresses of void functions.
2070 case "$voidflags" in
2072 $cat >try.c <<'EOCP'
2078 extern void moo(); /* function returning void */
2079 void (*goo)(); /* ptr to func returning void */
2092 if $cc -S -DTRY=$defvoidused try.c >.out 2>&1 ; then
2093 voidflags=$defvoidused
2094 echo "It appears to support void."
2095 if $contains warning .out >/dev/null 2>&1; then
2096 echo "However, you might get some warnings that look like this:"
2100 echo "Hmm, your compiler has some difficulty with void. Checking further..."
2101 if $cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
2102 echo "It supports 1..."
2103 if $cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
2105 echo "And it supports 2 but not 4."
2107 echo "It doesn't support 2..."
2108 if $cc -S -DTRY=5 try.c >/dev/null 2>&1 ; then
2110 echo "But it supports 4."
2113 echo "And it doesn't support 4."
2117 echo "There is no support at all for void."
2123 rp="Your void support flags add up to what? [$dflt]"
2129 : see what type gids are declared as in the kernel
2133 if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2135 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2137 elif $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
2140 set `grep 'groups\[NGROUPS\];' /usr/include/sys/user.h 2>/dev/null` unsigned short
2142 unsigned) dflt="$1 $2" ;;
2151 echo "(The following only matters if you have getgroups().)"
2152 rp="What type are the group ids returned by getgroups()? [$dflt]"
2157 : see if this is an fcntl system
2159 if $test -r /usr/include/fcntl.h ; then
2161 echo "fcntl.h found."
2164 echo "No fcntl.h found, but that's ok."
2167 : see if this is an grp system
2169 if $test -r /usr/include/grp.h ; then
2174 echo "No grp.h found."
2177 : see if this is a netinet/in.h system
2179 xxx=`loc netinet/in.h x /usr/include /usr/local/include $inclwanted`
2180 if test -f $xxx; then
2182 echo "netinet/in.h found."
2185 echo "No netinet/in.h found."
2188 : see if this is a sys/dir.h system
2190 if $test -r /usr/include/sys/dir.h ; then
2192 echo "sys/dir.h found."
2195 echo "No sys/dir.h found."
2198 : see if ioctl defs are in sgtty/termio or sys/ioctl
2200 if $test -r /usr/include/sys/ioctl.h ; then
2201 i_sysioctl="$define"
2202 echo "sys/ioctl.h found."
2205 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
2208 : see if this is a sys/ndir.h system
2210 xxx=`loc sys/ndir.h x /usr/include /usr/local/include $inclwanted`
2211 if test -f $xxx; then
2213 echo "sys/ndir.h found."
2216 echo "No sys/ndir.h found."
2219 : see if this is DG/UX with a funky utime.h
2221 if $test -r /usr/include/utime.h ; then
2223 echo "utime.h found."
2226 echo "No utime.h found, but that's ok."
2229 : see if this is a varargs system
2231 if $test -r /usr/include/varargs.h ; then
2233 echo "varargs.h found."
2236 echo "No varargs.h found, but that's ok (I hope)."
2239 : see if this is a vfork system
2241 if $test -r /usr/include/vfork.h ; then
2243 echo "vfork.h found."
2246 echo "No vfork.h found."
2249 : check for length of integer
2253 echo "Checking to see how big your integers are..."
2254 $cat >try.c <<'EOCP'
2258 printf("%d\n", sizeof(int));
2261 if $cc try.c -o try >/dev/null 2>&1 ; then
2265 echo "(I can't seem to compile the test program. Guessing...)"
2272 rp="What is the size of an integer (in bytes)? [$dflt]"
2278 : determine where private executables go
2281 dflt=/usr/lib/$package
2282 test -d /usr/local/lib && dflt=/usr/local/lib/$package
2289 The $package package has some auxiliary files that should be put in a library
2290 that is accessible by everyone. Where do you want to put these "private"
2292 $echo $n "but accessible files? [$dflt] $c"
2293 rp="Put private files where? [$dflt]"
2297 : check for size of random number generator
2301 echo "Checking to see how many bits your rand function produces..."
2302 $cat >try.c <<'EOCP'
2307 register unsigned long tmp;
2308 register unsigned long max = 0L;
2310 for (i=1000; i; i--) {
2311 tmp = (unsigned long)rand();
2312 if (tmp > max) max = tmp;
2319 if $cc try.c -o try >/dev/null 2>&1 ; then
2323 echo "(I can't seem to compile the test program...)"
2330 rp="How many bits does your rand() function produce? [$dflt]"
2336 : generate list of signal names
2340 echo "Generating a list of signal names..."
2341 set X `cat /usr/include/signal.h /usr/include/sys/signal.h 2>&1 | awk '
2342 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
2343 sig[$3] = substr($2,4,20)
2344 if (max < $3 && $3 < 60) {
2350 for (i=1; i<=max; i++) {
2363 0) echo 'kill -l' >/tmp/foo$$
2364 set X `$csh -f </tmp/foo$$`
2367 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
2375 echo "Signals are: $sig_name"
2377 : see what type of char stdio uses.
2379 if $contains 'unsigned.*char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
2380 echo "Your stdio uses unsigned chars."
2381 stdchar="unsigned char"
2383 echo "Your stdio uses signed chars."
2387 : see what type uids are declared as in the kernel
2390 if $contains 'uid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
2393 set `grep '_ruid;' /usr/include/sys/user.h 2>/dev/null` unsigned short
2395 unsigned) dflt="$1 $2" ;;
2405 rp="What type are user ids returned by getuid(), etc.? [$dflt]"
2410 : preserve RCS keywords in files with variable substitution, grrr
2415 : determine which malloc to compile in
2417 case "$usemymalloc" in
2425 *) dflt="$usemymalloc"
2428 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
2436 y*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
2437 *) mallocsrc=''; mallocobj='';;
2440 : determine compiler compiler
2447 rp="Which compiler compiler (yacc or bison) will you use? [$dflt]"
2456 echo "End of configuration questions."
2459 : create config.sh file
2461 if test -d ../UU; then
2464 echo "Creating config.sh..."
2465 $spitshell <<EOT >config.sh
2468 # This file was produced by running the Configure script.
2470 d_eunice='$d_eunice'
2472 eunicefix='$eunicefix'
2502 sendmail='$sendmail'
2527 byteorder='$byteorder'
2528 contains='$contains'
2529 cppstdin='$cppstdin'
2530 cppminus='$cppminus'
2534 d_charsprf='$d_charsprf'
2536 cryptlib='$cryptlib'
2538 d_dosuid='$d_dosuid'
2540 d_fchmod='$d_fchmod'
2541 d_fchown='$d_fchown'
2544 d_getgrps='$d_getgrps'
2545 d_gethent='$d_gethent'
2546 d_getpgrp='$d_getpgrp'
2547 d_getpgrp2='$d_getpgrp2'
2548 d_getprior='$d_getprior'
2552 d_killpg='$d_killpg'
2554 d_memcmp='$d_memcmp'
2555 d_memcpy='$d_memcpy'
2559 d_readdir='$d_readdir'
2560 d_rename='$d_rename'
2562 d_setegid='$d_setegid'
2563 d_seteuid='$d_seteuid'
2564 d_setpgrp='$d_setpgrp'
2565 d_setpgrp2='$d_setpgrp2'
2566 d_setprior='$d_setprior'
2567 d_setregid='$d_setregid'
2568 d_setresgid='$d_setresgid'
2569 d_setreuid='$d_setreuid'
2570 d_setresuid='$d_setresuid'
2571 d_setrgid='$d_setrgid'
2572 d_setruid='$d_setruid'
2573 d_socket='$d_socket'
2574 d_sockpair='$d_sockpair'
2575 d_oldsock='$d_oldsock'
2576 socketlib='$socketlib'
2577 d_statblks='$d_statblks'
2578 d_stdstdio='$d_stdstdio'
2579 d_strctcpy='$d_strctcpy'
2580 d_strerror='$d_strerror'
2581 d_symlink='$d_symlink'
2582 d_syscall='$d_syscall'
2583 d_varargs='$d_varargs'
2585 d_voidsig='$d_voidsig'
2586 d_vprintf='$d_vprintf'
2587 d_charvspr='$d_charvspr'
2590 i_dirent='$i_dirent'
2591 d_dirnamlen='$d_dirnamlen'
2596 d_pwquota='$d_pwquota'
2598 d_pwchange='$d_pwchange'
2599 d_pwclass='$d_pwclass'
2600 d_pwexpire='$d_pwexpire'
2601 i_sysdir='$i_sysdir'
2602 i_sysioctl='$i_sysioctl'
2603 i_sysndir='$i_sysndir'
2605 i_systime='$i_systime'
2606 d_systimekernel='$d_systimekernel'
2608 i_varargs='$i_varargs'
2612 mallocsrc='$mallocsrc'
2613 mallocobj='$mallocobj'
2614 usemymalloc='$usemymalloc'
2623 optimize='$optimize'
2625 cppflags='$cppflags'
2632 randbits='$randbits'
2633 sig_name='$sig_name'
2634 spitshell='$spitshell'
2636 sharpbang='$sharpbang'
2640 voidflags='$voidflags'
2641 defvoidused='$defvoidused'
2653 echo "If you didn't make any mistakes, then just type a carriage return here."
2654 rp="If you need to edit config.sh, do it as a shell escape here:"
2659 *) : in case they cannot read
2662 : if this fails, just run all the .SH files by hand
2666 echo "Doing variable substitutions on .SH files..."
2667 set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
2670 0) set x *.SH; shift;;
2672 if test ! -f $1; then
2678 dir=`$expr X$file : 'X\(.*\)/'`
2679 file=`$expr X$file : 'X.*/\(.*\)'`
2680 (cd $dir && . $file)
2687 if test -f config.h.SH; then
2688 if test ! -f config.h; then
2689 : oops, they left it out of MANIFEST, probably, so do it anyway.
2694 if $contains '^depend:' Makefile >/dev/null 2>&1; then
2698 Now you need to generate make dependencies by running "make depend".
2699 You might prefer to run it in background: "make depend > makedepend.out &"
2700 It can take a while, so you might not want to run it right now.
2703 rp="Run make depend now? [$dflt]"
2707 y*) make depend && echo "Now you must run a make."
2709 *) echo "You must run 'make depend' then 'make'."
2712 elif test -f Makefile; then
2714 echo "Now you must run a make."
2720 : the following is currently useless
2721 cd UU && $rm -f $rmlist
2722 : since this removes it all anyway