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 # $RCSfile: Configure,v $$Revision: 4.0.1.2 $$Date: 91/06/07 10:09:34 $
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.)
20 SCO csh still thinks true is false. Write to SCO today and tell them that next
21 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
23 (Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
24 we'd have to do is go in and swap the && and || tokens, wherever they are.)
26 [End of diatribe. We now return you to your regularly scheduled programming...]
30 OOPS! You naughty creature! You didn't run Configure with sh!
31 I will attempt to remedy the situation by running sh for you...
35 true || cat /tmp/c1$$ /tmp/c2$$
38 export PATH || cat /tmp/c2$$
39 export PATH || exec sh $0
40 rm -f /tmp/c1$$ /tmp/c2$$
42 PATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin"
45 echo "Say 'sh Configure', not 'sh <Configure'"
49 (alias) >/dev/null 2>&1 && \
50 echo "(I see you are using the Korn shell. Some ksh's blow up on Configure," && \
51 echo "especially on exotic machines. If yours does, try the Bourne shell instead.)"
53 if test ! -d ../UU; then
61 -d) shift; fastread='yes';;
295 : get the name of the package
299 echo "Beginning of configuration questions for $package kit."
300 : Eunice requires " " instead of "", can you believe it
305 : change the next line if compiling for Xenix/286 on Xenix/386
306 xlibpth='/usr/lib/386 /lib/386'
307 libpth='/usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
308 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
309 trap 'echo " "; exit 1' 1 2 3
311 : We must find out about Eunice early
313 if test -f /etc/unixtovms; then
314 eunicefix=/etc/unixtovms
316 if test -f /etc/unixtovms.exe; then
317 eunicefix=/etc/unixtovms.exe
320 attrlist="DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__"
321 attrlist="$attrlist __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
322 attrlist="$attrlist hp9000s300 hp9000s500 hp9000s800 hpux"
323 attrlist="$attrlist i186 i386 i8086 iAPX286 ibm interdata"
324 attrlist="$attrlist m68k m88k mc300 mc500 mc68000 mc68k mc700 mert"
325 attrlist="$attrlist ns16000 ns32000 nsc32000 os pdp11 posix pyr sinix"
326 attrlist="$attrlist sparc sun tower tower32 tower32_600 tower32_800 tss"
327 attrlist="$attrlist u3b2 u3b20 u3b200 u3b5 ultrix unix vax venix xenix"
328 attrlist="$attrlist z8000"
330 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"
331 d_newshome="/usr/NeWS"
344 libswanted="c_s net_s net nsl_s nsl socket nm ndir ndbm dbm malloc sun m bsd BSD x posix ucb"
345 inclwanted='/usr/include /usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan /usr/ucbinclude'
347 : Now test for existence of everything in MANIFEST
349 echo "First let's make sure your kit is complete. Checking..."
350 awk '$1 !~ /PACKINGLIST/ {print $1}' ../MANIFEST | split -200
352 for filelist in x??; do
353 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
355 if test -s missing; then
361 : some greps do not return status, grrr.
362 echo "grimblepritz" >contains.txt
363 if grep blurfldyick contains.txt >/dev/null 2>&1 ; then
365 elif grep grimblepritz contains.txt >/dev/null 2>&1 ; then
370 : the following should work in any shell
374 echo "AGH! Grep doesn't return a status. Attempting remedial action."
375 cat >contains <<'EOSS'
376 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
381 : see if sh knows # comments
383 echo "Checking your sh to see if it knows about # comments..."
384 if sh -c '#' >/dev/null 2>&1 ; then
385 echo "Your sh handles # comments correctly."
389 echo "Okay, let's see if #! works on this system..."
390 if test -f /bsd43/bin/echo; then
391 echo "#!/bsd43/bin/echo hi" > spit.sh
393 echo "#!/bin/echo hi" > spit.sh
398 if $contains hi today >/dev/null 2>&1; then
402 echo "#! /bin/echo hi" > spit.sh
406 if test -s today; then
415 echo "Your sh doesn't grok # comments--I will strip them later on."
417 echo "exec grep -v '^#'" >spitshell
420 spitshell=`pwd`/spitshell
421 echo "I presume that if # doesn't work, #! won't work either!"
425 : figure out how to guarantee sh startup
427 echo "Checking out how to guarantee sh startup..."
428 startsh=$sharpbang'/bin/sh'
429 echo "Let's see if '$startsh' works..."
441 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
444 : first determine how to suppress newline on echo command
445 echo "Checking echo to see how to suppress newlines..."
446 (echo "hi there\c" ; echo " ") >echotmp
447 if $contains c echotmp >/dev/null 2>&1 ; then
458 echo $n "Type carriage return to continue. Your cursor should be here-->$c"
461 : now set up to do reads with possible shell escape and default assignment
464 yes) ans=''; echo " " ;;
467 while expr "X\$ans" : "X!" >/dev/null; do
476 set \`expr "X\$ans" : "X!\(.*\)\$"\`
489 : general instructions
492 This installation shell script will examine your system and ask you questions
493 to determine how the $package package should be installed. If you get stuck
494 on a question, you may use a ! shell escape to start a subshell or execute
495 a command. Many of the questions will have default answers in square
496 brackets--typing carriage return will give you the default.
498 On some of the questions which ask for file or directory names you are
499 allowed to use the ~name construct to specify the login directory belonging
500 to "name", even if you don't have a shell which knows about that. Questions
501 where this is allowed will be marked "(~name ok)".
504 rp="[Type carriage return to continue]"
509 Much effort has been expended to ensure that this shell script will run on any
510 Unix system. If despite that it blows up on you, your best bet is to edit
511 Configure and run it again. Also, let me (lwall@netlabs.com)
512 know how I blew it. If you can't run Configure for some reason, you'll have
513 to generate a config.sh file by hand.
515 This installation script affects things in two ways: 1) it may do direct
516 variable substitutions on some of the files included in this kit, and
517 2) it builds a config.h file for inclusion in C programs. You may edit
518 any of these files as the need arises after running this script.
520 If you make a mistake on a question, there is no easy way to back up to it
521 currently. The easiest thing to do is to edit config.sh and rerun all the
522 SH files. Configure will offer to let you do this before it runs the SH files.
525 rp="[Type carriage return to continue]"
529 : find out where common programs are
531 echo "Locating common programs..."
544 if test -d \$dir/\$thing; then
550 if test -f \$dir/\$thing; then
553 elif test -f \$dir/\$thing.exe; then
554 : on Eunice apparently
591 pth=`echo :$boPATH:$PATH:$eoPATH: | sed -e 's/:/ /g'`
592 for file in $loclist; do
593 xxx=`./loc $file $file $pth`
598 echo $file is in $xxx.
601 echo "I don't know where $file is. I hope it's in everyone's PATH."
606 echo "Don't worry if any of the following aren't found..."
608 for file in $trylist; do
609 xxx=`./loc $file $file $pth`
614 echo $file is in $xxx.
617 echo "I don't see $file out there, $ans."
624 echo "Substituting grep for egrep."
630 echo "Hopefully test is built into your sh."
633 if sh -c "PATH= test true" >/dev/null 2>&1; then
634 echo "Using the test built into your sh."
644 echo "Hopefully echo is built into your sh."
648 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
649 $echo $n "hi there$c" >Loc1.txt
650 echo $n "hi there$c" >Loc2.txt
651 if cmp Loc1.txt Loc2.txt >/dev/null 2>&1; then
652 echo "They are compatible. In fact, they may be identical."
655 '-n') n='' c='\c' ans='\c' ;;
656 *) n='-n' c='' ans='-n' ;;
659 They are not compatible! You are probably running ksh on a non-USG system.
660 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
661 have echo built in and we may have to run some Bourne shell scripts. That
662 means I'll have to use $ans to suppress newlines now. Life is ridiculous.
665 rp="Your cursor should be here-->"
676 : set up shell script to do ~ expansion
682 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
685 if $test -f /bin/csh; then
686 /bin/csh -f -c "glob \$1"
689 name=\`$expr x\$1 : '..\([^/]*\)'\`
690 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
691 if $test ! -d "\$dir"; then
693 echo "\$me: can't locate home directory for: \$name" >&2
698 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
714 : get old answers, if there is a config file out there
716 if test -f ../config.sh; then
718 eval "`grep lastuname ../config.sh`"
719 tmp=`(uname -a) 2>&1`
720 if test "X$tmp" = "X$lastuname"; then
726 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
730 n*) echo "OK, I'll ignore it."; mv ../config.sh ../config.sh.old;;
731 *) echo "Fetching default answers from your old config.sh file..."
741 if test -d ../hints && test ! -f ../config.sh; then
743 echo "First time through, eh? I have some defaults handy for the following systems:"
744 (cd ../hints; ls -C *.sh | sed 's/\.sh/ /g')
746 : Half the following guesses are probably wrong...
747 test -f /irix && dflt="$dflt sgi"
748 test -f /xenix && dflt="$dflt sco_xenix"
749 test -f /dynix && dflt="$dflt dynix"
750 test -f /dnix && dflt="$dflt dnix"
751 test -f /bin/mips && /bin/mips && dflt="$dflt mips"
752 test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next"
753 if test -f /bin/uname || test -f /usr/bin/uname; then
754 set `uname -a | tr '[A-Z]' '[a-z]'`
756 test -f "../hints/$5.sh" && dflt="$dflt $5"
759 3b2) dflt="$dflt 3b2";;
760 fps*) dflt="$dflt fps";;
761 mips*) dflt="$dflt mips";;
762 [23]100) dflt="$dflt mips";;
763 next*) dflt="$dflt next" ;;
767 aix) dflt="$dflt aix_rs" ;;
769 3.4) dflt="$dflt sunos_3_4" ;;
770 3.5) dflt="$dflt sunos_3_5" ;;
771 4.0.1) dflt="$dflt sunos_4_0_1" ;;
772 4.0.2) dflt="$dflt sunos_4_0_2" ;;
775 dnix) dflt="$dflt dnix" ;;
776 genix) dflt="$dflt genix" ;;
777 hp*ux) dflt="$dflt hpux" ;;
778 next) dflt="$dflt next" ;;
779 irix) dflt="$dflt sgi" ;;
781 3*) dflt="$dflt ultrix_3" ;;
782 4*) dflt="$dflt ultrix_4" ;;
785 uts) dflt="$dflt uts" ;;
786 $2) if test -f /etc/systemid; then
787 set `echo $3 | sed 's/\./ /` $4
788 if test -f ../hints/sco_$1_$2_$3.sh; then
789 dflt="$dflt sco_$1_$2_$3"
790 elif test -f ../hints/sco_$1_$2.sh; then
791 dflt="$dflt sco_$1_$2"
792 elif test -f ../hints/sco_$1.sh; then
799 set X `echo $dflt | tr ' ' '\012' | sort | uniq`
805 echo '(You may give one or more space-separated answers, or "none" if appropriate.'
806 echo 'If your OS version has no hints, do not give a wrong version--say "none".)'
807 rp="Which of these apply, if any? [$dflt]"
811 if test -f ../hints/$file.sh; then
813 cat ../hints/$file.sh >>../config.sh
823 echo "*** WHOA THERE!!! ***"
824 echo " The $hint value for \$$2 on this machine was \"$was\"!"
825 rp=" Keep the $hint value? [y]"
829 y) td=$was; tu=$was;;
833 setvar='td=$define; tu=$undef; set X $1; eval "was=\$$2";
835 defineundef) . whoa; eval "$2=\$td";;
836 undefdefine) . whoa; eval "$2=\$tu";;
840 : determine where manual pages go
843 $package has manual pages available in source form.
847 echo "However, you don't have nroff, so they're probably useless to you."
854 echo "If you don't want the manual sources installed, answer 'none'."
857 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`
863 while $test "$cont" ; do
865 rp="Where do the manual pages (source) go (~name ok)? [$dflt]"
874 mansrc=`./filexp "$ans"`
875 if $test -d "$mansrc"; then
878 if $test "$fastread" = yes; then
883 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
921 : Sigh. Well, at least the box is fast...
924 case "$usrinclude" in
925 '') dflt='/usr/include';;
926 *) dflt=$usrinclude;;
929 if $test -f /bin/mips && /bin/mips; then
930 echo "Looks like a MIPS system..."
931 $cat >usrinclude.c <<'EOCP'
936 if cc -E usrinclude.c > usrinclude.out && $contains / usrinclude.out >/dev/null 2>&1 ; then
937 echo "and you're compiling with the BSD43 compiler and libraries."
938 dflt='/bsd43/usr/include'
941 echo "and you're compiling with the SysV compiler and libraries."
944 echo "Doesn't look like a MIPS system."
951 while $test "$cont" ; do
953 rp="Where are the include files you want to use? [$dflt]"
957 if $test -d $ans; then
960 if $test "$fastread" = yes; then
965 rp="Directory $ans doesn't exist. Use that name anyway? [$dflt]"
975 : make some quick guesses about what we are up against
977 cat $usrinclude/signal.h $usrinclude/sys/signal.h >guess.txt 2>/dev/null
978 if test "$usrinclude" = "/bsd43/usr/include" ; then
979 echo "Looks kind of like a SysV MIPS running BSD, but we'll see..."
983 elif test `echo abc | tr a-z A-Z` = Abc ; then
984 echo "Looks kind of like a USG system, but we'll see..."
988 elif $contains SIGTSTP guess.txt >/dev/null 2>&1 ; then
989 echo "Looks kind of like a BSD system, but we'll see..."
994 echo "Looks kind of like a version 7 system, but we'll see..."
1002 There is, however, a strange, musty smell in the air that reminds me of
1003 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
1005 echo "exit 0" >eunice
1010 echo "Congratulations. You aren't running Eunice."
1012 echo "exit 1" >eunice
1015 if test -f /xenix; then
1016 echo "Actually, this looks more like a XENIX system..."
1017 echo "exit 0" >xenix
1020 echo "It's not Xenix..."
1021 echo "exit 1" >xenix
1025 if test -f /venix; then
1026 echo "Actually, this looks more like a VENIX system..."
1027 echo "exit 0" >venix
1033 echo "Nor is it Venix..."
1035 echo "exit 1" >venix
1037 chmod +x bsd usg v7 eunice venix
1038 $eunicefix bsd usg v7 eunice venix
1040 : see what memory models we can support
1043 : We may not use Cppsym or we get a circular dependency through cc.
1044 : But this should work regardless of which cc we eventually use.
1045 cat >pdp11.c <<'EOP'
1054 cc -o pdp11 pdp11.c >/dev/null 2>&1
1055 if pdp11 2>/dev/null; then
1056 dflt='unsplit split'
1058 ans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1061 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1066 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1069 if $test -d /lib/large || $test -d /usr/lib/large; then
1072 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1078 *) dflt="$models" ;;
1082 Some systems have different model sizes. On most systems they are called
1083 small, medium, large, and huge. On the PDP11 they are called unsplit and
1084 split. If your system doesn't support different memory models, say "none".
1085 If you wish to force everything to one memory model, say "none" here and
1086 put the appropriate flags later when it asks you for other cc and ld flags.
1087 Venix systems may wish to put "none" and let the compiler figure things out.
1088 (In the following question multiple model names should be space separated.)
1091 rp="Which models are supported? [$dflt]"
1108 if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
1109 $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
1117 rp="What flag indicates separate I and D space? [$dflt]"
1126 *large*|*small*|*medium*|*huge*)
1133 rp="What flag indicates large model? [$dflt]"
1149 rp="What flag indicates huge model? [$dflt]"
1165 rp="What flag indicates medium model? [$dflt]"
1173 *) medium="$large";;
1181 rp="What flag indicates small model? [$dflt]"
1193 echo "Unrecognized memory models--you may have to edit Makefile.SH"
1197 : see if we need a special compiler
1211 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1225 On some systems the default C compiler will not resolve multiple global
1226 references that happen to have the same name. On some such systems the
1227 "Mcc" command may be used to force these to be resolved. On other systems
1228 a "cc -M" command is required. (Note that the -M flag on other systems
1229 indicates a memory model to use!) If you have the Gnu C compiler, you
1230 might wish to use that instead. What command will force resolution on
1232 $echo $n "this system? [$dflt] $c"
1233 rp="Command to resolve multiple refs? [$dflt]"
1241 rp="Use which C compiler? [$dflt]"
1247 gcc*) cpp=`./loc gcc-cpp $cpp $pth`
1248 case "$nativegcc" in
1249 '') case "$ccflags" in
1250 *-fpcc-struct-return*) dflt=n;;
1258 rp="Are your system (especially dbm) libraries compiled with gcc? [$dflt]"
1262 n*) nativegcc="$undef"; gccflags='-fpcc-struct-return';;
1263 *) nativegcc="$define"; gccflags='';;
1268 : determine optimize, if desired, or use for debug flag also
1279 Some C compilers have problems with their optimizers, by default, $package
1280 compiles with the -O flag to use the optimizer. Alternately, you might
1281 want to use the symbolic debugger, which uses the -g flag (on traditional
1282 Unix systems). Either flag can be specified here. To use neither flag,
1283 specify the word "none".
1286 rp="What optimizer/debugger flag should be used? [$dflt]"
1291 'none') optimize=" "
1297 *gcc*) dflt="$gccflags";;
1301 *-fpcc-struct-return*) dflt="$ccflags";;
1303 *gcc*) dflt="$ccflags $gccflags";;
1304 *) dflt="$ccflags";;
1308 for thisincl in $inclwanted; do
1309 if test -d $thisincl; then
1310 if test "x$thisincl" != "x$usrinclude"; then
1313 *) dflt="$dflt -I$thisincl";;
1322 *) dflt="$dflt -DDEBUGGING";;
1326 if $contains 'LANGUAGE_C' $usrinclude/signal.h >/dev/null 2>&1; then
1329 *) dflt="$dflt -DLANGUAGE_C";;
1332 if $contains '_NO_PROTO' $usrinclude/signal.h >/dev/null 2>&1; then
1335 *) dflt="$dflt -D_NO_PROTO";;
1343 Your C compiler may want other flags. For this question you should
1344 include -I/whatever and -DWHATEVER flags and any other flags used by
1345 the C compiler, but you should NOT include libraries or ld flags like
1346 -lwhatever. To use no flags, specify the word "none".
1349 rp="Any additional cc flags? [$dflt]"
1357 : the following weeds options from ccflags that are of no interest to cpp
1360 *gcc*) cppflags="$cppflags -D__GNUC__";;
1368 -D*|-U*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
1372 *-*) echo "(C preprocessor flags: $cppflags)";;
1384 *) dflt="$ldflags";;
1387 rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1396 echo "Checking for optional libraries..."
1401 case "$libswanted" in
1402 '') libswanted='c_s';;
1404 for thislib in $libswanted; do
1408 *) thatlib="${thislib}_s";;
1411 xxx=`./loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1412 if test -f $xxx; then
1413 echo "Found -l$thislib."
1415 *"-l$thislib "*|*"-l$thatlib "*);;
1416 *) dflt="$dflt -l$thislib ";;
1419 xxx=`./loc lib$thislib.a X $libpth`
1420 if test -f $xxx; then
1424 *) dflt="$dflt $xxx ";;
1427 xxx=`./loc Slib$thislib.a X $xlibpth`
1428 if test -f $xxx; then
1429 echo "Found -l$thislib."
1431 *"-l$thislib "*|*"-l$thatlib "*);;
1432 *) dflt="$dflt -l$thislib ";;
1435 xxx=`./loc lib$thislib.so X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1436 if test -f $xxx; then
1437 echo "Found -l$thislib as a shared object only."
1439 *"-l$thislib "*|*"-l$thatlib "*);;
1440 *) dflt="$dflt -l$thislib ";;
1443 echo "No -l$thislib."
1458 Some versions of Unix support shared libraries, which make
1459 executables smaller but make load time slightly longer.
1461 On some systems, mostly newer Unix System V's, the shared library
1462 is included by putting the option "-lc_s" as the last thing on the
1463 cc command line when linking. Other systems use shared libraries
1464 by default. There may be other libraries needed to compile $package
1465 on your machine as well. If your system needs the "-lc_s" option,
1466 include it here. Include any other special libraries here as well.
1467 Say "none" for none.
1471 rp="Any additional libraries? [$dflt]"
1479 : check for size of random number generator
1481 case "$alignbytes" in
1483 echo "Checking alignment constraints..."
1484 $cat >try.c <<'EOCP'
1491 printf("%d\n", (char*)&try.bar - (char*)&try.foo);
1494 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
1498 echo "(I can't seem to compile the test program...)"
1505 rp="Doubles must be aligned on a how-many-byte boundary? [$dflt]"
1511 : determine where public executables go
1514 The following questions distinguish the directory in which executables
1515 reside from the directory in which they are installed (and from which they
1516 are presumably copied to the former directory by occult means). This
1517 distinction is often necessary under afs. On most other systems, however,
1518 the two directories are the same.
1523 dflt=`./loc . /usr/local/bin /usr/local/bin /usr/lbin /usr/local /usr/bin /bin`
1529 while $test "$cont" ; do
1530 rp="In which directory will public executables reside (~name ok)? [$dflt]"
1531 $echo "In which directory will public executables reside (~name ok)?"
1532 $echo $n "[$dflt] $c"
1536 if test -d $bin; then
1543 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
1553 case "$installbin" in
1555 dflt=`echo $bin | sed 's#^/afs/#/afs/.#'`
1556 test -d $dflt || dflt="$bin"
1558 *) dflt="$installbin"
1562 while $test "$cont" ; do
1563 rp="In which directory will public executables be installed (~name ok)? [$dflt]"
1564 $echo "In which directory will public executables be installed (~name ok)?"
1565 $echo $n "[$dflt] $c"
1568 installbin=`./filexp $installbin`
1569 if test -d $installbin; then
1576 rp="Directory $installbin doesn't exist. Use that name anyway? [$dflt]"
1586 : check for ordering of bytes in a long
1587 case "$byteorder" in
1591 In the following, larger digits indicate more significance. A big-endian
1592 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
1593 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
1594 machines may have weird orders like 3412. A Cray will report 87654321. If
1595 the test program works the default is probably right.
1596 I'm now running the test program...
1598 $cat >byteorder.c <<'EOCP'
1605 char c[sizeof(long)];
1608 if (sizeof(long) > 4)
1609 u.l = (0x08070605 << 32) | 0x04030201;
1612 for (i=0; i < sizeof(long); i++)
1613 printf("%c",u.c[i]+'0');
1617 if $cc byteorder.c -o byteorder >/dev/null 2>&1 ; then
1620 ????|????????) echo "(The test program ran ok.)";;
1621 *) echo "(The test program didn't run right for some reason.)";;
1625 echo "(I can't seem to compile the test program. Guessing big-endian...)"
1633 rp="What is the order of bytes in a long? [$dflt]"
1638 : check for ability to cast negative floats to unsigned
1640 echo 'Checking to see if your C compiler can cast weird floats to unsigned'
1641 $cat >try.c <<'EOCP'
1644 blech() { exit(3); }
1649 unsigned long along;
1651 unsigned short ashort;
1654 signal(SIGFPE, blech);
1655 along = (unsigned long)f;
1656 aint = (unsigned int)f;
1657 ashort = (unsigned short)f;
1658 if (along != (unsigned long)-123)
1660 if (aint != (unsigned int)-123)
1662 if (ashort != (unsigned short)-123)
1664 f = (double)0x40000000;
1667 along = (unsigned long)f;
1668 if (along != 0x80000000)
1672 along = (unsigned long)f;
1673 if (along != 0x7fffffff)
1677 along = (unsigned long)f;
1678 if (along != 0x80000001)
1683 if $cc -o try $ccflags try.c >/dev/null 2>&1; then
1689 case "$castflags" in
1691 echo "Yup, it does."
1694 echo "Nope, it doesn't."
1701 : see how we invoke the C preprocessor
1703 echo "Now, how can we feed standard input to your C preprocessor..."
1704 cat <<'EOT' >testcpp.c
1711 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
1713 wrapper=`pwd`/cppstdin
1716 if test "X$cppstdin" != "X" && \
1717 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
1718 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1719 echo "You used to use $cppstdin $cppminus so we'll use that again."
1720 elif test "$cc" = gcc && \
1721 (echo "Using gcc, eh? We'll try to force gcc -E using a wrapper..."; \
1722 $wrapper <testcpp.c >testcpp.out 2>&1; \
1723 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
1727 elif echo 'Maybe "'"$cc"' -E" will work...'; \
1728 $cc -E <testcpp.c >testcpp.out 2>&1; \
1729 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1730 echo "Yup, it does."
1733 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
1734 $cc -E - <testcpp.c >testcpp.out 2>&1; \
1735 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1736 echo "Yup, it does."
1739 elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
1740 $wrapper <testcpp.c >testcpp.out 2>&1; \
1741 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1745 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
1746 $cpp <testcpp.c >testcpp.out 2>&1; \
1747 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1751 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
1752 $cpp - <testcpp.c >testcpp.out 2>&1; \
1753 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1754 echo "Hooray, it works! I was beginning to wonder."
1757 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
1758 $cc -P <testcpp.c >testcpp.out 2>&1; \
1759 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1760 echo "Yipee, that works!"
1763 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
1764 $cc -P - <testcpp.c >testcpp.out 2>&1; \
1765 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1766 echo "At long last!"
1771 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
1772 rp='Name a C preprocessor:'
1775 $cppstdin <testcpp.c >testcpp.out 2>&1
1776 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1777 echo "OK, that will do."
1779 echo "Sorry, I can't get that to work. Go find one and rerun Configure."
1784 : get list of predefined functions in a handy place
1790 '') if test -f /mach_boot; then
1792 elif test -d /usr/ccs/lib; then
1799 : on mips, we DO NOT want /lib, and we want inclPath/usr/lib
1802 libpth='$inclPath/usr/lib /usr/local/lib'
1805 libpth='/usr/ccs/lib /lib /usr/lib /usr/ucblib /usr/local/lib'
1810 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
1815 *) for thislib in $libs; do
1817 -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
1818 try=`./loc lib$thislib.a blurfl/dyick $libpth`
1819 if test ! -f $try; then
1820 try=`./loc lib$thislib blurfl/dyick $libpth`
1821 if test ! -f $try; then
1822 try=`./loc $thislib blurfl/dyick $libpth`
1823 if test ! -f $try; then
1824 try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
1825 if test ! -f $try; then
1831 libnames="$libnames $try"
1833 *) libnames="$libnames $thislib" ;;
1838 set /usr/ccs/lib/libc.so
1839 test -f $1 || set /usr/lib/libc.so
1840 test -f $1 || set /usr/lib/libc.so.[0-9]*
1841 test -f $1 || set /lib/libsys_s.a
1843 if test -f "$1"; then
1844 echo "Your (shared) C library seems to be in $1."
1846 elif test -f "$libc"; then
1847 echo "Your C library seems to be in $libc."
1848 elif test -f /lib/libc.a; then
1849 echo "Your C library seems to be in /lib/libc.a. You're normal."
1852 if ans=`./loc libc.a blurfl/dyick $libpth`; test -f "$ans"; then
1854 elif ans=`./loc libc blurfl/dyick $libpth`; test -f "$ans"; then
1855 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
1856 elif ans=`./loc clib blurfl/dyick $libpth`; test -f "$ans"; then
1858 elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1860 elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1862 elif ans=`./loc Llibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1865 if test -f "$ans"; then
1866 echo "Your C library seems to be in $ans, of all places."
1871 I can't seem to find your C library. I've looked in the following places:
1875 None of these seems to contain your C library. What is the full name
1878 $echo $n "of your C library? $c"
1879 rp='C library full name?'
1885 if test $libc = "/lib/libc"; then
1886 libc="$libc /lib/clib"
1890 If the guess above is wrong (which it might be if you're using a strange
1891 compiler, or your machine supports multiple models), you can override it here.
1894 rp="Your C library is where? [$dflt]"
1899 echo $libc $libnames | tr ' ' '\012' | sort | uniq >libnames
1900 $echo "Extracting names from the following files for later perusal:"
1901 sed 's/^/ /' libnames
1902 echo $n "This may take a while...$c"
1903 set X `cat libnames`
1905 nm $nm_opts $* 2>/dev/null >libc.tmp
1906 $sed -n -e 's/^.* [ATDS] *[_.]*//p' -e 's/^.* [ATDS] //p' <libc.tmp >libc.list
1907 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1909 elif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \
1910 <libc.tmp >libc.list; \
1911 $contains '^printf$' libc.list >/dev/null 2>&1; then
1913 elif $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list; \
1914 $contains '^printf$' libc.list >/dev/null 2>&1; then
1916 elif $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list; \
1917 $contains '^printf$' libc.list >/dev/null 2>&1; then
1919 elif $sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' \
1920 <libc.tmp >libc.list; \
1921 $contains '^printf$' libc.list >/dev/null 2>&1; then
1923 elif $grep '|' <libc.tmp | $sed -n -e '/|COMMON/d' -e '/|DATA/d' -e '/ file/d' \
1924 -e 's/^\([^ ]*\).*/\1/p' >libc.list
1925 $contains '^printf$' libc.list >/dev/null 2>&1; then
1927 elif $sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p' \
1928 <libc.tmp >libc.list; \
1929 $contains '^printf$' libc.list >/dev/null 2>&1; then
1932 nm -p $* 2>/dev/null >libc.tmp
1933 $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
1934 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1939 echo "nm didn't seem to work right."
1940 echo "Trying ar instead..."
1941 if ar t $libc > libc.tmp; then
1942 for thisname in $libnames; do
1943 ar t $thisname >>libc.tmp
1945 $sed -e 's/\.o$//' < libc.tmp > libc.list
1948 echo "ar didn't seem to work right."
1949 echo "Maybe this is a Cray...trying bld instead..."
1950 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
1951 for thisname in $libnames; do
1953 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
1954 ar t $thisname >>libc.tmp
1958 echo "That didn't work either. Giving up."
1964 if test -f /lib/syscalls.exp; then
1965 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..."
1966 sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
1969 inlibc='echo " "; td=$define; tu=$undef;
1970 if $contains "^$1\$" libc.list >/dev/null 2>&1;
1971 then echo "$1() found";
1972 eval "case \"\$$2\" in undef) . whoa; esac"; eval "$2=\$td";
1973 else echo "$1() not found";
1974 eval "case \"\$$2\" in define) . whoa; esac"; eval "$2=\$tu"; fi'
1976 : see if bcmp exists
1980 : see if bcopy exists
1984 : see if bzero exists
1988 : see if sprintf is declared as int or pointer to char
1990 cat >ucbsprf.c <<'EOF'
1996 exit((unsigned long)sprintf(buf,"%s","foo") > 10L);
1999 if $cc $ccflags ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then
2000 echo "Your sprintf() returns (int)."
2003 echo "Your sprintf() returns (char*)."
2009 : see if vprintf exists
2011 if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
2012 echo 'vprintf() found.'
2014 cat >vprintf.c <<'EOF'
2015 #include <varargs.h>
2017 main() { xxx("foo"); }
2026 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
2029 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
2030 echo "Your vsprintf() returns (int)."
2033 echo "Your vsprintf() returns (char*)."
2037 echo 'vprintf() not found.'
2047 : see if chsize exists
2051 : see if crypt exists
2053 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
2054 echo 'crypt() found.'
2058 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
2059 if $test -z "$cryptlib"; then
2060 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
2064 if $test -z "$cryptlib"; then
2065 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
2069 if $test -z "$cryptlib"; then
2070 cryptlib=`./loc libcrypt.a "" $libpth`
2074 if $test -z "$cryptlib"; then
2075 echo 'crypt() not found.'
2084 : get csh whereabouts
2086 'csh') val="$undef" ;;
2092 : see if readdir exists
2093 set readdir d_readdir
2096 : see if there are directory access routines out there
2098 xxx=`./loc ndir.h x $usrinclude /usr/local/include $inclwanted`
2101 xxx=`./loc sys/ndir.h x $usrinclude /usr/local/include $inclwanted`
2104 D_dirnamlen="$undef"
2113 if $test -r $usrinclude/dirent.h; then
2114 echo "dirent.h found."
2115 if $contains 'd_namlen' $usrinclude/dirent.h >/dev/null 2>&1; then
2116 D_dirnamlen="$define"
2119 elif $test -r $xxx; then
2120 echo "You seem to use <$xxx>,"
2121 if $test "$d_readdir" = "$define"; then
2122 echo "and I can get readdir() from your C library."
2123 elif $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a; then
2124 echo "and I'll get the routines using -lndir ."
2127 ans=`./loc libndir.a x $libpth`
2130 echo "but I can't find the ndir library!"
2133 echo "and I found the directory library in $ans."
2138 if $contains 'd_namlen' $xxx >/dev/null 2>&1; then
2139 D_dirnamlen="$define"
2143 I_sys_ndir="$define"
2150 : The next line used to require this to be a bsd system.
2151 if $contains '^readdir$' libc.list >/dev/null 2>&1 ; then
2152 echo "No ndir library found, but you have readdir() so we'll use that."
2153 if $contains 'd_namlen' $usrinclude/sys/dir.h >/dev/null 2>&1; then
2154 D_dirnamlen="$define"
2158 echo "No ndir library found--using ./$d_ndir.c."
2159 : This will lose since $d_ndir.h is in another directory.
2160 : I doubt we can rely on it being in ../$d_ndir.h .
2161 : At least it will fail in a conservative manner.
2162 if $contains 'd_namlen' $d_ndir.h >/dev/null 2>&1; then
2163 D_dirnamlen="$define"
2170 val=$D_dirnamlen; set d_dirnamlen; eval $setvar
2171 val=$I_dirent; set i_dirent; eval $setvar
2172 val=$I_sys_dir; set i_sys_dir; eval $setvar
2173 val=$I_my_dir; set i_my_dir; eval $setvar
2174 val=$I_ndir; set i_ndir; eval $setvar
2175 val=$I_sys_ndir; set i_sys_ndir; eval $setvar
2177 : now see if they want to do setuid emulation
2185 Some sites have disabled setuid #! scripts because of a bug in the kernel
2186 that prevents them from being secure. If you are on such a system, the
2187 setuid/setgid bits on scripts are currently useless. It is possible for
2188 $package to detect those bits and emulate setuid/setgid in a secure fashion
2189 until a better solution is devised for the kernel problem.
2192 rp="Do you want to do setuid/setgid emulation? [$dflt]"
2199 y*) d_dosuid="$define";;
2200 *) d_dosuid="$undef";;
2203 : see if dup2 exists
2207 : see if fchmod exists
2211 : see if fchown exists
2215 : see if this is an fcntl system
2219 : see if we can have long filenames
2221 rm -f 123456789abcde
2222 if (echo hi >123456789abcdef) 2>/dev/null; then
2224 if test -f 123456789abcde; then
2225 echo 'You cannot have filenames longer than 14 characters. Sigh.'
2228 echo 'You can have filenames longer than 14 characters.'
2232 : version 8 probably
2233 echo "You can't have filenames longer than 14 chars. You can't even think about them!"
2239 : see if flock exists
2243 : see if getgroups exists
2244 set getgroups d_getgrps
2247 : see if gethostent exists
2248 set gethostent d_gethent
2251 : see if getpgrp exists
2252 set getpgrp d_getpgrp
2255 : see if getpgrp2 exists
2256 set getpgrp2 d_getpgrp2
2259 : see if getpriority exists
2260 set getpriority d_getprior
2263 : see if htonl exists
2271 *) if $test -f /unix; then
2278 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
2279 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2280 echo "Your system has both index() and strchr(). Shall I use"
2281 rp="index() rather than strchr()? [$dflt]"
2285 n*) d_index="$define" ;;
2286 *) d_index="$undef" ;;
2290 echo "index() found."
2293 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2295 echo "strchr() found."
2297 echo "No index() or strchr() found!"
2302 : see if killpg exists
2306 : see if lstat exists
2310 : see if memcmp exists
2314 : see if memcpy exists
2318 : see if mkdir exists
2322 : see if msgctl exists
2326 : see if msgget exists
2330 : see if msgsnd exists
2334 : see if msgrcv exists
2338 : see how much of the 'msg*(2)' library is present.
2341 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
2342 *undef*) h_msg=false;;
2344 : we could also check for sys/ipc.h ...
2345 if $h_msg && $test -r $usrinclude/sys/msg.h; then
2346 echo "You have the full msg*(2) library."
2349 echo "You don't have the full msg*(2) library."
2355 : see if ndbm is available
2357 xxx=`./loc ndbm.h x $usrinclude /usr/local/include $inclwanted`
2358 if test -f $xxx; then
2360 echo "ndbm.h found."
2363 echo "ndbm.h not found."
2368 : see if we have the old dbm
2370 xxx=`./loc dbm.h x $usrinclude /usr/local/include $inclwanted`
2371 if test -f $xxx; then
2376 echo "dbm.h not found."
2381 : see whether socket exists
2384 if $contains socket libc.list >/dev/null 2>&1; then
2385 echo "Looks like you have Berkeley networking support."
2387 : now check for advanced features
2388 if $contains setsockopt libc.list >/dev/null 2>&1; then
2391 echo "...but it uses the old 4.1c interface, rather than 4.2"
2395 : hpux, for one, puts all the socket stuff in socklib.o
2396 if $contains socklib libc.list >/dev/null 2>&1; then
2397 echo "Looks like you have Berkeley networking support."
2399 : we will have to assume that it supports the 4.2 BSD interface
2402 echo "Hmmm...you don't have Berkeley networking in libc.a..."
2403 : look for an optional networking library
2404 if test -f /usr/lib/libnet.a; then
2405 (ar t /usr/lib/libnet.a ||
2406 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
2407 if $contains socket libc.list >/dev/null 2>&1; then
2408 echo "but the Wollongong group seems to have hacked it in."
2409 socketlib="-lnet -lnsl_s"
2411 : now check for advanced features
2412 if $contains setsockopt libc.list >/dev/null 2>&1; then
2415 echo "...using the old 4.1c interface, rather than 4.2"
2419 echo "or even in libnet.a, which is peculiar."
2424 echo "or anywhere else I see."
2433 if $contains socketpair libc.list >/dev/null 2>&1; then
2444 : Locate the flags for 'open()'
2446 $cat >open3.c <<'EOCP'
2447 #include <sys/types.h>
2452 #include <sys/file.h>
2465 : check sys/file.h first to get FREAD on Sun
2466 if $test -r $usrinclude/sys/file.h && \
2467 $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
2469 echo "sys/file.h defines the O_* constants..."
2471 echo "and you have the 3 argument form of open()."
2474 echo "but not the 3 argument form of open(). Oh, well."
2477 elif $test -r $usrinclude/fcntl.h && \
2478 $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
2480 echo "fcntl.h defines the O_* constants..."
2482 echo "and you have the 3 argument form of open()."
2485 echo "but not the 3 argument form of open(). Oh, well."
2490 echo "I can't find the O_* constant definitions! You got problems."
2495 : see if how pwd stuff is defined
2497 if $test -r $usrinclude/pwd.h ; then
2500 $cppstdin $cppflags $cppminus <$usrinclude/pwd.h >pwd.txt
2501 if $contains 'pw_quota' pwd.txt >/dev/null 2>&1; then
2506 if $contains 'pw_age' pwd.txt >/dev/null 2>&1; then
2511 if $contains 'pw_change' pwd.txt >/dev/null 2>&1; then
2512 d_pwchange="$define"
2516 if $contains 'pw_class' pwd.txt >/dev/null 2>&1; then
2521 if $contains 'pw_expire' pwd.txt >/dev/null 2>&1; then
2522 d_pwexpire="$define"
2526 if $contains 'pw_comment' pwd.txt >/dev/null 2>&1; then
2527 d_pwcomment="$define"
2529 d_pwcomment="$undef"
2538 d_pwcomment="$undef"
2539 echo "No pwd.h found."
2542 : see if rename exists
2546 : see if rmdir exists
2550 : see if select exists
2554 : see if semctl exists
2558 : see if semget exists
2562 : see if semop exists
2566 : see how much of the 'sem*(2)' library is present.
2569 case "$d_semctl$d_semget$d_semop" in
2570 *undef*) h_sem=false;;
2572 : we could also check for sys/ipc.h ...
2573 if $h_sem && $test -r $usrinclude/sys/sem.h; then
2574 echo "You have the full sem*(2) library."
2577 echo "You don't have the full sem*(2) library."
2583 : see if setegid exists
2584 set setegid d_setegid
2587 : see if seteuid exists
2588 set seteuid d_seteuid
2591 : see if setpgrp exists
2592 set setpgrp d_setpgrp
2595 : see if setpgrp2 exists
2596 set setpgrp2 d_setpgrp2
2599 : see if setpriority exists
2600 set setpriority d_setprior
2603 : see if setregid exists
2604 set setregid d_setregid
2606 set setresgid d_setresgid
2609 : see if setreuid exists
2610 set setreuid d_setreuid
2612 set setresuid d_setresuid
2615 : see if setrgid exists
2616 set setrgid d_setrgid
2619 : see if setruid exists
2620 set setruid d_setruid
2623 : see if shmctl exists
2627 : see if shmget exists
2631 : see if shmat exists
2635 d_voidshmat="$undef"
2638 $cppstdin $cppflags $cppminus < $usrinclude/sys/shm.h >voidshmat.txt 2>/dev/null
2639 if $contains "void.*shmat" voidshmat.txt >/dev/null 2>&1; then
2640 echo "and shmat returns (void*)"
2641 d_voidshmat="$define"
2643 echo "and shmat returns (char*)"
2648 : see if shmdt exists
2652 : see how much of the 'shm*(2)' library is present.
2655 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
2656 *undef*) h_shm=false;;
2658 : we could also check for sys/ipc.h ...
2659 if $h_shm && $test -r $usrinclude/sys/shm.h; then
2660 echo "You have the full shm*(2) library."
2663 echo "You don't have the full shm*(2) library."
2669 : see if stat knows about block sizes
2671 if $contains 'st_blocks;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2672 if $contains 'st_blksize;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2673 echo "Your stat knows about block sizes."
2676 echo "Your stat doesn't know about block sizes."
2680 echo "Your stat doesn't know about block sizes."
2686 : see if stdio is really std
2688 if $contains 'char.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2689 if $contains '_cnt;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2690 echo "Your stdio is pretty std."
2693 echo "Your stdio isn't very std."
2697 echo "Your stdio isn't very std."
2703 : check for structure copying
2705 echo "Checking to see if your C compiler can copy structs..."
2706 $cat >strctcpy.c <<'EOCP'
2716 if $cc -c strctcpy.c >/dev/null 2>&1 ; then
2721 echo "Nope, it can't."
2726 : see if strerror exists
2727 set strerror d_strerror
2730 : see if symlink exists
2731 set symlink d_symlink
2734 : see if syscall exists
2735 set syscall d_syscall
2738 : set if package uses struct tm
2741 : set if package uses struct timeval
2743 define) w_s_timevl=1 ;;
2746 : set if package uses localtime function
2749 : see which of time.h, sys/time.h, and sys/select should be included.
2753 Testing to see which of <time.h>, <sys/time.h>, and <sys/select.h>
2754 should be included, because this application wants:
2757 case "$w_s_itimer" in
2759 echo " struct itimerval"
2760 idefs="-DS_ITIMERVAL $idefs"
2763 case "$w_s_timevl" in
2765 echo " struct timeval"
2766 idefs="-DS_TIMEVAL $idefs"
2772 idefs="-DS_TM $idefs"
2775 case "$w_localtim" in
2777 echo " ctime(3) declarations"
2778 idefs="-DD_CTIME $idefs"
2783 echo " (something I don't know about)"
2787 echo "I'm now running the test program..."
2788 $cat >i_time.c <<'EOCP'
2789 #include <sys/types.h>
2794 #ifdef SYSTIMEKERNEL
2797 #include <sys/time.h>
2800 #include <sys/select.h>
2810 struct itimerval baz;
2813 if (foo.tm_sec == foo.tm_sec)
2816 if (bar.tv_sec == bar.tv_sec)
2820 if (baz.it_interval == baz.it_interval)
2824 if (bar.tv_sec == bar.tv_sec)
2828 /* this might not do anything for us... */
2829 tmp = localtime((time_t *)0);
2835 for i_sys_select in '' '-DI_SYS_SELECT'; do
2836 for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
2837 for i_time in '' '-DI_TIME'; do
2838 for i_systime in '-DI_SYS_TIME' ''; do
2840 '') echo Trying $i_time $i_systime $d_systimekernel $i_sys_select
2841 if $cc $ccflags $idefs \
2842 $i_time $i_systime $d_systimekernel $i_sys_select \
2843 i_time.c -o i_time >/dev/null 2>&1 ; then
2844 set X $i_time $i_systime $d_systimekernel $i_sys_select
2847 echo Succeeded with $flags
2856 *SYSTIMEKERNEL*) val="$define";;
2862 *I_TIME*) val="$define";;
2868 *I_SYS_SELECT*) val="$define";;
2874 *I_SYS_TIME*) val="$define";;
2879 case "$flags$i_sys_time$i_time" in
2880 undefundef) i_sys_time="$define"; i_time="$define";
2881 echo "ICK, NOTHING WORKED!!! You may have to diddle the includes.";;
2884 : see if signal is declared as pointer to function returning int or void
2886 $cppstdin $cppflags $cppminus < $usrinclude/signal.h >d_voidsig.txt
2887 if $contains 'int[^A-Za-z]*signal' d_voidsig.txt >/dev/null 2>&1 ; then
2888 echo "You have int (*signal())() instead of void."
2891 echo "You have void (*signal())() instead of int."
2897 define) d_tosignal=void;;
2901 : see if truncate exists
2902 set truncate d_truncate
2905 : see if there is a vfork
2909 : check for volatile keyword
2911 echo 'Checking to see if your C compiler knows about "volatile"...'
2912 $cat >try.c <<'EOCP'
2915 typedef unsigned short foo_t;
2918 volatile foo_t blech;
2922 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
2924 echo "Yup, it does."
2927 echo "Nope, it doesn't."
2933 : see if there is a wait4
2937 : see if there is a waitpid
2938 set waitpid d_waitpid
2941 : see what type gids are declared as in the kernel
2944 if $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
2947 set `grep '_rgid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
2949 unsigned) dflt="$1 $2" ;;
2959 rp="What type are groups ids returned by getgid(), etc.? [$dflt]"
2964 : see what type gids are returned by getgroups
2966 case "$groupstype" in
2968 if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2970 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2972 elif $contains 'getgroups.*short' /usr/include/libc.h >/dev/null 2>&1; then
2974 elif $contains 'getgroups.*int' /usr/include/libc.h >/dev/null 2>&1; then
2976 elif $contains 'getgroups.*short' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
2978 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
2980 elif $contains 'int.*gidset' /usr/man/man2/getgroups.2 >/dev/null 2>&1; then
2982 elif $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
2985 set `grep 'groups\[NGROUPS\];' $usrinclude/sys/user.h 2>/dev/null` unsigned short
2987 unsigned) dflt="$1 $2" ;;
2992 *) dflt="$groupstype"
2996 echo "(The following only matters if you have getgroups().)"
2997 rp="What type are the group ids returned by getgroups()? [$dflt]"
3002 : check for length of integer
3006 echo "Checking to see how big your integers are..."
3007 $cat >intsize.c <<'EOCP'
3011 printf("%d\n", sizeof(int));
3014 if $cc intsize.c -o intsize >/dev/null 2>&1 ; then
3018 echo "(I can't seem to compile the test program. Guessing...)"
3025 rp="What is the size of an integer (in bytes)? [$dflt]"
3030 : determine which malloc to compile in
3032 case "$usemymalloc" in
3040 *) dflt="$usemymalloc"
3043 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
3051 y*) mallocsrc='malloc.c'; mallocobj='malloc.o'
3052 libs=`echo $libs | sed 's/-lmalloc//'`
3053 case "$mallocptrtype" in
3055 cat >usemymalloc.c <<'END'
3063 if $cc $ccflags -c usemymalloc.c >/dev/null 2>&1; then
3071 echo "Your system wants malloc to return $mallocptrtype*, it would seem."
3073 *) mallocsrc=''; mallocobj=''; mallocptrtype=void;;
3076 : determine where private executables go
3079 dflt=/usr/lib/$package
3080 test -d /usr/local/lib && dflt=/usr/local/lib/$package
3087 The $package package has some auxiliary files that should be reside in a library
3088 that is accessible by everyone. Where should these "private" but accessible
3090 $echo $n "files reside? (~name ok) [$dflt] $c"
3091 rp="Private files will reside where? [$dflt]"
3093 privlib=`./filexp "$ans"`
3095 case "$installprivlib" in
3097 dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'`
3098 test -d $dflt || dflt="$privlib"
3100 *) dflt="$installprivlib"
3105 On some systems (such as afs) you have to install the library files in a
3106 different directory to get them to go to the right place. Where should the
3108 $echo $n "library files be installed? (~name ok) [$dflt] $c"
3109 rp="Install private files where? [$dflt]"
3111 installprivlib=`./filexp "$ans"`
3113 : check for size of random number generator
3117 echo "Checking to see how many bits your rand function produces..."
3118 $cat >randbits.c <<'EOCP'
3123 register unsigned long tmp;
3124 register unsigned long max = 0L;
3126 for (i=1000; i; i--) {
3127 tmp = (unsigned long)rand();
3128 if (tmp > max) max = tmp;
3135 if $cc randbits.c -o randbits >/dev/null 2>&1 ; then
3139 echo "(I can't seem to compile the test program...)"
3146 rp="How many bits does your rand() function produce? [$dflt]"
3151 : determine where publicly executable scripts go
3152 case "$scriptdir" in
3155 : guess some guesses
3156 test -d /usr/share/scripts && dflt=/usr/share/scripts
3157 test -d /usr/share/bin && dflt=/usr/share/bin
3159 *) dflt="$scriptdir"
3165 Some installations have a separate directory just for executable scripts so
3166 that they can mount it across multiple architectures but keep the scripts in
3167 one spot. You might, for example, have a subdirectory of /usr/share for this.
3168 Or you might just lump your scripts in with all your other executables.
3171 while $test "$cont" ; do
3172 rp="Where will publicly executable scripts reside (~name ok)? [$dflt]"
3176 scriptdir=`./filexp "$scriptdir"`
3177 if test -d $scriptdir; then
3184 rp="Directory $scriptdir doesn't exist. Use that name anyway? [$dflt]"
3194 case "$installscr" in
3196 dflt=`echo $scriptdir | sed 's#^/afs/#/afs/.#'`
3197 test -d $dflt || dflt="$scriptdir"
3199 *) dflt="$scriptdir"
3205 Some installations must install scripts in a different directory than where
3206 they will eventually reside. On most systems they're the same directory.
3208 while $test "$cont" ; do
3209 rp="Where do you install publicly executable scripts (~name ok)? [$dflt]"
3213 installscr=`./filexp "$installscr"`
3214 if test -d $installscr; then
3221 rp="Directory $installscr doesn't exist. Use that name anyway? [$dflt]"
3231 : generate list of signal names
3235 echo "Generating a list of signal names..."
3236 set X `cat $usrinclude/signal.h $usrinclude/sys/signal.h 2>&1 | awk '
3237 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
3238 sig[$3] = substr($2,4,20)
3239 if (max < $3 && $3 < 60) {
3245 for (i=1; i<=max; i++) {
3258 0) echo 'kill -l' >/tmp/foo$$
3259 set X `$csh -f </tmp/foo$$`
3262 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
3270 echo "Signals are: $sig_name"
3272 : see what type of char stdio uses.
3274 if $contains 'unsigned.*char.*\*.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
3275 echo "Your stdio uses unsigned chars."
3276 stdchar="unsigned char"
3278 echo "Your stdio uses signed chars."
3282 : see what type uids are declared as in the kernel
3285 if $contains 'uid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3288 set `grep '_ruid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3290 unsigned) dflt="$1 $2" ;;
3300 rp="What type are user ids returned by getuid(), etc.? [$dflt]"
3305 : check for void type
3308 Checking to see how well your C compiler groks the void type...
3310 Support flag bits are:
3311 1: basic void declarations.
3312 2: arrays of pointers to functions returning void.
3313 4: operations between pointers to and addresses of void functions.
3318 $cat >void.c <<'EOCP'
3324 extern void moo(); /* function returning void */
3325 void (*goo)(); /* ptr to func returning void */
3338 if $cc -c -DTRY=$voidwant void.c >void.out 2>&1 ; then
3340 echo "It appears to support void to the level $package wants ($voidwant)."
3341 if $contains warning void.out >/dev/null 2>&1; then
3342 echo "However, you might get some warnings that look like this:"
3346 echo "Hmm, your compiler has some difficulty with void. Checking further..."
3347 if $cc -c -DTRY=1 void.c >/dev/null 2>&1 ; then
3348 echo "It supports 1..."
3349 if $cc -c -DTRY=3 void.c >/dev/null 2>&1 ; then
3351 echo "And it supports 2 but not 4."
3353 echo "It doesn't support 2..."
3354 if $cc -c -DTRY=5 void.c >/dev/null 2>&1 ; then
3356 echo "But it supports 4."
3359 echo "And it doesn't support 4."
3363 echo "There is no support at all for void."
3369 rp="Your void support flags add up to what? [$dflt]"
3374 : preserve RCS keywords in files with variable substitution, grrr
3382 Revision='$Revision'
3387 : determine compiler compiler
3392 dflt='yacc -Sm25000'
3399 rp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]"
3407 : see if we can include fcntl.h
3411 echo "We'll be including <fcntl.h>."
3414 if $h_sys_file; then
3415 echo "We don't need to <fcntl.h> if we include <sys/file.h>."
3417 echo "We won't be including <fcntl.h>."
3423 : see if gdbm is available
3425 xxx=`./loc gdbm.h x $usrinclude /usr/local/include $inclwanted`
3426 if test -f $xxx; then
3428 echo "gdbm.h found."
3431 echo "gdbm.h not found."
3436 : see if this is an grp system
3438 if $test -r $usrinclude/grp.h ; then
3443 echo "No grp.h found."
3448 : see if this is a netinet/in.h or sys/in.h system
3450 xxx=`./loc netinet/in.h x $usrinclude /usr/local/include $inclwanted`
3451 if test -f $xxx; then
3454 echo "netinet/in.h found."
3457 echo "No netinet/in.h found, ..."
3458 xxx=`./loc sys/in.h x $usrinclude /usr/local/include $inclwanted`
3459 if test -f $xxx; then
3461 echo "but I found sys/in.h instead."
3464 echo "and I didn't find sys/in.h either."
3473 : Do we need to #include <sys/file.h> ?
3475 if $h_sys_file; then
3477 echo "We'll be including <sys/file.h>."
3480 echo "We won't be including <sys/file.h>."
3485 : see if ioctl defs are in sgtty/termio or sys/ioctl
3487 if $test -r $usrinclude/sys/ioctl.h ; then
3489 echo "sys/ioctl.h found."
3492 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
3497 : see if we should include utime.h
3499 if $test -r $usrinclude/utime.h ; then
3501 echo "utime.h found."
3504 echo "No utime.h found, but that's ok."
3509 : see if this is a varargs system
3511 if $test -r $usrinclude/varargs.h ; then
3513 echo "varargs.h found."
3516 echo "No varargs.h found, but that's ok (I hope)."
3521 : see if this is a vfork system
3523 if $test -r $usrinclude/vfork.h ; then
3525 echo "vfork.h found."
3528 echo "No vfork.h found."
3533 : end of configuration questions
3535 echo "End of configuration questions."
3538 : create config.sh file
3540 if test -d ../UU; then
3543 echo "Creating config.sh..."
3544 test -f config.sh && cp config.sh UU/oldconfig.sh
3545 $spitshell <<EOT >config.sh
3548 # This file was produced by running the Configure script.
3549 d_eunice='$d_eunice'
3551 eunicefix='$eunicefix'
3581 sendmail='$sendmail'
3611 lastuname='$lastuname'
3612 alignbytes='$alignbytes'
3614 installbin='$installbin'
3615 byteorder='$byteorder'
3616 contains='$contains'
3617 cppstdin='$cppstdin'
3618 cppminus='$cppminus'
3622 d_castneg='$d_castneg'
3623 castflags='$castflags'
3624 d_charsprf='$d_charsprf'
3625 d_chsize='$d_chsize'
3627 cryptlib='$cryptlib'
3629 d_dosuid='$d_dosuid'
3631 d_fchmod='$d_fchmod'
3632 d_fchown='$d_fchown'
3634 d_flexfnam='$d_flexfnam'
3636 d_getgrps='$d_getgrps'
3637 d_gethent='$d_gethent'
3638 d_getpgrp='$d_getpgrp'
3639 d_getpgrp2='$d_getpgrp2'
3640 d_getprior='$d_getprior'
3643 d_killpg='$d_killpg'
3645 d_memcmp='$d_memcmp'
3646 d_memcpy='$d_memcpy'
3649 d_msgctl='$d_msgctl'
3650 d_msgget='$d_msgget'
3651 d_msgrcv='$d_msgrcv'
3652 d_msgsnd='$d_msgsnd'
3656 d_readdir='$d_readdir'
3657 d_rename='$d_rename'
3659 d_select='$d_select'
3661 d_semctl='$d_semctl'
3662 d_semget='$d_semget'
3664 d_setegid='$d_setegid'
3665 d_seteuid='$d_seteuid'
3666 d_setpgrp='$d_setpgrp'
3667 d_setpgrp2='$d_setpgrp2'
3668 d_setprior='$d_setprior'
3669 d_setregid='$d_setregid'
3670 d_setresgid='$d_setresgid'
3671 d_setreuid='$d_setreuid'
3672 d_setresuid='$d_setresuid'
3673 d_setrgid='$d_setrgid'
3674 d_setruid='$d_setruid'
3677 d_voidshmat='$d_voidshmat'
3678 d_shmctl='$d_shmctl'
3680 d_shmget='$d_shmget'
3681 d_socket='$d_socket'
3682 d_sockpair='$d_sockpair'
3683 d_oldsock='$d_oldsock'
3684 socketlib='$socketlib'
3685 d_statblks='$d_statblks'
3686 d_stdstdio='$d_stdstdio'
3687 d_strctcpy='$d_strctcpy'
3688 d_strerror='$d_strerror'
3689 d_symlink='$d_symlink'
3690 d_syscall='$d_syscall'
3691 d_truncate='$d_truncate'
3693 d_voidsig='$d_voidsig'
3694 d_tosignal='$d_tosignal'
3695 d_volatile='$d_volatile'
3696 d_vprintf='$d_vprintf'
3697 d_charvspr='$d_charvspr'
3699 d_waitpid='$d_waitpid'
3701 groupstype='$groupstype'
3708 d_pwquota='$d_pwquota'
3710 d_pwchange='$d_pwchange'
3711 d_pwclass='$d_pwclass'
3712 d_pwexpire='$d_pwexpire'
3713 d_pwcomment='$d_pwcomment'
3714 i_sys_file='$i_sys_file'
3715 i_sysioctl='$i_sysioctl'
3717 i_sys_time='$i_sys_time'
3718 i_sys_select='$i_sys_select'
3719 d_systimekernel='$d_systimekernel'
3721 i_varargs='$i_varargs'
3727 i_my_dir='$i_my_dir'
3729 i_sys_ndir='$i_sys_ndir'
3730 i_dirent='$i_dirent'
3731 i_sys_dir='$i_sys_dir'
3732 d_dirnamlen='$d_dirnamlen'
3735 mallocsrc='$mallocsrc'
3736 mallocobj='$mallocobj'
3737 usemymalloc='$usemymalloc'
3738 mallocptrtype='$mallocptrtype'
3747 optimize='$optimize'
3749 cppflags='$cppflags'
3752 nativegcc='$nativegcc'
3757 randbits='$randbits'
3758 scriptdir='$scriptdir'
3759 installscr='$installscr'
3760 sig_name='$sig_name'
3761 spitshell='$spitshell'
3763 sharpbang='$sharpbang'
3767 usrinclude='$usrinclude'
3768 inclPath='$inclPath'
3770 voidhave='$voidhave'
3771 voidwant='$voidwant'
3772 w_localtim='$w_localtim'
3773 w_s_timevl='$w_s_timevl'
3778 installprivlib='$installprivlib'
3781 test -f patchlevel.h && awk '{printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
3782 echo "CONFIG=true" >>config.sh
3784 if test -f UU/oldconfig.sh; then
3785 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
3786 sort | uniq -u >UU/oldsyms
3787 set X `cat UU/oldsyms`
3791 *) echo "Hmm...You had some extra variables I don't know about...I'll try to keep 'em..."
3792 for sym in `cat UU/oldsyms`; do
3793 echo " Propagating $hint variable "'$'"$sym..."
3794 eval 'tmp="$'"${sym}"'"'
3796 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
3808 echo "If you didn't make any mistakes, then just type a carriage return here."
3809 rp="If you need to edit config.sh, do it as a shell escape here:"
3814 *) : in case they cannot read
3820 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
3824 Now you need to generate make dependencies by running "make depend".
3825 You might prefer to run it in background: "make depend > makedepend.out &"
3826 It can take a while, so you might not want to run it right now.
3829 rp="Run make depend now? [$dflt]"
3833 y*) make depend && echo "Now you must run a make."
3835 *) echo "You must run 'make depend' then 'make'."
3838 elif test -f [Mm]akefile; then
3840 echo "Now you must run a make."