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/08/18 08:40:20 UTC
[PATCH] Configure mods
Ok you'll need to refresh before this patch makes sense ... 'cause I
committed what seemed like a no-brainer (I moved the db/dbm specific code
from Configure into the appropriate module initializer thing). Then I
noticed various problems.
I don't see why we need to print "foobar runs" and then dozens of
commands... well it wasn't dozens in the simple examples we had before.
But as soon as you get anything complicated (which db and dbm really are)
it's just way overwhelming to print that stuff. The truth is, the person
is about to compile the .c file and they're implicitly trusting it ... so
printing the commands isn't overly useful.
So I've got that linux code that figures out if the system has -ldb,
-ldbm, -lndbm, or -lgdbm. But doing that automatically just annoys a user
who might want to specify a library directly. So I implemented
"TestCompile func funcname" which tests if with the LIBS setting so far
can you compile a program containing a reference to funcname.
Then I tweaked the db/dbm things to "TestCompile func dbopen" (dbm_open
resp.) and not add libraries if it can already compile without them.
Remember there was a fellow with problems linking both db and dbm? I'm
guessing the problem is that DBM_LIB was listed after DB_LIB ... "-ldb
-lndbm" is entirely useless since db includes wrappers for all the
functions in ndbm (usually). This can be avoided by reordering
mod_auth_db and mod_auth_dbm in Configuration.tmpl.
Dean
Index: Configuration.tmpl
===================================================================
RCS file: /export/home/cvs/apachen/src/Configuration.tmpl,v
retrieving revision 1.71
diff -u -r1.71 Configuration.tmpl
--- Configuration.tmpl 1997/08/10 13:29:51 1.71
+++ Configuration.tmpl 1997/08/18 06:31:00
@@ -240,8 +240,8 @@
## "gdbm" package if not and possibly adjust EXTRA_LIBS. (This may be
## done by Configure at a later date)
-# AddModule modules/standard/mod_auth_db.o
# AddModule modules/standard/mod_auth_dbm.o
+# AddModule modules/standard/mod_auth_db.o
## msql_auth checks against an mSQL database. You must have mSQL installed
## and an "msql.h" available for this to even compile. Additionally,
Index: Configure
===================================================================
RCS file: /export/home/cvs/apachen/src/Configure,v
retrieving revision 1.136
diff -u -r1.136 Configure
--- Configure 1997/08/18 06:05:34 1.136
+++ Configure 1997/08/18 06:31:01
@@ -767,10 +767,8 @@
modname=`grep "Name:" $tmpfile2 | sed 's/^.*Name:[ ]*//'`
if grep "ConfigStart" $tmpfile2 > /dev/null \
&& grep "ConfigEnd" $tmpfile2 > /dev/null; then
- echo " o $modname runs:"
sed '1,/ConfigStart/d;/ConfigEnd/,$d' $tmpfile2 > \
$tmpfile3
- sed 's/^/>> /' $tmpfile3
. ./$tmpfile3
fi
rm -f $tmpfile2 $tmpfile3
Index: helpers/TestCompile
===================================================================
RCS file: /export/home/cvs/apachen/src/helpers/TestCompile,v
retrieving revision 1.4
diff -u -r1.4 TestCompile
--- TestCompile 1997/08/10 20:28:03 1.4
+++ TestCompile 1997/08/18 06:31:02
@@ -1,6 +1,6 @@
#!/bin/sh
exstat=1
-trap 'rm -f Makefile dummy; exit $exstat' 0 1 2 3 15
+trap 'rm -f Makefile dummy testfunc.c testfunc; exit $exstat' 0 1 2 3 15
#
# Yet another Apache Configure helper script.
# This script tests certain aspects of the compilation
@@ -23,6 +23,8 @@
# also call it as './helpers/TestCompile'
#
+cd ./helpers
+
#
# Handle "verbose" and "silent" flags
#
@@ -52,6 +54,7 @@
else
ERRDIR='2>/dev/null'
fi
+ TARGET='dummy'
;;
"sanity")
TLIB=""
@@ -60,6 +63,20 @@
else
ERRDIR=""
fi
+ TARGET='dummy'
+ ;;
+ "func")
+ if [ "x$2" = "x" ]; then
+ exit
+ fi
+ TLIB=""
+ ERRDIR='2>/dev/null'
+ TARGET='testfunc'
+ cat <<EOF >testfunc.c
+void main(void) {
+ $2();
+}
+EOF
;;
*)
exit
@@ -69,7 +86,6 @@
#
# Get makefile settings and build a basic Makefile
#
-cd ./helpers
rm -f dummy
cat ../Makefile.config > Makefile
cat <<EOF >> Makefile
@@ -81,13 +97,15 @@
dummy:
\$(CC) \$(CFLAGS) \$(INCLUDES) \$(LDFLAGS) dummy.c -o dummy $TLIB
+testfunc:
+ \$(CC) \$(CFLAGS) \$(INCLUDES) \$(LDFLAGS) testfunc.c -o testfunc \$(LIBS)
EOF
# Now run that Makefile
-eval "make dummy >/dev/null $ERRDIR"
+eval "make $TARGET >/dev/null $ERRDIR"
# And see if dummy exists, if so, then we assume the
# condition we are testing for is good
-if [ -f dummy ]; then
+if [ -f $TARGET ]; then
exstat=0
fi
Index: modules/standard/mod_auth_db.module
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_auth_db.module,v
retrieving revision 1.2
diff -u -r1.2 mod_auth_db.module
--- mod_auth_db.module 1997/08/18 06:05:36 1.2
+++ mod_auth_db.module 1997/08/18 06:31:02
@@ -1,16 +1,18 @@
Name: db_auth_module
ConfigStart
- case "$PLAT" in
- *-linux*)
- # many systems have -ldb installed
- DB_LIB=""
- if ./helpers/TestCompile lib db; then
- DB_LIB="-ldb"
- fi
- ;;
- esac
- LIBS="$LIBS $DB_LIB"
- if [ "X$DB_LIB" != "X" ]; then
- echo " + using $DB_LIB for mod_auth_db"
+ if ! ./helpers/TestCompile func dbopen; then
+ case "$PLAT" in
+ *-linux*)
+ # many systems have -ldb installed
+ DB_LIB=""
+ if ./helpers/TestCompile lib db; then
+ DB_LIB="-ldb"
+ fi
+ ;;
+ esac
+ LIBS="$LIBS $DB_LIB"
+ if [ "X$DB_LIB" != "X" ]; then
+ echo " + using $DB_LIB for mod_auth_db"
+ fi
fi
ConfigEnd
Index: modules/standard/mod_auth_dbm.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_auth_dbm.c,v
retrieving revision 1.23
diff -u -r1.23 mod_auth_dbm.c
--- mod_auth_dbm.c 1997/08/18 06:05:36 1.23
+++ mod_auth_dbm.c 1997/08/18 06:31:03
@@ -79,20 +79,22 @@
* MODULE-DEFINITION-START
* Name: dbm_auth_module
* ConfigStart
- case "$PLAT" in
- *-linux*)
- # many systems don't have -ldbm
- DBM_LIB=""
- if ./helpers/TestCompile lib dbm; then
- DBM_LIB="-ldbm"
- elif ./helpers/TestCompile lib ndbm; then
- DBM_LIB="-lndbm"
- fi
- ;;
- esac
- LIBS="$LIBS $DBM_LIB"
- if [ "X$DBM_LIB" != "X" ]; then
- echo " + using $DBM_LIB for mod_auth_dbm"
+ if ! ./helpers/TestCompile func dbm_open; then
+ case "$PLAT" in
+ *-linux*)
+ # many systems don't have -ldbm
+ DBM_LIB=""
+ if ./helpers/TestCompile lib dbm; then
+ DBM_LIB="-ldbm"
+ elif ./helpers/TestCompile lib ndbm; then
+ DBM_LIB="-lndbm"
+ fi
+ ;;
+ esac
+ LIBS="$LIBS $DBM_LIB"
+ if [ "X$DBM_LIB" != "X" ]; then
+ echo " + using $DBM_LIB for mod_auth_dbm"
+ fi
fi
* ConfigEnd
* MODULE-DEFINITION-END
Re: [PATCH] Configure mods
Posted by Paul Sutton <pa...@ukweb.com>.
On Sun, 17 Aug 1997, Dean Gaudet wrote:
> So I've got that linux code that figures out if the system has -ldb,
> -ldbm, -lndbm, or -lgdbm. But doing that automatically just annoys a user
Does it really check for gdbm? The text "gdbm" does not appear in the
code.
Anyway +1.
> Remember there was a fellow with problems linking both db and dbm? I'm
> guessing the problem is that DBM_LIB was listed after DB_LIB ... "-ldb
> -lndbm" is entirely useless since db includes wrappers for all the
> functions in ndbm (usually). This can be avoided by reordering
> mod_auth_db and mod_auth_dbm in Configuration.tmpl.
I've never used db, but I'll believe you! +1. If this is the case, a note
in Configuration would be in order here.
//pcs