You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/07/21 02:40:39 UTC

[PATCH] linux: make use of TestLib

Jim I wasn't sure how you wanted us to use helpers/TestLib ... so I've
made changes below to use it the way I thought it should be used... tell
me if you like 'em or not.

The rest of this cleans up the multiple linux targets.  It tests for
-lcrypt.  It also finds the appropriate db or dbm libraries. 

Note that I still think it's kind of bunk to automatically select one db
lib over another without providing the user a method of overriding it.

Also, support/dbmmanage needs something like "use DB_File;", or "use
GDBM_File", or whatever added to it by Configure.  I'm sure the perl
weenies can tell us what the correct thing is ;)  There's a PR on this
topic, I think it's been changed to the documentation category. 

Dean

Index: Configure
===================================================================
RCS file: /export/home/cvs/apache/src/Configure,v
retrieving revision 1.113
diff -u -r1.113 Configure
--- Configure	1997/07/19 09:34:32	1.113
+++ Configure	1997/07/21 00:35:05
@@ -279,22 +279,11 @@
 	    CFLAGS="$CFLAGS -DIRIX"
 	fi
 	;;
-    alpha-*-linux2)
-	DEF_WANTHSREGEX=yes
-	OS='Linux'
-	CFLAGS="$CFLAGS -DLINUX=2"
-	LIBS="$LIBS -lcrypt"
-	;;
-    sparc-*-linux2)
-	DEF_WANTHSREGEX=yes
-	OS='Linux'
-	CFLAGS="$CFLAGS -DLINUX=2"
-	LIBS="$LIBS -lm"
-	;;
     *-linux2)
 	DEF_WANTHSREGEX=yes
 	OS='Linux'
 	CFLAGS="$CFLAGS -DLINUX=2"
+	LIBS="$LIBS -lm"
 	;;
     *-linux1)
 	DEF_WANTHSREGEX=yes
@@ -684,14 +673,39 @@
 # before we actually write LIBS to Makefile.config.
 # Punt for now...
 
+case "$PLAT" in
+    *-linux*)
+	# newer systems using glibc 2.x need -lcrypt
+	if ./helpers/TestLib crypt; then
+	    LIBS="$LIBS -lcrypt"
+	fi
+	# many systems have -ldb installed
+	DB_LIB=""
+	if ./helpers/TestLib db; then
+	    DB_LIB="-ldb"
+	fi;
+	# many systems don't have -ldbm
+	DBM_LIB=""
+	if ./helpers/TestLib dbm; then
+	    DBM_LIB="-ldbm"
+	elif ./helpers/TestLib ndbm; then
+	    DBM_LIB="-lndbm"
+	elif ./helpers/TestLib gdbm; then
+	    DBM_LIB="-lgdbm"
+	fi
+	;;
+esac
+
 #
 # Are they using dbm/db auth? If so, add DBM/DB library.
 #
 if grep mod_auth_dbm Makefile > /dev/null; then
     LIBS="$LIBS $DBM_LIB"
+    echo " + using $DBM_LIB for mod_auth_dbm"
 fi
 if grep mod_auth_db Makefile > /dev/null; then
     LIBS="$LIBS $DB_LIB"
+    echo " + using $DB_LIB for mod_auth_db"
 fi
 
 ####################################################################
Index: helpers/TestLib
===================================================================
RCS file: /export/home/cvs/apache/src/helpers/TestLib,v
retrieving revision 1.5
diff -u -r1.5 TestLib
--- TestLib	1997/07/21 00:16:19	1.5
+++ TestLib	1997/07/21 00:35:14
@@ -1,5 +1,7 @@
 #!/bin/sh
-trap 'rm -f Makefile dummy; exit' 0 1 2 3 15
+# assume we'll exit with an error
+result=1
+trap 'rm -f Makefile dummy; exit $result' 0 1 2 3 15
 #
 # Yet another Apache Configure helper script.
 # This one exists simply to test for the existance of
@@ -30,22 +32,20 @@
 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)
+CFLAGS=\$(OPTIM) \$(CFLAGS1) \$(EXTRA_CFLAGS)
+LIBS=\$(EXTRA_LIBS) \$(LIBS1)
+INCLUDES=\$(INCLUDES1) \$(EXTRA_INCLUDES)
+LDFLAGS=\$(LDFLAGS1) \$(EXTRA_LDFLAGS)
 
-all:
+dummy:
 	\$(CC) \$(CFLAGS) \$(INCLUDES) \$(LDFLAGS) dummy.c -o dummy -l$1
 
 EOF
 
 # Now run that Makefile
-`make > /dev/null 2<&1`
+make dummy > /dev/null 2>&1 </dev/null
 
 # And see if dummy exists
 if [ -f dummy ]; then
-    echo "yes"
-else
-    echo "no"
+    result=0
 fi