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.6 90/03/12 16:10:23 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';;
222 echo "Beginning of configuration questions for $package kit."
223 : Eunice requires " " instead of "", can you believe it
228 : change the next line if compiling for Xenix/286 on Xenix/386
229 xlibpth='/usr/lib/386 /lib/386'
230 libpth='/usr/lib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
231 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
232 rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
233 trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
235 : We must find out about Eunice early
237 if test -f /etc/unixtovms; then
238 eunicefix=/etc/unixtovms
240 if test -f /etc/unixtovms.exe; then
241 eunicefix=/etc/unixtovms.exe
244 : Now test for existence of everything in MANIFEST
246 echo "First let's make sure your kit is complete. Checking..."
247 (cd ..; awk '' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$)
250 attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
251 attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
252 attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
253 attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
254 attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
255 attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
256 attrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__"
257 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"
258 d_newshome="/usr/NeWS"
260 libswanted="net_s net nsl_s nsl socket nm ndir ndbm dbm sun bsd BSD x c_s"
261 inclwanted='/usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan'
262 : some greps do not return status, grrr.
263 echo "grimblepritz" >grimble
264 if grep blurfldyick grimble >/dev/null 2>&1 ; then
266 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
272 : the following should work in any shell
276 echo "AGH! Grep doesn't return a status. Attempting remedial action."
277 cat >contains <<'EOSS'
278 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
283 : see if sh knows # comments
285 echo "Checking your sh to see if it knows about # comments..."
286 if sh -c '#' >/dev/null 2>&1 ; then
287 echo "Your sh handles # comments correctly."
291 echo "Okay, let's see if #! works on this system..."
292 echo "#!/bin/echo hi" > try
296 if $contains hi today >/dev/null 2>&1; then
300 echo "#! /bin/echo hi" > try
304 if test -s today; then
313 echo "Your sh doesn't grok # comments--I will strip them later on."
315 echo "exec grep -v '^#'" >spitshell
318 spitshell=`pwd`/spitshell
319 echo "I presume that if # doesn't work, #! won't work either!"
323 : figure out how to guarantee sh startup
325 echo "Checking out how to guarantee sh startup..."
326 startsh=$sharpbang'/bin/sh'
327 echo "Let's see if '$startsh' works..."
339 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
343 : first determine how to suppress newline on echo command
344 echo "Checking echo to see how to suppress newlines..."
345 (echo "hi there\c" ; echo " ") >.echotmp
346 if $contains c .echotmp >/dev/null 2>&1 ; then
357 echo $n "Type carriage return to continue. Your cursor should be here-->$c"
361 : now set up to do reads with possible shell escape and default assignment
364 yes) ans=''; echo " " ;;
367 while expr "X\$ans" : "X!" >/dev/null; do
376 set \`expr "X\$ans" : "X!\(.*\)\$"\`
389 : general instructions
392 This installation shell script will examine your system and ask you questions
393 to determine how the $package package should be installed. If you get stuck
394 on a question, you may use a ! shell escape to start a subshell or execute
395 a command. Many of the questions will have default answers in square
396 brackets--typing carriage return will give you the default.
398 On some of the questions which ask for file or directory names you are
399 allowed to use the ~name construct to specify the login directory belonging
400 to "name", even if you don't have a shell which knows about that. Questions
401 where this is allowed will be marked "(~name ok)".
404 rp="[Type carriage return to continue]"
409 Much effort has been expended to ensure that this shell script will run
410 on any Unix system. If despite that it blows up on you, your best bet is
411 to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
412 know how I blew it. If you can't run Configure for some reason, you'll have
413 to generate a config.sh file by hand.
415 This installation script affects things in two ways: 1) it may do direct
416 variable substitutions on some of the files included in this kit, and
417 2) it builds a config.h file for inclusion in C programs. You may edit
418 any of these files as the need arises after running this script.
420 If you make a mistake on a question, there is no easy way to back up to it
421 currently. The easiest thing to do is to edit config.sh and rerun all the
422 SH files. Configure will offer to let you do this before it runs the SH files.
425 rp="[Type carriage return to continue]"
429 : get old answers, if there is a config file out there
430 if test -f ../config.sh; then
433 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
437 n*) echo "OK, I'll ignore it.";;
438 *) echo "Fetching default answers from your old config.sh file..."
448 : find out where common programs are
450 echo "Locating common programs..."
463 if test -d \$dir/\$thing; then
469 if test -f \$dir/\$thing; then
472 elif test -f \$dir/\$thing.exe; then
473 : on Eunice apparently
506 for file in $loclist; do
507 xxx=`loc $file $file $pth`
512 echo $file is in $xxx.
515 echo "I don't know where $file is. I hope it's in everyone's PATH."
520 echo "Don't worry if any of the following aren't found..."
522 for file in $trylist; do
523 xxx=`loc $file $file $pth`
528 echo $file is in $xxx.
531 echo "I don't see $file out there, $ans."
538 echo "Substituting grep for egrep."
544 echo "Hopefully test is built into your sh."
547 if sh -c "PATH= test true" >/dev/null 2>&1; then
548 echo "Using the test built into your sh."
558 echo "Hopefully echo is built into your sh."
562 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
563 $echo $n "hi there$c" >foo1
564 echo $n "hi there$c" >foo2
565 if cmp foo1 foo2 >/dev/null 2>&1; then
566 echo "They are compatible. In fact, they may be identical."
569 '-n') n='' c='\c' ans='\c' ;;
570 *) n='-n' c='' ans='-n' ;;
573 They are not compatible! You are probably running ksh on a non-USG system.
574 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
575 have echo built in and we may have to run some Bourne shell scripts. That
576 means I'll have to use $ans to suppress newlines now. Life is ridiculous.
579 rp="Your cursor should be here-->"
592 : set up shell script to do ~ expansion
598 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
601 if $test -f /bin/csh; then
602 /bin/csh -f -c "glob \$1"
605 name=\`$expr x\$1 : '..\([^/]*\)'\`
606 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
607 if $test ! -d "\$dir"; then
609 echo "\$me: can't locate home directory for: \$name" >&2
614 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
630 : determine where public executables go
633 dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
639 while $test "$cont" ; do
641 rp="Where do you want to put the public executables? (~name ok) [$dflt]"
645 bin=`./filexp "$bin"`
646 if test -d $bin; then
653 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
663 : determine where manual pages go
666 $package has manual pages that need to be installed in source form.
670 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`
676 while $test "$cont" ; do
678 rp="Where do the manual pages (source) go? (~name ok) [$dflt]"
681 mansrc=`./filexp "$ans"`
682 if $test -d "$mansrc"; then
685 if $test "$fastread" = yes; then
690 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
723 : make some quick guesses about what we are up against
726 cat /usr/include/signal.h /usr/include/sys/signal.h >foo
727 if test `echo abc | tr a-z A-Z` = Abc ; then
728 echo "Looks kind of like a USG system, but we'll see..."
732 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
733 echo "Looks kind of like a BSD system, but we'll see..."
738 echo "Looks kind of like a version 7 system, but we'll see..."
746 There is, however, a strange, musty smell in the air that reminds me of
747 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
749 echo "exit 0" >eunice
754 echo "Congratulations. You aren't running Eunice."
756 echo "exit 1" >eunice
759 if test -f /xenix; then
760 echo "Actually, this looks more like a XENIX system..."
764 echo "It's not Xenix..."
769 if test -f /venix; then
770 echo "Actually, this looks more like a VENIX system..."
777 echo "Nor is it Venix..."
781 chmod +x bsd usg v7 eunice venix
782 $eunicefix bsd usg v7 eunice venix
784 rmlist="$rmlist bsd usg v7 eunice venix xenix"
786 : see what memory models we can support
789 : We may not use Cppsym or we get a circular dependency through cc.
790 : But this should work regardless of which cc we eventually use.
800 cc -o pdp11 pdp11.c >/dev/null 2>&1
801 if pdp11 2>/dev/null; then
804 ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
807 *) if $test -d /lib/small || $test -d /usr/lib/small; then
812 if $test -d /lib/medium || $test -d /usr/lib/medium; then
815 if $test -d /lib/large || $test -d /usr/lib/large; then
818 if $test -d /lib/huge || $test -d /usr/lib/huge; then
828 Some systems have different model sizes. On most systems they are called
829 small, medium, large, and huge. On the PDP11 they are called unsplit and
830 split. If your system doesn't support different memory models, say "none".
831 If you wish to force everything to one memory model, say "none" here and
832 put the appropriate flags later when it asks you for other cc and ld flags.
833 Venix systems may wish to put "none" and let the compiler figure things out.
834 (In the following question multiple model names should be space separated.)
837 rp="Which models are supported? [$dflt]"
854 if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
855 $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
863 rp="What flag indicates separate I and D space? [$dflt]"
872 *large*|*small*|*medium*|*huge*)
879 rp="What flag indicates large model? [$dflt]"
895 rp="What flag indicates huge model? [$dflt]"
911 rp="What flag indicates medium model? [$dflt]"
927 rp="What flag indicates small model? [$dflt]"
939 echo "Unrecognized memory models--you may have to edit Makefile.SH"
943 : see if we need a special compiler
957 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
971 On some systems the default C compiler will not resolve multiple global
972 references that happen to have the same name. On some such systems the
973 "Mcc" command may be used to force these to be resolved. On other systems
974 a "cc -M" command is required. (Note that the -M flag on other systems
975 indicates a memory model to use!) If you have the Gnu C compiler, you
976 might wish to use that instead. What command will force resolution on
978 $echo $n "this system? [$dflt] $c"
979 rp="Command to resolve multiple refs? [$dflt]"
987 rp="Use which C compiler? [$dflt]"
993 gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
996 : determine optimize, if desired, or use for debug flag also
1007 Some C compilers have problems with their optimizers, by default, $package
1008 compiles with the -O flag to use the optimizer. Alternately, you might
1009 want to use the symbolic debugger, which uses the -g flag (on traditional
1010 Unix systems). Either flag can be specified here. To use neither flag,
1011 specify the word "none".
1014 rp="What optimizer/debugger flag should be used? [$dflt]"
1019 'none') optimize=" "
1025 *gcc*) dflt='-fpcc-struct-return';;
1029 *) dflt="$ccflags";;
1031 for thisincl in $inclwanted; do
1032 if test -d $thisincl; then
1035 *) dflt="$dflt -I$thisincl";;
1043 *) dflt="$dflt -DDEBUGGING";;
1047 if $contains 'LANGUAGE_C' /usr/include/signal.h >/dev/null 2>&1; then
1050 *) dflt="$dflt -DLANGUAGE_C";;
1058 Your C compiler may want other flags. For this question you should
1059 include -I/whatever and -DWHATEVER flags and any other flags used by
1060 the C compiler, but you should NOT include libraries or ld flags like
1061 -lwhatever. To use no flags, specify the word "none".
1064 rp="Any additional cc flags? [$dflt]"
1072 : the following weeds options from ccflags that are of no interest to cpp
1075 *gcc*) cppflags="$cppflags -D__GNUC__";;
1083 -D*|-I*) cppflags="$cppflags $flag";;
1087 *-*) echo "(C preprocessor flags: $cppflags)";;
1099 *) dflt="$ldflags";;
1102 rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1109 rmlist="$rmlist pdp11"
1112 echo "Checking for optional libraries..."
1113 case "$libswanted" in
1114 '') libswanted='c_s';;
1116 for thislib in $libswanted; do
1120 *) thatlib="${thislib}_s";;
1123 xxx=`loc lib$thislib.a X /usr/lib /usr/local/lib /lib`
1124 if test -f $xxx; then
1125 echo "Found -l$thislib."
1127 *-l$thislib*|*-l$thatlib*);;
1128 *) dflt="$dflt -l$thislib";;
1131 xxx=`loc lib$thislib.a X $libpth`
1132 if test -f $xxx; then
1136 *) dflt="$dflt $xxx";;
1139 xxx=`loc Slib$thislib.a X $xlibpth`
1140 if test -f $xxx; then
1141 echo "Found -l$thislib."
1143 *-l$thislib*|*-l$thatlib*);;
1144 *) dflt="$dflt -l$thislib";;
1147 echo "No -l$thislib."
1164 Some versions of Unix support shared libraries, which make
1165 executables smaller but make load time slightly longer.
1167 On some systems, mostly newer Unix System V's, the shared library
1168 is included by putting the option "-lc_s" as the last thing on the
1169 cc command line when linking. Other systems use shared libraries
1170 by default. There may be other libraries needed to compile $package
1171 on your machine as well. If your system needs the "-lc_s" option,
1172 include it here. Include any other special libraries here as well.
1173 Say "none" for none.
1177 rp="Any additional libraries? [$dflt]"
1185 : check for ordering of bytes in a long
1186 case "$byteorder" in
1190 In the following, larger digits indicate more significance. A big-endian
1191 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
1192 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
1193 machines may have weird orders like 3412. A Cray will report 87654321. If
1194 the test program works the default is probably right.
1195 I'm now running the test program...
1197 $cat >try.c <<'EOCP'
1204 char c[sizeof(long)];
1207 if (sizeof(long) > 4)
1208 u.l = (0x08070605<<32) | 0x04030201;
1211 for (i=0; i < sizeof(long); i++)
1212 printf("%c",u.c[i]+'0');
1216 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
1219 ????|????????) echo "(The test program ran ok.)";;
1220 *) echo "(The test program didn't run right for some reason.)";;
1224 echo "(I can't seem to compile the test program. Guessing big-endian...)"
1232 rp="What is the order of bytes in a long? [$dflt]"
1238 : see how we invoke the C preprocessor
1240 echo "Now, how can we feed standard input to your C preprocessor..."
1241 cat <<'EOT' >testcpp.c
1246 echo 'Maybe "'"$cc"' -E" will work...'
1247 $cc -E <testcpp.c >testcpp.out 2>&1
1248 : try to force gcc preprocessor if that is the compiler they are using
1250 0) cppstdin="$cc -E";;
1254 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1255 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1257 cppstdin=`pwd`/cppstdin
1260 $cppstdin <testcpp.c >testcpp.out 2>&1
1265 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1266 echo "Yup, it does."
1270 echo 'Nope, maybe "'$cpp'" will work...'
1271 $cpp <testcpp.c >testcpp.out 2>&1
1272 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1273 echo "Yup, it does."
1277 echo 'No such luck...maybe "'$cpp' -" will work...'
1278 $cpp - <testcpp.c >testcpp.out 2>&1
1279 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1284 echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
1285 $cc -E - <testcpp.c >testcpp.out 2>&1
1286 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1287 echo "Hooray, it works! I was beginning to wonder."
1291 echo 'Nope...maybe "'"$cc"' -P" will work...'
1292 $cc -P <testcpp.c >testcpp.out 2>&1
1293 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1294 echo "Yup, that does."
1298 echo 'Nope...maybe "'"$cc"' -P -" will work...'
1299 $cc -P - <testcpp.c >testcpp.out 2>&1
1300 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1301 echo "Yup, that does."
1305 echo 'Hmm...perhaps you already told me...'
1308 *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
1310 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1311 echo "Hooray, you did! I was beginning to wonder."
1313 echo 'Uh-uh. Time to get fancy...'
1315 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1316 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1318 cppstdin=`pwd`/cppstdin
1321 $cppstdin <testcpp.c >testcpp.out 2>&1
1322 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1326 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
1327 rp='Name a C preprocessor:'
1330 $cppstdin <testcpp.c >testcpp.out 2>&1
1331 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1332 echo "OK, that will do."
1334 echo "Sorry, I can't get that to work. Go find one."
1345 rm -f testcpp.c testcpp.out
1347 : get list of predefined functions in a handy place
1353 '') libpth='/lib /usr/lib /usr/local/lib';;
1356 *-lc_s*) libc=`loc libc_s.a $libc $libpth`
1361 *) for thislib in $libs; do
1363 -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
1364 try=`loc lib$thislib.a blurfl/dyick $libpth`
1365 if test ! -f $try; then
1366 try=`loc lib$thislib blurfl/dyick $libpth`
1367 if test ! -f $try; then
1368 try=`loc $thislib blurfl/dyick $libpth`
1369 if test ! -f $try; then
1370 try=`loc Slib$thislib.a blurfl/dyick $xlibpth`
1371 if test ! -f $try; then
1377 libnames="$libnames $try"
1379 *) libnames="$libnames $thislib" ;;
1384 set /usr/lib/libc.so.[0-9]*
1386 if test -f "$1"; then
1387 echo "Your shared C library is in $1."
1389 elif test -f $libc; then
1390 echo "Your C library is in $libc, like you said before."
1391 elif test -f /lib/libc.a; then
1392 echo "Your C library is in /lib/libc.a. You're normal."
1395 ans=`loc libc.a blurfl/dyick $libpth`
1396 if test ! -f "$ans"; then
1397 ans=`loc libc blurfl/dyick $libpth`
1399 if test ! -f "$ans"; then
1400 ans=`loc clib blurfl/dyick $libpth`
1402 if test ! -f "$ans"; then
1403 ans=`loc Slibc.a blurfl/dyick $xlibpth`
1405 if test ! -f "$ans"; then
1406 ans=`loc Mlibc.a blurfl/dyick $xlibpth`
1408 if test ! -f "$ans"; then
1409 ans=`loc Llibc.a blurfl/dyick $xlibpth`
1411 if test -f "$ans"; then
1412 echo "Your C library is in $ans, of all places."
1417 I can't seem to find your C library. I've looked in the following places:
1421 None of these seems to contain your C library. What is the full name
1424 $echo $n "of your C library? $c"
1425 rp='C library full name?'
1431 set `echo $libc $libnames | tr ' ' '\012' | sort | uniq`
1432 $echo $n "Extracting names from $* for later perusal...$c"
1433 nm $* 2>/dev/null >libc.tmp
1434 $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
1435 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1438 $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
1439 $contains '^printf$' libc.list >/dev/null 2>&1 || \
1440 $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list
1441 $contains '^printf$' libc.list >/dev/null 2>&1 || \
1442 $sed -n -e 's/^_//' \
1443 -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
1444 $contains '^printf$' libc.list >/dev/null 2>&1 || \
1445 $sed -n -e 's/^.*|FUNC |GLOB .*|//p' <libc.tmp >libc.list
1446 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1450 echo "nm didn't seem to work right."
1451 echo "Trying ar instead..."
1452 if ar t $libc > libc.tmp; then
1453 for thisname in $libnames; do
1454 ar t $thisname >>libc.tmp
1456 $sed -e 's/\.o$//' < libc.tmp > libc.list
1459 echo "ar didn't seem to work right."
1460 echo "Maybe this is a Cray...trying bld instead..."
1461 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
1462 for thisname in $libnames; do
1464 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
1465 ar t $thisname >>libc.tmp
1469 echo "That didn't work either. Giving up."
1477 if $contains "^$1\$" libc.list >/dev/null 2>&1;
1478 then echo "$1() found"; eval "$2=$define";
1479 else echo "$1() not found"; eval "$2=$undef"; fi'
1481 rmlist="$rmlist libc.tmp libc.list"
1483 : see if bcmp exists
1487 : see if bcopy exists
1491 : see if bzero exists
1495 : see if sprintf is declared as int or pointer to char
1497 cat >.ucbsprf.c <<'EOF'
1498 main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
1500 if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1501 echo "Your sprintf() returns (int)."
1504 echo "Your sprintf() returns (char*)."
1505 d_charsprf="$define"
1507 /bin/rm -f .ucbsprf.c .ucbsprf
1509 : see if vprintf exists
1511 if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
1512 echo 'vprintf() found.'
1514 cat >.ucbsprf.c <<'EOF'
1516 #include <varargs.h>
1518 main() { xxx("foo"); }
1527 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
1530 if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1531 echo "Your vsprintf() returns (int)."
1534 echo "Your vsprintf() returns (char*)."
1535 d_charvspr="$define"
1537 /bin/rm -f .ucbsprf.c .ucbsprf
1539 echo 'vprintf() not found.'
1544 : see if crypt exists
1546 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
1547 echo 'crypt() found.'
1551 cryptlib=`loc Slibcrypt.a "" $xlibpth`
1552 if $test -z "$cryptlib"; then
1553 cryptlib=`loc Mlibcrypt.a "" $xlibpth`
1557 if $test -z "$cryptlib"; then
1558 cryptlib=`loc Llibcrypt.a "" $xlibpth`
1562 if $test -z "$cryptlib"; then
1563 cryptlib=`loc libcrypt.a "" $libpth`
1567 if $test -z "$cryptlib"; then
1568 echo 'crypt() not found.'
1575 : get csh whereabouts
1577 'csh') d_csh="$undef" ;;
1578 *) d_csh="$define" ;;
1581 : see if this is a dirent system
1583 if $test -r /usr/include/dirent.h ; then
1585 echo "dirent.h found."
1586 if $contains 'd_namlen' /usr/include/sys/dirent.h >/dev/null 2>&1; then
1587 d_dirnamlen="$define"
1589 d_dirnamlen="$undef"
1593 if $contains 'd_namlen' /usr/include/sys/dir.h >/dev/null 2>&1; then
1594 d_dirnamlen="$define"
1596 d_dirnamlen="$undef"
1598 echo "No dirent.h found."
1601 : now see if they want to do setuid emulation
1609 Some sites have disabled setuid #! scripts because of a bug in the kernel
1610 that prevents them from being secure. If you are on such a system, the
1611 setuid/setgid bits on scripts are currently useless. It is possible for
1612 $package to detect those bits and emulate setuid/setgid in a secure fashion
1613 until a better solution is devised for the kernel problem.
1616 rp="Do you want to do setuid/setgid emulation? [$dflt]"
1623 y*) d_dosuid="$define";;
1624 *) d_dosuid="$undef";;
1627 : see if dup2 exists
1631 : see if fchmod exists
1635 : see if fchown exists
1639 : see if this is an fcntl system
1641 if $test -r /usr/include/fcntl.h ; then
1643 echo "fcntl.h found."
1646 echo "No fcntl.h found, but that's ok."
1649 : see if flock exists
1653 : see if getgroups exists
1654 set getgroups d_getgrps
1657 : see if gethostent exists
1658 set gethostent d_gethent
1661 : see if getpgrp exists
1662 set getpgrp d_getpgrp
1665 : see if getpgrp2 exists
1666 set getpgrp2 d_getpgrp2
1669 : see if getpriority exists
1670 set getpriority d_getprior
1673 : see if htonl exists
1683 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
1684 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1685 echo "Your system has both index() and strchr(). Shall I use"
1686 rp="index() rather than strchr()? [$dflt]"
1690 n*) d_index="$define" ;;
1691 *) d_index="$undef" ;;
1695 echo "index() found."
1698 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1700 echo "strchr() found."
1702 echo "No index() or strchr() found!"
1707 : see if ioctl defs are in sgtty/termio or sys/ioctl
1709 if $test -r /usr/include/sys/ioctl.h ; then
1711 echo "sys/ioctl.h found."
1714 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
1717 : see if killpg exists
1721 : see if lstat exists
1725 : see if memcmp exists
1729 : see if memcpy exists
1733 : see if mkdir exists
1737 : see if ndbm is available
1739 xxx=`loc ndbm.h x /usr/include /usr/local/include $inclwanted`
1740 if test -f $xxx; then
1742 echo "ndbm.h found."
1745 echo "ndbm.h not found."
1748 : see if we have the old dbm
1750 xxx=`loc dbm.h x /usr/include /usr/local/include $inclwanted`
1751 if test -f $xxx; then
1756 echo "dbm.h not found."
1759 : see if this is a pwd system
1761 if $test -r /usr/include/pwd.h ; then
1764 $cppstdin $cppflags </usr/include/pwd.h >$$.h
1765 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
1770 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
1775 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
1776 d_pwchange="$define"
1780 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
1785 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
1786 d_pwexpire="$define"
1798 echo "No pwd.h found."
1801 : see if readdir exists
1802 set readdir d_readdir
1805 : see if rename exists
1809 : see if rmdir exists
1813 : see if setegid exists
1814 set setegid d_setegid
1817 : see if seteuid exists
1818 set seteuid d_seteuid
1821 : see if setpgrp exists
1822 set setpgrp d_setpgrp
1825 : see if setpgrp2 exists
1826 set setpgrp2 d_setpgrp2
1829 : see if setpriority exists
1830 set setpriority d_setprior
1833 : see if setregid exists
1834 set setregid d_setregid
1836 set setresgid d_setresgid
1839 : see if setreuid exists
1840 set setreuid d_setreuid
1842 set setresuid d_setresuid
1845 : see if setrgid exists
1846 set setrgid d_setrgid
1849 : see if setruid exists
1850 set setruid d_setruid
1854 : see whether socket exists
1856 if $contains socket libc.list >/dev/null 2>&1; then
1857 echo "Looks like you have Berkeley networking support."
1859 : now check for advanced features
1860 if $contains setsockopt libc.list >/dev/null 2>&1; then
1863 echo "...but it uses the old 4.1c interface, rather than 4.2"
1867 : hpux, for one, puts all the socket stuff in socklib.o
1868 if $contains socklib libc.list >/dev/null 2>&1; then
1869 echo "Looks like you have Berkeley networking support."
1871 : we will have to assume that it supports the 4.2 BSD interface
1874 echo "Hmmm...you don't have Berkeley networking in libc.a..."
1875 : look for an optional networking library
1876 if test -f /usr/lib/libnet.a; then
1877 (ar t /usr/lib/libnet.a ||
1878 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
1879 if $contains socket libc.list >/dev/null 2>&1; then
1880 echo "but the Wollongong group seems to have hacked it in."
1883 : now check for advanced features
1884 if $contains setsockopt libc.list >/dev/null 2>&1; then
1887 echo "...using the old 4.1c interface, rather than 4.2"
1891 echo "or even in libnet.a, which is peculiar."
1896 echo "or anywhere else I see."
1902 if $contains socketpair libc.list >/dev/null 2>&1; then
1903 d_sockpair="$define"
1908 : see if stat knows about block sizes
1910 if $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1911 if $contains 'st_blksize;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1912 echo "Your stat knows about block sizes."
1913 d_statblks="$define"
1915 echo "Your stat doesn't know about block sizes."
1919 echo "Your stat doesn't know about block sizes."
1923 : see if stdio is really std
1925 if $contains 'char.*_ptr.*;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1926 if $contains '_cnt;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1927 echo "Your stdio is pretty std."
1928 d_stdstdio="$define"
1930 echo "Your stdio isn't very std."
1934 echo "Your stdio isn't very std."
1938 : check for structure copying
1940 echo "Checking to see if your C compiler can copy structs..."
1941 $cat >try.c <<'EOCP'
1951 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
1952 d_strctcpy="$define"
1956 echo "Nope, it can't."
1960 : see if strerror exists
1961 set strerror d_strerror
1964 : see if symlink exists
1965 set symlink d_symlink
1968 : see if syscall exists
1969 set syscall d_syscall
1972 : see if we should include time.h, sys/time.h, or both
1975 Testing to see if we should include <time.h>, <sys/time.h> or both.
1976 I'm now running the test program...
1978 $cat >try.c <<'EOCP'
1983 #ifdef SYSTIMEKERNEL
1986 #include <sys/time.h>
1994 if (foo.tm_sec == foo.tm_sec)
1997 if (bar.tv_sec == bar.tv_sec)
2004 for s_timeval in '-DS_TIMEVAL' ''; do
2005 for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
2006 for i_time in '' '-DI_TIME'; do
2007 for i_systime in '-DI_SYSTIME' ''; do
2009 '') echo Trying $i_time $i_systime $d_systimekernel $s_timeval
2011 $i_time $i_systime $d_systimekernel $s_timeval \
2012 try.c -o try >/dev/null 2>&1 ; then
2013 set X $i_time $i_systime $d_systimekernel $s_timeval
2016 echo Succeeded with $flags
2025 *SYSTIMEKERNEL*) d_systimekernel="$define";;
2026 *) d_systimekernel="$undef";;
2029 *I_TIME*) i_time="$define";;
2030 *) i_time="$undef";;
2033 *I_SYSTIME*) i_systime="$define";;
2034 *) i_systime="$undef";;
2038 : see if this is a varargs system
2040 if $test -r /usr/include/varargs.h ; then
2042 echo "varargs.h found."
2045 echo "No varargs.h found, but that's ok (I hope)."
2048 : see if there is a vfork
2052 : see if signal is declared as pointer to function returning int or void
2054 $cppstdin $cppflags < /usr/include/signal.h >$$.tmp
2055 if $contains 'void.*signal' $$.tmp >/dev/null 2>&1 ; then
2056 echo "You have void (*signal())() instead of int."
2059 echo "You have int (*signal())() instead of void."
2064 : check for volatile keyword
2066 echo 'Checking to see if your C compiler knows about "volatile"...'
2067 $cat >try.c <<'EOCP'
2075 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
2076 d_volatile="$define"
2077 echo "Yup, it does."
2080 echo "Nope, it doesn't."
2084 : see if there is a wait4
2088 : check for void type
2091 Checking to see how well your C compiler groks the void type...
2093 Support flag bits are:
2094 1: basic void declarations.
2095 2: arrays of pointers to functions returning void.
2096 4: operations between pointers to and addresses of void functions.
2099 case "$voidflags" in
2101 $cat >try.c <<'EOCP'
2107 extern void moo(); /* function returning void */
2108 void (*goo)(); /* ptr to func returning void */
2121 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
2122 voidflags=$defvoidused
2123 echo "It appears to support void."
2124 if $contains warning .out >/dev/null 2>&1; then
2125 echo "However, you might get some warnings that look like this:"
2129 echo "Hmm, your compiler has some difficulty with void. Checking further..."
2130 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1 ; then
2131 echo "It supports 1..."
2132 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1 ; then
2134 echo "And it supports 2 but not 4."
2136 echo "It doesn't support 2..."
2137 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1 ; then
2139 echo "But it supports 4."
2142 echo "And it doesn't support 4."
2146 echo "There is no support at all for void."
2152 rp="Your void support flags add up to what? [$dflt]"
2158 : see what type gids are declared as in the kernel
2162 if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2164 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2166 elif $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
2169 set `grep 'groups\[NGROUPS\];' /usr/include/sys/user.h 2>/dev/null` unsigned short
2171 unsigned) dflt="$1 $2" ;;
2180 echo "(The following only matters if you have getgroups().)"
2181 rp="What type are the group ids returned by getgroups()? [$dflt]"
2186 : see if this is an fcntl system
2188 if $test -r /usr/include/fcntl.h ; then
2190 echo "fcntl.h found."
2193 echo "No fcntl.h found, but that's ok."
2196 : see if this is an grp system
2198 if $test -r /usr/include/grp.h ; then
2203 echo "No grp.h found."
2206 : see if this is a netinet/in.h system
2208 xxx=`loc netinet/in.h x /usr/include /usr/local/include $inclwanted`
2209 if test -f $xxx; then
2211 echo "netinet/in.h found."
2214 echo "No netinet/in.h found."
2217 : see if this is a sys/dir.h system
2219 if $test -r /usr/include/sys/dir.h ; then
2221 echo "sys/dir.h found."
2224 echo "No sys/dir.h found."
2227 : see if ioctl defs are in sgtty/termio or sys/ioctl
2229 if $test -r /usr/include/sys/ioctl.h ; then
2230 i_sysioctl="$define"
2231 echo "sys/ioctl.h found."
2234 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
2237 : see if this is a sys/ndir.h system
2239 xxx=`loc sys/ndir.h x /usr/include /usr/local/include $inclwanted`
2240 if test -f $xxx; then
2242 echo "sys/ndir.h found."
2245 echo "No sys/ndir.h found."
2248 : see if we should include utime.h
2250 if $test -r /usr/include/utime.h ; then
2252 echo "utime.h found."
2255 echo "No utime.h found, but that's ok."
2258 : see if this is a varargs system
2260 if $test -r /usr/include/varargs.h ; then
2262 echo "varargs.h found."
2265 echo "No varargs.h found, but that's ok (I hope)."
2268 : see if this is a vfork system
2270 if $test -r /usr/include/vfork.h ; then
2272 echo "vfork.h found."
2275 echo "No vfork.h found."
2278 : check for length of integer
2282 echo "Checking to see how big your integers are..."
2283 $cat >try.c <<'EOCP'
2287 printf("%d\n", sizeof(int));
2290 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
2294 echo "(I can't seem to compile the test program. Guessing...)"
2301 rp="What is the size of an integer (in bytes)? [$dflt]"
2307 : determine where private executables go
2310 dflt=/usr/lib/$package
2311 test -d /usr/local/lib && dflt=/usr/local/lib/$package
2318 The $package package has some auxiliary files that should be put in a library
2319 that is accessible by everyone. Where do you want to put these "private"
2321 $echo $n "but accessible files? (~name ok) [$dflt] $c"
2322 rp="Put private files where? [$dflt]"
2324 privlib=`./filexp "$ans"`
2326 : check for size of random number generator
2330 echo "Checking to see how many bits your rand function produces..."
2331 $cat >try.c <<'EOCP'
2336 register unsigned long tmp;
2337 register unsigned long max = 0L;
2339 for (i=1000; i; i--) {
2340 tmp = (unsigned long)rand();
2341 if (tmp > max) max = tmp;
2348 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
2352 echo "(I can't seem to compile the test program...)"
2359 rp="How many bits does your rand() function produce? [$dflt]"
2365 : generate list of signal names
2369 echo "Generating a list of signal names..."
2370 set X `cat /usr/include/signal.h /usr/include/sys/signal.h 2>&1 | awk '
2371 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
2372 sig[$3] = substr($2,4,20)
2373 if (max < $3 && $3 < 60) {
2379 for (i=1; i<=max; i++) {
2392 0) echo 'kill -l' >/tmp/foo$$
2393 set X `$csh -f </tmp/foo$$`
2396 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
2404 echo "Signals are: $sig_name"
2406 : see what type of char stdio uses.
2408 if $contains 'unsigned.*char.*_ptr.*;' /usr/include/stdio.h >/dev/null 2>&1 ; then
2409 echo "Your stdio uses unsigned chars."
2410 stdchar="unsigned char"
2412 echo "Your stdio uses signed chars."
2416 : see what type uids are declared as in the kernel
2419 if $contains 'uid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
2422 set `grep '_ruid;' /usr/include/sys/user.h 2>/dev/null` unsigned short
2424 unsigned) dflt="$1 $2" ;;
2434 rp="What type are user ids returned by getuid(), etc.? [$dflt]"
2439 : preserve RCS keywords in files with variable substitution, grrr
2444 : determine which malloc to compile in
2446 case "$usemymalloc" in
2454 *) dflt="$usemymalloc"
2457 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
2465 y*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
2466 *) mallocsrc=''; mallocobj='';;
2469 : determine compiler compiler
2476 rp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]"
2485 echo "End of configuration questions."
2488 : create config.sh file
2490 if test -d ../UU; then
2493 echo "Creating config.sh..."
2494 $spitshell <<EOT >config.sh
2497 # This file was produced by running the Configure script.
2499 d_eunice='$d_eunice'
2501 eunicefix='$eunicefix'
2531 sendmail='$sendmail'
2556 byteorder='$byteorder'
2557 contains='$contains'
2558 cppstdin='$cppstdin'
2559 cppminus='$cppminus'
2563 d_charsprf='$d_charsprf'
2565 cryptlib='$cryptlib'
2567 d_dosuid='$d_dosuid'
2569 d_fchmod='$d_fchmod'
2570 d_fchown='$d_fchown'
2573 d_getgrps='$d_getgrps'
2574 d_gethent='$d_gethent'
2575 d_getpgrp='$d_getpgrp'
2576 d_getpgrp2='$d_getpgrp2'
2577 d_getprior='$d_getprior'
2581 d_killpg='$d_killpg'
2583 d_memcmp='$d_memcmp'
2584 d_memcpy='$d_memcpy'
2588 d_readdir='$d_readdir'
2589 d_rename='$d_rename'
2591 d_setegid='$d_setegid'
2592 d_seteuid='$d_seteuid'
2593 d_setpgrp='$d_setpgrp'
2594 d_setpgrp2='$d_setpgrp2'
2595 d_setprior='$d_setprior'
2596 d_setregid='$d_setregid'
2597 d_setresgid='$d_setresgid'
2598 d_setreuid='$d_setreuid'
2599 d_setresuid='$d_setresuid'
2600 d_setrgid='$d_setrgid'
2601 d_setruid='$d_setruid'
2602 d_socket='$d_socket'
2603 d_sockpair='$d_sockpair'
2604 d_oldsock='$d_oldsock'
2605 socketlib='$socketlib'
2606 d_statblks='$d_statblks'
2607 d_stdstdio='$d_stdstdio'
2608 d_strctcpy='$d_strctcpy'
2609 d_strerror='$d_strerror'
2610 d_symlink='$d_symlink'
2611 d_syscall='$d_syscall'
2612 d_varargs='$d_varargs'
2614 d_voidsig='$d_voidsig'
2615 d_volatile='$d_volatile'
2616 d_vprintf='$d_vprintf'
2617 d_charvspr='$d_charvspr'
2620 i_dirent='$i_dirent'
2621 d_dirnamlen='$d_dirnamlen'
2626 d_pwquota='$d_pwquota'
2628 d_pwchange='$d_pwchange'
2629 d_pwclass='$d_pwclass'
2630 d_pwexpire='$d_pwexpire'
2631 i_sysdir='$i_sysdir'
2632 i_sysioctl='$i_sysioctl'
2633 i_sysndir='$i_sysndir'
2635 i_systime='$i_systime'
2636 d_systimekernel='$d_systimekernel'
2638 i_varargs='$i_varargs'
2642 mallocsrc='$mallocsrc'
2643 mallocobj='$mallocobj'
2644 usemymalloc='$usemymalloc'
2653 optimize='$optimize'
2655 cppflags='$cppflags'
2662 randbits='$randbits'
2663 sig_name='$sig_name'
2664 spitshell='$spitshell'
2666 sharpbang='$sharpbang'
2670 voidflags='$voidflags'
2671 defvoidused='$defvoidused'
2683 echo "If you didn't make any mistakes, then just type a carriage return here."
2684 rp="If you need to edit config.sh, do it as a shell escape here:"
2689 *) : in case they cannot read
2692 : if this fails, just run all the .SH files by hand
2696 echo "Doing variable substitutions on .SH files..."
2697 set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
2700 0) set x *.SH; shift;;
2702 if test ! -f $1; then
2708 dir=`$expr X$file : 'X\(.*\)/'`
2709 file=`$expr X$file : 'X.*/\(.*\)'`
2710 (cd $dir && . $file)
2717 if test -f config.h.SH; then
2718 if test ! -f config.h; then
2719 : oops, they left it out of MANIFEST, probably, so do it anyway.
2724 if $contains '^depend:' Makefile >/dev/null 2>&1; then
2728 Now you need to generate make dependencies by running "make depend".
2729 You might prefer to run it in background: "make depend > makedepend.out &"
2730 It can take a while, so you might not want to run it right now.
2733 rp="Run make depend now? [$dflt]"
2737 y*) make depend && echo "Now you must run a make."
2739 *) echo "You must run 'make depend' then 'make'."
2742 elif test -f Makefile; then
2744 echo "Now you must run a make."
2750 : the following is currently useless
2751 cd UU && $rm -f $rmlist
2752 : since this removes it all anyway