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 # $Id: Head.U,v 2.11 90/09/17 17:04:47 hokey Exp Locker: hokey $
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=".:$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';;
267 : get the name of the package
271 echo "Beginning of configuration questions for $package kit."
272 : Eunice requires " " instead of "", can you believe it
277 : change the next line if compiling for Xenix/286 on Xenix/386
278 xlibpth='/usr/lib/386 /lib/386'
279 libpth='/usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
280 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
281 trap 'echo " "; exit 1' 1 2 3
283 : We must find out about Eunice early
285 if test -f /etc/unixtovms; then
286 eunicefix=/etc/unixtovms
288 if test -f /etc/unixtovms.exe; then
289 eunicefix=/etc/unixtovms.exe
292 kit_has_binaries=false
293 attrlist="DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__"
294 attrlist="$attrlist __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
295 attrlist="$attrlist hp9000s300 hp9000s500 hp9000s800 hpux"
296 attrlist="$attrlist i186 i386 i8086 iAPX286 ibm interdata"
297 attrlist="$attrlist m68k m88k mc300 mc500 mc68000 mc68k mc700 mert"
298 attrlist="$attrlist ns16000 ns32000 nsc32000 os pdp11 posix pyr sinix"
299 attrlist="$attrlist sparc sun tower tower32 tower32_600 tower32_800 tss"
300 attrlist="$attrlist u3b2 u3b20 u3b200 u3b5 ultrix unix vax venix xenix"
301 attrlist="$attrlist z8000"
303 eoPATH="/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 /bsd43/usr/bin"
304 d_newshome="/usr/NeWS"
316 libswanted="net_s net nsl_s nsl socket nm ndir ndbm dbm sun m bsd BSD x c_s"
317 inclwanted='/usr/include /usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan'
319 : Now test for existence of everything in MANIFEST
321 echo "First let's make sure your kit is complete. Checking..."
322 if $kit_has_binaries; then
325 for i in `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST`
327 if test ! -f $i ; then
337 (cd ..; awk '{}' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$)
341 : some greps do not return status, grrr.
342 echo "grimblepritz" >contains.txt
343 if grep blurfldyick contains.txt >/dev/null 2>&1 ; then
345 elif grep grimblepritz contains.txt >/dev/null 2>&1 ; then
350 : the following should work in any shell
354 echo "AGH! Grep doesn't return a status. Attempting remedial action."
355 cat >contains <<'EOSS'
356 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
361 : see if sh knows # comments
363 echo "Checking your sh to see if it knows about # comments..."
364 if sh -c '#' >/dev/null 2>&1 ; then
365 echo "Your sh handles # comments correctly."
369 echo "Okay, let's see if #! works on this system..."
370 if test -f /bsd43/bin/echo; then
371 echo "#!/bsd43/bin/echo hi" > spit.sh
373 echo "#!/bin/echo hi" > spit.sh
378 if $contains hi today >/dev/null 2>&1; then
382 echo "#! /bin/echo hi" > spit.sh
386 if test -s today; then
395 echo "Your sh doesn't grok # comments--I will strip them later on."
397 echo "exec grep -v '^#'" >spitshell
400 spitshell=`pwd`/spitshell
401 echo "I presume that if # doesn't work, #! won't work either!"
405 : figure out how to guarantee sh startup
407 echo "Checking out how to guarantee sh startup..."
408 startsh=$sharpbang'/bin/sh'
409 echo "Let's see if '$startsh' works..."
421 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
424 : first determine how to suppress newline on echo command
425 echo "Checking echo to see how to suppress newlines..."
426 (echo "hi there\c" ; echo " ") >echotmp
427 if $contains c echotmp >/dev/null 2>&1 ; then
438 echo $n "Type carriage return to continue. Your cursor should be here-->$c"
441 : now set up to do reads with possible shell escape and default assignment
444 yes) ans=''; echo " " ;;
447 while expr "X\$ans" : "X!" >/dev/null; do
456 set \`expr "X\$ans" : "X!\(.*\)\$"\`
469 : general instructions
472 This installation shell script will examine your system and ask you questions
473 to determine how the $package package should be installed. If you get stuck
474 on a question, you may use a ! shell escape to start a subshell or execute
475 a command. Many of the questions will have default answers in square
476 brackets--typing carriage return will give you the default.
478 On some of the questions which ask for file or directory names you are
479 allowed to use the ~name construct to specify the login directory belonging
480 to "name", even if you don't have a shell which knows about that. Questions
481 where this is allowed will be marked "(~name ok)".
484 rp="[Type carriage return to continue]"
489 Much effort has been expended to ensure that this shell script will run on any
490 Unix system. If despite that it blows up on you, your best bet is to edit
491 Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
492 know how I blew it. If you can't run Configure for some reason, you'll have
493 to generate a config.sh file by hand.
495 This installation script affects things in two ways: 1) it may do direct
496 variable substitutions on some of the files included in this kit, and
497 2) it builds a config.h file for inclusion in C programs. You may edit
498 any of these files as the need arises after running this script.
500 If you make a mistake on a question, there is no easy way to back up to it
501 currently. The easiest thing to do is to edit config.sh and rerun all the
502 SH files. Configure will offer to let you do this before it runs the SH files.
505 rp="[Type carriage return to continue]"
509 : get old answers, if there is a config file out there
510 if test -f ../config.sh; then
513 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
517 n*) echo "OK, I'll ignore it.";;
518 *) echo "Fetching default answers from your old config.sh file..."
528 : find out where common programs are
530 echo "Locating common programs..."
543 if test -d \$dir/\$thing; then
549 if test -f \$dir/\$thing; then
552 elif test -f \$dir/\$thing.exe; then
553 : on Eunice apparently
590 pth=`echo :$boPATH:$PATH:$eoPATH: | sed -e 's/:/ /g'`
591 for file in $loclist; do
592 xxx=`./loc $file $file $pth`
597 echo $file is in $xxx.
600 echo "I don't know where $file is. I hope it's in everyone's PATH."
605 echo "Don't worry if any of the following aren't found..."
607 for file in $trylist; do
608 xxx=`./loc $file $file $pth`
613 echo $file is in $xxx.
616 echo "I don't see $file out there, $ans."
623 echo "Substituting grep for egrep."
629 echo "Hopefully test is built into your sh."
632 if sh -c "PATH= test true" >/dev/null 2>&1; then
633 echo "Using the test built into your sh."
643 echo "Hopefully echo is built into your sh."
647 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
648 $echo $n "hi there$c" >Loc1.txt
649 echo $n "hi there$c" >Loc2.txt
650 if cmp Loc1.txt Loc2.txt >/dev/null 2>&1; then
651 echo "They are compatible. In fact, they may be identical."
654 '-n') n='' c='\c' ans='\c' ;;
655 *) n='-n' c='' ans='-n' ;;
658 They are not compatible! You are probably running ksh on a non-USG system.
659 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
660 have echo built in and we may have to run some Bourne shell scripts. That
661 means I'll have to use $ans to suppress newlines now. Life is ridiculous.
664 rp="Your cursor should be here-->"
675 : set up shell script to do ~ expansion
681 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
684 if $test -f /bin/csh; then
685 /bin/csh -f -c "glob \$1"
688 name=\`$expr x\$1 : '..\([^/]*\)'\`
689 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
690 if $test ! -d "\$dir"; then
692 echo "\$me: can't locate home directory for: \$name" >&2
697 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
713 : determine where manual pages go
716 $package has manual pages available in source form.
720 echo "However, you don't have nroff, so they're probably useless to you."
727 echo "If you don't want the manual sources installed, answer 'none'."
730 dflt=`./loc . none /usr/man/local/man1 /usr/man/man.L /usr/man/manl /usr/man/mann /usr/man/u_man/man1 /usr/man/man1`
736 while $test "$cont" ; do
738 rp="Where do the manual pages (source) go (~name ok)? [$dflt]"
747 mansrc=`./filexp "$ans"`
748 if $test -d "$mansrc"; then
751 if $test "$fastread" = yes; then
756 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
794 : Sigh. Well, at least the box is fast...
797 case "$usrinclude" in
798 '') dflt='/usr/include';;
799 *) dflt=$usrinclude;;
802 if $test -f /bin/mips && /bin/mips; then
803 echo "Looks like a MIPS system..."
804 $cat >usrinclude.c <<'EOCP'
809 if cc -E usrinclude.c > usrinclude.out && $contains / usrinclude.out >/dev/null 2>&1 ; then
810 echo "and you're compiling with the BSD43 compiler and libraries."
811 dflt='/bsd43/usr/include'
814 echo "and you're compiling with the SysV compiler and libraries."
817 echo "Doesn't look like a MIPS system."
824 while $test "$cont" ; do
826 rp="Where are the include files you want to use? [$dflt]"
830 if $test -d $ans; then
833 if $test "$fastread" = yes; then
838 rp="Directory $ans doesn't exist. Use that name anyway? [$dflt]"
848 : make some quick guesses about what we are up against
850 cat $usrinclude/signal.h $usrinclude/sys/signal.h >guess.txt 2>/dev/null
851 if test "$usrinclude" = "/bsd43/usr/include" ; then
852 echo "Looks kind of like a SysV MIPS running BSD, but we'll see..."
856 elif test `echo abc | tr a-z A-Z` = Abc ; then
857 echo "Looks kind of like a USG system, but we'll see..."
861 elif $contains SIGTSTP guess.txt >/dev/null 2>&1 ; then
862 echo "Looks kind of like a BSD system, but we'll see..."
867 echo "Looks kind of like a version 7 system, but we'll see..."
875 There is, however, a strange, musty smell in the air that reminds me of
876 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
878 echo "exit 0" >eunice
883 echo "Congratulations. You aren't running Eunice."
885 echo "exit 1" >eunice
888 if test -f /xenix; then
889 echo "Actually, this looks more like a XENIX system..."
893 echo "It's not Xenix..."
898 if test -f /venix; then
899 echo "Actually, this looks more like a VENIX system..."
906 echo "Nor is it Venix..."
910 chmod +x bsd usg v7 eunice venix
911 $eunicefix bsd usg v7 eunice venix
913 : see what memory models we can support
916 : We may not use Cppsym or we get a circular dependency through cc.
917 : But this should work regardless of which cc we eventually use.
927 cc -o pdp11 pdp11.c >/dev/null 2>&1
928 if pdp11 2>/dev/null; then
931 ans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
934 *) if $test -d /lib/small || $test -d /usr/lib/small; then
939 if $test -d /lib/medium || $test -d /usr/lib/medium; then
942 if $test -d /lib/large || $test -d /usr/lib/large; then
945 if $test -d /lib/huge || $test -d /usr/lib/huge; then
955 Some systems have different model sizes. On most systems they are called
956 small, medium, large, and huge. On the PDP11 they are called unsplit and
957 split. If your system doesn't support different memory models, say "none".
958 If you wish to force everything to one memory model, say "none" here and
959 put the appropriate flags later when it asks you for other cc and ld flags.
960 Venix systems may wish to put "none" and let the compiler figure things out.
961 (In the following question multiple model names should be space separated.)
964 rp="Which models are supported? [$dflt]"
981 if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
982 $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
990 rp="What flag indicates separate I and D space? [$dflt]"
999 *large*|*small*|*medium*|*huge*)
1006 rp="What flag indicates large model? [$dflt]"
1022 rp="What flag indicates huge model? [$dflt]"
1038 rp="What flag indicates medium model? [$dflt]"
1046 *) medium="$large";;
1054 rp="What flag indicates small model? [$dflt]"
1066 echo "Unrecognized memory models--you may have to edit Makefile.SH"
1070 : see if we need a special compiler
1084 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1098 On some systems the default C compiler will not resolve multiple global
1099 references that happen to have the same name. On some such systems the
1100 "Mcc" command may be used to force these to be resolved. On other systems
1101 a "cc -M" command is required. (Note that the -M flag on other systems
1102 indicates a memory model to use!) If you have the Gnu C compiler, you
1103 might wish to use that instead. What command will force resolution on
1105 $echo $n "this system? [$dflt] $c"
1106 rp="Command to resolve multiple refs? [$dflt]"
1114 rp="Use which C compiler? [$dflt]"
1120 gcc*) cpp=`./loc gcc-cpp $cpp $pth`;;
1123 : determine optimize, if desired, or use for debug flag also
1134 Some C compilers have problems with their optimizers, by default, $package
1135 compiles with the -O flag to use the optimizer. Alternately, you might
1136 want to use the symbolic debugger, which uses the -g flag (on traditional
1137 Unix systems). Either flag can be specified here. To use neither flag,
1138 specify the word "none".
1141 rp="What optimizer/debugger flag should be used? [$dflt]"
1146 'none') optimize=" "
1152 *gcc*) dflt='-fpcc-struct-return';;
1156 *) dflt="$ccflags";;
1158 for thisincl in $inclwanted; do
1159 if test -d $thisincl; then
1160 if test "x$thisincl" != "x$usrinclude"; then
1163 *) dflt="$dflt -I$thisincl";;
1172 *) dflt="$dflt -DDEBUGGING";;
1176 if $contains 'LANGUAGE_C' $usrinclude/signal.h >/dev/null 2>&1; then
1179 *) dflt="$dflt -DLANGUAGE_C";;
1187 Your C compiler may want other flags. For this question you should
1188 include -I/whatever and -DWHATEVER flags and any other flags used by
1189 the C compiler, but you should NOT include libraries or ld flags like
1190 -lwhatever. To use no flags, specify the word "none".
1193 rp="Any additional cc flags? [$dflt]"
1201 : the following weeds options from ccflags that are of no interest to cpp
1204 *gcc*) cppflags="$cppflags -D__GNUC__";;
1212 -D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
1216 *-*) echo "(C preprocessor flags: $cppflags)";;
1228 *) dflt="$ldflags";;
1231 rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1240 echo "Checking for optional libraries..."
1245 case "$libswanted" in
1246 '') libswanted='c_s';;
1248 for thislib in $libswanted; do
1252 *) thatlib="${thislib}_s";;
1255 xxx=`./loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1256 if test -f $xxx; then
1257 echo "Found -l$thislib."
1259 *-l$thislib*|*-l$thatlib*);;
1260 *) dflt="$dflt -l$thislib";;
1263 xxx=`./loc lib$thislib.a X $libpth`
1264 if test -f $xxx; then
1268 *) dflt="$dflt $xxx";;
1271 xxx=`./loc Slib$thislib.a X $xlibpth`
1272 if test -f $xxx; then
1273 echo "Found -l$thislib."
1275 *-l$thislib*|*-l$thatlib*);;
1276 *) dflt="$dflt -l$thislib";;
1279 echo "No -l$thislib."
1293 Some versions of Unix support shared libraries, which make
1294 executables smaller but make load time slightly longer.
1296 On some systems, mostly newer Unix System V's, the shared library
1297 is included by putting the option "-lc_s" as the last thing on the
1298 cc command line when linking. Other systems use shared libraries
1299 by default. There may be other libraries needed to compile $package
1300 on your machine as well. If your system needs the "-lc_s" option,
1301 include it here. Include any other special libraries here as well.
1302 Say "none" for none.
1306 rp="Any additional libraries? [$dflt]"
1314 : check for size of random number generator
1316 case "$alignbytes" in
1318 echo "Checking alignment constraints..."
1319 $cat >try.c <<'EOCP'
1326 printf("%d\n", (char*)&try.bar - (char*)&try.foo);
1329 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
1333 echo "(I can't seem to compile the test program...)"
1340 rp="Doubles must be aligned on a how-many-byte boundary? [$dflt]"
1346 : determine where public executables go
1349 The following questions distinguish the directory in which executables
1350 reside from the directory in which they are installed (and from which they
1351 are presumably copied to the former directory by occult means). This
1352 distinction is often necessary under afs. On most other systems, however,
1353 the two directories are the same.
1358 dflt=`./loc . /usr/local/bin /usr/local/bin /usr/lbin /usr/local /usr/bin /bin`
1364 while $test "$cont" ; do
1365 rp="In which directory will public executables reside (~name ok)? [$dflt]"
1370 if test -d $bin; then
1377 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
1387 case "$installbin" in
1389 dflt=`echo $bin | sed 's#^/afs/#/afs/.#'`
1391 *) dflt="$installbin"
1395 while $test "$cont" ; do
1396 rp="In which directory will public executables be installed (~name ok)? [$dflt]"
1400 installbin=`./filexp $installbin`
1401 if test -d $installbin; then
1408 rp="Directory $installbin doesn't exist. Use that name anyway? [$dflt]"
1418 : check for ordering of bytes in a long
1419 case "$byteorder" in
1423 In the following, larger digits indicate more significance. A big-endian
1424 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
1425 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
1426 machines may have weird orders like 3412. A Cray will report 87654321. If
1427 the test program works the default is probably right.
1428 I'm now running the test program...
1430 $cat >byteorder.c <<'EOCP'
1437 char c[sizeof(long)];
1440 if (sizeof(long) > 4)
1441 u.l = (0x08070605 << 32) | 0x04030201;
1444 for (i=0; i < sizeof(long); i++)
1445 printf("%c",u.c[i]+'0');
1449 if $cc byteorder.c -o byteorder >/dev/null 2>&1 ; then
1452 ????|????????) echo "(The test program ran ok.)";;
1453 *) echo "(The test program didn't run right for some reason.)";;
1457 echo "(I can't seem to compile the test program. Guessing big-endian...)"
1465 rp="What is the order of bytes in a long? [$dflt]"
1470 : check for ability to cast negative floats to unsigned
1472 echo 'Checking to see if your C compiler can cast weird floats to unsigned'
1473 $cat >try.c <<'EOCP'
1479 unsigned long along;
1481 unsigned short ashort;
1484 signal(SIGFPE, SIG_IGN);
1485 along = (unsigned long)f;
1486 aint = (unsigned int)f;
1487 ashort = (unsigned short)f;
1488 if (along != (unsigned long)-123)
1490 if (aint != (unsigned int)-123)
1492 if (ashort != (unsigned short)-123)
1494 f = (double)0x40000000;
1497 along = (unsigned long)f;
1498 if (along != 0x80000000)
1502 along = (unsigned long)f;
1503 if (along != 0x7fffffff)
1507 along = (unsigned long)f;
1508 if (along != 0x80000001)
1513 if $cc -o try $ccflags try.c >/dev/null 2>&1; then
1519 case "$castflags" in
1520 0) d_castneg="$define"
1521 echo "Yup, it does."
1523 *) d_castneg="$undef"
1524 echo "Nope, it doesn't."
1529 : see how we invoke the C preprocessor
1531 echo "Now, how can we feed standard input to your C preprocessor..."
1532 cat <<'EOT' >testcpp.c
1537 echo 'Maybe "'"$cc"' -E" will work...'
1538 $cc -E <testcpp.c >testcpp.out 2>&1
1539 : try to force gcc preprocessor if that is the compiler they are using
1541 0) cppstdin="$cc -E";;
1545 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1546 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1548 cppstdin=`pwd`/cppstdin
1551 $cppstdin <testcpp.c >testcpp.out 2>&1
1556 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1557 echo "Yup, it does."
1561 echo 'Nope...maybe "'"$cc"' -E -" will work...'
1562 $cc -E - <testcpp.c >testcpp.out 2>&1
1563 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1564 echo "Yup, it does."
1568 echo 'No such luck, maybe "'$cpp'" will work...'
1569 $cpp <testcpp.c >testcpp.out 2>&1
1570 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1575 echo 'Nixed again...maybe "'$cpp' -" will work...'
1576 $cpp - <testcpp.c >testcpp.out 2>&1
1577 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1578 echo "Hooray, it works! I was beginning to wonder."
1582 echo 'Nope...maybe "'"$cc"' -P" will work...'
1583 $cc -P <testcpp.c >testcpp.out 2>&1
1584 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1585 echo "Yup, that does."
1589 echo 'Nope...maybe "'"$cc"' -P -" will work...'
1590 $cc -P - <testcpp.c >testcpp.out 2>&1
1591 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1592 echo "Yup, that does."
1596 echo 'Hmm...perhaps you already told me...'
1599 *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
1601 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1602 echo "Hooray, you did! I was beginning to wonder."
1604 echo 'Uh-uh. Time to get fancy...'
1606 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1607 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1609 cppstdin=`pwd`/cppstdin
1612 $cppstdin <testcpp.c >testcpp.out 2>&1
1613 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1617 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
1618 rp='Name a C preprocessor:'
1621 $cppstdin <testcpp.c >testcpp.out 2>&1
1622 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1623 echo "OK, that will do."
1625 echo "Sorry, I can't get that to work. Go find one."
1637 : get list of predefined functions in a handy place
1643 '') if test -f /mach_boot; then
1645 elif test -d /usr/ccs/lib; then
1652 : on mips, we DO NOT want /lib, and we want inclPath/usr/lib
1655 libpth='$inclPath/usr/lib /usr/local/lib'
1658 libpth='/usr/ccs/lib /lib /usr/lib /usr/ucblib /usr/local/lib'
1663 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
1668 *) for thislib in $libs; do
1670 -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
1671 try=`./loc lib$thislib.a blurfl/dyick $libpth`
1672 if test ! -f $try; then
1673 try=`./loc lib$thislib blurfl/dyick $libpth`
1674 if test ! -f $try; then
1675 try=`./loc $thislib blurfl/dyick $libpth`
1676 if test ! -f $try; then
1677 try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
1678 if test ! -f $try; then
1684 libnames="$libnames $try"
1686 *) libnames="$libnames $thislib" ;;
1691 set /usr/ccs/lib/libc.so
1692 test -f $1 || set /usr/lib/libc.so
1693 test -f $1 || set /usr/lib/libc.so.[0-9]*
1694 test -f $1 || set /lib/libsys_s.a
1696 if test -f "$1"; then
1697 echo "Your shared C library is in $1."
1699 elif test -f $libc; then
1700 echo "Your C library is in $libc, like you said before."
1701 elif test -f /lib/libc.a; then
1702 echo "Your C library is in /lib/libc.a. You're normal."
1705 if ans=`./loc libc.a blurfl/dyick $libpth`; test -f "$ans"; then
1707 elif ans=`./loc libc blurfl/dyick $libpth`; test -f "$ans"; then
1708 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
1709 elif ans=`./loc clib blurfl/dyick $libpth`; test -f "$ans"; then
1711 elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1713 elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1715 elif ans=`./loc Llibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1718 if test -f "$ans"; then
1719 echo "Your C library is in $ans, of all places."
1724 I can't seem to find your C library. I've looked in the following places:
1728 None of these seems to contain your C library. What is the full name
1731 $echo $n "of your C library? $c"
1732 rp='C library full name?'
1738 if test $libc = "/lib/libc"; then
1739 libc="$libc /lib/clib"
1741 set `echo $libc $libnames | tr ' ' '\012' | sort | uniq`
1742 $echo $n "Extracting names from $* for later perusal...$c"
1743 nm $nm_opts $* 2>/dev/null >libc.tmp
1744 $sed -n -e 's/^.* [ATDS] *[_.]*//p' -e 's/^.* [ATDS] //p' <libc.tmp >libc.list
1745 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1747 elif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \
1748 <libc.tmp >libc.list; \
1749 $contains '^printf$' libc.list >/dev/null 2>&1; then
1751 elif $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list; \
1752 $contains '^printf$' libc.list >/dev/null 2>&1; then
1754 elif $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list; \
1755 $contains '^printf$' libc.list >/dev/null 2>&1; then
1757 elif $sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' \
1758 <libc.tmp >libc.list; \
1759 $contains '^printf$' libc.list >/dev/null 2>&1; then
1761 elif $grep '|' <libc.tmp | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
1762 -e 's/^\([^ ]*\).*/\1/p' >libc.list
1763 $contains '^printf$' libc.list >/dev/null 2>&1; then
1765 elif $sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p' \
1766 <libc.tmp >libc.list; \
1767 $contains '^printf$' libc.list >/dev/null 2>&1; then
1770 nm -p $* 2>/dev/null >libc.tmp
1771 $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
1772 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1777 echo "nm didn't seem to work right."
1778 echo "Trying ar instead..."
1779 if ar t $libc > libc.tmp; then
1780 for thisname in $libnames; do
1781 ar t $thisname >>libc.tmp
1783 $sed -e 's/\.o$//' < libc.tmp > libc.list
1786 echo "ar didn't seem to work right."
1787 echo "Maybe this is a Cray...trying bld instead..."
1788 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
1789 for thisname in $libnames; do
1791 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
1792 ar t $thisname >>libc.tmp
1796 echo "That didn't work either. Giving up."
1804 if $contains "^$1\$" libc.list >/dev/null 2>&1;
1805 then echo "$1() found"; eval "$2=$define";
1806 else echo "$1() not found"; eval "$2=$undef"; fi'
1808 : see if bcmp exists
1812 : see if bcopy exists
1816 : see if bzero exists
1820 : see if sprintf is declared as int or pointer to char
1822 cat >ucbsprf.c <<'EOF'
1823 main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
1825 if $cc $ccflags ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then
1826 echo "Your sprintf() returns (int)."
1829 echo "Your sprintf() returns (char*)."
1830 d_charsprf="$define"
1833 : see if vprintf exists
1835 if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
1836 echo 'vprintf() found.'
1838 cat >vprintf.c <<'EOF'
1839 #include <varargs.h>
1841 main() { xxx("foo"); }
1850 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
1853 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
1854 echo "Your vsprintf() returns (int)."
1857 echo "Your vsprintf() returns (char*)."
1858 d_charvspr="$define"
1861 echo 'vprintf() not found.'
1866 : see if chsize exists
1870 : see if crypt exists
1872 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
1873 echo 'crypt() found.'
1877 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
1878 if $test -z "$cryptlib"; then
1879 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
1883 if $test -z "$cryptlib"; then
1884 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
1888 if $test -z "$cryptlib"; then
1889 cryptlib=`./loc libcrypt.a "" $libpth`
1893 if $test -z "$cryptlib"; then
1894 echo 'crypt() not found.'
1901 : get csh whereabouts
1903 'csh') d_csh="$undef" ;;
1904 *) d_csh="$define" ;;
1907 : see if readdir exists
1908 set readdir d_readdir
1911 : see if there are directory access routines out there
1913 xxx=`./loc ndir.h x $usrinclude /usr/local/include $inclwanted`
1916 xxx=`./loc sys/ndir.h x $usrinclude /usr/local/include $inclwanted`
1919 d_dirnamlen="$undef"
1928 if $test -r $usrinclude/dirent.h; then
1929 echo "dirent.h found."
1930 if $contains 'd_namlen' $usrinclude/dirent.h >/dev/null 2>&1; then
1931 d_dirnamlen="$define"
1934 elif $test -r $xxx; then
1935 echo "You seem to use <$xxx>,"
1936 if $test "$d_readdir" = "$define"; then
1937 echo "and I can get readdir() from your C library."
1938 elif $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a; then
1939 echo "and I'll get the routines using -lndir ."
1942 ans=`./loc libndir.a x $libpth`
1945 echo "but I can't find the ndir library!"
1948 echo "and I found the directory library in $ans."
1953 if $contains 'd_namlen' $xxx >/dev/null 2>&1; then
1954 d_dirnamlen="$define"
1958 i_sys_ndir="$define"
1965 # The next line used to require this to be a bsd system.
1966 if $contains '^readdir$' libc.list >/dev/null 2>&1 ; then
1967 echo "No ndir library found, but you have readdir() so we'll use that."
1968 if $contains 'd_namlen' $usrinclude/sys/dir.h >/dev/null 2>&1; then
1969 d_dirnamlen="$define"
1973 echo "No ndir library found--using ./$d_ndir.c."
1974 # This will lose since $d_ndir.h is in another directory.
1975 # I doubt we can rely on it being in ../$d_ndir.h .
1976 # At least it will fail in a conservative manner.
1977 if $contains 'd_namlen' $d_ndir.h >/dev/null 2>&1; then
1978 d_dirnamlen="$define"
1986 : now see if they want to do setuid emulation
1994 Some sites have disabled setuid #! scripts because of a bug in the kernel
1995 that prevents them from being secure. If you are on such a system, the
1996 setuid/setgid bits on scripts are currently useless. It is possible for
1997 $package to detect those bits and emulate setuid/setgid in a secure fashion
1998 until a better solution is devised for the kernel problem.
2001 rp="Do you want to do setuid/setgid emulation? [$dflt]"
2008 y*) d_dosuid="$define";;
2009 *) d_dosuid="$undef";;
2012 : see if dup2 exists
2016 : see if fchmod exists
2020 : see if fchown exists
2024 : see if this is an fcntl system
2028 : see if we can have long filenames
2030 rm -f 123456789abcde
2031 if (echo hi >123456789abcdef) 2>/dev/null; then
2033 if test -f 123456789abcde; then
2034 echo 'You cannot have filenames longer than 14 characters. Sigh.'
2037 echo 'You can have filenames longer than 14 characters.'
2038 d_flexfnam="$define"
2041 : version 8 probably
2042 echo "You can't have filenames longer than 14 chars. V8 can't even think about them!"
2045 : see if flock exists
2049 : see if getgroups exists
2050 set getgroups d_getgrps
2053 : see if gethostent exists
2054 set gethostent d_gethent
2057 : see if getpgrp exists
2058 set getpgrp d_getpgrp
2061 : see if getpgrp2 exists
2062 set getpgrp2 d_getpgrp2
2065 : see if getpriority exists
2066 set getpriority d_getprior
2069 : see if htonl exists
2079 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
2080 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2081 echo "Your system has both index() and strchr(). Shall I use"
2082 rp="index() rather than strchr()? [$dflt]"
2086 n*) d_index="$define" ;;
2087 *) d_index="$undef" ;;
2091 echo "index() found."
2094 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2096 echo "strchr() found."
2098 echo "No index() or strchr() found!"
2103 : see if killpg exists
2107 : see if lstat exists
2111 : see if memcmp exists
2115 : see if memcpy exists
2119 : see if mkdir exists
2123 : see if msgctl exists
2127 : see if msgget exists
2131 : see if msgsnd exists
2135 : see if msgrcv exists
2139 : see how much of the 'msg*(2)' library is present.
2142 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
2143 *undef*) h_msg=false;;
2145 : we could also check for sys/ipc.h ...
2146 if $h_msg && $test -r $usrinclude/sys/msg.h; then
2147 echo "You have the full msg*(2) library."
2150 echo "You don't have the full msg*(2) library."
2154 : see if ndbm is available
2156 xxx=`./loc ndbm.h x $usrinclude /usr/local/include $inclwanted`
2157 if test -f $xxx; then
2159 echo "ndbm.h found."
2162 echo "ndbm.h not found."
2165 : see if we have the old dbm
2167 xxx=`./loc dbm.h x $usrinclude /usr/local/include $inclwanted`
2168 if test -f $xxx; then
2173 echo "dbm.h not found."
2176 : see whether socket exists
2179 if $contains socket libc.list >/dev/null 2>&1; then
2180 echo "Looks like you have Berkeley networking support."
2182 : now check for advanced features
2183 if $contains setsockopt libc.list >/dev/null 2>&1; then
2186 echo "...but it uses the old 4.1c interface, rather than 4.2"
2190 : hpux, for one, puts all the socket stuff in socklib.o
2191 if $contains socklib libc.list >/dev/null 2>&1; then
2192 echo "Looks like you have Berkeley networking support."
2194 : we will have to assume that it supports the 4.2 BSD interface
2197 echo "Hmmm...you don't have Berkeley networking in libc.a..."
2198 : look for an optional networking library
2199 if test -f /usr/lib/libnet.a; then
2200 (ar t /usr/lib/libnet.a ||
2201 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
2202 if $contains socket libc.list >/dev/null 2>&1; then
2203 echo "but the Wollongong group seems to have hacked it in."
2204 socketlib="-lnet -lnsl_s"
2206 : now check for advanced features
2207 if $contains setsockopt libc.list >/dev/null 2>&1; then
2210 echo "...using the old 4.1c interface, rather than 4.2"
2214 echo "or even in libnet.a, which is peculiar."
2219 echo "or anywhere else I see."
2225 if $contains socketpair libc.list >/dev/null 2>&1; then
2226 d_sockpair="$define"
2231 : Locate the flags for 'open()'
2233 $cat >open3.c <<'EOCP'
2234 #include <sys/types.h>
2239 #include <sys/file.h>
2252 : check sys/file.h first to get FREAD on Sun
2253 if $test -r $usrinclude/sys/file.h && \
2254 $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
2256 echo "sys/file.h defines the O_* constants..."
2258 echo "and you have the 3 argument form of open()."
2261 echo "but not the 3 argument form of open(). Oh, well."
2264 elif $test -r $usrinclude/fcntl.h && \
2265 $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
2267 echo "fcntl.h defines the O_* constants..."
2269 echo "and you have the 3 argument form of open()."
2272 echo "but not the 3 argument form of open(). Oh, well."
2277 echo "I can't find the O_* constant definitions! You got problems."
2280 : see if how pwd stuff is defined
2282 if $test -r $usrinclude/pwd.h ; then
2285 $cppstdin $cppflags <$usrinclude/pwd.h >pwd.txt
2286 if $contains 'pw_quota' pwd.txt >/dev/null 2>&1; then
2291 if $contains 'pw_age' pwd.txt >/dev/null 2>&1; then
2296 if $contains 'pw_change' pwd.txt >/dev/null 2>&1; then
2297 d_pwchange="$define"
2301 if $contains 'pw_class' pwd.txt >/dev/null 2>&1; then
2306 if $contains 'pw_expire' pwd.txt >/dev/null 2>&1; then
2307 d_pwexpire="$define"
2311 if $contains 'pw_comment' pwd.txt >/dev/null 2>&1; then
2312 d_pwcomment="$define"
2314 d_pwcomment="$undef"
2323 d_pwcomment="$undef"
2324 echo "No pwd.h found."
2327 : see if rename exists
2331 : see if rmdir exists
2335 : see if select exists
2339 : see if semctl exists
2343 : see if semget exists
2347 : see if semop exists
2351 : see how much of the 'sem*(2)' library is present.
2354 case "$d_semctl$d_semget$d_semop" in
2355 *undef*) h_sem=false;;
2357 : we could also check for sys/ipc.h ...
2358 if $h_sem && $test -r $usrinclude/sys/sem.h; then
2359 echo "You have the full sem*(2) library."
2362 echo "You don't have the full sem*(2) library."
2366 : see if setegid exists
2367 set setegid d_setegid
2370 : see if seteuid exists
2371 set seteuid d_seteuid
2374 : see if setpgrp exists
2375 set setpgrp d_setpgrp
2378 : see if setpgrp2 exists
2379 set setpgrp2 d_setpgrp2
2382 : see if setpriority exists
2383 set setpriority d_setprior
2386 : see if setregid exists
2387 set setregid d_setregid
2389 set setresgid d_setresgid
2392 : see if setreuid exists
2393 set setreuid d_setreuid
2395 set setresuid d_setresuid
2398 : see if setrgid exists
2399 set setrgid d_setrgid
2402 : see if setruid exists
2403 set setruid d_setruid
2406 : see if shmctl exists
2410 : see if shmget exists
2414 : see if shmat exists
2418 : see if shmdt exists
2422 : see how much of the 'shm*(2)' library is present.
2425 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
2426 *undef*) h_shm=false;;
2428 : we could also check for sys/ipc.h ...
2429 if $h_shm && $test -r $usrinclude/sys/shm.h; then
2430 echo "You have the full shm*(2) library."
2433 echo "You don't have the full shm*(2) library."
2437 : see if stat knows about block sizes
2439 if $contains 'st_blocks;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2440 if $contains 'st_blksize;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2441 echo "Your stat knows about block sizes."
2442 d_statblks="$define"
2444 echo "Your stat doesn't know about block sizes."
2448 echo "Your stat doesn't know about block sizes."
2452 : see if stdio is really std
2454 if $contains 'char.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2455 if $contains '_cnt;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2456 echo "Your stdio is pretty std."
2457 d_stdstdio="$define"
2459 echo "Your stdio isn't very std."
2463 echo "Your stdio isn't very std."
2467 : check for structure copying
2469 echo "Checking to see if your C compiler can copy structs..."
2470 $cat >strctcpy.c <<'EOCP'
2480 if $cc -c strctcpy.c >/dev/null 2>&1 ; then
2481 d_strctcpy="$define"
2485 echo "Nope, it can't."
2488 : see if strerror exists
2489 set strerror d_strerror
2492 : see if symlink exists
2493 set symlink d_symlink
2496 : see if syscall exists
2497 set syscall d_syscall
2500 : set if package uses struct tm
2503 : set if package uses struct timeval
2506 : set if package uses localtime function
2509 : see which of time.h, sys/time.h, and sys/select should be included.
2513 Testing to see which of <time.h>, <sys/time.h>, and <sys/select.h>
2514 should be included, because this application wants:
2517 case "$w_s_itimer" in
2519 echo " struct itimerval"
2520 idefs="-DS_ITIMERVAL $idefs"
2523 case "$w_s_timevl" in
2525 echo " struct timeval"
2526 idefs="-DS_TIMEVAL $idefs"
2532 idefs="-DS_TM $idefs"
2535 case "$w_localtim" in
2537 echo " ctime(3) declarations"
2538 idefs="-DD_CTIME $idefs"
2543 echo " (something I don't know about)"
2547 echo "I'm now running the test program..."
2548 $cat >i_time.c <<'EOCP'
2549 #include <sys/types.h>
2554 #ifdef SYSTIMEKERNEL
2557 #include <sys/time.h>
2560 #include <sys/select.h>
2570 struct itimerval baz;
2573 if (foo.tm_sec == foo.tm_sec)
2576 if (bar.tv_sec == bar.tv_sec)
2580 if (baz.it_interval == baz.it_interval)
2584 if (bar.tv_sec == bar.tv_sec)
2588 /* this might not do anything for us... */
2589 tmp = localtime((time_t *)0);
2595 for i_sys_select in '' '-DI_SYS_SELECT'; do
2596 for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
2597 for i_time in '' '-DI_TIME'; do
2598 for i_systime in '-DI_SYS_TIME' ''; do
2600 '') echo Trying $i_time $i_systime $d_systimekernel $i_sys_select
2601 if $cc $ccflags i_time.c $idefs \
2602 $i_time $i_systime $d_systimekernel $i_sys_select \
2603 -o i_time >/dev/null 2>&1 ; then
2604 set X $i_time $i_systime $d_systimekernel $i_sys_select
2607 echo Succeeded with $flags
2616 *SYSTIMEKERNEL*) d_systimekernel="$define";;
2617 *) d_systimekernel="$undef";;
2620 *I_TIME*) i_time="$define";;
2621 *) i_time="$undef";;
2624 *I_SYS_SELECT*) i_sys_select="$define";;
2625 *) i_sys_select="$undef";;
2628 *I_SYS_TIME*) i_sys_time="$define";;
2629 *) i_sys_time="$undef";;
2632 : see if signal is declared as pointer to function returning int or void
2634 $cppstdin $cppflags $cppminus < $usrinclude/signal.h >d_voidsig.txt
2635 if $contains 'void.*signal' d_voidsig.txt >/dev/null 2>&1 ; then
2636 echo "You have void (*signal())() instead of int."
2639 echo "You have int (*signal())() instead of void."
2643 : see if truncate exists
2644 set truncate d_truncate
2647 : see if there is a vfork
2651 : check for volatile keyword
2653 echo 'Checking to see if your C compiler knows about "volatile"...'
2654 $cat >try.c <<'EOCP'
2657 typedef unsigned short foo_t;
2660 volatile foo_t blech;
2664 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
2665 d_volatile="$define"
2666 echo "Yup, it does."
2669 echo "Nope, it doesn't."
2673 : see if there is a wait4
2677 : see if there is a waitpid
2678 set waitpid d_waitpid
2681 : see what type gids are declared as in the kernel
2685 if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2687 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2689 elif $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
2692 set `grep 'groups\[NGROUPS\];' $usrinclude/sys/user.h 2>/dev/null` unsigned short
2694 unsigned) dflt="$1 $2" ;;
2703 echo "(The following only matters if you have getgroups().)"
2704 rp="What type are the group ids returned by getgroups()? [$dflt]"
2709 : check for length of integer
2713 echo "Checking to see how big your integers are..."
2714 $cat >intsize.c <<'EOCP'
2718 printf("%d\n", sizeof(int));
2721 if $cc intsize.c -o intsize >/dev/null 2>&1 ; then
2725 echo "(I can't seem to compile the test program. Guessing...)"
2732 rp="What is the size of an integer (in bytes)? [$dflt]"
2737 : determine where private executables go
2740 dflt=/usr/lib/$package
2741 test -d /usr/local/lib && dflt=/usr/local/lib/$package
2748 The $package package has some auxiliary files that should be reside in a library
2749 that is accessible by everyone. Where should these "private" but accessible
2751 $echo $n "files reside? (~name ok) [$dflt] $c"
2752 rp="Private files will reside where? [$dflt]"
2754 privlib=`./filexp "$ans"`
2756 case "$installprivlib" in
2758 dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'`
2760 *) dflt="$installprivlib"
2765 On some systems (such as afs) you have to install the library files in a
2766 different directory to get them to go to the right place. Where should the
2768 $echo $n "library files be installed? (~name ok) [$dflt] $c"
2769 rp="Install private files where? [$dflt]"
2771 installprivlib=`./filexp "$ans"`
2773 : check for size of random number generator
2777 echo "Checking to see how many bits your rand function produces..."
2778 $cat >randbits.c <<'EOCP'
2783 register unsigned long tmp;
2784 register unsigned long max = 0L;
2786 for (i=1000; i; i--) {
2787 tmp = (unsigned long)rand();
2788 if (tmp > max) max = tmp;
2795 if $cc randbits.c -o randbits >/dev/null 2>&1 ; then
2799 echo "(I can't seem to compile the test program...)"
2806 rp="How many bits does your rand() function produce? [$dflt]"
2811 : determine where public executables go
2812 case "$scriptdir" in
2815 : guess some guesses
2816 test -d /usr/share/scripts && dflt=/usr/share/scripts
2817 test -d /usr/share/bin && dflt=/usr/share/bin
2819 *) dflt="$scriptdir"
2825 Some installations have a separate directory just for executable scripts so
2826 that they can mount it across multiple architectures but keep the scripts in
2827 one spot. You might, for example, have a subdirectory of /usr/share for this.
2828 Or you might just lump your scripts in with all your other executables.
2831 while $test "$cont" ; do
2832 rp="Where do you keep publicly executable scripts (~name ok)? [$dflt]"
2836 scriptdir=`./filexp "$scriptdir"`
2837 if test -d $scriptdir; then
2844 rp="Directory $scriptdir doesn't exist. Use that name anyway? [$dflt]"
2854 : generate list of signal names
2858 echo "Generating a list of signal names..."
2859 set X `cat $usrinclude/signal.h $usrinclude/sys/signal.h 2>&1 | awk '
2860 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
2861 sig[$3] = substr($2,4,20)
2862 if (max < $3 && $3 < 60) {
2868 for (i=1; i<=max; i++) {
2881 0) echo 'kill -l' >/tmp/foo$$
2882 set X `$csh -f </tmp/foo$$`
2885 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
2893 echo "Signals are: $sig_name"
2895 : see what type of char stdio uses.
2897 if $contains 'unsigned.*char.*_ptr;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2898 echo "Your stdio uses unsigned chars."
2899 stdchar="unsigned char"
2901 echo "Your stdio uses signed chars."
2905 : see what type uids are declared as in the kernel
2908 if $contains 'uid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
2911 set `grep '_ruid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
2913 unsigned) dflt="$1 $2" ;;
2923 rp="What type are user ids returned by getuid(), etc.? [$dflt]"
2928 : check for void type
2931 Checking to see how well your C compiler groks the void type...
2933 Support flag bits are:
2934 1: basic void declarations.
2935 2: arrays of pointers to functions returning void.
2936 4: operations between pointers to and addresses of void functions.
2941 $cat >void.c <<'EOCP'
2947 extern void moo(); /* function returning void */
2948 void (*goo)(); /* ptr to func returning void */
2961 if $cc -S -DTRY=$voidwant void.c >void.out 2>&1 ; then
2963 echo "It appears to support void to the level $package wants ($voidwant)."
2964 if $contains warning void.out >/dev/null 2>&1; then
2965 echo "However, you might get some warnings that look like this:"
2969 echo "Hmm, your compiler has some difficulty with void. Checking further..."
2970 if $cc -S -DTRY=1 void.c >/dev/null 2>&1 ; then
2971 echo "It supports 1..."
2972 if $cc -S -DTRY=3 void.c >/dev/null 2>&1 ; then
2974 echo "And it supports 2 but not 4."
2976 echo "It doesn't support 2..."
2977 if $cc -S -DTRY=5 void.c >/dev/null 2>&1 ; then
2979 echo "But it supports 4."
2982 echo "And it doesn't support 4."
2986 echo "There is no support at all for void."
2992 rp="Your void support flags add up to what? [$dflt]"
2997 : preserve RCS keywords in files with variable substitution, grrr
3003 : determine which malloc to compile in
3005 case "$usemymalloc" in
3013 *) dflt="$usemymalloc"
3016 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
3024 y*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
3025 *) mallocsrc=''; mallocobj='';;
3028 : determine compiler compiler
3033 dflt='yacc -Sm25000'
3040 rp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]"
3048 : see if we can include fcntl.h
3052 echo "We'll be including <fcntl.h>."
3055 if $h_sys_file; then
3056 echo "We don't need to <fcntl.h> if we include <sys/file.h>."
3058 echo "We won't be including <fcntl.h>."
3062 : see if gdbm is available
3064 xxx=`./loc gdbm.h x $usrinclude /usr/local/include $inclwanted`
3065 if test -f $xxx; then
3067 echo "gdbm.h found."
3070 echo "gdbm.h not found."
3073 : see if this is an grp system
3075 if $test -r $usrinclude/grp.h ; then
3080 echo "No grp.h found."
3083 : see if this is a netinet/in.h or sys/in.h system
3085 xxx=`./loc netinet/in.h x $usrinclude /usr/local/include $inclwanted`
3086 if test -f $xxx; then
3089 echo "netinet/in.h found."
3092 echo "No netinet/in.h found, ..."
3093 xxx=`./loc sys/in.h x $usrinclude /usr/local/include $inclwanted`
3094 if test -f $xxx; then
3096 echo "but I found sys/in.h instead."
3099 echo "and I didn't find sys/in.h either."
3103 : Do we need to #include <sys/file.h> ?
3105 if $h_sys_file; then
3106 i_sys_file="$define"
3107 echo "We'll be including <sys/file.h>."
3110 echo "We won't be including <sys/file.h>."
3113 : see if ioctl defs are in sgtty/termio or sys/ioctl
3115 if $test -r $usrinclude/sys/ioctl.h ; then
3116 i_sysioctl="$define"
3117 echo "sys/ioctl.h found."
3120 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
3123 : see if we should include utime.h
3125 if $test -r $usrinclude/utime.h ; then
3127 echo "utime.h found."
3130 echo "No utime.h found, but that's ok."
3133 : see if this is a varargs system
3135 if $test -r $usrinclude/varargs.h ; then
3137 echo "varargs.h found."
3140 echo "No varargs.h found, but that's ok (I hope)."
3143 : see if this is a vfork system
3145 if $test -r $usrinclude/vfork.h ; then
3147 echo "vfork.h found."
3150 echo "No vfork.h found."
3153 : end of configuration questions
3155 echo "End of configuration questions."
3158 : create config.sh file
3160 if test -d ../UU; then
3163 echo "Creating config.sh..."
3164 $spitshell <<EOT >config.sh
3167 # This file was produced by running the Configure script.
3169 kit_has_binaries='$kit_has_binaries'
3170 d_eunice='$d_eunice'
3172 eunicefix='$eunicefix'
3202 sendmail='$sendmail'
3232 alignbytes='$alignbytes'
3234 installbin='$installbin'
3235 byteorder='$byteorder'
3236 contains='$contains'
3237 cppstdin='$cppstdin'
3238 cppminus='$cppminus'
3242 d_castneg='$d_castneg'
3243 castflags='$castflags'
3244 d_charsprf='$d_charsprf'
3245 d_chsize='$d_chsize'
3247 cryptlib='$cryptlib'
3249 d_dosuid='$d_dosuid'
3251 d_fchmod='$d_fchmod'
3252 d_fchown='$d_fchown'
3254 d_flexfnam='$d_flexfnam'
3256 d_getgrps='$d_getgrps'
3257 d_gethent='$d_gethent'
3258 d_getpgrp='$d_getpgrp'
3259 d_getpgrp2='$d_getpgrp2'
3260 d_getprior='$d_getprior'
3263 d_killpg='$d_killpg'
3265 d_memcmp='$d_memcmp'
3266 d_memcpy='$d_memcpy'
3269 d_msgctl='$d_msgctl'
3270 d_msgget='$d_msgget'
3271 d_msgrcv='$d_msgrcv'
3272 d_msgsnd='$d_msgsnd'
3276 d_readdir='$d_readdir'
3277 d_rename='$d_rename'
3279 d_select='$d_select'
3281 d_semctl='$d_semctl'
3282 d_semget='$d_semget'
3284 d_setegid='$d_setegid'
3285 d_seteuid='$d_seteuid'
3286 d_setpgrp='$d_setpgrp'
3287 d_setpgrp2='$d_setpgrp2'
3288 d_setprior='$d_setprior'
3289 d_setregid='$d_setregid'
3290 d_setresgid='$d_setresgid'
3291 d_setreuid='$d_setreuid'
3292 d_setresuid='$d_setresuid'
3293 d_setrgid='$d_setrgid'
3294 d_setruid='$d_setruid'
3297 d_shmctl='$d_shmctl'
3299 d_shmget='$d_shmget'
3300 d_socket='$d_socket'
3301 d_sockpair='$d_sockpair'
3302 d_oldsock='$d_oldsock'
3303 socketlib='$socketlib'
3304 d_statblks='$d_statblks'
3305 d_stdstdio='$d_stdstdio'
3306 d_strctcpy='$d_strctcpy'
3307 d_strerror='$d_strerror'
3308 d_symlink='$d_symlink'
3309 d_syscall='$d_syscall'
3310 d_truncate='$d_truncate'
3312 d_voidsig='$d_voidsig'
3313 d_tosignal='$d_tosignal'
3314 d_volatile='$d_volatile'
3315 d_vprintf='$d_vprintf'
3316 d_charvspr='$d_charvspr'
3318 d_waitpid='$d_waitpid'
3326 d_pwquota='$d_pwquota'
3328 d_pwchange='$d_pwchange'
3329 d_pwclass='$d_pwclass'
3330 d_pwexpire='$d_pwexpire'
3331 d_pwcomment='$d_pwcomment'
3332 i_sys_file='$i_sys_file'
3333 i_sysioctl='$i_sysioctl'
3335 i_sys_time='$i_sys_time'
3336 i_sys_select='$i_sys_select'
3337 d_systimekernel='$d_systimekernel'
3339 i_varargs='$i_varargs'
3345 i_my_dir='$i_my_dir'
3347 i_sys_ndir='$i_sys_ndir'
3348 i_dirent='$i_dirent'
3349 i_sys_dir='$i_sys_dir'
3350 d_dirnamlen='$d_dirnamlen'
3353 mallocsrc='$mallocsrc'
3354 mallocobj='$mallocobj'
3355 usemymalloc='$usemymalloc'
3364 optimize='$optimize'
3366 cppflags='$cppflags'
3373 randbits='$randbits'
3374 scriptdir='$scriptdir'
3375 sig_name='$sig_name'
3376 spitshell='$spitshell'
3378 sharpbang='$sharpbang'
3382 usrinclude='$usrinclude'
3383 inclPath='$inclPath'
3385 voidhave='$voidhave'
3386 voidwant='$voidwant'
3387 w_localtim='$w_localtim'
3388 w_s_timevl='$w_s_timevl'
3393 installprivlib='$installprivlib'
3401 test -f patchlevel.h && awk '{printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
3404 echo "If you didn't make any mistakes, then just type a carriage return here."
3405 rp="If you need to edit config.sh, do it as a shell escape here:"
3410 *) : in case they cannot read
3413 : if this fails, just run all the .SH files by hand
3417 echo "Doing variable substitutions on .SH files..."
3418 set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
3421 0) set x *.SH; shift;;
3423 if test ! -f $1; then
3429 dir=`$expr X$file : 'X\(.*\)/'`
3430 file=`$expr X$file : 'X.*/\(.*\)'`
3431 (cd $dir && . $file)
3438 if test -f config.h.SH; then
3439 if test ! -f config.h; then
3440 : oops, they left it out of MANIFEST, probably, so do it anyway.
3445 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
3449 Now you need to generate make dependencies by running "make depend".
3450 You might prefer to run it in background: "make depend > makedepend.out &"
3451 It can take a while, so you might not want to run it right now.
3454 rp="Run make depend now? [$dflt]"
3458 y*) make depend && echo "Now you must run a make."
3460 *) echo "You must run 'make depend' then 'make'."
3463 elif test -f [Mm]akefile; then
3465 echo "Now you must run a make."