gstein 01/01/24 20:37:40
Modified: build apu-conf.m4
. configure.in aprutil.dsp libaprutil.dsp
dbm apr_dbm.c
include/private .cvsignore
Added: include/private apu_select_dbm.h.in apu_select_dbm.hw
Removed: include/private apu_private.h.in apu_private.hw
Log:
Teach configure about the new DB selections. The stuff must still be on the
existing include/lib paths (both DB and GDBM), so we may want more in the
future.
apu_private.h was only about selecting the DBM type. It has become
apu_select_dbm.h and includes a DB header if applicable. We may reintroduce
apu_private (for other modules that don't want the DB header all the time)
or simply place other feature selections into apu_config.h.
Note that --with-dbm=db selects the "best" DB version. Manual forcing can be
done with db1, db185, db2, or db3.
Revision Changes Path
1.3 +176 -18 apr-util/build/apu-conf.m4
Index: apu-conf.m4
===================================================================
RCS file: /home/cvs/apr-util/build/apu-conf.m4,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- apu-conf.m4 2000/12/12 09:44:53 1.2
+++ apu-conf.m4 2001/01/25 04:37:39 1.3
@@ -41,37 +41,189 @@
])
dnl
+dnl APU_CHECK_DB1: is DB1 present?
+dnl
+dnl if present: sets apu_use_db=1, db_header, and db_lib
+dnl
+AC_DEFUN(APU_CHECK_DB1,[
+AC_CHECK_HEADER(db1/db.h, [
+ apu_use_db=1
+ db_header=db1/db.h
+ db_lib=db1
+ ])
+])
+
+dnl
+dnl APU_CHECK_DB185: is DB1.85 present?
+dnl
+dnl if present: sets apu_use_db=1, db_header, and db_lib
+dnl
+AC_DEFUN(APU_CHECK_DB185,[
+AC_CHECK_HEADER(db_185.h, [
+ apu_use_db=1
+ db_header=db_185.h
+ db_lib=db1
+ ])
+])
+
+dnl
+dnl APU_CHECK_DB2or3: are DB2 or DB3 present?
+dnl
+dnl if present: sets apu_use_db=1, db_header, and db_lib
+dnl
+AC_DEFUN(APU_CHECK_DB2or3,[
+AC_CHECK_HEADER(db.h, [
+ apu_use_db=1
+ db_header=db.h
+ db_lib=db
+ ])
+])
+
+dnl
+dnl APU_CHECK_DB_VSN: check the actual version of db (for db2 or db3)
+dnl
+dnl sets db_version
+dnl
+AC_DEFUN(APU_CHECK_DB_VSN,[
+ apu_save_libs="$LIBS"
+ LIBS="$LIBS -ldb"
+ AC_TRY_RUN([
+#include "db.h"
+main()
+{
+ int major, minor, patch;
+ db_version(&major, &minor, &patch);
+ if (major == 2)
+ exit(1);
+ exit(0);
+}
+], db_version=3, db_version=2, db_version=2)
+ LIBS="$apu_save_libs"
+])
+
+dnl
+dnl APU_FIND_DB: find one of the DB libraries to use
+dnl
+dnl if found, then which_dbm is set to one of: db1, db185, db2, db3
+dnl
+AC_DEFUN(APU_FIND_DB,[
+ APU_CHECK_DB2or3
+ if test $apu_use_db = 1; then
+ APU_CHECK_DB_VSN
+ which_dbm="db$db_version"
+ else
+ APU_CHECK_DB1
+ if test $apu_use_db = 1; then
+ which_dbm="db1"
+ else
+ APU_CHECK_DB185
+ if test $apu_use_db = 1; then
+ which_dbm="db185"
+ fi
+ fi
+ fi
+])
+
+dnl
dnl APU_CHECK_DBM: see what kind of DBM backend to use for apr_dbm.
dnl
AC_DEFUN(APU_CHECK_DBM,[
apu_use_sdbm=0
apu_use_gdbm=0
-AC_MSG_CHECKING(for chosen DBM type)
+apu_use_db=0
+db_header=db.h # default so apu_select_dbm.h is syntactically
correct
+
AC_ARG_WITH(dbm,
- [ --with-dbm=DBM choose the DBM type to use. DBM={sdbm,gdbm}],[
+ [ --with-dbm=DBM choose the DBM type to use.
+ DBM={sdbm,gdbm,db,db1,db185,db2,db3}],[
if test "$withval" = "yes"; then
- AC_MSG_ERROR([You need to specify a DBM type to use. One of: sdbm, gdbm])
+ AC_MSG_ERROR([--with-dbm needs to specify a DBM type to use.
+One of: sdbm, gdbm, db, db1, db185, db2, db3])
fi
- case "$withval" in
- sdbm)
- apu_use_sdbm=1
- AC_MSG_RESULT(sdbm)
- ;;
- gdbm)
- apu_use_gdbm=1
- AC_MSG_RESULT(gdbm)
- ;;
- *)
- AC_MSG_ERROR([$withval is an unknown DBM type. Use one of: sdbm, gdbm])
- ;;
- esac
+ look_for="$withval"
],[
- apu_use_sdbm=1
- AC_MSG_RESULT([sdbm (default)])
+ look_for=default
])
+
+case "$look_for" in
+ sdbm)
+ apu_use_sdbm=1
+ which_dbm=sdbm
+ ;;
+ gdbm)
+ apu_use_gdbm=1
+ which_dbm=gdbm
+ ;;
+ db)
+ APU_FIND_DB
+ if test -n "$which_dbm"; then
+ # pretend we were looking for this one
+ look_for=$which_dbm
+ else
+ look_errmsg="could not find a DB header"
+ fi
+ ;;
+ db1)
+ APU_CHECK_DB1
+ if test $apu_use_db = 1; then
+ which_dbm=db1
+ fi
+ ;;
+ db185)
+ APU_CHECK_DB185
+ if test $apu_use_db = 1; then
+ which_dbm=db185
+ fi
+ ;;
+ db2)
+ APU_CHECK_DB2or3
+ if test $apu_use_db = 1; then
+ APU_CHECK_DB_VSN
+ if test "$db_version" = 2; then
+ which_dbm=db2
+ else
+ look_errmsg="db2 not present (found db3)"
+ fi
+ fi
+ ;;
+ db3)
+ APU_CHECK_DB2or3
+ if test $apu_use_db = 1; then
+ APU_CHECK_DB_VSN
+ if test "$db_version" = 3; then
+ which_dbm=db3
+ else
+ look_errmsg="db3 not present (found db2)"
+ fi
+ fi
+ ;;
+ default)
+ dnl ### use more sophisticated DBMs for the default?
+ which_dbm="sdbm (default)"
+ apu_use_sdbm=1
+ ;;
+ *)
+ look_errmsg="--with-dbm=$look_for is an unknown DBM type.
+Use one of: sdbm, gdbm, db, db1, db185, db2, db3"
+ ;;
+esac
+
+AC_MSG_CHECKING(for chosen DBM type)
+if test "$look_for" = "$which_dbm"; then
+ AC_MSG_RESULT($which_dbm)
+elif test "$look_for" = "default"; then
+ AC_MSG_RESULT($which_dbm)
+elif test -n "$look_errmsg"; then
+ AC_MSG_ERROR($look_errmsg)
+else
+ AC_MSG_ERROR($look_for not present)
+fi
+
AC_SUBST(apu_use_sdbm)
AC_SUBST(apu_use_gdbm)
+AC_SUBST(apu_use_db)
+AC_SUBST(db_header)
if test $apu_use_gdbm = 1; then
lib_save="$LIBS"
@@ -79,6 +231,12 @@
AC_CHECK_LIB(gdbm, gdbm_open)
APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LIBS"
LIBS="$lib_save $LIBS"
+fi
+
+if test $apu_use_db = 1; then
+ dnl ### use AC_CHECK_LIB?
+ LIBS="$LIBS -l$db_lib"
+ APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LIBS"
fi
])
1.11 +1 -1 apr-util/configure.in
Index: configure.in
===================================================================
RCS file: /home/cvs/apr-util/configure.in,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -u -r1.10 -r1.11
--- configure.in 2001/01/18 04:34:44 1.10
+++ configure.in 2001/01/25 04:37:39 1.11
@@ -79,7 +79,7 @@
export_vars.sh
build/Makefile
build/rules.mk
- include/private/apu_private.h
+ include/private/apu_select_dbm.h
include/apu.h
buckets/Makefile
crypto/Makefile
1.18 +9 -9 apr-util/aprutil.dsp
Index: aprutil.dsp
===================================================================
RCS file: /home/cvs/apr-util/aprutil.dsp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -u -r1.17 -r1.18
--- aprutil.dsp 2001/01/19 13:16:36 1.17
+++ aprutil.dsp 2001/01/25 04:37:39 1.18
@@ -248,27 +248,27 @@
# End Source File
# Begin Source File
-SOURCE=.\include\private\apu_private.hw
+SOURCE=.\include\private\apu_select_dbm.hw
!IF "$(CFG)" == "aprutil - Win32 Release"
# Begin Custom Build
-InputPath=.\include\private\apu_private.hw
+InputPath=.\include\private\apu_select_dbm.hw
-".\include\private\apu_private.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy .\include\private\apu_private.hw .\include\private\apu_private.h >
nul
- echo Created apu_private.h from apu_private.hw
+".\include\private\apu_select_dbm.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy .\include\private\apu_select_dbm.hw
.\include\private\apu_select_dbm.h > nul
+ echo Created apu_select_dbm.h from apu_select_dbm.hw
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - Win32 Debug"
# Begin Custom Build
-InputPath=.\include\private\apu_private.hw
+InputPath=.\include\private\apu_select_dbm.hw
-".\include\private\apu_private.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy .\include\private\apu_private.hw .\include\private\apu_private.h >
nul
- echo Created apu_private.h from apu_private.hw
+".\include\private\apu_select_dbm.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy .\include\private\apu_select_dbm.hw
.\include\private\apu_select_dbm.h > nul
+ echo Created apu_select_dbm.h from apu_select_dbm.hw
# End Custom Build
1.10 +9 -9 apr-util/libaprutil.dsp
Index: libaprutil.dsp
===================================================================
RCS file: /home/cvs/apr-util/libaprutil.dsp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -u -r1.9 -r1.10
--- libaprutil.dsp 2001/01/19 13:16:36 1.9
+++ libaprutil.dsp 2001/01/25 04:37:39 1.10
@@ -253,27 +253,27 @@
# End Source File
# Begin Source File
-SOURCE=.\include\private\apu_private.hw
+SOURCE=.\include\private\apu_select_dbm.hw
!IF "$(CFG)" == "libaprutil - Win32 Release"
# Begin Custom Build
-InputPath=.\include\private\apu_private.hw
+InputPath=.\include\private\apu_select_dbm.hw
-".\include\private\apu_private.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy .\include\private\apu_private.hw .\include\private\apu_private.h >
nul
- echo Created apu_private.h from apu_private.hw
+".\include\private\apu_select_dbm.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy .\include\private\apu_select_dbm.hw
.\include\private\apu_select_dbm.h > nul
+ echo Created apu_select_dbm.h from apu_select_dbm.hw
# End Custom Build
!ELSEIF "$(CFG)" == "libaprutil - Win32 Debug"
# Begin Custom Build
-InputPath=.\include\private\apu_private.hw
+InputPath=.\include\private\apu_select_dbm.hw
-".\include\private\apu_private.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy .\include\private\apu_private.hw .\include\private\apu_private.h >
nul
- echo Created apu_private.h from apu_private.hw
+".\include\private\apu_select_dbm.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy .\include\private\apu_select_dbm.hw
.\include\private\apu_select_dbm.h > nul
+ echo Created apu_select_dbm.h from apu_select_dbm.hw
# End Custom Build
1.16 +4 -4 apr-util/dbm/apr_dbm.c
Index: apr_dbm.c
===================================================================
RCS file: /home/cvs/apr-util/dbm/apr_dbm.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -u -r1.15 -r1.16
--- apr_dbm.c 2001/01/24 13:27:22 1.15
+++ apr_dbm.c 2001/01/25 04:37:40 1.16
@@ -57,7 +57,7 @@
#include "apr_pools.h"
#include "apr_strings.h"
-#include "apu_private.h"
+#include "apu_select_dbm.h"
#include "apr_dbm.h"
@@ -131,10 +131,10 @@
#elif APU_USE_DB
/*
- * We pick up all varieties of Berkeley DB through db.h. This code has been
- * compiled/tested against DB1, DB_185, DB2, and DB3.
+ * 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.
*/
-#include </usr/local/BerkeleyDB.3.1/include/db.h>
#if defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 3)
#define DB_VER 3
1.3 +1 -1 apr-util/include/private/.cvsignore
Index: .cvsignore
===================================================================
RCS file: /home/cvs/apr-util/include/private/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- .cvsignore 2000/12/06 02:19:48 1.2
+++ .cvsignore 2001/01/25 04:37:40 1.3
@@ -1,3 +1,3 @@
apu_config.h.in
apu_config.h
-apu_private.h
+apu_select_dbm.h
1.1 apr-util/include/private/apu_select_dbm.h.in
Index: apu_select_dbm.h.in
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#ifndef APU_SELECT_DBM_H
#define APU_SELECT_DBM_H
/*
** The following macros control what features APRUTIL will use
*/
#define APU_USE_SDBM @apu_use_sdbm@
#define APU_USE_GDBM @apu_use_gdbm@
#define APU_USE_DB @apu_use_db@
#if APU_USE_DB
#include <@db_header@>
#endif
#endif /* !APU_SELECT_DBM_H */
1.1 apr-util/include/private/apu_select_dbm.hw
Index: apu_select_dbm.hw
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#ifndef APU_SELECT_DBM_H
#define APU_SELECT_DBM_H
/*
** The following macros control what features APRUTIL will use
*/
#define APU_USE_SDBM 1
#define APU_USE_GDBM 0
#define APU_USE_DB 0
#if APU_USE_DB
#include <db.h>
#endif
#endif /* !APU_SELECT_DBM_H */