can you guys please confirm that this works on your platforms/configurations.
I'll be commiting this in tomorrow if no one squeaks.


..Ian

Index: build/apu-conf.m4
===================================================================
RCS file: /home/cvs/apr-util/build/apu-conf.m4,v
retrieving revision 1.28
diff -u -u -r1.28 apu-conf.m4
--- build/apu-conf.m4   18 Jan 2002 19:07:05 -0000      1.28
+++ build/apu-conf.m4   18 Jan 2002 21:20:57 -0000
@@ -158,6 +158,32 @@
 fi
 ])

+AC_DEFUN(APU_CHECK_BERKELEY_DB,[
+if test "$apu_want_db" != "0"; then
+  APU_CHECK_DB4
+  if test "$apu_db_version" != "4"; then
+    APU_CHECK_DB3
+    if test "$apu_db_version" != "3"; then
+      APU_CHECK_DB2
+      if test "$apu_db_version" != "2"; then
+        APU_CHECK_DB1
+        if test "$apu_db_version" != "1"; then
+          APU_CHECK_DB185
+        fi
+      fi
+    fi
+  fi
+fi
+AC_MSG_CHECKING(for Berkeley DB)
+if test "$apu_db_version" != "0"; then
+  apu_have_db=1
+  AC_MSG_RESULT(found db$apu_db_version)
+else
+  AC_MSG_RESULT(not found)
+fi
+
+
+])
 dnl
 dnl APU_CHECK_DBM: see what kind of DBM backend to use for apr_dbm.
 dnl
@@ -209,30 +235,48 @@


dnl We're going to try to find the highest version of Berkeley DB supported.
-APU_CHECK_DB4
-if test "$apu_db_version" != "4"; then
- APU_CHECK_DB3
- if test "$apu_db_version" != "3"; then
- APU_CHECK_DB2
- if test "$apu_db_version" != "2"; then
- APU_CHECK_DB1
- if test "$apu_db_version" != "1"; then
- APU_CHECK_DB185
- fi
- fi
- fi
-fi
+AC_ARG_WITH([berkeley-db],
+[--with-berkeley-db=PATH
+ Find the Berkeley DB header and library in \`PATH/include' and
+ \`PATH/lib'. If PATH is of the form \`HEADER:LIB', then search
+ for header files in HEADER, and the library in LIB. If you omit
+ the \`=PATH' part completely, the configure script will search
+ for Berkeley DB in a number of standard places.
+], [
+ if test "$withval" = "yes"; then
+ apu_want_db=1
+ BDB_INC=""
+ BDB_LIB=""
+ elif test "$withval" = "no"; then
+ apu_want_db=0
+ else
+ apu_want_db=1
+ case "$withval" in
+ *":"*)
+ BDB_INC="-I`echo $withval |sed -e 's/:.*$//'`"
+ BDB_LIB="-L`echo $withval |sed -e 's/^.*://'`"
+ ;;
+ *)
+ BDB_INC="-I$withval/include"
+ BDB_LIB="-L$withval/lib"
+ ;;
+ esac
+ AC_MSG_RESULT(looking for berkeley-db includes with $BDB_INC)
+ AC_MSG_RESULT(looking for berkeley-db libs with $BDB_LIB)
+ fi
+ CPPFLAGS=$BDB_INC
+ LIBS=$BDB_LIB
+ if test "$apu_want_db" != "0"; then
+ APU_CHECK_BERKELEY_DB
+ if test "$withval" != "yes"; then
+ APR_ADDTO( APRUTIL_INCLUDES, [$BDB_INC])
+ APR_ADDTO( APRUTIL_EXPORT_LIBS, [$BDB_LIB])
+ fi
+ fi
+],[
+ APU_CHECK_BERKELEY_DB
+])


-dnl Yes, it'd be nice if we could collate the output in an order
-dnl so that the AC_MSG_CHECKING would be output before the actual
-dnl checks, but it isn't happening now.
-AC_MSG_CHECKING(for Berkeley DB)
-if test "$apu_db_version" != "0"; then
-  apu_have_db=1
-  AC_MSG_RESULT(found db$apu_db_version)
-else
-  AC_MSG_RESULT(not found)
-fi

 dnl Note that we may have found db3, but the user wants db1.  So, check
 dnl explicitly for db1 in this case.  Unfortunately, this means
@@ -256,6 +300,8 @@
     fi
     ;;
   db1)
+    CPPFLAGS=$BDB_INC
+    LIBS=$BDB_LIB
     APU_CHECK_DB1
     if test "$apu_db_version" = "1"; then
       apu_use_db=1
@@ -265,6 +311,8 @@
     fi
     ;;
   db185)
+    CPPFLAGS=$BDB_INC
+    LIBS=$BDB_LIB
     APU_CHECK_DB185
     if test "$apu_db_version" = "185"; then
       apu_use_db=1
@@ -274,6 +322,8 @@
     fi
     ;;
   db2)
+    CPPFLAGS=$BDB_INC
+    LIBS=$BDB_LIB
     APU_CHECK_DB2
     if test "$apu_db_version" = "2"; then
       apu_use_db=1
@@ -283,6 +333,8 @@
     fi
     ;;
   db3)
+    CPPFLAGS=$BDB_INC
+    LIBS=$BDB_LIB
     APU_CHECK_DB3
     if test "$apu_db_version" = "3"; then
       apu_use_db=1
@@ -292,6 +344,8 @@
     fi
     ;;
   db4)
+    CPPFLAGS=$BDB_INC
+    LIBS=$BDB_LIB
     APU_CHECK_DB4
     if test "$apu_db_version" = "4"; then
       apu_use_db=1
Index: build/apu-conf.m4
===================================================================
RCS file: /home/cvs/apr-util/build/apu-conf.m4,v
retrieving revision 1.28
diff -u -u -r1.28 apu-conf.m4
--- build/apu-conf.m4   18 Jan 2002 19:07:05 -0000      1.28
+++ build/apu-conf.m4   18 Jan 2002 21:20:57 -0000
@@ -158,6 +158,32 @@
 fi
 ])
 
+AC_DEFUN(APU_CHECK_BERKELEY_DB,[
+if test "$apu_want_db" != "0"; then
+  APU_CHECK_DB4
+  if test "$apu_db_version" != "4"; then
+    APU_CHECK_DB3
+    if test "$apu_db_version" != "3"; then
+      APU_CHECK_DB2
+      if test "$apu_db_version" != "2"; then
+        APU_CHECK_DB1
+        if test "$apu_db_version" != "1"; then
+          APU_CHECK_DB185
+        fi
+      fi
+    fi
+  fi
+fi
+AC_MSG_CHECKING(for Berkeley DB)
+if test "$apu_db_version" != "0"; then
+  apu_have_db=1
+  AC_MSG_RESULT(found db$apu_db_version)
+else
+  AC_MSG_RESULT(not found)
+fi
+
+
+])
 dnl
 dnl APU_CHECK_DBM: see what kind of DBM backend to use for apr_dbm.
 dnl
@@ -209,30 +235,48 @@
         
 
 dnl We're going to try to find the highest version of Berkeley DB supported.
-APU_CHECK_DB4
-if test "$apu_db_version" != "4"; then
-  APU_CHECK_DB3
-  if test "$apu_db_version" != "3"; then
-    APU_CHECK_DB2
-    if test "$apu_db_version" != "2"; then
-      APU_CHECK_DB1
-      if test "$apu_db_version" != "1"; then
-        APU_CHECK_DB185
-      fi
-    fi
-  fi
-fi
+AC_ARG_WITH([berkeley-db],
+[--with-berkeley-db=PATH
+     Find the Berkeley DB header and library in \`PATH/include' and
+    \`PATH/lib'.  If PATH is of the form \`HEADER:LIB', then search
+    for header files in HEADER, and the library in LIB.  If you omit
+    the \`=PATH' part completely, the configure script will search
+    for Berkeley DB in a number of standard places.
+], [
+   if test "$withval" = "yes"; then
+      apu_want_db=1
+      BDB_INC=""
+      BDB_LIB=""
+    elif test "$withval" = "no"; then
+      apu_want_db=0
+    else
+      apu_want_db=1
+      case "$withval" in 
+        *":"*)
+          BDB_INC="-I`echo $withval |sed -e 's/:.*$//'`"
+          BDB_LIB="-L`echo $withval |sed -e 's/^.*://'`"
+        ;;
+        *)
+          BDB_INC="-I$withval/include"
+          BDB_LIB="-L$withval/lib"
+        ;;
+      esac
+      AC_MSG_RESULT(looking for berkeley-db includes with $BDB_INC)
+      AC_MSG_RESULT(looking for berkeley-db libs with $BDB_LIB)
+    fi
+    CPPFLAGS=$BDB_INC
+    LIBS=$BDB_LIB
+    if test "$apu_want_db" != "0"; then
+        APU_CHECK_BERKELEY_DB
+        if test "$withval" != "yes"; then
+            APR_ADDTO( APRUTIL_INCLUDES, [$BDB_INC])
+            APR_ADDTO( APRUTIL_EXPORT_LIBS, [$BDB_LIB])
+        fi
+    fi 
+],[
+    APU_CHECK_BERKELEY_DB
+])
 
-dnl Yes, it'd be nice if we could collate the output in an order
-dnl so that the AC_MSG_CHECKING would be output before the actual
-dnl checks, but it isn't happening now.
-AC_MSG_CHECKING(for Berkeley DB)
-if test "$apu_db_version" != "0"; then
-  apu_have_db=1
-  AC_MSG_RESULT(found db$apu_db_version)
-else
-  AC_MSG_RESULT(not found)
-fi
 
 dnl Note that we may have found db3, but the user wants db1.  So, check
 dnl explicitly for db1 in this case.  Unfortunately, this means 
@@ -256,6 +300,8 @@
     fi
     ;;
   db1)
+    CPPFLAGS=$BDB_INC
+    LIBS=$BDB_LIB
     APU_CHECK_DB1
     if test "$apu_db_version" = "1"; then
       apu_use_db=1
@@ -265,6 +311,8 @@
     fi
     ;;
   db185)
+    CPPFLAGS=$BDB_INC
+    LIBS=$BDB_LIB
     APU_CHECK_DB185
     if test "$apu_db_version" = "185"; then
       apu_use_db=1
@@ -274,6 +322,8 @@
     fi
     ;;
   db2)
+    CPPFLAGS=$BDB_INC
+    LIBS=$BDB_LIB
     APU_CHECK_DB2
     if test "$apu_db_version" = "2"; then
       apu_use_db=1
@@ -283,6 +333,8 @@
     fi
     ;;
   db3)
+    CPPFLAGS=$BDB_INC
+    LIBS=$BDB_LIB
     APU_CHECK_DB3
     if test "$apu_db_version" = "3"; then
       apu_use_db=1
@@ -292,6 +344,8 @@
     fi
     ;;
   db4)
+    CPPFLAGS=$BDB_INC
+    LIBS=$BDB_LIB
     APU_CHECK_DB4
     if test "$apu_db_version" = "4"; then
       apu_use_db=1

Reply via email to