update find_bdb62 to allow bdb5.3

--with-incompatible-bdb now looks correctly for bdb5.3
This commit is contained in:
Michel van Kessel
2021-02-05 19:29:03 +01:00
parent 4ef44927a5
commit e0cc50fcdc

View File

@@ -3,68 +3,85 @@ dnl Distributed under the MIT software license, see the accompanying
dnl file COPYING or http://www.opensource.org/licenses/mit-license.php. dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.
AC_DEFUN([BITCOIN_FIND_BDB62],[ AC_DEFUN([BITCOIN_FIND_BDB62],[
AC_MSG_CHECKING([for Berkeley DB C++ headers]) AC_ARG_VAR(BDB_CFLAGS, [C compiler flags for BerkeleyDB, bypasses autodetection])
BDB_CPPFLAGS= AC_ARG_VAR(BDB_LIBS, [Linker flags for BerkeleyDB, bypasses autodetection])
BDB_LIBS= if test "x$use_bdb" = "xno"; then
bdbpath=X use_bdb=no
bdb62path=X elif test "x$BDB_CFLAGS" = "x"; then
bdbdirlist= AC_MSG_CHECKING([for Berkeley DB C++ headers])
for _vn in 6.2 62 6 ''; do BDB_CPPFLAGS=
for _pfx in b lib ''; do bdbpath=X
bdbdirlist="$bdbdirlist ${_pfx}db${_vn}" bdb62path=X
bdbdirlist=
for _vn in 6.2 62 6 5 5.3 ''; do
for _pfx in b lib ''; do
bdbdirlist="$bdbdirlist ${_pfx}db${_vn}"
done
done done
done for searchpath in $bdbdirlist ''; do
for searchpath in $bdbdirlist ''; do test -n "${searchpath}" && searchpath="${searchpath}/"
test -n "${searchpath}" && searchpath="${searchpath}/" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <${searchpath}db_cxx.h>
#include <${searchpath}db_cxx.h> ]],[[
]],[[ #if !((DB_VERSION_MAJOR == 6 && DB_VERSION_MINOR >= 2) || DB_VERSION_MAJOR < 6 || DB_VERSION_MAJOR > 6)
#if !((DB_VERSION_MAJOR == 6 && DB_VERSION_MINOR >= 2) || DB_VERSION_MAJOR > 6) #error "failed to find bdb 6.2+"
#error "failed to find bdb 6.2+" #endif
#endif ]])],[
]])],[ if test "x$bdbpath" = "xX"; then
if test "x$bdbpath" = "xX"; then bdbpath="${searchpath}"
bdbpath="${searchpath}" fi
fi ],[
],[ continue
continue ])
]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <${searchpath}db_cxx.h>
#include <${searchpath}db_cxx.h> ]],[[
]],[[ #if !(DB_VERSION_MAJOR == 6 && DB_VERSION_MINOR == 2)
#if !(DB_VERSION_MAJOR == 6 && DB_VERSION_MINOR == 2) #error "failed to find bdb 6.2"
#error "failed to find bdb 6.2" #endif
#endif ]])],[
]])],[ bdb62path="${searchpath}"
bdb62path="${searchpath}" break
break ],[])
],[]) done
done if test "x$bdbpath" = "xX"; then
if test "x$bdbpath" = "xX"; then use_bdb=no
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
AC_MSG_ERROR([libdb_cxx headers missing,]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)]) AC_MSG_ERROR([libdb_cxx headers missing, ]AC_PACKAGE_NAME[ requires this library for BDB wallet support (--without-bdb to disable BDB wallet support)])
elif test "x$bdb62path" = "xX"; then elif test "x$bdb62path" = "xX"; then
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx) BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx)
AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 6.2])],[ AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 6.2])],[
AC_MSG_WARN([Found Berkeley DB other than 6.2; wallets opened by this build will not be portable!]) AC_MSG_WARN([Found Berkeley DB other than 6.2; BDB wallets opened by this build will not be portable!])
],[ ],[
AC_MSG_ERROR([Found Berkeley DB other than 6.2, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)]) AC_MSG_ERROR([Found Berkeley DB other than 6.2, required for portable BDB wallets (--with-incompatible-bdb to ignore or --without-bdb to disable BDB wallet support)])
]) ])
use_bdb=yes
else
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx)
bdbpath="${bdb62path}"
use_bdb=yes
fi
else else
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb62path}],db_cxx) BDB_CPPFLAGS=${BDB_CFLAGS}
bdbpath="${bdb62path}"
fi fi
AC_SUBST(BDB_CPPFLAGS) AC_SUBST(BDB_CPPFLAGS)
if test "x$use_bdb" = "xno"; then
# TODO: Ideally this could find the library version and make sure it matches the headers being used use_bdb=no
for searchlib in db_cxx-6.2 db_cxx; do elif test "x$BDB_LIBS" = "x"; then
AC_CHECK_LIB([$searchlib],[main],[ # TODO: Ideally this could find the library version and make sure it matches the headers being used
BDB_LIBS="-l${searchlib}" for searchlib in db_cxx db_cxx-6.2 db_cxx-5.3 db6_cxx db5_cxx; do
break AC_CHECK_LIB([$searchlib],[main],[
]) BDB_LIBS="-l${searchlib}"
done break
if test "x$BDB_LIBS" = "x"; then ])
AC_MSG_ERROR([libdb_cxx missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)]) done
if test "x$BDB_LIBS" = "x"; then
AC_MSG_ERROR([libdb_cxx missing, ]AC_PACKAGE_NAME[ requires this library for BDB wallet support (--without-bdb to disable BDB wallet support)])
fi
fi
if test "x$use_bdb" != "xno"; then
AC_SUBST(BDB_LIBS)
AC_DEFINE([USE_BDB], [1], [Define if BDB support should be compiled in])
use_bdb=yes
fi fi
AC_SUBST(BDB_LIBS)
]) ])