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.1 $$Date: 91/04/11 17:26:42 $
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';;
292 : get the name of the package
296 echo "Beginning of configuration questions for $package kit."
297 : Eunice requires " " instead of "", can you believe it
302 : change the next line if compiling for Xenix/286 on Xenix/386
303 xlibpth='/usr/lib/386 /lib/386'
304 libpth='/usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
305 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
306 trap 'echo " "; exit 1' 1 2 3
308 : We must find out about Eunice early
310 if test -f /etc/unixtovms; then
311 eunicefix=/etc/unixtovms
313 if test -f /etc/unixtovms.exe; then
314 eunicefix=/etc/unixtovms.exe
317 attrlist="DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__"
318 attrlist="$attrlist __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
319 attrlist="$attrlist hp9000s300 hp9000s500 hp9000s800 hpux"
320 attrlist="$attrlist i186 i386 i8086 iAPX286 ibm interdata"
321 attrlist="$attrlist m68k m88k mc300 mc500 mc68000 mc68k mc700 mert"
322 attrlist="$attrlist ns16000 ns32000 nsc32000 os pdp11 posix pyr sinix"
323 attrlist="$attrlist sparc sun tower tower32 tower32_600 tower32_800 tss"
324 attrlist="$attrlist u3b2 u3b20 u3b200 u3b5 ultrix unix vax venix xenix"
325 attrlist="$attrlist z8000"
327 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"
328 d_newshome="/usr/NeWS"
341 libswanted="net_s net nsl_s nsl socket nm ndir ndbm dbm malloc sun m bsd BSD x c_s posix"
342 inclwanted='/usr/include /usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan'
344 : Now test for existence of everything in MANIFEST
346 echo "First let's make sure your kit is complete. Checking..."
347 awk '$1 !~ /PACKINGLIST/ {print $1}' ../MANIFEST | split -200
349 for filelist in x??; do
350 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
352 if test -s missing; then
358 : some greps do not return status, grrr.
359 echo "grimblepritz" >contains.txt
360 if grep blurfldyick contains.txt >/dev/null 2>&1 ; then
362 elif grep grimblepritz contains.txt >/dev/null 2>&1 ; then
367 : the following should work in any shell
371 echo "AGH! Grep doesn't return a status. Attempting remedial action."
372 cat >contains <<'EOSS'
373 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
378 : see if sh knows # comments
380 echo "Checking your sh to see if it knows about # comments..."
381 if sh -c '#' >/dev/null 2>&1 ; then
382 echo "Your sh handles # comments correctly."
386 echo "Okay, let's see if #! works on this system..."
387 if test -f /bsd43/bin/echo; then
388 echo "#!/bsd43/bin/echo hi" > spit.sh
390 echo "#!/bin/echo hi" > spit.sh
395 if $contains hi today >/dev/null 2>&1; then
399 echo "#! /bin/echo hi" > spit.sh
403 if test -s today; then
412 echo "Your sh doesn't grok # comments--I will strip them later on."
414 echo "exec grep -v '^#'" >spitshell
417 spitshell=`pwd`/spitshell
418 echo "I presume that if # doesn't work, #! won't work either!"
422 : figure out how to guarantee sh startup
424 echo "Checking out how to guarantee sh startup..."
425 startsh=$sharpbang'/bin/sh'
426 echo "Let's see if '$startsh' works..."
438 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
441 : first determine how to suppress newline on echo command
442 echo "Checking echo to see how to suppress newlines..."
443 (echo "hi there\c" ; echo " ") >echotmp
444 if $contains c echotmp >/dev/null 2>&1 ; then
455 echo $n "Type carriage return to continue. Your cursor should be here-->$c"
458 : now set up to do reads with possible shell escape and default assignment
461 yes) ans=''; echo " " ;;
464 while expr "X\$ans" : "X!" >/dev/null; do
473 set \`expr "X\$ans" : "X!\(.*\)\$"\`
486 : general instructions
489 This installation shell script will examine your system and ask you questions
490 to determine how the $package package should be installed. If you get stuck
491 on a question, you may use a ! shell escape to start a subshell or execute
492 a command. Many of the questions will have default answers in square
493 brackets--typing carriage return will give you the default.
495 On some of the questions which ask for file or directory names you are
496 allowed to use the ~name construct to specify the login directory belonging
497 to "name", even if you don't have a shell which knows about that. Questions
498 where this is allowed will be marked "(~name ok)".
501 rp="[Type carriage return to continue]"
506 Much effort has been expended to ensure that this shell script will run on any
507 Unix system. If despite that it blows up on you, your best bet is to edit
508 Configure and run it again. Also, let me (lwall@netlabs.com)
509 know how I blew it. If you can't run Configure for some reason, you'll have
510 to generate a config.sh file by hand.
512 This installation script affects things in two ways: 1) it may do direct
513 variable substitutions on some of the files included in this kit, and
514 2) it builds a config.h file for inclusion in C programs. You may edit
515 any of these files as the need arises after running this script.
517 If you make a mistake on a question, there is no easy way to back up to it
518 currently. The easiest thing to do is to edit config.sh and rerun all the
519 SH files. Configure will offer to let you do this before it runs the SH files.
522 rp="[Type carriage return to continue]"
526 : find out where common programs are
528 echo "Locating common programs..."
541 if test -d \$dir/\$thing; then
547 if test -f \$dir/\$thing; then
550 elif test -f \$dir/\$thing.exe; then
551 : on Eunice apparently
588 pth=`echo :$boPATH:$PATH:$eoPATH: | sed -e 's/:/ /g'`
589 for file in $loclist; do
590 xxx=`./loc $file $file $pth`
595 echo $file is in $xxx.
598 echo "I don't know where $file is. I hope it's in everyone's PATH."
603 echo "Don't worry if any of the following aren't found..."
605 for file in $trylist; do
606 xxx=`./loc $file $file $pth`
611 echo $file is in $xxx.
614 echo "I don't see $file out there, $ans."
621 echo "Substituting grep for egrep."
627 echo "Hopefully test is built into your sh."
630 if sh -c "PATH= test true" >/dev/null 2>&1; then
631 echo "Using the test built into your sh."
641 echo "Hopefully echo is built into your sh."
645 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
646 $echo $n "hi there$c" >Loc1.txt
647 echo $n "hi there$c" >Loc2.txt
648 if cmp Loc1.txt Loc2.txt >/dev/null 2>&1; then
649 echo "They are compatible. In fact, they may be identical."
652 '-n') n='' c='\c' ans='\c' ;;
653 *) n='-n' c='' ans='-n' ;;
656 They are not compatible! You are probably running ksh on a non-USG system.
657 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
658 have echo built in and we may have to run some Bourne shell scripts. That
659 means I'll have to use $ans to suppress newlines now. Life is ridiculous.
662 rp="Your cursor should be here-->"
673 : set up shell script to do ~ expansion
679 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
682 if $test -f /bin/csh; then
683 /bin/csh -f -c "glob \$1"
686 name=\`$expr x\$1 : '..\([^/]*\)'\`
687 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
688 if $test ! -d "\$dir"; then
690 echo "\$me: can't locate home directory for: \$name" >&2
695 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
711 : get old answers, if there is a config file out there
713 if test -f ../config.sh; then
715 eval `grep lastuname ../config.sh`
716 uname=`(uname -a || hostname) 2>&1`
717 if test "X$uname" = "X$lastuname"; then
723 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
727 n*) echo "OK, I'll ignore it."; mv ../config.sh ../config.sh.old;;
728 *) echo "Fetching default answers from your old config.sh file..."
738 if test -d ../hints && test ! -f ../config.sh; then
740 echo "First time through, eh? I have some defaults handy for the following systems:"
741 (cd ../hints; ls -C *.sh | sed 's/\.sh/ /g')
743 : Half the following guesses are probably wrong...
744 test -f /irix && dflt="$dflt sgi"
745 test -f /xenix && dflt="$dflt sco_xenix"
746 test -f /dynix && dflt="$dflt dynix"
747 test -f /dnix && dflt="$dflt dnix"
748 test -f /bin/mips && /bin/mips && dflt="$dflt mips"
749 if test -f /bin/uname || test -f /usr/bin/uname; then
750 set `uname -a | tr '[A-Z]' '[a-z]'`
752 test -f "../hints/$5.sh" && dflt="$dflt $5"
755 3b2) dflt="$dflt 3b2";;
756 fps*) dflt="$dflt fps";;
757 mips*) dflt="$dflt mips";;
758 [23]100) dflt="$dflt mips";;
759 next*) dflt="$dflt next" ;;
763 aix) dflt="$dflt aix_rs" ;;
765 3.4) dflt="$dflt sunos_3_4" ;;
766 3.5) dflt="$dflt sunos_3_5" ;;
767 4.0.1) dflt="$dflt sunos_4_0_1" ;;
768 4.0.2) dflt="$dflt sunos_4_0_2" ;;
771 dnix) dflt="$dflt dnix" ;;
772 genix) dflt="$dflt genix" ;;
773 hp*ux) dflt="$dflt hpux" ;;
774 next) dflt="$dflt next" ;;
775 irix) dflt="$dflt sgi" ;;
777 3*) dflt="$dflt ultrix_3" ;;
778 4*) dflt="$dflt ultrix_4" ;;
781 uts) dflt="$dflt uts" ;;
782 $2) if test -f /etc/systemid; then
783 set `echo $3 | sed 's/\./ /` $4
784 if test -f ../hints/sco_$1_$2_$3.sh; then
785 dflt="$dflt sco_$1_$2_$3"
786 elif test -f ../hints/sco_$1_$2.sh; then
787 dflt="$dflt sco_$1_$2"
788 elif test -f ../hints/sco_$1.sh; then
795 set X `echo $dflt | tr ' ' '\012' | sort | uniq`
801 echo '(You may give one or more space-separated answers, or "none" if appropriate.)'
802 rp="Which of these apply, if any? [$dflt]"
806 if test -f ../hints/$file.sh; then
817 echo "*** WHOA THERE!!! ***"
818 echo " The $hint value for \$$2 on this machine was \"$was\"!"
819 rp=" Keep the $hint value? [y]"
823 y) td=$was; tu=$was;;
827 setvar='td=$define; tu=$undef; set X $1; eval "was=\$$2";
829 defineundef) . whoa; eval "$2=\$td";;
830 undefdefine) . whoa; eval "$2=\$tu";;
834 : determine where manual pages go
837 $package has manual pages available in source form.
841 echo "However, you don't have nroff, so they're probably useless to you."
848 echo "If you don't want the manual sources installed, answer 'none'."
851 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`
857 while $test "$cont" ; do
859 rp="Where do the manual pages (source) go (~name ok)? [$dflt]"
868 mansrc=`./filexp "$ans"`
869 if $test -d "$mansrc"; then
872 if $test "$fastread" = yes; then
877 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
915 : Sigh. Well, at least the box is fast...
918 case "$usrinclude" in
919 '') dflt='/usr/include';;
920 *) dflt=$usrinclude;;
923 if $test -f /bin/mips && /bin/mips; then
924 echo "Looks like a MIPS system..."
925 $cat >usrinclude.c <<'EOCP'
930 if cc -E usrinclude.c > usrinclude.out && $contains / usrinclude.out >/dev/null 2>&1 ; then
931 echo "and you're compiling with the BSD43 compiler and libraries."
932 dflt='/bsd43/usr/include'
935 echo "and you're compiling with the SysV compiler and libraries."
938 echo "Doesn't look like a MIPS system."
945 while $test "$cont" ; do
947 rp="Where are the include files you want to use? [$dflt]"
951 if $test -d $ans; then
954 if $test "$fastread" = yes; then
959 rp="Directory $ans doesn't exist. Use that name anyway? [$dflt]"
969 : make some quick guesses about what we are up against
971 cat $usrinclude/signal.h $usrinclude/sys/signal.h >guess.txt 2>/dev/null
972 if test "$usrinclude" = "/bsd43/usr/include" ; then
973 echo "Looks kind of like a SysV MIPS running BSD, but we'll see..."
977 elif test `echo abc | tr a-z A-Z` = Abc ; then
978 echo "Looks kind of like a USG system, but we'll see..."
982 elif $contains SIGTSTP guess.txt >/dev/null 2>&1 ; then
983 echo "Looks kind of like a BSD system, but we'll see..."
988 echo "Looks kind of like a version 7 system, but we'll see..."
996 There is, however, a strange, musty smell in the air that reminds me of
997 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
999 echo "exit 0" >eunice
1004 echo "Congratulations. You aren't running Eunice."
1006 echo "exit 1" >eunice
1009 if test -f /xenix; then
1010 echo "Actually, this looks more like a XENIX system..."
1011 echo "exit 0" >xenix
1014 echo "It's not Xenix..."
1015 echo "exit 1" >xenix
1019 if test -f /venix; then
1020 echo "Actually, this looks more like a VENIX system..."
1021 echo "exit 0" >venix
1027 echo "Nor is it Venix..."
1029 echo "exit 1" >venix
1031 chmod +x bsd usg v7 eunice venix
1032 $eunicefix bsd usg v7 eunice venix
1034 : see what memory models we can support
1037 : We may not use Cppsym or we get a circular dependency through cc.
1038 : But this should work regardless of which cc we eventually use.
1039 cat >pdp11.c <<'EOP'
1048 cc -o pdp11 pdp11.c >/dev/null 2>&1
1049 if pdp11 2>/dev/null; then
1050 dflt='unsplit split'
1052 ans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1055 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1060 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1063 if $test -d /lib/large || $test -d /usr/lib/large; then
1066 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1072 *) dflt="$models" ;;
1076 Some systems have different model sizes. On most systems they are called
1077 small, medium, large, and huge. On the PDP11 they are called unsplit and
1078 split. If your system doesn't support different memory models, say "none".
1079 If you wish to force everything to one memory model, say "none" here and
1080 put the appropriate flags later when it asks you for other cc and ld flags.
1081 Venix systems may wish to put "none" and let the compiler figure things out.
1082 (In the following question multiple model names should be space separated.)
1085 rp="Which models are supported? [$dflt]"
1102 if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
1103 $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
1111 rp="What flag indicates separate I and D space? [$dflt]"
1120 *large*|*small*|*medium*|*huge*)
1127 rp="What flag indicates large model? [$dflt]"
1143 rp="What flag indicates huge model? [$dflt]"
1159 rp="What flag indicates medium model? [$dflt]"
1167 *) medium="$large";;
1175 rp="What flag indicates small model? [$dflt]"
1187 echo "Unrecognized memory models--you may have to edit Makefile.SH"
1191 : see if we need a special compiler
1205 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1219 On some systems the default C compiler will not resolve multiple global
1220 references that happen to have the same name. On some such systems the
1221 "Mcc" command may be used to force these to be resolved. On other systems
1222 a "cc -M" command is required. (Note that the -M flag on other systems
1223 indicates a memory model to use!) If you have the Gnu C compiler, you
1224 might wish to use that instead. What command will force resolution on
1226 $echo $n "this system? [$dflt] $c"
1227 rp="Command to resolve multiple refs? [$dflt]"
1235 rp="Use which C compiler? [$dflt]"
1241 gcc*) cpp=`./loc gcc-cpp $cpp $pth`;;
1244 : determine optimize, if desired, or use for debug flag also
1255 Some C compilers have problems with their optimizers, by default, $package
1256 compiles with the -O flag to use the optimizer. Alternately, you might
1257 want to use the symbolic debugger, which uses the -g flag (on traditional
1258 Unix systems). Either flag can be specified here. To use neither flag,
1259 specify the word "none".
1262 rp="What optimizer/debugger flag should be used? [$dflt]"
1267 'none') optimize=" "
1273 *gcc*) dflt='-fpcc-struct-return';;
1277 *) dflt="$ccflags";;
1279 for thisincl in $inclwanted; do
1280 if test -d $thisincl; then
1281 if test "x$thisincl" != "x$usrinclude"; then
1284 *) dflt="$dflt -I$thisincl";;
1293 *) dflt="$dflt -DDEBUGGING";;
1297 if $contains 'LANGUAGE_C' $usrinclude/signal.h >/dev/null 2>&1; then
1300 *) dflt="$dflt -DLANGUAGE_C";;
1303 if $contains '_NO_PROTO' $usrinclude/signal.h >/dev/null 2>&1; then
1306 *) dflt="$dflt -D_NO_PROTO";;
1314 Your C compiler may want other flags. For this question you should
1315 include -I/whatever and -DWHATEVER flags and any other flags used by
1316 the C compiler, but you should NOT include libraries or ld flags like
1317 -lwhatever. To use no flags, specify the word "none".
1320 rp="Any additional cc flags? [$dflt]"
1328 : the following weeds options from ccflags that are of no interest to cpp
1331 *gcc*) cppflags="$cppflags -D__GNUC__";;
1339 -D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
1343 *-*) echo "(C preprocessor flags: $cppflags)";;
1355 *) dflt="$ldflags";;
1358 rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1367 echo "Checking for optional libraries..."
1372 case "$libswanted" in
1373 '') libswanted='c_s';;
1375 for thislib in $libswanted; do
1379 *) thatlib="${thislib}_s";;
1382 xxx=`./loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1383 if test -f $xxx; then
1384 echo "Found -l$thislib."
1386 *"-l$thislib "*|*"-l$thatlib "*);;
1387 *) dflt="$dflt -l$thislib ";;
1390 xxx=`./loc lib$thislib.a X $libpth`
1391 if test -f $xxx; then
1395 *) dflt="$dflt $xxx ";;
1398 xxx=`./loc Slib$thislib.a X $xlibpth`
1399 if test -f $xxx; then
1400 echo "Found -l$thislib."
1402 *"-l$thislib "*|*"-l$thatlib "*);;
1403 *) dflt="$dflt -l$thislib ";;
1406 xxx=`./loc lib$thislib.so X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1407 if test -f $xxx; then
1408 echo "Found -l$thislib as a shared object only."
1410 *"-l$thislib "*|*"-l$thatlib "*);;
1411 *) dflt="$dflt -l$thislib ";;
1414 echo "No -l$thislib."
1429 Some versions of Unix support shared libraries, which make
1430 executables smaller but make load time slightly longer.
1432 On some systems, mostly newer Unix System V's, the shared library
1433 is included by putting the option "-lc_s" as the last thing on the
1434 cc command line when linking. Other systems use shared libraries
1435 by default. There may be other libraries needed to compile $package
1436 on your machine as well. If your system needs the "-lc_s" option,
1437 include it here. Include any other special libraries here as well.
1438 Say "none" for none.
1442 rp="Any additional libraries? [$dflt]"
1450 : check for size of random number generator
1452 case "$alignbytes" in
1454 echo "Checking alignment constraints..."
1455 $cat >try.c <<'EOCP'
1462 printf("%d\n", (char*)&try.bar - (char*)&try.foo);
1465 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
1469 echo "(I can't seem to compile the test program...)"
1476 rp="Doubles must be aligned on a how-many-byte boundary? [$dflt]"
1482 : determine where public executables go
1485 The following questions distinguish the directory in which executables
1486 reside from the directory in which they are installed (and from which they
1487 are presumably copied to the former directory by occult means). This
1488 distinction is often necessary under afs. On most other systems, however,
1489 the two directories are the same.
1494 dflt=`./loc . /usr/local/bin /usr/local/bin /usr/lbin /usr/local /usr/bin /bin`
1500 while $test "$cont" ; do
1501 rp="In which directory will public executables reside (~name ok)? [$dflt]"
1502 $echo "In which directory will public executables reside (~name ok)?"
1503 $echo $n "[$dflt] $c"
1507 if test -d $bin; then
1514 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
1524 case "$installbin" in
1526 dflt=`echo $bin | sed 's#^/afs/#/afs/.#'`
1528 *) dflt="$installbin"
1532 while $test "$cont" ; do
1533 rp="In which directory will public executables be installed (~name ok)? [$dflt]"
1534 $echo "In which directory will public executables be installed (~name ok)?"
1535 $echo $n "[$dflt] $c"
1538 installbin=`./filexp $installbin`
1539 if test -d $installbin; then
1546 rp="Directory $installbin doesn't exist. Use that name anyway? [$dflt]"
1556 : check for ordering of bytes in a long
1557 case "$byteorder" in
1561 In the following, larger digits indicate more significance. A big-endian
1562 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
1563 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
1564 machines may have weird orders like 3412. A Cray will report 87654321. If
1565 the test program works the default is probably right.
1566 I'm now running the test program...
1568 $cat >byteorder.c <<'EOCP'
1575 char c[sizeof(long)];
1578 if (sizeof(long) > 4)
1579 u.l = (0x08070605 << 32) | 0x04030201;
1582 for (i=0; i < sizeof(long); i++)
1583 printf("%c",u.c[i]+'0');
1587 if $cc byteorder.c -o byteorder >/dev/null 2>&1 ; then
1590 ????|????????) echo "(The test program ran ok.)";;
1591 *) echo "(The test program didn't run right for some reason.)";;
1595 echo "(I can't seem to compile the test program. Guessing big-endian...)"
1603 rp="What is the order of bytes in a long? [$dflt]"
1608 : check for ability to cast negative floats to unsigned
1610 echo 'Checking to see if your C compiler can cast weird floats to unsigned'
1611 $cat >try.c <<'EOCP'
1617 unsigned long along;
1619 unsigned short ashort;
1622 signal(SIGFPE, SIG_IGN);
1623 along = (unsigned long)f;
1624 aint = (unsigned int)f;
1625 ashort = (unsigned short)f;
1626 if (along != (unsigned long)-123)
1628 if (aint != (unsigned int)-123)
1630 if (ashort != (unsigned short)-123)
1632 f = (double)0x40000000;
1635 along = (unsigned long)f;
1636 if (along != 0x80000000)
1640 along = (unsigned long)f;
1641 if (along != 0x7fffffff)
1645 along = (unsigned long)f;
1646 if (along != 0x80000001)
1651 if $cc -o try $ccflags try.c >/dev/null 2>&1; then
1657 case "$castflags" in
1659 echo "Yup, it does."
1662 echo "Nope, it doesn't."
1669 : see how we invoke the C preprocessor
1671 echo "Now, how can we feed standard input to your C preprocessor..."
1672 cat <<'EOT' >testcpp.c
1677 echo 'Maybe "'"$cc"' -E" will work...'
1678 $cc -E <testcpp.c >testcpp.out 2>&1
1679 : try to force gcc preprocessor if that is the compiler they are using
1681 0) cppstdin="$cc -E";;
1685 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1686 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1688 cppstdin=`pwd`/cppstdin
1691 $cppstdin <testcpp.c >testcpp.out 2>&1
1696 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1697 echo "Yup, it does."
1701 echo 'Nope...maybe "'"$cc"' -E -" will work...'
1702 $cc -E - <testcpp.c >testcpp.out 2>&1
1703 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1704 echo "Yup, it does."
1708 echo 'No such luck, maybe "'$cpp'" will work...'
1709 $cpp <testcpp.c >testcpp.out 2>&1
1710 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1715 echo 'Nixed again...maybe "'$cpp' -" will work...'
1716 $cpp - <testcpp.c >testcpp.out 2>&1
1717 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1718 echo "Hooray, it works! I was beginning to wonder."
1722 echo 'Nope...maybe "'"$cc"' -P" will work...'
1723 $cc -P <testcpp.c >testcpp.out 2>&1
1724 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1725 echo "Yup, that does."
1729 echo 'Nope...maybe "'"$cc"' -P -" will work...'
1730 $cc -P - <testcpp.c >testcpp.out 2>&1
1731 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1732 echo "Yup, that does."
1736 echo 'Hmm...perhaps you already told me...'
1739 *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
1741 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1742 echo "Hooray, you did! I was beginning to wonder."
1744 echo 'Uh-uh. Time to get fancy...'
1746 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1747 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1749 cppstdin=`pwd`/cppstdin
1752 $cppstdin <testcpp.c >testcpp.out 2>&1
1753 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1757 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
1758 rp='Name a C preprocessor:'
1761 $cppstdin <testcpp.c >testcpp.out 2>&1
1762 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1763 echo "OK, that will do."
1765 echo "Sorry, I can't get that to work. Go find one."
1777 : get list of predefined functions in a handy place
1783 '') if test -f /mach_boot; then
1785 elif test -d /usr/ccs/lib; then
1792 : on mips, we DO NOT want /lib, and we want inclPath/usr/lib
1795 libpth='$inclPath/usr/lib /usr/local/lib'
1798 libpth='/usr/ccs/lib /lib /usr/lib /usr/ucblib /usr/local/lib'
1803 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
1808 *) for thislib in $libs; do
1810 -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
1811 try=`./loc lib$thislib.a blurfl/dyick $libpth`
1812 if test ! -f $try; then
1813 try=`./loc lib$thislib blurfl/dyick $libpth`
1814 if test ! -f $try; then
1815 try=`./loc $thislib blurfl/dyick $libpth`
1816 if test ! -f $try; then
1817 try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
1818 if test ! -f $try; then
1824 libnames="$libnames $try"
1826 *) libnames="$libnames $thislib" ;;
1831 set /usr/ccs/lib/libc.so
1832 test -f $1 || set /usr/lib/libc.so
1833 test -f $1 || set /usr/lib/libc.so.[0-9]*
1834 test -f $1 || set /lib/libsys_s.a
1836 if test -f "$1"; then
1837 echo "Your shared C library is in $1."
1839 elif test -f "$libc"; then
1840 echo "Your C library is in $libc."
1841 elif test -f /lib/libc.a; then
1842 echo "Your C library is in /lib/libc.a. You're normal."
1845 if ans=`./loc libc.a blurfl/dyick $libpth`; test -f "$ans"; then
1847 elif ans=`./loc libc blurfl/dyick $libpth`; test -f "$ans"; then
1848 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
1849 elif ans=`./loc clib blurfl/dyick $libpth`; test -f "$ans"; then
1851 elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1853 elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1855 elif ans=`./loc Llibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1858 if test -f "$ans"; then
1859 echo "Your C library is in $ans, of all places."
1864 I can't seem to find your C library. I've looked in the following places:
1868 None of these seems to contain your C library. What is the full name
1871 $echo $n "of your C library? $c"
1872 rp='C library full name?'
1878 if test $libc = "/lib/libc"; then
1879 libc="$libc /lib/clib"
1881 set `echo $libc $libnames | tr ' ' '\012' | sort | uniq`
1882 $echo $n "Extracting names from $* for later perusal...$c"
1883 nm $nm_opts $* 2>/dev/null >libc.tmp
1884 $sed -n -e 's/^.* [ATDS] *[_.]*//p' -e 's/^.* [ATDS] //p' <libc.tmp >libc.list
1885 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1887 elif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \
1888 <libc.tmp >libc.list; \
1889 $contains '^printf$' libc.list >/dev/null 2>&1; then
1891 elif $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list; \
1892 $contains '^printf$' libc.list >/dev/null 2>&1; then
1894 elif $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list; \
1895 $contains '^printf$' libc.list >/dev/null 2>&1; then
1897 elif $sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' \
1898 <libc.tmp >libc.list; \
1899 $contains '^printf$' libc.list >/dev/null 2>&1; then
1901 elif $grep '|' <libc.tmp | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
1902 -e 's/^\([^ ]*\).*/\1/p' >libc.list
1903 $contains '^printf$' libc.list >/dev/null 2>&1; then
1905 elif $sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p' \
1906 <libc.tmp >libc.list; \
1907 $contains '^printf$' libc.list >/dev/null 2>&1; then
1910 nm -p $* 2>/dev/null >libc.tmp
1911 $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
1912 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1917 echo "nm didn't seem to work right."
1918 echo "Trying ar instead..."
1919 if ar t $libc > libc.tmp; then
1920 for thisname in $libnames; do
1921 ar t $thisname >>libc.tmp
1923 $sed -e 's/\.o$//' < libc.tmp > libc.list
1926 echo "ar didn't seem to work right."
1927 echo "Maybe this is a Cray...trying bld instead..."
1928 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
1929 for thisname in $libnames; do
1931 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
1932 ar t $thisname >>libc.tmp
1936 echo "That didn't work either. Giving up."
1946 if $contains "^$1\$" libc.list >/dev/null 2>&1;
1947 then echo "$1() found"; eval "$2=$define";
1948 else echo "$1() not found"; eval "$2=$undef"; fi'
1952 inlibc='echo " "; td=$define; tu=$undef;
1953 if $contains "^$1\$" libc.list >/dev/null 2>&1;
1954 then echo "$1() found";
1955 eval "case \"\$$2\" in undef) . whoa; esac"; eval "$2=\$td";
1956 else echo "$1() not found";
1957 eval "case \"\$$2\" in define) . whoa; esac"; eval "$2=\$tu"; fi'
1959 : see if bcmp exists
1963 : see if bcopy exists
1967 : see if bzero exists
1971 : see if sprintf is declared as int or pointer to char
1973 cat >ucbsprf.c <<'EOF'
1979 exit((unsigned long)sprintf(buf,"%s","foo") > 10L);
1982 if $cc $ccflags ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then
1983 echo "Your sprintf() returns (int)."
1986 echo "Your sprintf() returns (char*)."
1992 : see if vprintf exists
1994 if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
1995 echo 'vprintf() found.'
1997 cat >vprintf.c <<'EOF'
1998 #include <varargs.h>
2000 main() { xxx("foo"); }
2009 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
2012 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
2013 echo "Your vsprintf() returns (int)."
2016 echo "Your vsprintf() returns (char*)."
2020 echo 'vprintf() not found.'
2030 : see if chsize exists
2034 : see if crypt exists
2036 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
2037 echo 'crypt() found.'
2041 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
2042 if $test -z "$cryptlib"; then
2043 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
2047 if $test -z "$cryptlib"; then
2048 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
2052 if $test -z "$cryptlib"; then
2053 cryptlib=`./loc libcrypt.a "" $libpth`
2057 if $test -z "$cryptlib"; then
2058 echo 'crypt() not found.'
2067 : get csh whereabouts
2069 'csh') val="$undef" ;;
2075 : see if readdir exists
2076 set readdir d_readdir
2079 : see if there are directory access routines out there
2081 xxx=`./loc ndir.h x $usrinclude /usr/local/include $inclwanted`
2084 xxx=`./loc sys/ndir.h x $usrinclude /usr/local/include $inclwanted`
2087 D_dirnamlen="$undef"
2096 if $test -r $usrinclude/dirent.h; then
2097 echo "dirent.h found."
2098 if $contains 'd_namlen' $usrinclude/dirent.h >/dev/null 2>&1; then
2099 D_dirnamlen="$define"
2102 elif $test -r $xxx; then
2103 echo "You seem to use <$xxx>,"
2104 if $test "$d_readdir" = "$define"; then
2105 echo "and I can get readdir() from your C library."
2106 elif $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a; then
2107 echo "and I'll get the routines using -lndir ."
2110 ans=`./loc libndir.a x $libpth`
2113 echo "but I can't find the ndir library!"
2116 echo "and I found the directory library in $ans."
2121 if $contains 'd_namlen' $xxx >/dev/null 2>&1; then
2122 D_dirnamlen="$define"
2126 I_sys_ndir="$define"
2133 : The next line used to require this to be a bsd system.
2134 if $contains '^readdir$' libc.list >/dev/null 2>&1 ; then
2135 echo "No ndir library found, but you have readdir() so we'll use that."
2136 if $contains 'd_namlen' $usrinclude/sys/dir.h >/dev/null 2>&1; then
2137 D_dirnamlen="$define"
2141 echo "No ndir library found--using ./$d_ndir.c."
2142 : This will lose since $d_ndir.h is in another directory.
2143 : I doubt we can rely on it being in ../$d_ndir.h .
2144 : At least it will fail in a conservative manner.
2145 if $contains 'd_namlen' $d_ndir.h >/dev/null 2>&1; then
2146 D_dirnamlen="$define"
2153 val=$D_dirnamlen; set d_dirnamlen; eval $setvar
2154 val=$I_dirent; set i_dirent; eval $setvar
2155 val=$I_sys_dir; set i_sys_dir; eval $setvar
2156 val=$I_my_dir; set i_my_dir; eval $setvar
2157 val=$I_ndir; set i_ndir; eval $setvar
2158 val=$I_sys_ndir; set i_sys_ndir; eval $setvar
2160 : now see if they want to do setuid emulation
2168 Some sites have disabled setuid #! scripts because of a bug in the kernel
2169 that prevents them from being secure. If you are on such a system, the
2170 setuid/setgid bits on scripts are currently useless. It is possible for
2171 $package to detect those bits and emulate setuid/setgid in a secure fashion
2172 until a better solution is devised for the kernel problem.
2175 rp="Do you want to do setuid/setgid emulation? [$dflt]"
2182 y*) d_dosuid="$define";;
2183 *) d_dosuid="$undef";;
2186 : see if dup2 exists
2190 : see if fchmod exists
2194 : see if fchown exists
2198 : see if this is an fcntl system
2202 : see if we can have long filenames
2204 rm -f 123456789abcde
2205 if (echo hi >123456789abcdef) 2>/dev/null; then
2207 if test -f 123456789abcde; then
2208 echo 'You cannot have filenames longer than 14 characters. Sigh.'
2211 echo 'You can have filenames longer than 14 characters.'
2215 : version 8 probably
2216 echo "You can't have filenames longer than 14 chars. You can't even think about them!"
2222 : see if flock exists
2226 : see if getgroups exists
2227 set getgroups d_getgrps
2230 : see if gethostent exists
2231 set gethostent d_gethent
2234 : see if getpgrp exists
2235 set getpgrp d_getpgrp
2238 : see if getpgrp2 exists
2239 set getpgrp2 d_getpgrp2
2242 : see if getpriority exists
2243 set getpriority d_getprior
2246 : see if htonl exists
2254 *) if $test -f /unix; then
2261 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
2262 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2263 echo "Your system has both index() and strchr(). Shall I use"
2264 rp="index() rather than strchr()? [$dflt]"
2268 n*) d_index="$define" ;;
2269 *) d_index="$undef" ;;
2273 echo "index() found."
2276 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2278 echo "strchr() found."
2280 echo "No index() or strchr() found!"
2285 : see if killpg exists
2289 : see if lstat exists
2293 : see if memcmp exists
2297 : see if memcpy exists
2301 : see if mkdir exists
2305 : see if msgctl exists
2309 : see if msgget exists
2313 : see if msgsnd exists
2317 : see if msgrcv exists
2321 : see how much of the 'msg*(2)' library is present.
2324 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
2325 *undef*) h_msg=false;;
2327 : we could also check for sys/ipc.h ...
2328 if $h_msg && $test -r $usrinclude/sys/msg.h; then
2329 echo "You have the full msg*(2) library."
2332 echo "You don't have the full msg*(2) library."
2338 : see if ndbm is available
2340 xxx=`./loc ndbm.h x $usrinclude /usr/local/include $inclwanted`
2341 if test -f $xxx; then
2343 echo "ndbm.h found."
2346 echo "ndbm.h not found."
2351 : see if we have the old dbm
2353 xxx=`./loc dbm.h x $usrinclude /usr/local/include $inclwanted`
2354 if test -f $xxx; then
2359 echo "dbm.h not found."
2364 : see whether socket exists
2367 if $contains socket libc.list >/dev/null 2>&1; then
2368 echo "Looks like you have Berkeley networking support."
2370 : now check for advanced features
2371 if $contains setsockopt libc.list >/dev/null 2>&1; then
2374 echo "...but it uses the old 4.1c interface, rather than 4.2"
2378 : hpux, for one, puts all the socket stuff in socklib.o
2379 if $contains socklib libc.list >/dev/null 2>&1; then
2380 echo "Looks like you have Berkeley networking support."
2382 : we will have to assume that it supports the 4.2 BSD interface
2385 echo "Hmmm...you don't have Berkeley networking in libc.a..."
2386 : look for an optional networking library
2387 if test -f /usr/lib/libnet.a; then
2388 (ar t /usr/lib/libnet.a ||
2389 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
2390 if $contains socket libc.list >/dev/null 2>&1; then
2391 echo "but the Wollongong group seems to have hacked it in."
2392 socketlib="-lnet -lnsl_s"
2394 : now check for advanced features
2395 if $contains setsockopt libc.list >/dev/null 2>&1; then
2398 echo "...using the old 4.1c interface, rather than 4.2"
2402 echo "or even in libnet.a, which is peculiar."
2407 echo "or anywhere else I see."
2416 if $contains socketpair libc.list >/dev/null 2>&1; then
2427 : Locate the flags for 'open()'
2429 $cat >open3.c <<'EOCP'
2430 #include <sys/types.h>
2435 #include <sys/file.h>
2448 : check sys/file.h first to get FREAD on Sun
2449 if $test -r $usrinclude/sys/file.h && \
2450 $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
2452 echo "sys/file.h defines the O_* constants..."
2454 echo "and you have the 3 argument form of open()."
2457 echo "but not the 3 argument form of open(). Oh, well."
2460 elif $test -r $usrinclude/fcntl.h && \
2461 $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
2463 echo "fcntl.h defines the O_* constants..."
2465 echo "and you have the 3 argument form of open()."
2468 echo "but not the 3 argument form of open(). Oh, well."
2473 echo "I can't find the O_* constant definitions! You got problems."
2478 : see if how pwd stuff is defined
2480 if $test -r $usrinclude/pwd.h ; then
2483 $cppstdin $cppflags $cppminus <$usrinclude/pwd.h >pwd.txt
2484 if $contains 'pw_quota' pwd.txt >/dev/null 2>&1; then
2489 if $contains 'pw_age' pwd.txt >/dev/null 2>&1; then
2494 if $contains 'pw_change' pwd.txt >/dev/null 2>&1; then
2495 d_pwchange="$define"
2499 if $contains 'pw_class' pwd.txt >/dev/null 2>&1; then
2504 if $contains 'pw_expire' pwd.txt >/dev/null 2>&1; then
2505 d_pwexpire="$define"
2509 if $contains 'pw_comment' pwd.txt >/dev/null 2>&1; then
2510 d_pwcomment="$define"
2512 d_pwcomment="$undef"
2521 d_pwcomment="$undef"
2522 echo "No pwd.h found."
2525 : see if rename exists
2529 : see if rmdir exists
2533 : see if select exists
2537 : see if semctl exists
2541 : see if semget exists
2545 : see if semop exists
2549 : see how much of the 'sem*(2)' library is present.
2552 case "$d_semctl$d_semget$d_semop" in
2553 *undef*) h_sem=false;;
2555 : we could also check for sys/ipc.h ...
2556 if $h_sem && $test -r $usrinclude/sys/sem.h; then
2557 echo "You have the full sem*(2) library."
2560 echo "You don't have the full sem*(2) library."
2566 : see if setegid exists
2567 set setegid d_setegid
2570 : see if seteuid exists
2571 set seteuid d_seteuid
2574 : see if setpgrp exists
2575 set setpgrp d_setpgrp
2578 : see if setpgrp2 exists
2579 set setpgrp2 d_setpgrp2
2582 : see if setpriority exists
2583 set setpriority d_setprior
2586 : see if setregid exists
2587 set setregid d_setregid
2589 set setresgid d_setresgid
2592 : see if setreuid exists
2593 set setreuid d_setreuid
2595 set setresuid d_setresuid
2598 : see if setrgid exists
2599 set setrgid d_setrgid
2602 : see if setruid exists
2603 set setruid d_setruid
2606 : see if shmctl exists
2610 : see if shmget exists
2614 : see if shmat exists
2618 : see if shmdt exists
2622 : see how much of the 'shm*(2)' library is present.
2625 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
2626 *undef*) h_shm=false;;
2628 : we could also check for sys/ipc.h ...
2629 if $h_shm && $test -r $usrinclude/sys/shm.h; then
2630 echo "You have the full shm*(2) library."
2633 echo "You don't have the full shm*(2) library."
2639 : see if stat knows about block sizes
2641 if $contains 'st_blocks;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2642 if $contains 'st_blksize;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2643 echo "Your stat knows about block sizes."
2646 echo "Your stat doesn't know about block sizes."
2650 echo "Your stat doesn't know about block sizes."
2656 : see if stdio is really std
2658 if $contains 'char.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2659 if $contains '_cnt;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2660 echo "Your stdio is pretty std."
2663 echo "Your stdio isn't very std."
2667 echo "Your stdio isn't very std."
2673 : check for structure copying
2675 echo "Checking to see if your C compiler can copy structs..."
2676 $cat >strctcpy.c <<'EOCP'
2686 if $cc -c strctcpy.c >/dev/null 2>&1 ; then
2691 echo "Nope, it can't."
2696 : see if strerror exists
2697 set strerror d_strerror
2700 : see if symlink exists
2701 set symlink d_symlink
2704 : see if syscall exists
2705 set syscall d_syscall
2708 : set if package uses struct tm
2711 : set if package uses struct timeval
2713 define) w_s_timevl=1 ;;
2716 : set if package uses localtime function
2719 : see which of time.h, sys/time.h, and sys/select should be included.
2723 Testing to see which of <time.h>, <sys/time.h>, and <sys/select.h>
2724 should be included, because this application wants:
2727 case "$w_s_itimer" in
2729 echo " struct itimerval"
2730 idefs="-DS_ITIMERVAL $idefs"
2733 case "$w_s_timevl" in
2735 echo " struct timeval"
2736 idefs="-DS_TIMEVAL $idefs"
2742 idefs="-DS_TM $idefs"
2745 case "$w_localtim" in
2747 echo " ctime(3) declarations"
2748 idefs="-DD_CTIME $idefs"
2753 echo " (something I don't know about)"
2757 echo "I'm now running the test program..."
2758 $cat >i_time.c <<'EOCP'
2759 #include <sys/types.h>
2764 #ifdef SYSTIMEKERNEL
2767 #include <sys/time.h>
2770 #include <sys/select.h>
2780 struct itimerval baz;
2783 if (foo.tm_sec == foo.tm_sec)
2786 if (bar.tv_sec == bar.tv_sec)
2790 if (baz.it_interval == baz.it_interval)
2794 if (bar.tv_sec == bar.tv_sec)
2798 /* this might not do anything for us... */
2799 tmp = localtime((time_t *)0);
2805 for i_sys_select in '' '-DI_SYS_SELECT'; do
2806 for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
2807 for i_time in '' '-DI_TIME'; do
2808 for i_systime in '-DI_SYS_TIME' ''; do
2810 '') echo Trying $i_time $i_systime $d_systimekernel $i_sys_select
2811 if $cc $ccflags $idefs \
2812 $i_time $i_systime $d_systimekernel $i_sys_select \
2813 i_time.c -o i_time >/dev/null 2>&1 ; then
2814 set X $i_time $i_systime $d_systimekernel $i_sys_select
2817 echo Succeeded with $flags
2826 *SYSTIMEKERNEL*) val="$define";;
2832 *I_TIME*) val="$define";;
2838 *I_SYS_SELECT*) val="$define";;
2844 *I_SYS_TIME*) val="$define";;
2849 case "$flags$i_sys_time$i_time" in
2850 undefundef) i_sys_time="$define"; i_time="$define";
2851 echo "ICK, NOTHING WORKED!!! You may have to diddle the includes.";;
2854 : see if signal is declared as pointer to function returning int or void
2856 $cppstdin $cppflags $cppminus < $usrinclude/signal.h >d_voidsig.txt
2857 if $contains 'int.*signal' d_voidsig.txt >/dev/null 2>&1 ; then
2858 echo "You have int (*signal())() instead of void."
2862 echo "You have void (*signal())() instead of int."
2869 : see if truncate exists
2870 set truncate d_truncate
2873 : see if there is a vfork
2877 : check for volatile keyword
2879 echo 'Checking to see if your C compiler knows about "volatile"...'
2880 $cat >try.c <<'EOCP'
2883 typedef unsigned short foo_t;
2886 volatile foo_t blech;
2890 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
2892 echo "Yup, it does."
2895 echo "Nope, it doesn't."
2901 : see if there is a wait4
2905 : see if there is a waitpid
2906 set waitpid d_waitpid
2909 : see what type gids are declared as in the kernel
2912 if $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
2915 set `grep '_rgid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
2917 unsigned) dflt="$1 $2" ;;
2927 rp="What type are groups ids returned by getgid(), etc.? [$dflt]"
2932 : check for length of integer
2936 echo "Checking to see how big your integers are..."
2937 $cat >intsize.c <<'EOCP'
2941 printf("%d\n", sizeof(int));
2944 if $cc intsize.c -o intsize >/dev/null 2>&1 ; then
2948 echo "(I can't seem to compile the test program. Guessing...)"
2955 rp="What is the size of an integer (in bytes)? [$dflt]"
2960 : determine which malloc to compile in
2962 case "$usemymalloc" in
2970 *) dflt="$usemymalloc"
2973 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
2981 y*) mallocsrc='malloc.c'; mallocobj='malloc.o'
2982 libs=`echo $libs | sed 's/-lmalloc//'`
2983 case "$mallocptrtype" in
2985 cat >usemymalloc.c <<'END'
2989 if $cc $ccflags -c usemymalloc.c >/dev/null 2>&1; then
2997 echo "Your system wants malloc to return $mallocptrtype*, it would seem."
2999 *) mallocsrc=''; mallocobj=''; mallocptrtype=void;;
3002 : determine where private executables go
3005 dflt=/usr/lib/$package
3006 test -d /usr/local/lib && dflt=/usr/local/lib/$package
3013 The $package package has some auxiliary files that should be reside in a library
3014 that is accessible by everyone. Where should these "private" but accessible
3016 $echo $n "files reside? (~name ok) [$dflt] $c"
3017 rp="Private files will reside where? [$dflt]"
3019 privlib=`./filexp "$ans"`
3021 case "$installprivlib" in
3023 dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'`
3025 *) dflt="$installprivlib"
3030 On some systems (such as afs) you have to install the library files in a
3031 different directory to get them to go to the right place. Where should the
3033 $echo $n "library files be installed? (~name ok) [$dflt] $c"
3034 rp="Install private files where? [$dflt]"
3036 installprivlib=`./filexp "$ans"`
3038 : check for size of random number generator
3042 echo "Checking to see how many bits your rand function produces..."
3043 $cat >randbits.c <<'EOCP'
3048 register unsigned long tmp;
3049 register unsigned long max = 0L;
3051 for (i=1000; i; i--) {
3052 tmp = (unsigned long)rand();
3053 if (tmp > max) max = tmp;
3060 if $cc randbits.c -o randbits >/dev/null 2>&1 ; then
3064 echo "(I can't seem to compile the test program...)"
3071 rp="How many bits does your rand() function produce? [$dflt]"
3076 : determine where public executables go
3077 case "$scriptdir" in
3080 : guess some guesses
3081 test -d /usr/share/scripts && dflt=/usr/share/scripts
3082 test -d /usr/share/bin && dflt=/usr/share/bin
3084 *) dflt="$scriptdir"
3090 Some installations have a separate directory just for executable scripts so
3091 that they can mount it across multiple architectures but keep the scripts in
3092 one spot. You might, for example, have a subdirectory of /usr/share for this.
3093 Or you might just lump your scripts in with all your other executables.
3096 while $test "$cont" ; do
3097 rp="Where do you keep publicly executable scripts (~name ok)? [$dflt]"
3101 scriptdir=`./filexp "$scriptdir"`
3102 if test -d $scriptdir; then
3109 rp="Directory $scriptdir doesn't exist. Use that name anyway? [$dflt]"
3119 : generate list of signal names
3123 echo "Generating a list of signal names..."
3124 set X `cat $usrinclude/signal.h $usrinclude/sys/signal.h 2>&1 | awk '
3125 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
3126 sig[$3] = substr($2,4,20)
3127 if (max < $3 && $3 < 60) {
3133 for (i=1; i<=max; i++) {
3146 0) echo 'kill -l' >/tmp/foo$$
3147 set X `$csh -f </tmp/foo$$`
3150 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
3158 echo "Signals are: $sig_name"
3160 : see what type of char stdio uses.
3162 if $contains 'unsigned.*char.*_ptr;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
3163 echo "Your stdio uses unsigned chars."
3164 stdchar="unsigned char"
3166 echo "Your stdio uses signed chars."
3170 : see what type uids are declared as in the kernel
3173 if $contains 'uid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3176 set `grep '_ruid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3178 unsigned) dflt="$1 $2" ;;
3188 rp="What type are user ids returned by getuid(), etc.? [$dflt]"
3193 : check for void type
3196 Checking to see how well your C compiler groks the void type...
3198 Support flag bits are:
3199 1: basic void declarations.
3200 2: arrays of pointers to functions returning void.
3201 4: operations between pointers to and addresses of void functions.
3206 $cat >void.c <<'EOCP'
3212 extern void moo(); /* function returning void */
3213 void (*goo)(); /* ptr to func returning void */
3226 if $cc -S -DTRY=$voidwant void.c >void.out 2>&1 ; then
3228 echo "It appears to support void to the level $package wants ($voidwant)."
3229 if $contains warning void.out >/dev/null 2>&1; then
3230 echo "However, you might get some warnings that look like this:"
3234 echo "Hmm, your compiler has some difficulty with void. Checking further..."
3235 if $cc -S -DTRY=1 void.c >/dev/null 2>&1 ; then
3236 echo "It supports 1..."
3237 if $cc -S -DTRY=3 void.c >/dev/null 2>&1 ; then
3239 echo "And it supports 2 but not 4."
3241 echo "It doesn't support 2..."
3242 if $cc -S -DTRY=5 void.c >/dev/null 2>&1 ; then
3244 echo "But it supports 4."
3247 echo "And it doesn't support 4."
3251 echo "There is no support at all for void."
3257 rp="Your void support flags add up to what? [$dflt]"
3262 : preserve RCS keywords in files with variable substitution, grrr
3270 Revision='$Revision'
3275 : determine compiler compiler
3280 dflt='yacc -Sm25000'
3287 rp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]"
3295 : see what type gids are returned by getgroups
3297 case "$groupstype" in
3299 if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
3301 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
3303 elif $contains 'getgroups.*short' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
3305 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
3307 elif $contains 'int gidset' /usr/man/man2/getgroups.2 >/dev/null 2>&1 ; then
3309 elif $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3312 set `grep 'groups\[NGROUPS\];' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3314 unsigned) dflt="$1 $2" ;;
3319 *) dflt="$groupstype"
3323 echo "(The following only matters if you have getgroups().)"
3324 rp="What type are the group ids returned by getgroups()? [$dflt]"
3329 : see if we can include fcntl.h
3333 echo "We'll be including <fcntl.h>."
3336 if $h_sys_file; then
3337 echo "We don't need to <fcntl.h> if we include <sys/file.h>."
3339 echo "We won't be including <fcntl.h>."
3345 : see if gdbm is available
3347 xxx=`./loc gdbm.h x $usrinclude /usr/local/include $inclwanted`
3348 if test -f $xxx; then
3350 echo "gdbm.h found."
3353 echo "gdbm.h not found."
3358 : see if this is an grp system
3360 if $test -r $usrinclude/grp.h ; then
3365 echo "No grp.h found."
3370 : see if this is a netinet/in.h or sys/in.h system
3372 xxx=`./loc netinet/in.h x $usrinclude /usr/local/include $inclwanted`
3373 if test -f $xxx; then
3376 echo "netinet/in.h found."
3379 echo "No netinet/in.h found, ..."
3380 xxx=`./loc sys/in.h x $usrinclude /usr/local/include $inclwanted`
3381 if test -f $xxx; then
3383 echo "but I found sys/in.h instead."
3386 echo "and I didn't find sys/in.h either."
3395 : Do we need to #include <sys/file.h> ?
3397 if $h_sys_file; then
3399 echo "We'll be including <sys/file.h>."
3402 echo "We won't be including <sys/file.h>."
3407 : see if ioctl defs are in sgtty/termio or sys/ioctl
3409 if $test -r $usrinclude/sys/ioctl.h ; then
3411 echo "sys/ioctl.h found."
3414 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
3419 : see if we should include utime.h
3421 if $test -r $usrinclude/utime.h ; then
3423 echo "utime.h found."
3426 echo "No utime.h found, but that's ok."
3431 : see if this is a varargs system
3433 if $test -r $usrinclude/varargs.h ; then
3435 echo "varargs.h found."
3438 echo "No varargs.h found, but that's ok (I hope)."
3443 : see if this is a vfork system
3445 if $test -r $usrinclude/vfork.h ; then
3447 echo "vfork.h found."
3450 echo "No vfork.h found."
3455 : end of configuration questions
3457 echo "End of configuration questions."
3460 : create config.sh file
3462 if test -d ../UU; then
3465 echo "Creating config.sh..."
3466 $spitshell <<EOT >config.sh
3469 # This file was produced by running the Configure script.
3471 d_eunice='$d_eunice'
3473 eunicefix='$eunicefix'
3503 sendmail='$sendmail'
3533 lastuname='$lastuname'
3534 alignbytes='$alignbytes'
3536 installbin='$installbin'
3537 byteorder='$byteorder'
3538 contains='$contains'
3539 cppstdin='$cppstdin'
3540 cppminus='$cppminus'
3544 d_castneg='$d_castneg'
3545 castflags='$castflags'
3546 d_charsprf='$d_charsprf'
3547 d_chsize='$d_chsize'
3549 cryptlib='$cryptlib'
3551 d_dosuid='$d_dosuid'
3553 d_fchmod='$d_fchmod'
3554 d_fchown='$d_fchown'
3556 d_flexfnam='$d_flexfnam'
3558 d_getgrps='$d_getgrps'
3559 d_gethent='$d_gethent'
3560 d_getpgrp='$d_getpgrp'
3561 d_getpgrp2='$d_getpgrp2'
3562 d_getprior='$d_getprior'
3565 d_killpg='$d_killpg'
3567 d_memcmp='$d_memcmp'
3568 d_memcpy='$d_memcpy'
3571 d_msgctl='$d_msgctl'
3572 d_msgget='$d_msgget'
3573 d_msgrcv='$d_msgrcv'
3574 d_msgsnd='$d_msgsnd'
3578 d_readdir='$d_readdir'
3579 d_rename='$d_rename'
3581 d_select='$d_select'
3583 d_semctl='$d_semctl'
3584 d_semget='$d_semget'
3586 d_setegid='$d_setegid'
3587 d_seteuid='$d_seteuid'
3588 d_setpgrp='$d_setpgrp'
3589 d_setpgrp2='$d_setpgrp2'
3590 d_setprior='$d_setprior'
3591 d_setregid='$d_setregid'
3592 d_setresgid='$d_setresgid'
3593 d_setreuid='$d_setreuid'
3594 d_setresuid='$d_setresuid'
3595 d_setrgid='$d_setrgid'
3596 d_setruid='$d_setruid'
3599 d_shmctl='$d_shmctl'
3601 d_shmget='$d_shmget'
3602 d_socket='$d_socket'
3603 d_sockpair='$d_sockpair'
3604 d_oldsock='$d_oldsock'
3605 socketlib='$socketlib'
3606 d_statblks='$d_statblks'
3607 d_stdstdio='$d_stdstdio'
3608 d_strctcpy='$d_strctcpy'
3609 d_strerror='$d_strerror'
3610 d_symlink='$d_symlink'
3611 d_syscall='$d_syscall'
3612 d_truncate='$d_truncate'
3614 d_voidsig='$d_voidsig'
3615 d_tosignal='$d_tosignal'
3616 d_volatile='$d_volatile'
3617 d_vprintf='$d_vprintf'
3618 d_charvspr='$d_charvspr'
3620 d_waitpid='$d_waitpid'
3622 groupstype='$groupstype'
3629 d_pwquota='$d_pwquota'
3631 d_pwchange='$d_pwchange'
3632 d_pwclass='$d_pwclass'
3633 d_pwexpire='$d_pwexpire'
3634 d_pwcomment='$d_pwcomment'
3635 i_sys_file='$i_sys_file'
3636 i_sysioctl='$i_sysioctl'
3638 i_sys_time='$i_sys_time'
3639 i_sys_select='$i_sys_select'
3640 d_systimekernel='$d_systimekernel'
3642 i_varargs='$i_varargs'
3648 i_my_dir='$i_my_dir'
3650 i_sys_ndir='$i_sys_ndir'
3651 i_dirent='$i_dirent'
3652 i_sys_dir='$i_sys_dir'
3653 d_dirnamlen='$d_dirnamlen'
3656 mallocsrc='$mallocsrc'
3657 mallocobj='$mallocobj'
3658 usemymalloc='$usemymalloc'
3659 mallocptrtype='$mallocptrtype'
3668 optimize='$optimize'
3670 cppflags='$cppflags'
3677 randbits='$randbits'
3678 scriptdir='$scriptdir'
3679 sig_name='$sig_name'
3680 spitshell='$spitshell'
3682 sharpbang='$sharpbang'
3686 usrinclude='$usrinclude'
3687 inclPath='$inclPath'
3689 voidhave='$voidhave'
3690 voidwant='$voidwant'
3691 w_localtim='$w_localtim'
3692 w_s_timevl='$w_s_timevl'
3697 installprivlib='$installprivlib'
3705 test -f patchlevel.h && awk '{printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
3708 echo "If you didn't make any mistakes, then just type a carriage return here."
3709 rp="If you need to edit config.sh, do it as a shell escape here:"
3714 *) : in case they cannot read
3717 : if this fails, just run all the .SH files by hand
3721 echo "Doing variable substitutions on .SH files..."
3722 set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
3725 0) set x *.SH; shift;;
3727 if test ! -f $1; then
3736 dir=`$expr X$file : 'X\(.*\)/'`
3737 file=`$expr X$file : 'X.*/\(.*\)'`
3738 (cd $dir && . $file)
3745 if test -f config.h.SH; then
3746 if test ! -f config.h; then
3747 : oops, they left it out of MANIFEST, probably, so do it anyway.
3752 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
3756 Now you need to generate make dependencies by running "make depend".
3757 You might prefer to run it in background: "make depend > makedepend.out &"
3758 It can take a while, so you might not want to run it right now.
3761 rp="Run make depend now? [$dflt]"
3765 y*) make depend && echo "Now you must run a make."
3767 *) echo "You must run 'make depend' then 'make'."
3770 elif test -f [Mm]akefile; then
3772 echo "Now you must run a make."