You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ian Holsman <Ia...@cnet.com> on 2001/12/09 22:00:11 UTC
RE: cvs commit: apr-util/include/private apr_dbm_private.h
there's a DB4 ???
one thing I've noticed with the BerkeleyDB support is that we have
slightly different functionality when we do iterate through a DBM
gdbm/sdbm return a NULL key/value at EOF (with not error)
while Berkeley's return a DB_NOT_FOUND at the end.
it's minor.. but it needs to be fixed
-----Original Message-----
From: jerenkrantz@apache.org [mailto:jerenkrantz@apache.org]
Sent: Sunday, December 09, 2001 12:20 PM
To: apr-util-cvs@apache.org
Subject: cvs commit: apr-util/include/private apr_dbm_private.h
jerenkrantz 01/12/09 12:19:43
Modified: . CHANGES
build apu-conf.m4
dbm apr_dbm_berkeleydb.c
include apu.h.in
include/private apr_dbm_private.h
Log:
Add DB4 detection. It is identical to DB3 for all of our current purposes.
Also, clean up the autoconf DB macros to be name-space protected and
cleaner per Greg's suggestions.
Revision Changes Path
1.45 +2 -0 apr-util/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr-util/CHANGES,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- CHANGES 2001/12/09 20:13:29 1.44
+++ CHANGES 2001/12/09 20:19:43 1.45
@@ -1,5 +1,7 @@
Changes with APR-util b1
+ *) Add support for Berkeley DB4. [Justin Erenkrantz]
+
*) Improve testdbm help. [Justin Erenkrantz]
*) Improve autoconf detection of DBMs. [Justin Erenkrantz]
1.21 +97 -72 apr-util/build/apu-conf.m4
Index: apu-conf.m4
===================================================================
RCS file: /home/cvs/apr-util/build/apu-conf.m4,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- apu-conf.m4 2001/12/05 18:23:05 1.20
+++ apu-conf.m4 2001/12/09 20:19:43 1.21
@@ -61,56 +61,49 @@
dnl
dnl APU_CHECK_DB1: is DB1 present?
dnl
-dnl if present: sets apu_have_db=1, db_header, db_lib, and db_version
+dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
dnl
AC_DEFUN(APU_CHECK_DB1,[
AC_CHECK_HEADER(db1/db.h, [
AC_CHECK_LIB(db1, dbopen, [
- apu_have_db=1
- db_header=db1/db.h
- db_lib=db1
- db_version=1
+ apu_db_header=db1/db.h
+ apu_db_lib=db1
+ apu_db_version=1
])])])
dnl
dnl APU_CHECK_DB185: is DB1.85 present?
dnl
-dnl if present: sets apu_have_db=1, db_header, db_lib, and db_version
+dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
dnl
dnl NB: BerkelyDB v2 and above can be compiled in 1.85 mode
dnl which has a libdb not libdb1 or libdb185
AC_DEFUN(APU_CHECK_DB185,[
AC_CHECK_HEADER(db_185.h, [
AC_CHECK_LIB(db, dbopen, [
- apu_have_db=1
- db_header=db_185.h
- db_lib=db
- db_version=185
+ apu_db_header=db_185.h
+ apu_db_lib=db
+ apu_db_version=185
])])])
dnl
dnl APU_CHECK_DB2: is DB2 present?
dnl
-dnl if present: sets apu_have_db=1, db_header, and db_lib
+dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
dnl
AC_DEFUN(APU_CHECK_DB2,[
-apu_found_db=0
AC_CHECK_HEADER(db2/db.h, [
AC_CHECK_LIB(db2, db_open, [
- apu_have_db=1
- db_header=db2/db.h
- db_lib=db2
- db_version=2
- apu_found_db=1
+ apu_db_header=db2/db.h
+ apu_db_lib=db2
+ apu_db_version=2
])])
-if test $apu_found_db = 0; then
+if test $apu_db_version != 2; then
AC_CHECK_HEADER(db.h, [
AC_CHECK_LIB(db, db_open, [
- apu_have_db=1
- db_header=db.h
- db_lib=db
- db_version=2
- apu_found_db=1
+ apu_db_header=db.h
+ apu_db_lib=db
+ apu_db_version=2
])])
fi
])
@@ -118,27 +111,49 @@
dnl
dnl APU_CHECK_DB3: is DB3 present?
dnl
-dnl if present: sets apu_have_db=1, db_header, and db_lib
+dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
dnl
AC_DEFUN(APU_CHECK_DB3,[
-apu_found_db=0
AC_CHECK_HEADER(db3/db.h, [
AC_CHECK_LIB(db3, db_create, [
- apu_have_db=1
- db_header=db3/db.h
- db_lib=db3
- db_version=3
- apu_found_db=1
+ apu_db_header=db3/db.h
+ apu_db_lib=db3
+ apu_db_version=3
])])
-if test $apu_found_db = 0; then
+if test $apu_db_version != 3; then
AC_CHECK_HEADER(db.h, [
AC_CHECK_LIB(db, db_create, [
- apu_have_db=1
- db_header=db.h
- db_lib=db
- db_version=3
- apu_found_db=1
+ apu_db_header=db.h
+ apu_db_lib=db
+ apu_db_version=3
+ ])])
+fi
+])
+
+dnl
+dnl APU_CHECK_DB4: is DB4 present?
+dnl
+dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version
+dnl
+dnl At this point in time, DB4 doesn't have some functions that DB3 does.
+dnl So look for a function that was removed in DB3 to confirm DB4.
+dnl If it fails, then we know we are DB4 at least.
+dnl
+AC_DEFUN(APU_CHECK_DB4,[
+AC_CHECK_HEADER(db4/db.h, [
+ AC_CHECK_LIB(db4, db_create, [
+ apu_db_header=db4/db.h
+ apu_db_lib=db4
+ apu_db_version=4
])])
+if test $apu_db_version != 4; then
+AC_CHECK_HEADER(db.h, [
+ AC_CHECK_LIB(db, db_create, [
+ AC_CHECK_LIB(db, lock_get, [], [
+ apu_db_header=db.h
+ apu_db_lib=db
+ apu_db_version=4
+ ])])])
fi
])
@@ -154,7 +169,8 @@
apu_have_gdbm=0
apu_have_db=0
-db_header=db.h # default so apu_select_dbm.h is syntactically correct
+apu_db_header=db.h # default so apu_select_dbm.h is syntactically correct
+apu_db_version=0
AC_ARG_WITH(dbm,
[ --with-dbm=DBM choose the DBM type to use.
@@ -171,13 +187,16 @@
AC_CHECK_HEADER(gdbm.h, AC_CHECK_LIB(gdbm, gdbm_open, [apu_have_gdbm=1]))
dnl We're going to try to find the highest version of Berkeley DB supported.
-APU_CHECK_DB3
-if test $apu_have_db = 0; then
- APU_CHECK_DB2
- if test $apu_have_db = 0; then
- APU_CHECK_DB1
- if test $apu_have_db = 0; then
- APU_CHECK_DB185
+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
@@ -186,8 +205,9 @@
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_have_db = 1; then
- AC_MSG_RESULT(found db$db_version)
+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
@@ -199,68 +219,73 @@
case "$requested" in
sdbm)
apu_use_sdbm=1
- default_dbm=sdbm
+ apu_default_dbm=sdbm
;;
gdbm)
apu_use_gdbm=1
- default_dbm=gdbm
+ apu_default_dbm=gdbm
;;
db)
- if test $apu_have_db = 1; then
+ if test $apu_db_version != 0; then
apu_use_db=1
- default_dbm=db
+ apu_default_dbm=db
else
AC_MSG_ERROR(Berkeley db requested, but not found)
fi
;;
db1)
- apu_have_db=0
APU_CHECK_DB1
- if test $apu_have_db = 1; then
+ if test $apu_db_version = 1; then
apu_use_db=1
- default_dbm=db1
+ apu_default_dbm=db1
else
AC_MSG_ERROR(Berkeley db1 not found)
fi
;;
db185)
- apu_have_db=0
APU_CHECK_DB185
- if test $apu_have_db = 1; then
+ if test $apu_db_version = 185; then
apu_use_db=1
- default_dbm=db185
+ apu_default_dbm=db185
else
AC_MSG_ERROR(Berkeley db185 not found)
fi
;;
db2)
- apu_have_db=0
APU_CHECK_DB2
- if test $apu_have_db = 1; then
+ if test $apu_db_version = 2; then
apu_use_db=1
- default_dbm=db2
+ apu_default_dbm=db2
else
- AC_MSG_ERROR([db2 not present])
+ AC_MSG_ERROR(Berkeley db2 not found)
fi
;;
db3)
- apu_have_db=0
APU_CHECK_DB3
- if test $apu_have_db = 1; then
+ if test $apu_db_version = 3; then
+ apu_use_db=1
+ apu_default_dbm=db3
+ else
+ AC_MSG_ERROR(Berkeley db3 not found)
+ fi
+ ;;
+ db4)
+ APU_CHECK_DB4
+ if test $apu_db_version = 4; then
apu_use_db=1
- default_dbm=db3
+ apu_default_dbm=db4
else
- AC_MSG_ERROR([db3 not present])
+ AC_MSG_ERROR(Berkeley db4 not found)
fi
;;
default)
dnl ### use more sophisticated DBMs for the default?
- default_dbm="sdbm (default)"
+ apu_default_dbm="sdbm (default)"
apu_use_sdbm=1
;;
*)
AC_MSG_ERROR([--with-dbm=$look_for is an unknown DBM type.
-Use one of: sdbm, gdbm, db, db1, db185, db2, db3])
+Use one of: sdbm, gdbm, db, db1, db185, db2, db3, db4])
;;
esac
@@ -268,7 +293,7 @@
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 default DBM)
-AC_MSG_RESULT($default_dbm)
+AC_MSG_RESULT($apu_default_dbm)
AC_SUBST(apu_use_sdbm)
AC_SUBST(apu_use_gdbm)
@@ -277,8 +302,8 @@
AC_SUBST(apu_have_sdbm)
AC_SUBST(apu_have_gdbm)
AC_SUBST(apu_have_db)
-AC_SUBST(db_header)
-AC_SUBST(db_version)
+AC_SUBST(apu_db_header)
+AC_SUBST(apu_db_version)
dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
dnl we know the library is there.
@@ -287,9 +312,9 @@
APR_ADDTO(LIBS,[-lgdbm])
fi
-if test $apu_have_db = 1; then
- APR_ADDTO(APRUTIL_EXPORT_LIBS,[-l$db_lib])
- APR_ADDTO(LIBS,[-l$db_lib])
+if test $apu_db_version != 0; then
+ APR_ADDTO(APRUTIL_EXPORT_LIBS,[-l$apu_db_lib])
+ APR_ADDTO(LIBS,[-l$apu_db_lib])
fi
])
1.12 +6 -2 apr-util/dbm/apr_dbm_berkeleydb.c
Index: apr_dbm_berkeleydb.c
===================================================================
RCS file: /home/cvs/apr-util/dbm/apr_dbm_berkeleydb.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- apr_dbm_berkeleydb.c 2001/12/09 20:17:09 1.11
+++ apr_dbm_berkeleydb.c 2001/12/09 20:19:43 1.12
@@ -76,10 +76,14 @@
/*
* We pick up all varieties of Berkeley DB through db.h (included through
* apu_select_dbm.h). This code has been compiled/tested against DB1,
- * DB_185, DB2, and DB3.
+ * DB_185, DB2, DB3, and DB4.
*/
-#if defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 3)
+#if defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 4)
+/* At this time, there are no differences from our perspective between
+ * DB3 and DB4. */
+#define DB_VER 3
+#elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 3)
#define DB_VER 3
#elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 2)
#define DB_VER 2
1.10 +2 -2 apr-util/include/apu.h.in
Index: apu.h.in
===================================================================
RCS file: /home/cvs/apr-util/include/apu.h.in,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- apu.h.in 2001/11/28 17:34:18 1.9
+++ apu.h.in 2001/12/09 20:19:43 1.10
@@ -116,8 +116,8 @@
#define APU_HAVE_DB @apu_have_db@
#if APU_HAVE_DB
-/* found version @db_version@ */
-#include <@db_header@>
+/* found version @apu_db_version@ */
+#include <@apu_db_header@>
#endif
1.4 +1 -0 apr-util/include/private/apr_dbm_private.h
Index: apr_dbm_private.h
===================================================================
RCS file: /home/cvs/apr-util/include/private/apr_dbm_private.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apr_dbm_private.h 2001/11/11 07:46:29 1.3
+++ apr_dbm_private.h 2001/12/09 20:19:43 1.4
@@ -149,6 +149,7 @@
APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db1;
APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db2;
APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db3;
+APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db4;
APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db;
#ifdef __cplusplus
Re: cvs commit: apr-util/include/private apr_dbm_private.h
Posted by Greg Stein <gs...@lyra.org>.
On Sun, Dec 09, 2001 at 08:51:49PM -0800, Justin Erenkrantz wrote:
> On Sun, Dec 09, 2001 at 01:00:11PM -0800, Ian Holsman wrote:
>...
> > one thing I've noticed with the BerkeleyDB support is that we have
> > slightly different functionality when we do iterate through a DBM
> > gdbm/sdbm return a NULL key/value at EOF (with not error)
> > while Berkeley's return a DB_NOT_FOUND at the end.
> > it's minor.. but it needs to be fixed
>
> Which one is correct behavior? -- justin
Setting the key/value to NULL and return APR_SUCCESS.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
Re: cvs commit: apr-util/include/private apr_dbm_private.h
Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Sun, Dec 09, 2001 at 01:00:11PM -0800, Ian Holsman wrote:
> there's a DB4 ???
http://www.sleepycat.com/update/4.0.14/db-4.0.14.tar.gz
I think one of the SVN people mentioned it.
> one thing I've noticed with the BerkeleyDB support is that we have
> slightly different functionality when we do iterate through a DBM
> gdbm/sdbm return a NULL key/value at EOF (with not error)
> while Berkeley's return a DB_NOT_FOUND at the end.
> it's minor.. but it needs to be fixed
Which one is correct behavior? -- justin
Re: cvs commit: apr-util/include/private apr_dbm_private.h
Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Sun, Dec 09, 2001 at 01:00:11PM -0800, Ian Holsman wrote:
> there's a DB4 ???
http://www.sleepycat.com/update/4.0.14/db-4.0.14.tar.gz
I think one of the SVN people mentioned it.
> one thing I've noticed with the BerkeleyDB support is that we have
> slightly different functionality when we do iterate through a DBM
> gdbm/sdbm return a NULL key/value at EOF (with not error)
> while Berkeley's return a DB_NOT_FOUND at the end.
> it's minor.. but it needs to be fixed
Which one is correct behavior? -- justin