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.1 89/10/26 22:58:02 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';;
209 echo "Beginning of configuration questions for $package kit."
210 : Eunice requires " " instead of "", can you believe it
215 libpth='/usr/lib /usr/local/lib /usr/lib/386 /usr/lib/large /lib /lib/386 /lib/large /usr/lib/small /lib/small'
216 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
217 rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
218 trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
220 : We must find out about Eunice early
222 if test -f /etc/unixtovms; then
223 eunicefix=/etc/unixtovms
225 if test -f /etc/unixtovms.exe; then
226 eunicefix=/etc/unixtovms.exe
229 : Now test for existence of everything in MANIFEST
231 echo "First let's make sure your kit is complete. Checking..."
232 (cd ..; awk '' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$)
235 attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
236 attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
237 attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
238 attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
239 attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
240 attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
241 attrlist="$attrlist i186"
242 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"
243 d_newshome="/usr/NeWS"
246 : some greps do not return status, grrr.
247 echo "grimblepritz" >grimble
248 if grep blurfldyick grimble >/dev/null 2>&1 ; then
250 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
256 : the following should work in any shell
260 echo "AGH! Grep doesn't return a status. Attempting remedial action."
261 cat >contains <<'EOSS'
262 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
267 : first determine how to suppress newline on echo command
268 echo "Checking echo to see how to suppress newlines..."
269 (echo "hi there\c" ; echo " ") >.echotmp
270 if $contains c .echotmp >/dev/null 2>&1 ; then
281 echo $n "Type carriage return to continue. Your cursor should be here-->$c"
285 : now set up to do reads with possible shell escape and default assignment
288 yes) ans=''; echo " " ;;
291 while expr "X\$ans" : "X!" >/dev/null; do
300 set \`expr "X\$ans" : "X!\(.*\)\$"\`
313 : general instructions
316 This installation shell script will examine your system and ask you questions
317 to determine how the $package package should be installed. If you get stuck
318 on a question, you may use a ! shell escape to start a subshell or execute
319 a command. Many of the questions will have default answers in square
320 brackets--typing carriage return will give you the default.
322 On some of the questions which ask for file or directory names you are
323 allowed to use the ~name construct to specify the login directory belonging
324 to "name", even if you don't have a shell which knows about that. Questions
325 where this is allowed will be marked "(~name ok)".
328 rp="[Type carriage return to continue]"
333 Much effort has been expended to ensure that this shell script will run
334 on any Unix system. If despite that it blows up on you, your best bet is
335 to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
336 know how I blew it. If you can't run Configure for some reason, you'll have
337 to generate a config.sh file by hand.
339 This installation script affects things in two ways: 1) it may do direct
340 variable substitutions on some of the files included in this kit, and
341 2) it builds a config.h file for inclusion in C programs. You may edit
342 any of these files as the need arises after running this script.
344 If you make a mistake on a question, there is no easy way to back up to it
345 currently. The easiest thing to do is to edit config.sh and rerun all the
346 SH files. Configure will offer to let you do this before it runs the SH files.
349 rp="[Type carriage return to continue]"
353 : get old answers, if there is a config file out there
354 if test -f ../config.sh; then
357 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
361 n*) echo "OK, I'll ignore it.";;
362 *) echo "Fetching default answers from your old config.sh file..."
372 : find out where common programs are
374 echo "Locating common programs..."
387 if test -d \$dir/\$thing; then
393 if test -f \$dir/\$thing; then
396 elif test -f \$dir/\$thing.exe; then
397 : on Eunice apparently
429 for file in $loclist; do
430 xxx=`loc $file $file $pth`
435 echo $file is in $xxx.
438 echo "I don't know where $file is. I hope it's in everyone's PATH."
443 echo "Don't worry if any of the following aren't found..."
445 for file in $trylist; do
446 xxx=`loc $file $file $pth`
451 echo $file is in $xxx.
454 echo "I don't see $file out there, $ans."
461 echo "Substituting grep for egrep."
467 echo "Hopefully test is built into your sh."
470 if sh -c "PATH= test true" >/dev/null 2>&1; then
471 echo "Using the test built into your sh."
481 echo "Hopefully echo is built into your sh."
485 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
486 $echo $n "hi there$c" >foo1
487 echo $n "hi there$c" >foo2
488 if cmp foo1 foo2 >/dev/null 2>&1; then
489 echo "They are compatible. In fact, they may be identical."
492 '-n') n='' c='\c' ans='\c' ;;
493 *) n='-n' c='' ans='-n' ;;
496 They are not compatible! You are probably running ksh on a non-USG system.
497 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
498 have echo built in and we may have to run some Bourne shell scripts. That
499 means I'll have to use $ans to suppress newlines now. Life is ridiculous.
502 rp="Your cursor should be here-->"
515 : get list of predefined functions in a handy place
517 set /usr/lib/libc.so.[0-9]*
519 if test -f "$1"; then
520 echo "Your shared C library is in $1."
522 elif test -f /lib/libc.a; then
523 echo "Your C library is in /lib/libc.a. You're normal."
526 ans=`loc libc.a blurfl/dyick $libpth`
527 if test ! -f "$ans"; then
528 ans=`loc clib blurfl/dyick $libpth`
530 if test ! -f "$ans"; then
531 ans=`loc libc blurfl/dyick $libpth`
533 if test ! -f "$ans"; then
534 ans=`loc Slibc.a blurfl/dyick /usr/lib/386 /lib/386 $libpth`
536 if test ! -f "$ans"; then
537 ans=`loc Mlibc.a blurfl/dyick $libpth`
539 if test ! -f "$ans"; then
540 ans=`loc Llibc.a blurfl/dyick $libpth`
542 if test -f "$ans"; then
543 echo "Your C library is in $ans, of all places."
546 if test -f "$libc"; then
547 echo "Your C library is in $libc, like you said before."
551 I can't seem to find your C library. I've looked in the following places:
555 None of these seems to contain your C library. What is the full name
558 $echo $n "of your C library? $c"
559 rp='C library full name?'
566 $echo $n "Extracting names from $libc for later perusal...$c"
567 nm $libc 2>/dev/null >libc.tmp
568 $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
569 if $contains '^printf$' libc.list >/dev/null 2>&1; then
572 $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
573 $contains '^printf$' libc.list >/dev/null 2>&1 || \
574 $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list
575 $contains '^printf$' libc.list >/dev/null 2>&1 || \
576 $sed -n -e 's/^_//' \
577 -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
578 if $contains '^printf$' libc.list >/dev/null 2>&1; then
582 echo "nm didn't seem to work right."
583 echo "Trying ar instead..."
584 if ar t $libc > libc.tmp; then
585 $sed -e 's/\.o$//' < libc.tmp > libc.list
588 echo "ar didn't seem to work right."
589 echo "Maybe this is a Cray...trying bld instead..."
590 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
593 echo "That didn't work either. Giving up."
601 if $contains "^$1\$" libc.list >/dev/null 2>&1;
602 then echo "$1() found"; eval "$2=$define";
603 else echo "$1() not found"; eval "$2=$undef"; fi'
605 rmlist="$rmlist libc.tmp libc.list"
607 : make some quick guesses about what we are up against
610 cat /usr/include/signal.h /usr/include/sys/signal.h >foo
611 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
612 echo "Looks kind of like a BSD system, but we'll see..."
616 elif $contains '^fcntl$' libc.list >/dev/null 2>&1 ; then
617 echo "Looks kind of like a USG system, but we'll see..."
622 echo "Looks kind of like a version 7 system, but we'll see..."
627 if $contains '^vmssystem$' libc.list >/dev/null 2>&1 ; then
629 There is, however, a strange, musty smell in the air that reminds me of
630 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
632 echo "exit 0" >eunice
635 : it so happens the Eunice I know will not run shell scripts in Unix format
638 echo "Congratulations. You aren't running Eunice."
641 echo "exit 1" >eunice
643 if test -f /xenix; then
644 echo "Actually, this looks more like a XENIX system..."
648 echo "It's not Xenix..."
653 if test -f /venix; then
654 echo "Actually, this looks more like a VENIX system..."
661 echo "Nor is it Venix..."
665 chmod +x bsd usg v7 eunice venix
666 $eunicefix bsd usg v7 eunice venix
668 rmlist="$rmlist bsd usg v7 eunice venix xenix"
670 : see if sh knows # comments
672 echo "Checking your sh to see if it knows about # comments..."
673 if sh -c '#' >/dev/null 2>&1 ; then
674 echo "Your sh handles # comments correctly."
678 echo "Okay, let's see if #! works on this system..."
679 echo "#!/bin/echo hi" > try
683 if $contains hi today >/dev/null 2>&1; then
687 echo "#! /bin/echo hi" > try
691 if test -s today; then
700 echo "Your sh doesn't grok # comments--I will strip them later on."
702 echo "exec grep -v '^#'" >spitshell
705 spitshell=`pwd`/spitshell
706 echo "I presume that if # doesn't work, #! won't work either!"
710 : figure out how to guarantee sh startup
712 echo "Checking out how to guarantee sh startup..."
713 startsh=$sharpbang'/bin/sh'
714 echo "Let's see if '$startsh' works..."
726 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
730 : set up shell script to do ~ expansion
736 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
739 if $test -f /bin/csh; then
740 /bin/csh -f -c "glob \$1"
743 name=\`$expr x\$1 : '..\([^/]*\)'\`
744 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
745 if $test ! -d "\$dir"; then
747 echo "\$me: can't locate home directory for: \$name" >&2
752 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
768 : determine where public executables go
771 dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
777 while $test "$cont" ; do
779 rp="Where do you want to put the public executables? [$dflt]"
784 if test -d $bin; then
791 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
801 : determine where manual pages go
804 $package has manual pages that need to be installed in source form.
808 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`
814 while $test "$cont" ; do
816 rp="Where do the manual pages (source) go? [$dflt]"
819 mansrc=`filexp "$ans"`
820 if $test -d "$mansrc"; then
823 if $test "$fastread" = yes; then
828 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
861 : see what memory models we can support
864 : We may not use Cppsym or we get a circular dependency through cc.
865 : But this should work regardless of which cc we eventually use.
875 cc -o pdp11 pdp11.c >/dev/null 2>&1
876 if pdp11 2>/dev/null; then
879 ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
882 *) if $test -d /lib/small || $test -d /usr/lib/small; then
887 if $test -d /lib/medium || $test -d /usr/lib/medium; then
890 if $test -d /lib/large || $test -d /usr/lib/large; then
893 if $test -d /lib/huge || $test -d /usr/lib/huge; then
903 Some systems have different model sizes. On most systems they are called
904 small, medium, large, and huge. On the PDP11 they are called unsplit and
905 split. If your system doesn't support different memory models, say "none".
906 If you wish to force everything to one memory model, say "none" here and
907 put the appropriate flags later when it asks you for other cc and ld flags.
908 Venix systems may wish to put "none" and let the compiler figure things out.
909 (In the following question multiple model names should be space separated.)
912 rp="Which models are supported? [$dflt]"
929 if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
930 $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
938 rp="What flag indicates separate I and D space? [$dflt]"
947 *large*|*small*|*medium*|*huge*)
954 rp="What flag indicates large model? [$dflt]"
970 rp="What flag indicates huge model? [$dflt]"
986 rp="What flag indicates medium model? [$dflt]"
1002 rp="What flag indicates small model? [$dflt]"
1014 echo "Unrecognized memory models--you may have to edit Makefile.SH"
1018 : see if we need a special compiler
1032 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1046 On some systems the default C compiler will not resolve multiple global
1047 references that happen to have the same name. On some such systems the
1048 "Mcc" command may be used to force these to be resolved. On other systems
1049 a "cc -M" command is required. (Note that the -M flag on other systems
1050 indicates a memory model to use!) If you have the Gnu C compiler, you
1051 might wish to use that instead. What command will force resolution on
1053 $echo $n "this system? [$dflt] $c"
1054 rp="Command to resolve multiple refs? [$dflt]"
1062 rp="Use which C compiler? [$dflt]"
1068 gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
1071 : determine optimize, if desired, or use for debug flag also
1081 Some C compilers have problems with their optimizers, by default, $package
1082 compiles with the -O flag to use the optimizer. Alternately, you might
1083 want to use the symbolic debugger, which uses the -g flag (on traditional
1084 Unix systems). Either flag can be specified here. To use neither flag,
1085 specify the word "none".
1088 rp="What optimizer/debugger flag should be used? [$dflt]"
1093 'none') optimize=" "
1099 gcc) dflt='-fpcc-struct-return';;
1103 *) dflt="$ccflags";;
1106 rp="Any additional cc flags? [$dflt]"
1121 *) dflt="$ldflags";;
1124 rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1131 rmlist="$rmlist pdp11"
1140 Some versions of Unix support shared libraries, which make
1141 executables smaller but make load time slightly longer.
1143 On some systems, mostly newer Unix System V's, the shared library
1144 is included by putting the option "-lc_s" as the last thing on the
1145 cc command line when linking. Other systems use shared libraries
1146 by default. There may be other libraries needed to compile $package
1147 on your machine as well. If your system needs the "-lc_s" option,
1148 include it here. Include any other special libraries here as well.
1152 rp="Any additional libraries? [$dflt]"
1160 : check for ordering of bytes in a long
1161 case "$byteorder" in
1165 In the following, larger digits indicate more significance. A big-endian
1166 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
1167 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
1168 machines may have weird orders like 3412. If the test program works the
1169 default is probably right. I'm now running the test program...
1171 $cat >try.c <<'EOCP'
1182 printf("%c%c%c%c\n", u.c[0]+'0', u.c[1]+'0', u.c[2]+'0', u.c[3]+'0');
1185 if $cc try.c -o try >/dev/null 2>&1 ; then
1188 ????) echo "(The test program ran ok.)";;
1189 *) echo "(The test program didn't run right for some reason.)";;
1193 echo "(I can't seem to compile the test program. Guessing big-endian...)"
1201 rp="What is the order of bytes in a long? [$dflt]"
1207 : see how we invoke the C preprocessor
1209 echo "Now, how can we feed standard input to your C preprocessor..."
1210 cat <<'EOT' >testcpp.c
1215 echo 'Maybe "'"$cc"' -E" will work...'
1216 $cc -E <testcpp.c >testcpp.out 2>&1
1217 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1218 echo "Yup, it does."
1222 echo 'Nope, maybe "'$cpp'" will work...'
1223 $cpp <testcpp.c >testcpp.out 2>&1
1224 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1225 echo "Yup, it does."
1229 echo 'No such luck...maybe "'$cpp' -" will work...'
1230 $cpp - <testcpp.c >testcpp.out 2>&1
1231 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1236 echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
1237 $cc -E - <testcpp.c >testcpp.out 2>&1
1238 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1239 echo "Hooray, it works! I was beginning to wonder."
1243 echo 'Nope...maybe "'"$cc"' -P" will work...'
1244 $cc -P <testcpp.c >testcpp.out 2>&1
1245 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1246 echo "Yup, that does."
1250 echo 'Nope...maybe "'"$cc"' -P -" will work...'
1251 $cc -P - <testcpp.c >testcpp.out 2>&1
1252 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1253 echo "Yup, that does."
1257 echo 'Hmm...perhaps you already told me...'
1260 *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
1262 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1263 echo "Hooray, you did! I was beginning to wonder."
1265 echo 'Uh-uh. Time to get fancy...'
1267 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1268 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1270 cppstdin=`pwd`/cppstdin
1273 $cppstdin <testcpp.c >testcpp.out 2>&1
1274 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1278 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
1279 rp='Name a C preprocessor:'
1282 $cppstdin <testcpp.c >testcpp.out 2>&1
1283 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1284 echo "OK, that will do."
1286 echo "Sorry, I can't get that to work. Go find one."
1297 rm -f testcpp.c testcpp.out
1299 : see if bcmp exists
1303 : see if bcopy exists
1307 : see if sprintf is declared as int or pointer to char
1309 cat >.ucbsprf.c <<'EOF'
1310 main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
1312 if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1313 echo "Your sprintf() returns (int)."
1316 echo "Your sprintf() returns (char*)."
1317 d_charsprf="$define"
1319 /bin/rm -f .ucbsprf.c .ucbsprf
1321 : see if vprintf exists
1323 if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
1324 echo 'vprintf() found.'
1326 cat >.ucbsprf.c <<'EOF'
1327 #include <varargs.h>
1329 main() { xxx("foo"); }
1338 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
1341 if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1342 echo "Your vsprintf() returns (int)."
1345 echo "Your vsprintf() returns (char*)."
1346 d_charvspr="$define"
1348 /bin/rm -f .ucbsprf.c .ucbsprf
1350 echo 'vprintf() not found.'
1355 : see if crypt exists
1357 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
1358 echo 'crypt() found.'
1362 cryptlib=`loc Slibcrypt.a "" /lib/386 /lib`
1363 if $test -z "$cryptlib"; then
1364 cryptlib=`loc Mlibcrypt.a "" /lib/386 /lib`
1368 if $test -z "$cryptlib"; then
1369 cryptlib=`loc Llibcrypt.a "" /lib/386 /lib`
1373 if $test -z "$cryptlib"; then
1374 cryptlib=`loc libcrypt.a "" $libpth`
1378 if $test -z "$cryptlib"; then
1379 echo 'crypt() not found.'
1386 : see if this is a dirent system
1388 if $test -r /usr/include/dirent.h ; then
1390 echo "dirent.h found."
1391 if $contains 'd_namlen' /usr/include/sys/dirent.h >/dev/null 2>&1; then
1392 d_dirnamlen="$define"
1394 d_dirnamlen="$undef"
1398 d_dirnamlen="$define"
1399 echo "No dirent.h found."
1402 : now see if they want to do setuid emulation
1410 Some sites have disabled setuid #! scripts because of a bug in the kernel
1411 that prevents them from being secure. If you are on such a system, the
1412 setuid/setgid bits on scripts are currently useless. It is possible for
1413 $package to detect those bits and emulate setuid/setgid in a secure fashion
1414 until a better solution is devised for the kernel problem.
1417 rp="Do you want to do setuid/setgid emulation? [$dflt]"
1424 y*) d_dosuid="$define";;
1425 *) d_dosuid="$undef";;
1428 : see if dup2 exists
1432 : see if fchmod exists
1436 : see if fchown exists
1440 : see if this is an fcntl system
1442 if $test -r /usr/include/fcntl.h ; then
1444 echo "fcntl.h found."
1447 echo "No fcntl.h found, but that's ok."
1450 : see if flock exists
1454 : see if getgroups exists
1455 set getgroups d_getgrps
1458 : see if gethostent exists
1459 set gethostent d_gethent
1462 : see if getpgrp exists
1463 set getpgrp d_getpgrp
1466 : see if getpriority exists
1467 set getpriority d_getprior
1470 : see if htonl exists
1480 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
1481 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1482 echo "Your system has both index() and strchr(). Shall I use"
1483 rp="index() rather than strchr()? [$dflt]"
1487 n*) d_index="$define" ;;
1488 *) d_index="$undef" ;;
1492 echo "index() found."
1495 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1497 echo "strchr() found."
1499 echo "No index() or strchr() found!"
1504 : see if ioctl defs are in sgtty/termio or sys/ioctl
1506 if $test -r /usr/include/sys/ioctl.h ; then
1508 echo "sys/ioctl.h found."
1511 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
1514 : see if killpg exists
1518 : see if memcmp exists
1522 : see if memcpy exists
1526 : see if mkdir exists
1530 : see if ndbm is available
1532 if $test -r /usr/include/ndbm.h || $test -r /usr/local/include/ndbm.h; then
1534 echo "ndbm.h found."
1537 echo "ndbm.h not found."
1540 : see if we have the old dbm
1542 if $test -r /usr/include/dbm.h ; then
1547 echo "dbm.h not found."
1550 : see if this is a pwd system
1552 if $test -r /usr/include/pwd.h ; then
1555 if $contains 'pw_quota' /usr/include/pwd.h >/dev/null 2>&1; then
1560 if $contains 'pw_age' /usr/include/pwd.h >/dev/null 2>&1; then
1565 if $contains 'pw_change' /usr/include/pwd.h >/dev/null 2>&1; then
1566 d_pwchange="$define"
1570 if $contains 'pw_class' /usr/include/pwd.h >/dev/null 2>&1; then
1575 if $contains 'pw_expire' /usr/include/pwd.h >/dev/null 2>&1; then
1576 d_pwexpire="$define"
1587 echo "No pwd.h found."
1590 : see if readdir exists
1591 set readdir d_readdir
1594 : see if rename exists
1598 : see if rmdir exists
1602 : see if setegid exists
1603 set setegid d_setegid
1606 : see if seteuid exists
1607 set seteuid d_seteuid
1610 : see if setpgrp exists
1611 set setpgrp d_setpgrp
1614 : see if setpriority exists
1615 set setpriority d_setprior
1618 : see if setregid exists
1619 set setregid d_setregid
1621 set setresgid d_setresgid
1624 : see if setreuid exists
1625 set setreuid d_setreuid
1627 set setresuid d_setresuid
1630 : see if setrgid exists
1631 set setrgid d_setrgid
1634 : see if setruid exists
1635 set setruid d_setruid
1640 : see whether socket exists
1642 if $contains socket libc.list >/dev/null 2>&1; then
1643 echo "Looks like you have Berkeley networking support."
1645 : now check for advanced features
1646 if $contains setsockopt libc.list >/dev/null 2>&1; then
1649 echo "...but it uses the old 4.1c interface, rather than 4.2"
1653 : hpux, for one, puts all the socket stuff in socklib.o
1654 if $contains socklib libc.list >/dev/null 2>&1; then
1655 echo "Looks like you have Berkeley networking support."
1657 : we will have to assume that it supports the 4.2 BSD interface
1660 echo "Hmmm...you don't have Berkeley networking in libc.a..."
1661 : look for an optional networking library
1662 if test -f /usr/lib/libnet.a; then
1663 (ar t /usr/lib/libnet.a ||
1664 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
1665 if $contains socket libc.list >/dev/null 2>&1; then
1666 echo "but the Wollongong group seems to have hacked it in."
1668 sockethdr="-I/usr/netinclude"
1670 : now check for advanced features
1671 if $contains setsockopt libc.list >/dev/null 2>&1; then
1674 echo "...using the old 4.1c interface, rather than 4.2"
1678 echo "or even in libnet.a, which is peculiar."
1683 echo "or anywhere else I see."
1689 if $contains socketpair libc.list >/dev/null 2>&1; then
1690 d_sockpair="$define"
1695 : see if stat knows about block sizes
1697 if $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1698 if $contains 'st_blksize;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1699 echo "Your stat knows about block sizes."
1700 d_statblks="$define"
1702 echo "Your stat doesn't know about block sizes."
1706 echo "Your stat doesn't know about block sizes."
1710 : see if stdio is really std
1712 if $contains 'char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1713 if $contains '_cnt;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1714 echo "Your stdio is pretty std."
1715 d_stdstdio="$define"
1717 echo "Your stdio isn't very std."
1721 echo "Your stdio isn't very std."
1725 : check for structure copying
1727 echo "Checking to see if your C compiler can copy structs..."
1728 $cat >try.c <<'EOCP'
1738 if $cc -c try.c >/dev/null 2>&1 ; then
1739 d_strctcpy="$define"
1743 echo "Nope, it can't."
1747 : see if symlink exists
1748 set symlink d_symlink
1751 : see if syscall exists
1752 set syscall d_syscall
1755 : see if struct tm is defined in sys/time.h
1757 if $contains 'struct tm' /usr/include/time.h >/dev/null 2>&1 ; then
1758 echo "You have struct tm defined in <time.h> rather than <sys/time.h>."
1760 if test -f /usr/include/sys/time.h; then
1766 echo "You have struct tm defined in <sys/time.h> rather than <time.h>."
1771 : see if this is a varargs system
1773 if $test -r /usr/include/varargs.h ; then
1775 echo "varargs.h found."
1778 echo "No varargs.h found, but that's ok (I hope)."
1781 : see if there is a vfork
1785 : see if signal is declared as pointer to function returning int or void
1787 if $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 ; then
1788 echo "You have void (*signal())() instead of int."
1791 echo "You have int (*signal())() instead of void."
1795 : check for void type
1798 Checking to see how well your C compiler groks the void type...
1800 Support flag bits are:
1801 1: basic void declarations.
1802 2: arrays of pointers to functions returning void.
1803 4: operations between pointers to and addresses of void functions.
1806 case "$voidflags" in
1808 $cat >try.c <<'EOCP'
1814 extern void moo(); /* function returning void */
1815 void (*goo)(); /* ptr to func returning void */
1828 if $cc -S -DTRY=$defvoidused try.c >.out 2>&1 ; then
1829 voidflags=$defvoidused
1830 echo "It appears to support void."
1831 if $contains warning .out >/dev/null 2>&1; then
1832 echo "However, you might get some warnings that look like this:"
1836 echo "Hmm, your compiler has some difficulty with void. Checking further..."
1837 if $cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
1838 echo "It supports 1..."
1839 if $cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
1841 echo "And it supports 2 but not 4."
1843 echo "It doesn't support 2..."
1844 if $cc -S -DTRY=5 try.c >/dev/null 2>&1 ; then
1846 echo "But it supports 4."
1849 echo "And it doesn't support 4."
1853 echo "There is no support at all for void."
1859 rp="Your void support flags add up to what? [$dflt]"
1865 : see what type gids are declared as in the kernel
1868 if $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
1871 set `grep 'groups\[NGROUPS\];' /usr/include/sys/user.h 2>/dev/null` unsigned short
1873 unsigned) dflt="$1 $2" ;;
1883 rp="What type are the group ids are returned by getgroups()? [$dflt]"
1888 : see if this is an fcntl system
1890 if $test -r /usr/include/fcntl.h ; then
1892 echo "fcntl.h found."
1895 echo "No fcntl.h found, but that's ok."
1898 : see if this is an grp system
1900 if $test -r /usr/include/grp.h ; then
1905 echo "No grp.h found."
1908 : see if this is a netinet/in.h system
1910 if $test -r /usr/include/netinet/in.h ; then
1912 echo "netinet/in.h found."
1915 echo "No netinet/in.h found."
1918 : see if this is a sys/dir.h system
1920 if $test -r /usr/include/sys/dir.h ; then
1922 echo "sysdir.h found."
1925 echo "No sysdir.h found."
1928 : see if ioctl defs are in sgtty/termio or sys/ioctl
1930 if $test -r /usr/include/sys/ioctl.h ; then
1931 i_sysioctl="$define"
1932 echo "sys/ioctl.h found."
1935 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
1938 : see if this is a varargs system
1940 if $test -r /usr/include/varargs.h ; then
1942 echo "varargs.h found."
1945 echo "No varargs.h found, but that's ok (I hope)."
1948 : see if this is a vfork system
1950 if $test -r /usr/include/vfork.h ; then
1952 echo "vfork.h found."
1955 echo "No vfork.h found."
1958 : check for length of integer
1962 echo "Checking to see how big your integers are..."
1963 $cat >try.c <<'EOCP'
1967 printf("%d\n", sizeof(int));
1970 if $cc try.c -o try >/dev/null 2>&1 ; then
1974 echo "(I can't seem to compile the test program. Guessing...)"
1981 rp="What is the size of an integer (in bytes)? [$dflt]"
1987 : determine where private executables go
1990 dflt=/usr/lib/$package
1991 test -d /usr/local/lib && dflt=/usr/local/lib/$package
1998 The $package package has some auxiliary files that should be put in a library
1999 that is accessible by everyone. Where do you want to put these "private"
2001 $echo $n "but accessible files? [$dflt] $c"
2002 rp="Put private files where? [$dflt]"
2006 : check for size of random number generator
2010 echo "Checking to see how many bits your rand function produces..."
2011 $cat >try.c <<'EOCP'
2016 register unsigned long tmp;
2017 register unsigned long max = 0L;
2019 for (i=1000; i; i--) {
2020 tmp = (unsigned long)rand();
2021 if (tmp > max) max = tmp;
2028 if $cc try.c -o try >/dev/null 2>&1 ; then
2032 echo "(I can't seem to compile the test program...)"
2039 rp="How many bits does your rand() function produce? [$dflt]"
2045 : generate list of signal names
2049 echo "Generating a list of signal names..."
2050 set X `kill -l 2>/dev/null`
2053 0) echo 'kill -l' >/tmp/foo$$
2054 set X `/bin/csh -f </tmp/foo$$`
2057 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
2065 echo "Signals are: $sig_name"
2067 : see what type of char stdio uses.
2069 if $contains 'unsigned.*char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
2070 echo "Your stdio uses unsigned chars."
2071 stdchar="unsigned char"
2073 echo "Your stdio uses signed chars."
2077 : see what type uids are declared as in the kernel
2080 if $contains 'uid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
2083 set `grep '_ruid;' /usr/include/sys/user.h 2>/dev/null` unsigned short
2085 unsigned) dflt="$1 $2" ;;
2095 rp="What type are user ids returned by getuid(), etc.? [$dflt]"
2100 : preserve RCS keywords in files with variable substitution, grrr
2105 : see if we should include -ldbm
2107 if $test -r /usr/lib/libdbm.a || $test -r /usr/local/lib/libdbm.a ; then
2111 ans=`loc libdbm.a x $libpth`
2114 echo "No dbm library found."
2118 echo "DBM library found in $ans."
2124 : see if we should include -lndir
2126 if $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a ; then
2127 echo "New directory library found."
2130 ans=`loc libndir.a x $libpth`
2133 echo "No ndir library found."
2137 echo "New directory library found in $ans."
2145 case "$d_readdir" in
2147 echo "Since you have readdir in the C library, I'll ignore $libndir"
2154 : see if we should include -lnm
2156 if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
2157 echo "New math library found."
2160 ans=`loc libnm.a x $libpth`
2163 echo "No nm library found--the normal math library will have to do."
2167 echo "New math library found in $ans."
2173 : determine which malloc to compile in
2175 case "$usemymalloc" in
2183 *) dflt="$usemymalloc"
2186 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
2194 y*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
2195 *) mallocsrc=''; mallocobj='';;
2199 echo "End of configuration questions."
2202 : create config.sh file
2204 if test -d ../UU; then
2207 echo "Creating config.sh..."
2208 $spitshell <<EOT >config.sh
2211 # This file was produced by running the Configure script.
2213 d_eunice='$d_eunice'
2214 eunicefix='$eunicefix'
2245 sendmail='$sendmail'
2269 byteorder='$byteorder'
2270 contains='$contains'
2271 cppstdin='$cppstdin'
2272 cppminus='$cppminus'
2275 d_charsprf='$d_charsprf'
2277 cryptlib='$cryptlib'
2278 d_dosuid='$d_dosuid'
2280 d_fchmod='$d_fchmod'
2281 d_fchown='$d_fchown'
2284 d_getgrps='$d_getgrps'
2285 d_gethent='$d_gethent'
2286 d_getpgrp='$d_getpgrp'
2287 d_getprior='$d_getprior'
2291 d_killpg='$d_killpg'
2292 d_memcmp='$d_memcmp'
2293 d_memcpy='$d_memcpy'
2297 d_readdir='$d_readdir'
2298 d_rename='$d_rename'
2300 d_setegid='$d_setegid'
2301 d_seteuid='$d_seteuid'
2302 d_setpgrp='$d_setpgrp'
2303 d_setprior='$d_setprior'
2304 d_setregid='$d_setregid'
2305 d_setresgid='$d_setresgid'
2306 d_setreuid='$d_setreuid'
2307 d_setresuid='$d_setresuid'
2308 d_setrgid='$d_setrgid'
2309 d_setruid='$d_setruid'
2310 d_socket='$d_socket'
2311 d_sockpair='$d_sockpair'
2312 d_oldsock='$d_oldsock'
2313 socketlib='$socketlib'
2314 sockethdr='$sockethdr'
2315 d_statblks='$d_statblks'
2316 d_stdstdio='$d_stdstdio'
2317 d_strctcpy='$d_strctcpy'
2318 d_symlink='$d_symlink'
2319 d_syscall='$d_syscall'
2320 d_tminsys='$d_tminsys'
2321 i_systime='$i_systime'
2322 d_varargs='$d_varargs'
2324 d_voidsig='$d_voidsig'
2325 d_vprintf='$d_vprintf'
2326 d_charvspr='$d_charvspr'
2328 i_dirent='$i_dirent'
2329 d_dirnamlen='$d_dirnamlen'
2334 d_pwquota='$d_pwquota'
2336 i_sysdir='$i_sysdir'
2337 i_sysioctl='$i_sysioctl'
2338 i_varargs='$i_varargs'
2345 mallocsrc='$mallocsrc'
2346 mallocobj='$mallocobj'
2347 usemymalloc='$usemymalloc'
2356 optimize='$optimize'
2364 randbits='$randbits'
2365 sig_name='$sig_name'
2366 spitshell='$spitshell'
2368 sharpbang='$sharpbang'
2372 voidflags='$voidflags'
2373 defvoidused='$defvoidused'
2384 echo "If you didn't make any mistakes, then just type a carriage return here."
2385 rp="If you need to edit config.sh, do it as a shell escape here:"
2390 *) : in case they cannot read
2396 echo "Doing variable substitutions on .SH files..."
2397 set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
2400 0) set x *.SH; shift;;
2402 if test ! -f $1; then
2408 dir=`$expr X$file : 'X\(.*\)/'`
2409 file=`$expr X$file : 'X.*/\(.*\)'`
2410 (cd $dir && . $file)
2417 if test -f config.h.SH; then
2418 if test ! -f config.h; then
2419 : oops, they left it out of MANIFEST, probably, so do it anyway.
2424 if $contains '^depend:' Makefile >/dev/null 2>&1; then
2428 Now you need to generate make dependencies by running "make depend".
2429 You might prefer to run it in background: "make depend > makedepend.out &"
2430 It can take a while, so you might not want to run it right now.
2433 rp="Run make depend now? [$dflt]"
2437 y*) make depend && echo "Now you must run a make."
2439 *) echo "You must run 'make depend' then 'make'."
2442 elif test -f Makefile; then
2444 echo "Now you must run a make."
2450 : the following is currently useless
2451 cd UU && $rm -f $rmlist
2452 : since this removes it all anyway