jim 97/07/24 19:03:18
Modified: src Configure src/helpers dummy.c Added: src/helpers TestCompile Removed: src/helpers TestLib Log: Configure update: We now can check if $(CC) is ANSI or not, basically by trying to compile a small ANSI dummy program and seeing if it fails or not. Since the core is similar to what TestLib did, we use that but increase it's capability, thus becoming TestCompile Revision Changes Path 1.121 +12 -8 apache/src/Configure Index: Configure =================================================================== RCS file: /export/home/cvs/apache/src/Configure,v retrieving revision 1.120 retrieving revision 1.121 diff -u -r1.120 -r1.121 --- Configure 1997/07/24 04:35:45 1.120 +++ Configure 1997/07/25 02:03:15 1.121 @@ -14,7 +14,7 @@ # CutRule: Determines the value for a specified Rule # GuessOS: Uses uname to determine OS/platform # PrintPath: generic "type" or "whence" replacement -# TestLib: See if a specified library is available +# TestCompile: Can check for libs and if $(CC) is ANSI # #################################################################### ## Setup some defaults @@ -702,26 +702,30 @@ echo "SHELL=$SHELL">> Makefile.config #################################################################### -# This would be the area to do any ./helpers/TestLib tests, -# before we actually write LIBS to Makefile.config. -# Punt for now... +# Use TestCompile to see if $(CC) is ANSI +# +./helpers/TestCompile ansi + +#################################################################### +# Use TestCompile to look for various LIBS +# case "$PLAT" in *-linux*) # newer systems using glibc 2.x need -lcrypt - if ./helpers/TestLib crypt; then + if ./helpers/TestCompile lib crypt; then LIBS="$LIBS -lcrypt" fi # many systems have -ldb installed DB_LIB="" - if ./helpers/TestLib db; then + if ./helpers/TestCompile lib db; then DB_LIB="-ldb" fi; # many systems don't have -ldbm DBM_LIB="" - if ./helpers/TestLib dbm; then + if ./helpers/TestCompile lib dbm; then DBM_LIB="-ldbm" - elif ./helpers/TestLib ndbm; then + elif ./helpers/TestCompile lib ndbm; then DBM_LIB="-lndbm" fi ;; 1.3 +6 -0 apache/src/helpers/dummy.c Index: dummy.c =================================================================== RCS file: /export/home/cvs/apache/src/helpers/dummy.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- dummy.c 1997/07/21 20:18:59 1.2 +++ dummy.c 1997/07/25 02:03:17 1.3 @@ -1,4 +1,10 @@ /* this file is used by TestLib */ +int foo ( const char *c ) +{ +return 0; +} int main(void) { + const char *c = '\0'; + (void)foo(c); return 0; } 1.1 apache/src/helpers/TestCompile Index: TestCompile =================================================================== #!/bin/sh exstat=1 trap 'rm -f Makefile dummy; exit $exstat' 0 1 2 3 15 # # Yet another Apache Configure helper script. # This script tests certain aspects of the compilation # process. Right now, it can perform 2 tests: # # ./helpers/TestCompile lib <libname> # Which checks to see if <libname> exists on this system # # ./helpers/TestCompile ansi # Which checks to see if $(CC) is ANSI # # It does these by creating a small mini-makefile, based on # ../Makefile.config and trying to compile a small dummy # program. If the compilation succeeds, we assume the test # was successful as well. # # This must be run as './helpers/TestCompile' from # the ./src directory (same directory that Configure is # located) if you want to test it out. Configure must # also call it as './helpers/TestCompile' # # # Make sure have the right arguments # case "$1" in "lib") if [ "x$2" = "x" ]; then exit fi TLIB="-l$2" ;; "ansi") TLIB="" ;; esac # # Get makefile settings and build a basic Makefile # cd ./helpers rm -f dummy cat ../Makefile.config > Makefile cat <<EOF >> Makefile CFLAGS=\$(OPTIM) \$(CFLAGS1) \$(EXTRA_CFLAGS) LIBS=\$(EXTRA_LIBS) \$(LIBS1) INCLUDES=\$(INCLUDES1) \$(EXTRA_INCLUDES) LDFLAGS=\$(LDFLAGS1) \$(EXTRA_LDFLAGS) dummy: \$(CC) \$(CFLAGS) \$(INCLUDES) \$(LDFLAGS) dummy.c -o dummy $TLIB EOF # Now run that Makefile make dummy >/dev/null 2>&1 # And see if dummy exists, if so, then we assume the # condition we are testing for is good if [ -f dummy ]; then exstat=0 fi