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.2 89/11/11 04:05:37 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';;
214 echo "Beginning of configuration questions for $package kit."
215 : Eunice requires " " instead of "", can you believe it
220 libpth='/usr/lib /usr/local/lib /usr/lib/386 /usr/lib/large /lib /lib/386 /lib/large /usr/lib/small /lib/small'
221 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
222 rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
223 trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
225 : We must find out about Eunice early
227 if test -f /etc/unixtovms; then
228 eunicefix=/etc/unixtovms
230 if test -f /etc/unixtovms.exe; then
231 eunicefix=/etc/unixtovms.exe
234 : Now test for existence of everything in MANIFEST
236 echo "First let's make sure your kit is complete. Checking..."
237 (cd ..; awk '' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$)
240 attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
241 attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
242 attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
243 attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
244 attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
245 attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
246 attrlist="$attrlist i186"
247 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"
248 d_newshome="/usr/NeWS"
250 libswanted="net nm ndir ndbm dbm c_s"
252 : some greps do not return status, grrr.
253 echo "grimblepritz" >grimble
254 if grep blurfldyick grimble >/dev/null 2>&1 ; then
256 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
262 : the following should work in any shell
266 echo "AGH! Grep doesn't return a status. Attempting remedial action."
267 cat >contains <<'EOSS'
268 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
273 : see if sh knows # comments
275 echo "Checking your sh to see if it knows about # comments..."
276 if sh -c '#' >/dev/null 2>&1 ; then
277 echo "Your sh handles # comments correctly."
281 echo "Okay, let's see if #! works on this system..."
282 echo "#!/bin/echo hi" > try
286 if $contains hi today >/dev/null 2>&1; then
290 echo "#! /bin/echo hi" > try
294 if test -s today; then
303 echo "Your sh doesn't grok # comments--I will strip them later on."
305 echo "exec grep -v '^#'" >spitshell
308 spitshell=`pwd`/spitshell
309 echo "I presume that if # doesn't work, #! won't work either!"
313 : figure out how to guarantee sh startup
315 echo "Checking out how to guarantee sh startup..."
316 startsh=$sharpbang'/bin/sh'
317 echo "Let's see if '$startsh' works..."
329 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
333 : first determine how to suppress newline on echo command
334 echo "Checking echo to see how to suppress newlines..."
335 (echo "hi there\c" ; echo " ") >.echotmp
336 if $contains c .echotmp >/dev/null 2>&1 ; then
347 echo $n "Type carriage return to continue. Your cursor should be here-->$c"
351 : now set up to do reads with possible shell escape and default assignment
354 yes) ans=''; echo " " ;;
357 while expr "X\$ans" : "X!" >/dev/null; do
366 set \`expr "X\$ans" : "X!\(.*\)\$"\`
379 : general instructions
382 This installation shell script will examine your system and ask you questions
383 to determine how the $package package should be installed. If you get stuck
384 on a question, you may use a ! shell escape to start a subshell or execute
385 a command. Many of the questions will have default answers in square
386 brackets--typing carriage return will give you the default.
388 On some of the questions which ask for file or directory names you are
389 allowed to use the ~name construct to specify the login directory belonging
390 to "name", even if you don't have a shell which knows about that. Questions
391 where this is allowed will be marked "(~name ok)".
394 rp="[Type carriage return to continue]"
399 Much effort has been expended to ensure that this shell script will run
400 on any Unix system. If despite that it blows up on you, your best bet is
401 to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
402 know how I blew it. If you can't run Configure for some reason, you'll have
403 to generate a config.sh file by hand.
405 This installation script affects things in two ways: 1) it may do direct
406 variable substitutions on some of the files included in this kit, and
407 2) it builds a config.h file for inclusion in C programs. You may edit
408 any of these files as the need arises after running this script.
410 If you make a mistake on a question, there is no easy way to back up to it
411 currently. The easiest thing to do is to edit config.sh and rerun all the
412 SH files. Configure will offer to let you do this before it runs the SH files.
415 rp="[Type carriage return to continue]"
419 : get old answers, if there is a config file out there
420 if test -f ../config.sh; then
423 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
427 n*) echo "OK, I'll ignore it.";;
428 *) echo "Fetching default answers from your old config.sh file..."
438 : find out where common programs are
440 echo "Locating common programs..."
453 if test -d \$dir/\$thing; then
459 if test -f \$dir/\$thing; then
462 elif test -f \$dir/\$thing.exe; then
463 : on Eunice apparently
496 for file in $loclist; do
497 xxx=`loc $file $file $pth`
502 echo $file is in $xxx.
505 echo "I don't know where $file is. I hope it's in everyone's PATH."
510 echo "Don't worry if any of the following aren't found..."
512 for file in $trylist; do
513 xxx=`loc $file $file $pth`
518 echo $file is in $xxx.
521 echo "I don't see $file out there, $ans."
528 echo "Substituting grep for egrep."
534 echo "Hopefully test is built into your sh."
537 if sh -c "PATH= test true" >/dev/null 2>&1; then
538 echo "Using the test built into your sh."
548 echo "Hopefully echo is built into your sh."
552 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
553 $echo $n "hi there$c" >foo1
554 echo $n "hi there$c" >foo2
555 if cmp foo1 foo2 >/dev/null 2>&1; then
556 echo "They are compatible. In fact, they may be identical."
559 '-n') n='' c='\c' ans='\c' ;;
560 *) n='-n' c='' ans='-n' ;;
563 They are not compatible! You are probably running ksh on a non-USG system.
564 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
565 have echo built in and we may have to run some Bourne shell scripts. That
566 means I'll have to use $ans to suppress newlines now. Life is ridiculous.
569 rp="Your cursor should be here-->"
582 : set up shell script to do ~ expansion
588 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
591 if $test -f /bin/csh; then
592 /bin/csh -f -c "glob \$1"
595 name=\`$expr x\$1 : '..\([^/]*\)'\`
596 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
597 if $test ! -d "\$dir"; then
599 echo "\$me: can't locate home directory for: \$name" >&2
604 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
620 : determine where public executables go
623 dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
629 while $test "$cont" ; do
631 rp="Where do you want to put the public executables? [$dflt]"
636 if test -d $bin; then
643 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
653 : determine where manual pages go
656 $package has manual pages that need to be installed in source form.
660 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`
666 while $test "$cont" ; do
668 rp="Where do the manual pages (source) go? [$dflt]"
671 mansrc=`filexp "$ans"`
672 if $test -d "$mansrc"; then
675 if $test "$fastread" = yes; then
680 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
713 : make some quick guesses about what we are up against
716 cat /usr/include/signal.h /usr/include/sys/signal.h >foo
717 if test `echo abc | tr a-z A-Z` = Abc ; then
718 echo "Looks kind of like a USG system, but we'll see..."
722 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
723 echo "Looks kind of like a BSD system, but we'll see..."
728 echo "Looks kind of like a version 7 system, but we'll see..."
736 There is, however, a strange, musty smell in the air that reminds me of
737 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
739 echo "exit 0" >eunice
744 echo "Congratulations. You aren't running Eunice."
746 echo "exit 1" >eunice
749 if test -f /xenix; then
750 echo "Actually, this looks more like a XENIX system..."
754 echo "It's not Xenix..."
759 if test -f /venix; then
760 echo "Actually, this looks more like a VENIX system..."
767 echo "Nor is it Venix..."
771 chmod +x bsd usg v7 eunice venix
772 $eunicefix bsd usg v7 eunice venix
774 rmlist="$rmlist bsd usg v7 eunice venix xenix"
776 : see what memory models we can support
779 : We may not use Cppsym or we get a circular dependency through cc.
780 : But this should work regardless of which cc we eventually use.
790 cc -o pdp11 pdp11.c >/dev/null 2>&1
791 if pdp11 2>/dev/null; then
794 ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
797 *) if $test -d /lib/small || $test -d /usr/lib/small; then
802 if $test -d /lib/medium || $test -d /usr/lib/medium; then
805 if $test -d /lib/large || $test -d /usr/lib/large; then
808 if $test -d /lib/huge || $test -d /usr/lib/huge; then
818 Some systems have different model sizes. On most systems they are called
819 small, medium, large, and huge. On the PDP11 they are called unsplit and
820 split. If your system doesn't support different memory models, say "none".
821 If you wish to force everything to one memory model, say "none" here and
822 put the appropriate flags later when it asks you for other cc and ld flags.
823 Venix systems may wish to put "none" and let the compiler figure things out.
824 (In the following question multiple model names should be space separated.)
827 rp="Which models are supported? [$dflt]"
844 if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
845 $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
853 rp="What flag indicates separate I and D space? [$dflt]"
862 *large*|*small*|*medium*|*huge*)
869 rp="What flag indicates large model? [$dflt]"
885 rp="What flag indicates huge model? [$dflt]"
901 rp="What flag indicates medium model? [$dflt]"
917 rp="What flag indicates small model? [$dflt]"
929 echo "Unrecognized memory models--you may have to edit Makefile.SH"
933 : see if we need a special compiler
947 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
961 On some systems the default C compiler will not resolve multiple global
962 references that happen to have the same name. On some such systems the
963 "Mcc" command may be used to force these to be resolved. On other systems
964 a "cc -M" command is required. (Note that the -M flag on other systems
965 indicates a memory model to use!) If you have the Gnu C compiler, you
966 might wish to use that instead. What command will force resolution on
968 $echo $n "this system? [$dflt] $c"
969 rp="Command to resolve multiple refs? [$dflt]"
977 rp="Use which C compiler? [$dflt]"
983 gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
986 : determine optimize, if desired, or use for debug flag also
997 Some C compilers have problems with their optimizers, by default, $package
998 compiles with the -O flag to use the optimizer. Alternately, you might
999 want to use the symbolic debugger, which uses the -g flag (on traditional
1000 Unix systems). Either flag can be specified here. To use neither flag,
1001 specify the word "none".
1004 rp="What optimizer/debugger flag should be used? [$dflt]"
1009 'none') optimize=" "
1015 *gcc*) dflt='-fpcc-struct-return';;
1019 *) dflt="$ccflags";;
1021 if test -d /usr/netinclude; then
1024 *) dflt="$dflt -I/usr/netinclude";;
1031 *) dflt="$dflt -DDEBUGGING";;
1037 Your C compiler may want other flags. For this question you should
1038 include -I/whatever and -DWHATEVER flags and any other flags used by
1039 the C compiler, but you should NOT include libraries or ld flags like
1040 -lwhatever. To use no flags, specify the word "none".
1043 rp="Any additional cc flags? [$dflt]"
1051 : the following weeds options from ccflags that are of no interest to cpp
1054 *gcc*) cppflags="$cppflags -D__GNUC__";;
1062 -D*|-I*) cppflags="$cppflags $flag";;
1066 *-*) echo "(C preprocessor flags: $cppflags)";;
1078 *) dflt="$ldflags";;
1081 rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1088 rmlist="$rmlist pdp11"
1091 echo "Checking for optional libraries..."
1096 case "$libswanted" in
1097 '') libswanted='c_s';;
1099 for thislib in $libswanted; do
1100 if xxx=`loc lib$thislib.a X /usr/lib /usr/local/lib /lib`; then
1101 echo "Found -l$thislib."
1104 *) dflt="$dflt -l$thislib";;
1106 elif xxx=`loc lib$thislib.a X $libpth`; then
1110 *) dflt="$dflt $xxx";;
1113 echo "No -l$thislib."
1125 Some versions of Unix support shared libraries, which make
1126 executables smaller but make load time slightly longer.
1128 On some systems, mostly newer Unix System V's, the shared library
1129 is included by putting the option "-lc_s" as the last thing on the
1130 cc command line when linking. Other systems use shared libraries
1131 by default. There may be other libraries needed to compile $package
1132 on your machine as well. If your system needs the "-lc_s" option,
1133 include it here. Include any other special libraries here as well.
1137 rp="Any additional libraries? [$dflt]"
1145 : check for ordering of bytes in a long
1146 case "$byteorder" in
1150 In the following, larger digits indicate more significance. A big-endian
1151 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
1152 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
1153 machines may have weird orders like 3412. A Cray will report 87654321. If
1154 the test program works the default is probably right.
1155 I'm now running the test program...
1157 $cat >try.c <<'EOCP'
1167 u.l = 0x0807060504030201;
1168 for (i=0; i < sizeof(long); i++)
1169 printf("%c",u.c[i]+'0');
1173 if $cc try.c -o try >/dev/null 2>&1 ; then
1176 ????|????????) echo "(The test program ran ok.)";;
1177 *) echo "(The test program didn't run right for some reason.)";;
1181 echo "(I can't seem to compile the test program. Guessing big-endian...)"
1189 rp="What is the order of bytes in a long? [$dflt]"
1195 : see how we invoke the C preprocessor
1197 echo "Now, how can we feed standard input to your C preprocessor..."
1198 cat <<'EOT' >testcpp.c
1203 echo 'Maybe "'"$cc"' -E" will work...'
1204 $cc -E <testcpp.c >testcpp.out 2>&1
1205 : try to force gcc preprocessor if that is the compiler they are using
1207 0) cppstdin="$cc -E";;
1211 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1212 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1214 cppstdin=`pwd`/cppstdin
1217 $cppstdin <testcpp.c >testcpp.out 2>&1
1222 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1223 echo "Yup, it does."
1227 echo 'Nope, maybe "'$cpp'" will work...'
1228 $cpp <testcpp.c >testcpp.out 2>&1
1229 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1230 echo "Yup, it does."
1234 echo 'No such luck...maybe "'$cpp' -" will work...'
1235 $cpp - <testcpp.c >testcpp.out 2>&1
1236 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1241 echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
1242 $cc -E - <testcpp.c >testcpp.out 2>&1
1243 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1244 echo "Hooray, it works! I was beginning to wonder."
1248 echo 'Nope...maybe "'"$cc"' -P" will work...'
1249 $cc -P <testcpp.c >testcpp.out 2>&1
1250 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1251 echo "Yup, that does."
1255 echo 'Nope...maybe "'"$cc"' -P -" will work...'
1256 $cc -P - <testcpp.c >testcpp.out 2>&1
1257 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1258 echo "Yup, that does."
1262 echo 'Hmm...perhaps you already told me...'
1265 *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
1267 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1268 echo "Hooray, you did! I was beginning to wonder."
1270 echo 'Uh-uh. Time to get fancy...'
1272 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1273 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1275 cppstdin=`pwd`/cppstdin
1278 $cppstdin <testcpp.c >testcpp.out 2>&1
1279 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1283 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
1284 rp='Name a C preprocessor:'
1287 $cppstdin <testcpp.c >testcpp.out 2>&1
1288 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1289 echo "OK, that will do."
1291 echo "Sorry, I can't get that to work. Go find one."
1302 rm -f testcpp.c testcpp.out
1304 : get list of predefined functions in a handy place
1310 '') libpth='/lib /usr/lib /usr/local/lib';;
1313 *-lc_s*) libc=`loc libc_s.a $libc $libpth`
1318 *) for thislib in $libs; do
1320 -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
1321 try=`loc lib$thislib.a blurfl/dyick $libpth`
1322 if test ! -f $try; then
1323 try=`loc lib$thislib blurfl/dyick $libpth`
1324 if test ! -f $try; then
1325 try=`loc $thislib blurfl/dyick $libpth`
1326 if test ! -f $try; then
1331 libnames="$libnames $try"
1333 *) libnames="$libnames $thisname" ;;
1338 set /usr/lib/libc.so.[0-9]*
1340 if test -f "$1"; then
1341 echo "Your shared C library is in $1."
1343 elif test -f $libc; then
1344 echo "Your C library is in $libc, like you said before."
1345 elif test -f /lib/libc.a; then
1346 echo "Your C library is in /lib/libc.a. You're normal."
1349 ans=`loc libc.a blurfl/dyick $libpth`
1350 if test ! -f "$ans"; then
1351 ans=`loc libc blurfl/dyick $libpth`
1353 if test ! -f "$ans"; then
1354 ans=`loc clib blurfl/dyick $libpth`
1356 if test ! -f "$ans"; then
1357 ans=`loc Slibc.a blurfl/dyick /usr/lib/386 /lib/386 $libpth`
1359 if test ! -f "$ans"; then
1360 ans=`loc Mlibc.a blurfl/dyick $libpth`
1362 if test ! -f "$ans"; then
1363 ans=`loc Llibc.a blurfl/dyick $libpth`
1365 if test -f "$ans"; then
1366 echo "Your C library is in $ans, of all places."
1371 I can't seem to find your C library. I've looked in the following places:
1375 None of these seems to contain your C library. What is the full name
1378 $echo $n "of your C library? $c"
1379 rp='C library full name?'
1386 $echo $n "Extracting names from $* for later perusal...$c"
1387 nm $* 2>/dev/null >libc.tmp
1388 $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
1389 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1392 $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
1393 $contains '^printf$' libc.list >/dev/null 2>&1 || \
1394 $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list
1395 $contains '^printf$' libc.list >/dev/null 2>&1 || \
1396 $sed -n -e 's/^_//' \
1397 -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
1398 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1402 echo "nm didn't seem to work right."
1403 echo "Trying ar instead..."
1404 if ar t $libc > libc.tmp; then
1405 for thisname in $libnames; do
1406 ar t $thisname >>libc.tmp
1408 $sed -e 's/\.o$//' < libc.tmp > libc.list
1411 echo "ar didn't seem to work right."
1412 echo "Maybe this is a Cray...trying bld instead..."
1413 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
1414 for thisname in $libnames; do
1416 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
1417 ar t $thisname >>libc.tmp
1421 echo "That didn't work either. Giving up."
1429 if $contains "^$1\$" libc.list >/dev/null 2>&1;
1430 then echo "$1() found"; eval "$2=$define";
1431 else echo "$1() not found"; eval "$2=$undef"; fi'
1433 rmlist="$rmlist libc.tmp libc.list"
1435 : see if bcmp exists
1439 : see if bcopy exists
1443 : see if sprintf is declared as int or pointer to char
1445 cat >.ucbsprf.c <<'EOF'
1446 main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
1448 if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1449 echo "Your sprintf() returns (int)."
1452 echo "Your sprintf() returns (char*)."
1453 d_charsprf="$define"
1455 /bin/rm -f .ucbsprf.c .ucbsprf
1457 : see if vprintf exists
1459 if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
1460 echo 'vprintf() found.'
1462 cat >.ucbsprf.c <<'EOF'
1463 #include <varargs.h>
1465 main() { xxx("foo"); }
1474 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
1477 if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1478 echo "Your vsprintf() returns (int)."
1481 echo "Your vsprintf() returns (char*)."
1482 d_charvspr="$define"
1484 /bin/rm -f .ucbsprf.c .ucbsprf
1486 echo 'vprintf() not found.'
1491 : see if crypt exists
1493 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
1494 echo 'crypt() found.'
1498 cryptlib=`loc Slibcrypt.a "" /lib/386 /lib`
1499 if $test -z "$cryptlib"; then
1500 cryptlib=`loc Mlibcrypt.a "" /lib/386 /lib`
1504 if $test -z "$cryptlib"; then
1505 cryptlib=`loc Llibcrypt.a "" /lib/386 /lib`
1509 if $test -z "$cryptlib"; then
1510 cryptlib=`loc libcrypt.a "" $libpth`
1514 if $test -z "$cryptlib"; then
1515 echo 'crypt() not found.'
1522 : get csh whereabouts
1524 'csh') d_csh="$undef" ;;
1525 *) d_csh="$define" ;;
1528 : see if this is a dirent system
1530 if $test -r /usr/include/dirent.h ; then
1532 echo "dirent.h found."
1533 if $contains 'd_namlen' /usr/include/sys/dirent.h >/dev/null 2>&1; then
1534 d_dirnamlen="$define"
1536 d_dirnamlen="$undef"
1540 d_dirnamlen="$define"
1541 echo "No dirent.h found."
1544 : now see if they want to do setuid emulation
1552 Some sites have disabled setuid #! scripts because of a bug in the kernel
1553 that prevents them from being secure. If you are on such a system, the
1554 setuid/setgid bits on scripts are currently useless. It is possible for
1555 $package to detect those bits and emulate setuid/setgid in a secure fashion
1556 until a better solution is devised for the kernel problem.
1559 rp="Do you want to do setuid/setgid emulation? [$dflt]"
1566 y*) d_dosuid="$define";;
1567 *) d_dosuid="$undef";;
1570 : see if dup2 exists
1574 : see if fchmod exists
1578 : see if fchown exists
1582 : see if this is an fcntl system
1584 if $test -r /usr/include/fcntl.h ; then
1586 echo "fcntl.h found."
1589 echo "No fcntl.h found, but that's ok."
1592 : see if flock exists
1596 : see if getgroups exists
1597 set getgroups d_getgrps
1600 : see if gethostent exists
1601 set gethostent d_gethent
1604 : see if getpgrp exists
1605 set getpgrp d_getpgrp
1608 : see if getpriority exists
1609 set getpriority d_getprior
1612 : see if htonl exists
1622 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
1623 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1624 echo "Your system has both index() and strchr(). Shall I use"
1625 rp="index() rather than strchr()? [$dflt]"
1629 n*) d_index="$define" ;;
1630 *) d_index="$undef" ;;
1634 echo "index() found."
1637 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1639 echo "strchr() found."
1641 echo "No index() or strchr() found!"
1646 : see if ioctl defs are in sgtty/termio or sys/ioctl
1648 if $test -r /usr/include/sys/ioctl.h ; then
1650 echo "sys/ioctl.h found."
1653 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
1656 : see if killpg exists
1660 : see if memcmp exists
1664 : see if memcpy exists
1668 : see if mkdir exists
1672 : see if ndbm is available
1674 if xxx=`loc ndbm.h x /usr/include /usr/local/include /usr/netinclude`; then
1676 echo "ndbm.h found."
1679 echo "ndbm.h not found."
1682 : see if we have the old dbm
1684 if xxx=`loc dbm.h x /usr/include /usr/local/include /usr/netinclude`; then
1689 echo "dbm.h not found."
1692 : see if this is a pwd system
1694 if $test -r /usr/include/pwd.h ; then
1697 $cppstdin $cppflags </usr/include/pwd.h >$$.h
1698 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
1703 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
1708 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
1709 d_pwchange="$define"
1713 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
1718 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
1719 d_pwexpire="$define"
1731 echo "No pwd.h found."
1734 : see if readdir exists
1735 set readdir d_readdir
1738 : see if rename exists
1742 : see if rmdir exists
1746 : see if setegid exists
1747 set setegid d_setegid
1750 : see if seteuid exists
1751 set seteuid d_seteuid
1754 : see if setpgrp exists
1755 set setpgrp d_setpgrp
1758 : see if setpriority exists
1759 set setpriority d_setprior
1762 : see if setregid exists
1763 set setregid d_setregid
1765 set setresgid d_setresgid
1768 : see if setreuid exists
1769 set setreuid d_setreuid
1771 set setresuid d_setresuid
1774 : see if setrgid exists
1775 set setrgid d_setrgid
1778 : see if setruid exists
1779 set setruid d_setruid
1783 : see whether socket exists
1785 if $contains socket libc.list >/dev/null 2>&1; then
1786 echo "Looks like you have Berkeley networking support."
1788 : now check for advanced features
1789 if $contains setsockopt libc.list >/dev/null 2>&1; then
1792 echo "...but it uses the old 4.1c interface, rather than 4.2"
1796 : hpux, for one, puts all the socket stuff in socklib.o
1797 if $contains socklib libc.list >/dev/null 2>&1; then
1798 echo "Looks like you have Berkeley networking support."
1800 : we will have to assume that it supports the 4.2 BSD interface
1803 echo "Hmmm...you don't have Berkeley networking in libc.a..."
1804 : look for an optional networking library
1805 if test -f /usr/lib/libnet.a; then
1806 (ar t /usr/lib/libnet.a ||
1807 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
1808 if $contains socket libc.list >/dev/null 2>&1; then
1809 echo "but the Wollongong group seems to have hacked it in."
1812 : now check for advanced features
1813 if $contains setsockopt libc.list >/dev/null 2>&1; then
1816 echo "...using the old 4.1c interface, rather than 4.2"
1820 echo "or even in libnet.a, which is peculiar."
1825 echo "or anywhere else I see."
1831 if $contains socketpair libc.list >/dev/null 2>&1; then
1832 d_sockpair="$define"
1837 : see if stat knows about block sizes
1839 if $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1840 if $contains 'st_blksize;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1841 echo "Your stat knows about block sizes."
1842 d_statblks="$define"
1844 echo "Your stat doesn't know about block sizes."
1848 echo "Your stat doesn't know about block sizes."
1852 : see if stdio is really std
1854 if $contains 'char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1855 if $contains '_cnt;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1856 echo "Your stdio is pretty std."
1857 d_stdstdio="$define"
1859 echo "Your stdio isn't very std."
1863 echo "Your stdio isn't very std."
1867 : check for structure copying
1869 echo "Checking to see if your C compiler can copy structs..."
1870 $cat >try.c <<'EOCP'
1880 if $cc -c try.c >/dev/null 2>&1 ; then
1881 d_strctcpy="$define"
1885 echo "Nope, it can't."
1889 : see if symlink exists
1890 set symlink d_symlink
1893 : see if syscall exists
1894 set syscall d_syscall
1897 : see if struct tm is defined in sys/time.h
1899 if $contains 'struct tm' /usr/include/time.h >/dev/null 2>&1 ; then
1900 echo "You have struct tm defined in <time.h> rather than <sys/time.h>."
1902 if test -f /usr/include/sys/time.h; then
1908 echo "You have struct tm defined in <sys/time.h> rather than <time.h>."
1912 if $contains '^#.*include.*<time\.h>' /usr/include/sys/time.h >/dev/null 2>&1 ; then
1918 : see if this is a varargs system
1920 if $test -r /usr/include/varargs.h ; then
1922 echo "varargs.h found."
1925 echo "No varargs.h found, but that's ok (I hope)."
1928 : see if there is a vfork
1932 : see if signal is declared as pointer to function returning int or void
1934 if $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 ; then
1935 echo "You have void (*signal())() instead of int."
1938 echo "You have int (*signal())() instead of void."
1942 : see if there is a wait4
1946 : check for void type
1949 Checking to see how well your C compiler groks the void type...
1951 Support flag bits are:
1952 1: basic void declarations.
1953 2: arrays of pointers to functions returning void.
1954 4: operations between pointers to and addresses of void functions.
1957 case "$voidflags" in
1959 $cat >try.c <<'EOCP'
1965 extern void moo(); /* function returning void */
1966 void (*goo)(); /* ptr to func returning void */
1979 if $cc -S -DTRY=$defvoidused try.c >.out 2>&1 ; then
1980 voidflags=$defvoidused
1981 echo "It appears to support void."
1982 if $contains warning .out >/dev/null 2>&1; then
1983 echo "However, you might get some warnings that look like this:"
1987 echo "Hmm, your compiler has some difficulty with void. Checking further..."
1988 if $cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
1989 echo "It supports 1..."
1990 if $cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
1992 echo "And it supports 2 but not 4."
1994 echo "It doesn't support 2..."
1995 if $cc -S -DTRY=5 try.c >/dev/null 2>&1 ; then
1997 echo "But it supports 4."
2000 echo "And it doesn't support 4."
2004 echo "There is no support at all for void."
2010 rp="Your void support flags add up to what? [$dflt]"
2016 : see what type gids are declared as in the kernel
2019 if $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
2022 set `grep 'groups\[NGROUPS\];' /usr/include/sys/user.h 2>/dev/null` unsigned short
2024 unsigned) dflt="$1 $2" ;;
2034 echo "(The following only matters if you have getgroups().)"
2035 rp="What type are the group ids returned by getgroups()? [$dflt]"
2040 : see if this is an fcntl system
2042 if $test -r /usr/include/fcntl.h ; then
2044 echo "fcntl.h found."
2047 echo "No fcntl.h found, but that's ok."
2050 : see if this is an grp system
2052 if $test -r /usr/include/grp.h ; then
2057 echo "No grp.h found."
2060 : see if this is a netinet/in.h system
2062 if xxx=`loc netinet/in.h x /usr/include /usr/local/include /usr/netinclude`; then
2064 echo "netinet/in.h found."
2067 echo "No netinet/in.h found."
2070 : see if this is a sys/dir.h system
2072 if $test -r /usr/include/sys/dir.h ; then
2074 echo "sysdir.h found."
2077 echo "No sysdir.h found."
2080 : see if ioctl defs are in sgtty/termio or sys/ioctl
2082 if $test -r /usr/include/sys/ioctl.h ; then
2083 i_sysioctl="$define"
2084 echo "sys/ioctl.h found."
2087 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
2090 : see if this is a varargs system
2092 if $test -r /usr/include/varargs.h ; then
2094 echo "varargs.h found."
2097 echo "No varargs.h found, but that's ok (I hope)."
2100 : see if this is a vfork system
2102 if $test -r /usr/include/vfork.h ; then
2104 echo "vfork.h found."
2107 echo "No vfork.h found."
2110 : check for length of integer
2114 echo "Checking to see how big your integers are..."
2115 $cat >try.c <<'EOCP'
2119 printf("%d\n", sizeof(int));
2122 if $cc try.c -o try >/dev/null 2>&1 ; then
2126 echo "(I can't seem to compile the test program. Guessing...)"
2133 rp="What is the size of an integer (in bytes)? [$dflt]"
2139 : determine where private executables go
2142 dflt=/usr/lib/$package
2143 test -d /usr/local/lib && dflt=/usr/local/lib/$package
2150 The $package package has some auxiliary files that should be put in a library
2151 that is accessible by everyone. Where do you want to put these "private"
2153 $echo $n "but accessible files? [$dflt] $c"
2154 rp="Put private files where? [$dflt]"
2158 : check for size of random number generator
2162 echo "Checking to see how many bits your rand function produces..."
2163 $cat >try.c <<'EOCP'
2168 register unsigned long tmp;
2169 register unsigned long max = 0L;
2171 for (i=1000; i; i--) {
2172 tmp = (unsigned long)rand();
2173 if (tmp > max) max = tmp;
2180 if $cc try.c -o try >/dev/null 2>&1 ; then
2184 echo "(I can't seem to compile the test program...)"
2191 rp="How many bits does your rand() function produce? [$dflt]"
2197 : generate list of signal names
2201 echo "Generating a list of signal names..."
2202 set X `cat /usr/include/signal.h /usr/include/sys/signal.h 2>&1 | awk '
2203 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
2204 sig[$3] = substr($2,4,20)
2205 if (max < $3 && $3 < 60) {
2211 for (i=1; i<=max; i++) {
2224 0) echo 'kill -l' >/tmp/foo$$
2225 set X `$csh -f </tmp/foo$$`
2228 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
2236 echo "Signals are: $sig_name"
2238 : see what type of char stdio uses.
2240 if $contains 'unsigned.*char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
2241 echo "Your stdio uses unsigned chars."
2242 stdchar="unsigned char"
2244 echo "Your stdio uses signed chars."
2248 : see what type uids are declared as in the kernel
2251 if $contains 'uid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
2254 set `grep '_ruid;' /usr/include/sys/user.h 2>/dev/null` unsigned short
2256 unsigned) dflt="$1 $2" ;;
2266 rp="What type are user ids returned by getuid(), etc.? [$dflt]"
2271 : preserve RCS keywords in files with variable substitution, grrr
2276 : see if we should include -lnm
2278 if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
2279 echo "New math library found."
2282 ans=`loc libnm.a x $libpth`
2285 echo "No nm library found--the normal math library will have to do."
2289 echo "New math library found in $ans."
2295 : determine which malloc to compile in
2297 case "$usemymalloc" in
2305 *) dflt="$usemymalloc"
2308 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
2316 y*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
2317 *) mallocsrc=''; mallocobj='';;
2321 echo "End of configuration questions."
2324 : create config.sh file
2326 if test -d ../UU; then
2329 echo "Creating config.sh..."
2330 $spitshell <<EOT >config.sh
2333 # This file was produced by running the Configure script.
2335 d_eunice='$d_eunice'
2337 eunicefix='$eunicefix'
2367 sendmail='$sendmail'
2392 byteorder='$byteorder'
2393 contains='$contains'
2394 cppstdin='$cppstdin'
2395 cppminus='$cppminus'
2398 d_charsprf='$d_charsprf'
2400 cryptlib='$cryptlib'
2402 d_dosuid='$d_dosuid'
2404 d_fchmod='$d_fchmod'
2405 d_fchown='$d_fchown'
2408 d_getgrps='$d_getgrps'
2409 d_gethent='$d_gethent'
2410 d_getpgrp='$d_getpgrp'
2411 d_getprior='$d_getprior'
2415 d_killpg='$d_killpg'
2416 d_memcmp='$d_memcmp'
2417 d_memcpy='$d_memcpy'
2421 d_readdir='$d_readdir'
2422 d_rename='$d_rename'
2424 d_setegid='$d_setegid'
2425 d_seteuid='$d_seteuid'
2426 d_setpgrp='$d_setpgrp'
2427 d_setprior='$d_setprior'
2428 d_setregid='$d_setregid'
2429 d_setresgid='$d_setresgid'
2430 d_setreuid='$d_setreuid'
2431 d_setresuid='$d_setresuid'
2432 d_setrgid='$d_setrgid'
2433 d_setruid='$d_setruid'
2434 d_socket='$d_socket'
2435 d_sockpair='$d_sockpair'
2436 d_oldsock='$d_oldsock'
2437 socketlib='$socketlib'
2438 d_statblks='$d_statblks'
2439 d_stdstdio='$d_stdstdio'
2440 d_strctcpy='$d_strctcpy'
2441 d_symlink='$d_symlink'
2442 d_syscall='$d_syscall'
2443 d_tminsys='$d_tminsys'
2444 i_systime='$i_systime'
2445 i_timetoo='$i_timetoo'
2446 d_varargs='$d_varargs'
2448 d_voidsig='$d_voidsig'
2449 d_vprintf='$d_vprintf'
2450 d_charvspr='$d_charvspr'
2453 i_dirent='$i_dirent'
2454 d_dirnamlen='$d_dirnamlen'
2459 d_pwquota='$d_pwquota'
2461 d_pwchange='$d_pwchange'
2462 d_pwclass='$d_pwclass'
2463 d_pwexpire='$d_pwexpire'
2464 i_sysdir='$i_sysdir'
2465 i_sysioctl='$i_sysioctl'
2466 i_varargs='$i_varargs'
2471 mallocsrc='$mallocsrc'
2472 mallocobj='$mallocobj'
2473 usemymalloc='$usemymalloc'
2482 optimize='$optimize'
2484 cppflags='$cppflags'
2491 randbits='$randbits'
2492 sig_name='$sig_name'
2493 spitshell='$spitshell'
2495 sharpbang='$sharpbang'
2499 voidflags='$voidflags'
2500 defvoidused='$defvoidused'
2511 echo "If you didn't make any mistakes, then just type a carriage return here."
2512 rp="If you need to edit config.sh, do it as a shell escape here:"
2517 *) : in case they cannot read
2523 echo "Doing variable substitutions on .SH files..."
2524 set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
2527 0) set x *.SH; shift;;
2529 if test ! -f $1; then
2535 dir=`$expr X$file : 'X\(.*\)/'`
2536 file=`$expr X$file : 'X.*/\(.*\)'`
2537 (cd $dir && . $file)
2544 if test -f config.h.SH; then
2545 if test ! -f config.h; then
2546 : oops, they left it out of MANIFEST, probably, so do it anyway.
2551 if $contains '^depend:' Makefile >/dev/null 2>&1; then
2555 Now you need to generate make dependencies by running "make depend".
2556 You might prefer to run it in background: "make depend > makedepend.out &"
2557 It can take a while, so you might not want to run it right now.
2560 rp="Run make depend now? [$dflt]"
2564 y*) make depend && echo "Now you must run a make."
2566 *) echo "You must run 'make depend' then 'make'."
2569 elif test -f Makefile; then
2571 echo "Now you must run a make."
2577 : the following is currently useless
2578 cd UU && $rm -f $rmlist
2579 : since this removes it all anyway