1
dnl SVN_LIB_BERKELEY_DB(major, minor, patch)
3
dnl Compare if the DB provided by APR-UTIL is no older than the
4
dnl version given by MAJOR, MINOR, and PATCH.
6
dnl If we find a useable version, set the shell variable
7
dnl `svn_lib_berkeley_db' to `yes'. Otherwise, set `svn_lib_berkeley_db'
10
dnl This macro also checks for the `--with-berkeley-db=PATH' flag;
11
dnl if given, the macro will use the PATH specified, and the
12
dnl configuration script will die if it can't find the library. If
13
dnl the user gives the `--without-berkeley-db' flag, the entire
14
dnl search is skipped.
17
AC_DEFUN(SVN_LIB_BERKELEY_DB,
20
dnl Process the `with-berkeley-db' switch. We set `status' to one
21
dnl of the following values:
22
dnl `required' --- the user specified that they did want to use
23
dnl Berkeley DB, so abort the configuration if we cannot find it.
24
dnl `try-link' --- See if APR-UTIL supplies the correct DB version;
25
dnl if it doesn't, just do not build the bdb based filesystem.
26
dnl `skip' --- Do not look for Berkeley DB, and do not build the
27
dnl bdb based filesystem.
29
dnl Finding it is defined as doing a runtime check against the db
30
dnl that is supplied by APR-UTIL.
31
dnl Assuming `status' is not `skip', we do a runtime check against the db
32
dnl that is supplied by APR-UTIL.
34
dnl Since APR-UTIL uses --with-berkeley-db as well, and we pass it
35
dnl through when APR-UTIL is in the tree, we also accept a place spec
36
dnl as argument, and handle that case specifically.
38
dnl A `place spec' is either:
39
dnl - a directory prefix P, indicating we should look for headers in
40
dnl P/include and libraries in P/lib, or
41
dnl - a string of the form `HEADER:LIB', indicating that we should look
42
dnl for headers in HEADER and libraries in LIB.
44
AC_ARG_WITH(berkeley-db,
45
[ --with-berkeley-db=PATH
46
The Subversion Berkeley DB based filesystem library
47
requires Berkeley DB $db_version or newer. If you
48
specify `--without-berkeley-db', that library will
49
not be built. Otherwise, the configure script builds
50
that library if and only if APR-UTIL is linked
51
against a new enough version of Berkeley DB.
53
If and only if you are building APR-UTIL as part of
54
the Subversion build process, you may help APR-UTIL
55
to find the correct Berkeley DB installation by
56
passing a PATH to this option, to cause APR-UTIL to
57
look for the Berkeley DB header and library in
58
`PATH/include' and `PATH/lib'. If PATH is of the
59
form `HEADER:LIB', then search for header files in
60
HEADER, and the library in LIB. If you omit the
61
`=PATH' part completely, the configure script will
62
search for Berkeley DB in a number of standard
65
if test "$withval" = "no"; then
68
apu_db_version="`$apu_config --db-version`"
69
if test $? -ne 0; then
70
AC_MSG_ERROR([Can't determine whether apr-util is linked against a
71
proper version of Berkeley DB.])
74
if test "$withval" = "yes"; then
75
if test "$apu_db_version" != "4"; then
76
AC_MSG_ERROR([APR-UTIL wasn't linked against Berkeley DB 4,
77
while the fs component is required. Reinstall
78
APR-UTIL with the appropiate options.])
83
elif test "$apu_found" != "reconfig"; then
84
if test "$apu_db_version" != 4; then
85
AC_MSG_ERROR([APR-UTIL was installed independently, it won't be
86
possible to use the specified Berkeley DB: $withval])
89
AC_MSG_WARN([APR-UTIL may or may not be using the specified
90
Berkeley DB at `$withval'. Using the Berkeley DB
91
supplied by APR-UTIL.])
98
# No --with-berkeley-db option:
100
# Check if APR-UTIL is providing the correct Berkeley DB version
103
apu_db_version="`$apu_config --db-version`"
104
if test $? -ne 0; then
105
AC_MSG_WARN([Detected older version of APR-UTIL, trying to determine
106
whether apr-util is linked against Berkeley DB
109
elif test "$apu_db_version" != "4"; then
116
if test "$status" = "skip"; then
117
svn_lib_berkeley_db=no
119
AC_MSG_CHECKING([for availability of Berkeley DB])
120
SVN_LIB_BERKELEY_DB_TRY($1, $2, $3)
121
if test "$svn_have_berkeley_db" = "yes"; then
123
svn_lib_berkeley_db=yes
126
svn_lib_berkeley_db=no
127
if test "$status" = "required"; then
128
AC_MSG_ERROR([Berkeley DB $db_version wasn't found.])
135
dnl SVN_LIB_BERKELEY_DB_TRY(major, minor, patch)
137
dnl A subroutine of SVN_LIB_BERKELEY_DB.
139
dnl Check that a new-enough version of Berkeley DB is installed.
140
dnl "New enough" means no older than the version given by MAJOR,
141
dnl MINOR, and PATCH. The result of the test is not cached; no
142
dnl messages are printed.
144
dnl Set the shell variable `svn_have_berkeley_db' to `yes' if we found
145
dnl an appropriate version via APR-UTIL, or `no' otherwise.
147
dnl This macro uses the Berkeley DB library function `db_version' to
148
dnl find the version. If the library linked to APR-UTIL doesn't have this
149
dnl function, then this macro assumes it is too old.
151
dnl NOTE: This is pretty messed up. It seems that the FreeBSD port of
152
dnl Berkeley DB 4 puts the header file in /usr/local/include/db4, but the
153
dnl database library in /usr/local/lib, as libdb4.[a|so]. There is no
154
dnl /usr/local/include/db.h. So if you check for /usr/local first, you'll
155
dnl get the old header file from /usr/include, and the new library from
156
dnl /usr/local/lib. Disaster. Thus this test compares the version constants
157
dnl in the db.h header with the ones returned by db_version().
160
AC_DEFUN(SVN_LIB_BERKELEY_DB_TRY,
162
svn_lib_berkeley_db_try_save_cppflags="$CPPFLAGS"
163
svn_lib_berkeley_db_try_save_libs="$LIBS"
165
svn_check_berkeley_db_major=$1
166
svn_check_berkeley_db_minor=$2
167
svn_check_berkeley_db_patch=$3
169
# Extract only the -ldb.* flag from the libs supplied by apu-config
170
# Otherwise we get bit by the fact that expat might not be built yet
171
# Or that it resides in a non-standard location which we would have
172
# to compensate with using something like -R`$apu_config --prefix`/lib.
174
svn_apu_bdb_lib=["`$apu_config --libs | sed -e 's/.*\(-ldb[^ ]*\).*/\1/'`"]
176
CPPFLAGS="$SVN_APRUTIL_INCLUDES $CPPFLAGS"
177
LIBS="`$apu_config --ldflags` $svn_apu_bdb_lib $LIBS"
183
#include <apu_want.h>
187
int major, minor, patch;
189
db_version (&major, &minor, &patch);
191
/* Sanity check: ensure that db.h constants actually match the db library */
192
if (major != DB_VERSION_MAJOR
193
|| minor != DB_VERSION_MINOR
194
|| patch != DB_VERSION_PATCH)
197
/* Run-time check: ensure the library claims to be the correct version. */
199
if (major < $svn_check_berkeley_db_major)
201
if (major > $svn_check_berkeley_db_major)
204
if (minor < $svn_check_berkeley_db_minor)
206
if (minor > $svn_check_berkeley_db_minor)
209
if (patch >= $svn_check_berkeley_db_patch)
215
[svn_have_berkeley_db=yes],
216
[svn_have_berkeley_db=no],
217
[svn_have_berkeley_db=yes]
220
CPPFLAGS="$svn_lib_berkeley_db_try_save_cppflags"
221
LIBS="$svn_lib_berkeley_db_try_save_libs"