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 89/10/18 15:04:55 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'
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';;
208 echo "Beginning of configuration questions for $package kit."
209 : Eunice requires " " instead of "", can you believe it
214 libpth='/usr/lib /usr/local/lib /usr/lib/386 /usr/lib/large /lib /lib/386 /lib/large /usr/lib/small /lib/small'
215 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
216 rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
217 trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
219 : We must find out about Eunice early
221 if test -f /etc/unixtovms; then
222 eunicefix=/etc/unixtovms
224 if test -f /etc/unixtovms.exe; then
225 eunicefix=/etc/unixtovms.exe
228 : Now test for existence of everything in MANIFEST
230 echo "First let's make sure your kit is complete. Checking..."
231 (cd ..; awk '' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$)
234 attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
235 attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
236 attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
237 attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
238 attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
239 attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
240 attrlist="$attrlist i186"
241 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"
242 d_newshome="/usr/NeWS"
245 : some greps do not return status, grrr.
246 echo "grimblepritz" >grimble
247 if grep blurfldyick grimble >/dev/null 2>&1 ; then
249 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
255 : the following should work in any shell
259 echo "AGH! Grep doesn't return a status. Attempting remedial action."
260 cat >contains <<'EOSS'
261 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
266 : first determine how to suppress newline on echo command
267 echo "Checking echo to see how to suppress newlines..."
268 (echo "hi there\c" ; echo " ") >.echotmp
269 if $contains c .echotmp >/dev/null 2>&1 ; then
280 echo $n "Type carriage return to continue. Your cursor should be here-->$c"
284 : now set up to do reads with possible shell escape and default assignment
287 yes) ans=''; echo " " ;;
290 while expr "X\$ans" : "X!" >/dev/null; do
299 set \`expr "X\$ans" : "X!\(.*\)\$"\`
312 : general instructions
315 This installation shell script will examine your system and ask you questions
316 to determine how the $package package should be installed. If you get stuck
317 on a question, you may use a ! shell escape to start a subshell or execute
318 a command. Many of the questions will have default answers in square
319 brackets--typing carriage return will give you the default.
321 On some of the questions which ask for file or directory names you are
322 allowed to use the ~name construct to specify the login directory belonging
323 to "name", even if you don't have a shell which knows about that. Questions
324 where this is allowed will be marked "(~name ok)".
327 rp="[Type carriage return to continue]"
332 Much effort has been expended to ensure that this shell script will run
333 on any Unix system. If despite that it blows up on you, your best bet is
334 to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
335 know how I blew it. If you can't run Configure for some reason, you'll have
336 to generate a config.sh file by hand.
338 This installation script affects things in two ways: 1) it may do direct
339 variable substitutions on some of the files included in this kit, and
340 2) it builds a config.h file for inclusion in C programs. You may edit
341 any of these files as the need arises after running this script.
343 If you make a mistake on a question, there is no easy way to back up to it
344 currently. The easiest thing to do is to edit config.sh and rerun all the
345 SH files. Configure will offer to let you do this before it runs the SH files.
348 rp="[Type carriage return to continue]"
352 : get old answers, if there is a config file out there
353 if test -f ../config.sh; then
356 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
360 n*) echo "OK, I'll ignore it.";;
361 *) echo "Fetching default answers from your old config.sh file..."
371 : find out where common programs are
373 echo "Locating common programs..."
386 if test -d \$dir/\$thing; then
392 if test -f \$dir/\$thing; then
395 elif test -f \$dir/\$thing.exe; then
396 : 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
516 if $test -n "$uname"; then
522 if test -f /lib/libc.a; then
523 echo "Your C library is in /lib/libc.a. You're normal."
526 if test "$os" = DomainOS ; then
527 ans=`loc libc blurfl/dyick $libpth`
529 ans=`loc libc.a blurfl/dyick $libpth`
531 if test ! -f "$ans"; then
532 ans=`loc clib blurfl/dyick $libpth`
534 if test ! -f "$ans"; then
535 ans=`loc libc blurfl/dyick $libpth`
537 if test ! -f "$ans"; then
538 ans=`loc Slibc.a blurfl/dyick /usr/lib/386 /lib/386 $libpth`
540 if test ! -f "$ans"; then
541 ans=`loc Mlibc.a blurfl/dyick $libpth`
543 if test ! -f "$ans"; then
544 ans=`loc Llibc.a blurfl/dyick $libpth`
546 if test -f "$ans"; then
547 echo "Your C library is in $ans, of all places."
550 if test -f "$libc"; then
551 echo "Your C library is in $libc, like you said before."
555 I can't seem to find your C library. I've looked in the following places:
559 None of these seems to contain your C library. What is the full name
562 $echo $n "of your C library? $c"
563 rp='C library full name?'
570 $echo $n "Extracting names from $libc for later perusal...$c"
571 nm $libc 2>/dev/null >libc.tmp
572 $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
573 if $contains '^printf$' libc.list >/dev/null 2>&1; then
576 if test "$os" = DomainOS ; then
577 $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
579 $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list
581 $contains '^printf$' libc.list >/dev/null 2>&1 || \
582 $sed -n -e 's/^_//' \
583 -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
584 if $contains '^printf$' libc.list >/dev/null 2>&1; then
588 echo "nm didn't seem to work right."
589 echo "Trying ar instead..."
590 if ar t $libc > libc.tmp; then
591 $sed -e 's/\.o$//' < libc.tmp > libc.list
594 echo "ar didn't seem to work right."
595 echo "Maybe this is a Cray...trying bld instead..."
596 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
599 echo "That didn't work either. Giving up."
607 if $contains "^$1\$" libc.list >/dev/null 2>&1;
608 then echo "$1() found"; eval "$2=$define";
609 else echo "$1() not found"; eval "$2=$undef"; fi'
611 rmlist="$rmlist libc.tmp libc.list"
613 : make some quick guesses about what we are up against
616 cat /usr/include/signal.h /usr/include/sys/signal.h >foo
617 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
618 echo "Looks kind of like a BSD system, but we'll see..."
622 elif $contains '^fcntl$' libc.list >/dev/null 2>&1 ; then
623 echo "Looks kind of like a USG system, but we'll see..."
628 echo "Looks kind of like a version 7 system, but we'll see..."
633 if $contains '^vmssystem$' libc.list >/dev/null 2>&1 ; then
635 There is, however, a strange, musty smell in the air that reminds me of
636 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
638 echo "exit 0" >eunice
641 : it so happens the Eunice I know will not run shell scripts in Unix format
644 echo "Congratulations. You aren't running Eunice."
647 echo "exit 1" >eunice
649 if test -f /xenix; then
650 echo "Actually, this looks more like a XENIX system..."
654 echo "It's not Xenix..."
659 if test -f /venix; then
660 echo "Actually, this looks more like a VENIX system..."
667 echo "Nor is it Venix..."
671 chmod +x bsd usg v7 eunice venix
672 $eunicefix bsd usg v7 eunice venix
674 rmlist="$rmlist bsd usg v7 eunice venix xenix"
676 : see if sh knows # comments
678 echo "Checking your sh to see if it knows about # comments..."
679 if sh -c '#' >/dev/null 2>&1 ; then
680 echo "Your sh handles # comments correctly."
684 echo "Okay, let's see if #! works on this system..."
685 echo "#!/bin/echo hi" > try
689 if $contains hi today >/dev/null 2>&1; then
693 echo "#! /bin/echo hi" > try
697 if test -s today; then
706 echo "Your sh doesn't grok # comments--I will strip them later on."
708 echo "exec grep -v '^#'" >spitshell
711 spitshell=`pwd`/spitshell
712 echo "I presume that if # doesn't work, #! won't work either!"
716 : figure out how to guarantee sh startup
718 echo "Checking out how to guarantee sh startup..."
719 startsh=$sharpbang'/bin/sh'
720 echo "Let's see if '$startsh' works..."
732 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
736 : set up shell script to do ~ expansion
742 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
745 if $test -f /bin/csh; then
746 /bin/csh -f -c "glob \$1"
749 name=\`$expr x\$1 : '..\([^/]*\)'\`
750 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
751 if $test ! -d "\$dir"; then
753 echo "\$me: can't locate home directory for: \$name" >&2
758 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
774 : determine where public executables go
777 dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
783 while $test "$cont" ; do
785 rp="Where do you want to put the public executables? [$dflt]"
790 if test -d $bin; then
797 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
807 : determine where manual pages go
810 $package has manual pages that need to be installed in source form.
814 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`
820 while $test "$cont" ; do
822 rp="Where do the manual pages (source) go? [$dflt]"
825 mansrc=`filexp "$ans"`
826 if $test -d "$mansrc"; then
829 if $test "$fastread" = yes; then
834 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
867 : see what memory models we can support
870 : We may not use Cppsym or we get a circular dependency through cc.
871 : But this should work regardless of which cc we eventually use.
881 cc -o pdp11 pdp11.c >/dev/null 2>&1
882 if pdp11 2>/dev/null; then
885 ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
888 *) if $test -d /lib/small || $test -d /usr/lib/small; then
893 if $test -d /lib/medium || $test -d /usr/lib/medium; then
896 if $test -d /lib/large || $test -d /usr/lib/large; then
899 if $test -d /lib/huge || $test -d /usr/lib/huge; then
909 Some systems have different model sizes. On most systems they are called
910 small, medium, large, and huge. On the PDP11 they are called unsplit and
911 split. If your system doesn't support different memory models, say "none".
912 If you wish to force everything to one memory model, say "none" here and
913 put the appropriate flags later when it asks you for other cc and ld flags.
914 Venix systems may wish to put "none" and let the compiler figure things out.
915 (In the following question multiple model names should be space separated.)
918 rp="Which models are supported? [$dflt]"
935 if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
936 $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
944 rp="What flag indicates separate I and D space? [$dflt]"
953 *large*|*small*|*medium*|*huge*)
960 rp="What flag indicates large model? [$dflt]"
976 rp="What flag indicates huge model? [$dflt]"
992 rp="What flag indicates medium model? [$dflt]"
1000 *) medium="$large";;
1008 rp="What flag indicates small model? [$dflt]"
1020 echo "Unrecognized memory models--you may have to edit Makefile.SH"
1024 : see if we need a special compiler
1038 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1052 On some systems the default C compiler will not resolve multiple global
1053 references that happen to have the same name. On some such systems the
1054 "Mcc" command may be used to force these to be resolved. On other systems
1055 a "cc -M" command is required. (Note that the -M flag on other systems
1056 indicates a memory model to use!) If you have the Gnu C compiler, you
1057 might wish to use that instead. What command will force resolution on
1059 $echo $n "this system? [$dflt] $c"
1060 rp="Command to resolve multiple refs? [$dflt]"
1068 rp="Use which C compiler? [$dflt]"
1074 gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
1077 : determine optimize, if desired, or use for debug flag also
1087 Some C compilers have problems with their optimizers, by default, $package
1088 compiles with the -O flag to use the optimizer. Alternately, you might
1089 want to use the symbolic debugger, which uses the -g flag (on traditional
1090 Unix systems). Either flag can be specified here. To use neither flag,
1091 specify the word "none".
1094 rp="What optimizer/debugger flag should be used? [$dflt]"
1099 'none') optimize=" "
1105 gcc) dflt='-fpcc_struct_return';;
1109 *) dflt="$ccflags";;
1112 rp="Any additional cc flags? [$dflt]"
1127 *) dflt="$ldflags";;
1130 rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1137 rmlist="$rmlist pdp11"
1146 Some versions of Unix support shared libraries, which make
1147 executables smaller but make load time slightly longer.
1149 On some systems, mostly newer Unix System V's, the shared library
1150 is included by putting the option "-lc_s" as the last thing on the
1151 cc command line when linking. Other systems use shared libraries
1152 by default. There may be other libraries needed to compile $package
1153 on your machine as well. If your system needs the "-lc_s" option,
1154 include it here. Include any other special libraries here as well.
1158 rp="Any additional libraries? [$dflt]"
1166 : check for ordering of bytes in a long
1167 case "$byteorder" in
1171 In the following, larger digits indicate more significance. A big-endian
1172 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
1173 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
1174 machines may have weird orders like 3412. If the test program works the
1175 default is probably right. I'm now running the test program...
1177 $cat >try.c <<'EOCP'
1188 printf("%c%c%c%c\n", u.c[0]+'0', u.c[1]+'0', u.c[2]+'0', u.c[3]+'0');
1191 if $cc try.c -o try >/dev/null 2>&1 ; then
1194 ????) echo "(The test program ran ok.)";;
1195 *) echo "(The test program didn't run right for some reason.)";;
1199 echo "(I can't seem to compile the test program. Guessing big-endian...)"
1207 rp="What is the order of bytes in a long? [$dflt]"
1213 : see how we invoke the C preprocessor
1215 echo "Now, how can we feed standard input to your C preprocessor..."
1216 cat <<'EOT' >testcpp.c
1221 echo 'Maybe "'"$cc"' -E" will work...'
1222 $cc -E <testcpp.c >testcpp.out 2>&1
1223 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1224 echo "Yup, it does."
1228 echo 'Nope, maybe "'$cpp'" will work...'
1229 $cpp <testcpp.c >testcpp.out 2>&1
1230 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1231 echo "Yup, it does."
1235 echo 'No such luck...maybe "'$cpp' -" will work...'
1236 $cpp - <testcpp.c >testcpp.out 2>&1
1237 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1242 echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
1243 $cc -E - <testcpp.c >testcpp.out 2>&1
1244 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1245 echo "Hooray, it works! I was beginning to wonder."
1249 echo 'Nope...maybe "'"$cc"' -P" will work...'
1250 $cc -P <testcpp.c >testcpp.out 2>&1
1251 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1252 echo "Yup, that does."
1256 echo 'Nope...maybe "'"$cc"' -P -" will work...'
1257 $cc -P - <testcpp.c >testcpp.out 2>&1
1258 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1259 echo "Yup, that does."
1263 echo 'Hmm...perhaps you already told me...'
1266 *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
1268 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1269 echo "Hooray, you did! I was beginning to wonder."
1271 echo 'Uh-uh. Time to get fancy...'
1273 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1274 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1276 cppstdin=`pwd`/cppstdin
1279 $cppstdin <testcpp.c >testcpp.out 2>&1
1280 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1284 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
1285 rp='Name a C preprocessor:'
1288 $cppstdin <testcpp.c >testcpp.out 2>&1
1289 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1290 echo "OK, that will do."
1292 echo "Sorry, I can't get that to work. Go find one."
1303 rm -f testcpp.c testcpp.out
1305 : see if bcmp exists
1309 : see if bcopy exists
1313 : see if sprintf is declared as int or pointer to char
1315 cat >.ucbsprf.c <<'EOF'
1316 main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
1318 if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1319 echo "Your sprintf() returns (int)."
1322 echo "Your sprintf() returns (char*)."
1323 d_charsprf="$define"
1325 /bin/rm -f .ucbsprf.c .ucbsprf
1327 : see if vprintf exists
1329 if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
1330 echo 'vprintf() found.'
1332 cat >.ucbsprf.c <<'EOF'
1333 #include <varargs.h>
1335 main() { xxx("foo"); }
1344 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
1347 if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1348 echo "Your vsprintf() returns (int)."
1351 echo "Your vsprintf() returns (char*)."
1352 d_charvspr="$define"
1354 /bin/rm -f .ucbsprf.c .ucbsprf
1356 echo 'vprintf() not found.'
1361 : see if crypt exists
1363 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
1364 echo 'crypt() found.'
1368 cryptlib=`loc Slibcrypt.a "" /lib/386 /lib`
1369 if $test -z "$cryptlib"; then
1370 cryptlib=`loc Mlibcrypt.a "" /lib/386 /lib`
1374 if $test -z "$cryptlib"; then
1375 cryptlib=`loc Llibcrypt.a "" /lib/386 /lib`
1379 if $test -z "$cryptlib"; then
1380 cryptlib=`loc libcrypt.a "" $libpth`
1384 if $test -z "$cryptlib"; then
1385 echo 'crypt() not found.'
1392 : see if this is a dirent system
1394 if $test -r /usr/include/dirent.h ; then
1396 echo "dirent.h found."
1397 if $contains 'd_namlen' /usr/include/sys/dirent.h >/dev/null 2>&1; then
1398 d_dirnamlen="$define"
1400 d_dirnamlen="$undef"
1404 d_dirnamlen="$define"
1405 echo "No dirent.h found."
1408 : now see if they want to do setuid emulation
1416 Some sites have disabled setuid #! scripts because of a bug in the kernel
1417 that prevents them from being secure. If you are on such a system, the
1418 setuid/setgid bits on scripts are currently useless. It is possible for
1419 $package to detect those bits and emulate setuid/setgid in a secure fashion
1420 until a better solution is devised for the kernel problem.
1423 rp="Do you want to do setuid/setgid emulation? [$dflt]"
1430 y*) d_dosuid="$define";;
1431 *) d_dosuid="$undef";;
1434 : see if dup2 exists
1438 : see if fchmod exists
1442 : see if fchown exists
1446 : see if this is an fcntl system
1448 if $test -r /usr/include/fcntl.h ; then
1450 echo "fcntl.h found."
1453 echo "No fcntl.h found, but that's ok."
1456 : see if flock exists
1460 : see if getgroups exists
1461 set getgroups d_getgrps
1464 : see if gethostent exists
1465 set gethostent d_gethent
1468 : see if getpgrp exists
1469 set getpgrp d_getpgrp
1472 : see if getpriority exists
1473 set getpriority d_getprior
1476 : see if htonl exists
1486 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
1487 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1488 echo "Your system has both index() and strchr(). Shall I use"
1489 rp="index() rather than strchr()? [$dflt]"
1493 n*) d_index="$define" ;;
1494 *) d_index="$undef" ;;
1498 echo "index() found."
1501 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1503 echo "strchr() found."
1505 echo "No index() or strchr() found!"
1510 : see if ioctl defs are in sgtty/termio or sys/ioctl
1512 if $test -r /usr/include/sys/ioctl.h ; then
1514 echo "sys/ioctl.h found."
1517 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
1520 : see if killpg exists
1524 : see if memcmp exists
1528 : see if memcpy exists
1532 : see if mkdir exists
1536 : see if ndbm is available
1538 if $test -r /usr/include/ndbm.h || $test -r /usr/local/include/ndbm.h; then
1540 echo "ndbm.h found."
1543 echo "ndbm.h not found."
1546 : see if we have the old dbm
1548 if $test -r /usr/include/dbm.h ; then
1553 echo "dbm.h not found."
1556 : see if this is an pwd system
1558 if $test -r /usr/include/pwd.h ; then
1561 if $contains 'pw_quota' /usr/include/pwd.h >/dev/null 2>&1; then
1566 if $contains 'pw_age' /usr/include/pwd.h >/dev/null 2>&1; then
1575 echo "No pwd.h found."
1578 : see if readdir exists
1579 set readdir d_readdir
1582 : see if rename exists
1586 : see if rmdir exists
1590 : see if setegid exists
1591 set setegid d_setegid
1594 : see if seteuid exists
1595 set seteuid d_seteuid
1598 : see if setpgrp exists
1599 set setpgrp d_setpgrp
1602 : see if setpriority exists
1603 set setpriority d_setprior
1606 : see if setregid exists
1607 set setregid d_setregid
1609 set setresgid d_setresgid
1612 : see if setreuid exists
1613 set setreuid d_setreuid
1615 set setresuid d_setresuid
1618 : see if setrgid exists
1619 set setrgid d_setrgid
1622 : see if setruid exists
1623 set setruid d_setruid
1628 : see whether socket exists
1630 if $contains socket libc.list >/dev/null 2>&1; then
1631 echo "Looks like you have Berkeley networking support."
1633 : now check for advanced features
1634 if $contains setsockopt libc.list >/dev/null 2>&1; then
1637 echo "...but it uses the old 4.1c interface, rather than 4.2"
1641 : hpux, for one, puts all the socket stuff in socklib.o
1642 if $contains socklib libc.list >/dev/null 2>&1; then
1643 echo "Looks like you have Berkeley networking support."
1645 : we will have to assume that it supports the 4.2 BSD interface
1648 echo "Hmmm...you don't have Berkeley networking in libc.a..."
1649 : look for an optional networking library
1650 if test -f /usr/lib/libnet.a; then
1651 (ar t /usr/lib/libnet.a ||
1652 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
1653 if $contains socket libc.list >/dev/null 2>&1; then
1654 echo "but the Wollongong group seems to have hacked it in."
1656 sockethdr="-I/usr/netinclude"
1658 : now check for advanced features
1659 if $contains setsockopt libc.list >/dev/null 2>&1; then
1662 echo "...using the old 4.1c interface, rather than 4.2"
1666 echo "or even in libnet.a, which is peculiar."
1671 echo "or anywhere else I see."
1677 if $contains socketpair libc.list >/dev/null 2>&1; then
1678 d_sockpair="$define"
1683 : see if stat knows about block sizes
1685 if $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1686 if $contains 'st_blksize;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1687 echo "Your stat knows about block sizes."
1688 d_statblks="$define"
1690 echo "Your stat doesn't know about block sizes."
1694 echo "Your stat doesn't know about block sizes."
1698 : see if stdio is really std
1700 if $contains 'char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1701 if $contains '_cnt;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1702 echo "Your stdio is pretty std."
1703 d_stdstdio="$define"
1705 echo "Your stdio isn't very std."
1709 echo "Your stdio isn't very std."
1713 : check for structure copying
1715 echo "Checking to see if your C compiler can copy structs..."
1716 $cat >try.c <<'EOCP'
1726 if $cc -c try.c >/dev/null 2>&1 ; then
1727 d_strctcpy="$define"
1731 echo "Nope, it can't."
1735 : see if symlink exists
1736 set symlink d_symlink
1739 : see if syscall exists
1740 set syscall d_syscall
1743 : see if struct tm is defined in sys/time.h
1745 if $contains 'struct tm' /usr/include/time.h >/dev/null 2>&1 ; then
1746 echo "You have struct tm defined in <time.h> rather than <sys/time.h>."
1748 if test -f /usr/include/sys/time.h; then
1754 echo "You have struct tm defined in <sys/time.h> rather than <time.h>."
1759 : see if this is a varargs system
1761 if $test -r /usr/include/varargs.h ; then
1763 echo "varargs.h found."
1766 echo "No varargs.h found, but that's ok (I hope)."
1769 : see if there is a vfork
1773 : see if signal is declared as pointer to function returning int or void
1775 if $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 ; then
1776 echo "You have void (*signal())() instead of int."
1779 echo "You have int (*signal())() instead of void."
1783 : check for void type
1786 Checking to see how well your C compiler groks the void type...
1788 Support flag bits are:
1789 1: basic void declarations.
1790 2: arrays of pointers to functions returning void.
1791 4: operations between pointers to and addresses of void functions.
1794 case "$voidflags" in
1796 $cat >try.c <<'EOCP'
1802 extern void moo(); /* function returning void */
1803 void (*goo)(); /* ptr to func returning void */
1816 if $cc -S -DTRY=$defvoidused try.c >.out 2>&1 ; then
1817 voidflags=$defvoidused
1818 echo "It appears to support void."
1819 if $contains warning .out >/dev/null 2>&1; then
1820 echo "However, you might get some warnings that look like this:"
1824 echo "Hmm, your compiler has some difficulty with void. Checking further..."
1825 if $cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
1826 echo "It supports 1..."
1827 if $cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
1829 echo "And it supports 2 but not 4."
1831 echo "It doesn't support 2..."
1832 if $cc -S -DTRY=5 try.c >/dev/null 2>&1 ; then
1834 echo "But it supports 4."
1837 echo "And it doesn't support 4."
1841 echo "There is no support at all for void."
1847 rp="Your void support flags add up to what? [$dflt]"
1853 : see what type gids are declared as in the kernel
1856 if $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
1859 set `grep 'groups\[NGROUPS\];' /usr/include/sys/user.h 2>/dev/null` unsigned short
1861 unsigned) dflt="$1 $2" ;;
1871 rp="What type are group ids on this system declared as? [$dflt]"
1876 : see if this is an fcntl system
1878 if $test -r /usr/include/fcntl.h ; then
1880 echo "fcntl.h found."
1883 echo "No fcntl.h found, but that's ok."
1886 : see if this is an grp system
1888 if $test -r /usr/include/grp.h ; then
1893 echo "No grp.h found."
1896 : see if this is a sys/dir.h system
1898 if $test -r /usr/include/sys/dir.h ; then
1900 echo "sysdir.h found."
1903 echo "No sysdir.h found."
1906 : see if ioctl defs are in sgtty/termio or sys/ioctl
1908 if $test -r /usr/include/sys/ioctl.h ; then
1909 i_sysioctl="$define"
1910 echo "sys/ioctl.h found."
1913 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
1916 : see if this is a varargs system
1918 if $test -r /usr/include/varargs.h ; then
1920 echo "varargs.h found."
1923 echo "No varargs.h found, but that's ok (I hope)."
1926 : see if this is a vfork system
1928 if $test -r /usr/include/vfork.h ; then
1930 echo "vfork.h found."
1933 echo "No vfork.h found."
1936 : check for length of integer
1940 echo "Checking to see how big your integers are..."
1941 $cat >try.c <<'EOCP'
1945 printf("%d\n", sizeof(int));
1948 if $cc try.c -o try >/dev/null 2>&1 ; then
1952 echo "(I can't seem to compile the test program. Guessing...)"
1959 rp="What is the size of an integer (in bytes)? [$dflt]"
1965 : determine where private executables go
1968 dflt=/usr/lib/$package
1969 test -d /usr/local/lib && dflt=/usr/local/lib/$package
1976 The $package package has some auxiliary files that should be put in a library
1977 that is accessible by everyone. Where do you want to put these "private"
1979 $echo $n "but accessible files? [$dflt] $c"
1980 rp="Put private files where? [$dflt]"
1984 : check for size of random number generator
1988 echo "Checking to see how many bits your rand function produces..."
1989 $cat >try.c <<'EOCP'
1994 register unsigned long tmp;
1995 register unsigned long max = 0L;
1997 for (i=1000; i; i--) {
1998 tmp = (unsigned long)rand();
1999 if (tmp > max) max = tmp;
2006 if $cc try.c -o try >/dev/null 2>&1 ; then
2010 echo "(I can't seem to compile the test program...)"
2017 rp="How many bits does your rand() function produce? [$dflt]"
2023 : generate list of signal names
2027 echo "Generating a list of signal names..."
2028 set X `kill -l 2>/dev/null`
2031 0) echo 'kill -l' >/tmp/foo$$
2032 set X `/bin/csh -f </tmp/foo$$`
2035 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
2043 echo "Signals are: $sig_name"
2045 : see what type of char stdio uses.
2047 if $contains 'unsigned.*char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
2048 echo "Your stdio uses unsigned chars."
2049 stdchar="unsigned char"
2051 echo "Your stdio uses signed chars."
2055 : see what type uids are declared as in the kernel
2058 if $contains 'uid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
2061 set `grep '_ruid;' /usr/include/sys/user.h 2>/dev/null` unsigned short
2063 unsigned) dflt="$1 $2" ;;
2073 rp="What type are user ids on this system declared as? [$dflt]"
2078 : preserve RCS keywords in files with variable substitution, grrr
2083 : see if we should include -ldbm
2085 if $test -r /usr/lib/libdbm.a || $test -r /usr/local/lib/libdbm.a ; then
2089 ans=`loc libdbm.a x $libpth`
2092 echo "No dbm library found."
2096 echo "DBM library found in $ans."
2102 : see if we should include -lndir
2104 if $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a ; then
2105 echo "New directory library found."
2108 ans=`loc libndir.a x $libpth`
2111 echo "No ndir library found."
2115 echo "New directory library found in $ans."
2123 case "$d_readdir" in
2125 echo "Since you have readdir in the C library, I'll ignore $libndir"
2132 : see if we should include -lnm
2134 if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
2135 echo "New math library found."
2138 ans=`loc libnm.a x $libpth`
2141 echo "No nm library found--the normal math library will have to do."
2145 echo "New math library found in $ans."
2151 : determine which malloc to compile in
2153 case "$usemymalloc" in
2161 *) dflt="$usemymalloc"
2164 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
2172 y*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
2173 *) mallocsrc=''; mallocobj='';;
2177 echo "End of configuration questions."
2180 : create config.sh file
2182 if test -d ../UU; then
2185 echo "Creating config.sh..."
2186 $spitshell <<EOT >config.sh
2189 # This file was produced by running the Configure script.
2191 d_eunice='$d_eunice'
2192 eunicefix='$eunicefix'
2223 sendmail='$sendmail'
2247 byteorder='$byteorder'
2248 contains='$contains'
2249 cppstdin='$cppstdin'
2250 cppminus='$cppminus'
2253 d_charsprf='$d_charsprf'
2255 cryptlib='$cryptlib'
2256 d_dosuid='$d_dosuid'
2258 d_fchmod='$d_fchmod'
2259 d_fchown='$d_fchown'
2262 d_getgrps='$d_getgrps'
2263 d_gethent='$d_gethent'
2264 d_getpgrp='$d_getpgrp'
2265 d_getprior='$d_getprior'
2269 d_killpg='$d_killpg'
2270 d_memcmp='$d_memcmp'
2271 d_memcpy='$d_memcpy'
2275 d_readdir='$d_readdir'
2276 d_rename='$d_rename'
2278 d_setegid='$d_setegid'
2279 d_seteuid='$d_seteuid'
2280 d_setpgrp='$d_setpgrp'
2281 d_setprior='$d_setprior'
2282 d_setregid='$d_setregid'
2283 d_setresgid='$d_setresgid'
2284 d_setreuid='$d_setreuid'
2285 d_setresuid='$d_setresuid'
2286 d_setrgid='$d_setrgid'
2287 d_setruid='$d_setruid'
2288 d_socket='$d_socket'
2289 d_sockpair='$d_sockpair'
2290 d_oldsock='$d_oldsock'
2291 socketlib='$socketlib'
2292 sockethdr='$sockethdr'
2293 d_statblks='$d_statblks'
2294 d_stdstdio='$d_stdstdio'
2295 d_strctcpy='$d_strctcpy'
2296 d_symlink='$d_symlink'
2297 d_syscall='$d_syscall'
2298 d_tminsys='$d_tminsys'
2299 i_systime='$i_systime'
2300 d_varargs='$d_varargs'
2302 d_voidsig='$d_voidsig'
2303 d_vprintf='$d_vprintf'
2304 d_charvspr='$d_charvspr'
2306 i_dirent='$i_dirent'
2307 d_dirnamlen='$d_dirnamlen'
2311 d_pwquota='$d_pwquota'
2313 i_sysdir='$i_sysdir'
2314 i_sysioctl='$i_sysioctl'
2315 i_varargs='$i_varargs'
2322 mallocsrc='$mallocsrc'
2323 mallocobj='$mallocobj'
2324 usemymalloc='$usemymalloc'
2333 optimize='$optimize'
2341 randbits='$randbits'
2342 sig_name='$sig_name'
2343 spitshell='$spitshell'
2345 sharpbang='$sharpbang'
2349 voidflags='$voidflags'
2350 defvoidused='$defvoidused'
2361 echo "If you didn't make any mistakes, then just type a carriage return here."
2362 rp="If you need to edit config.sh, do it as a shell escape here:"
2367 *) : in case they cannot read
2373 echo "Doing variable substitutions on .SH files..."
2374 set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
2377 0) set x *.SH; shift;;
2379 if test ! -f $1; then
2385 dir=`$expr X$file : 'X\(.*\)/'`
2386 file=`$expr X$file : 'X.*/\(.*\)'`
2387 (cd $dir && . $file)
2394 if test -f config.h.SH; then
2395 if test ! -f config.h; then
2396 : oops, they left it out of MANIFEST, probably, so do it anyway.
2401 if $contains '^depend:' Makefile >/dev/null 2>&1; then
2405 Now you need to generate make dependencies by running "make depend".
2406 You might prefer to run it in background: "make depend > makedepend.out &"
2407 It can take a while, so you might not want to run it right now.
2410 rp="Run make depend now? [$dflt]"
2414 y*) make depend && echo "Now you must run a make."
2416 *) echo "You must run 'make depend' then 'make'."
2419 elif test -f Makefile; then
2421 echo "Now you must run a make."
2427 : the following is currently useless
2428 cd UU && $rm -f $rmlist
2429 : since this removes it all anyway