dogecoin/build-aux/m4/dogecoin_find_bdb53.m4

67 lines
2.3 KiB
Plaintext
Raw Permalink Normal View History

AC_DEFUN([BITCOIN_FIND_BDB53],[
2017-04-18 14:40:50 +02:00
AC_MSG_CHECKING([for Berkeley DB C++ headers])
BDB_CPPFLAGS=
BDB_LIBS=
bdbpath=X
bdb53path=X
2017-04-18 14:40:50 +02:00
bdbdirlist=
for _vn in 5.3 53 5 ''; do
2017-04-18 14:40:50 +02:00
for _pfx in b lib ''; do
bdbdirlist="$bdbdirlist ${_pfx}db${_vn}"
done
done
for searchpath in $bdbdirlist ''; do
test -n "${searchpath}" && searchpath="${searchpath}/"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <${searchpath}db_cxx.h>
]],[[
#if !((DB_VERSION_MAJOR == 5 && DB_VERSION_MINOR >= 3) || DB_VERSION_MAJOR > 5)
#error "failed to find bdb 5.3+"
2017-04-18 14:40:50 +02:00
#endif
]])],[
if test "x$bdbpath" = "xX"; then
bdbpath="${searchpath}"
fi
],[
continue
])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <${searchpath}db_cxx.h>
]],[[
#if !(DB_VERSION_MAJOR == 5 && DB_VERSION_MINOR == 3)
#error "failed to find bdb 5.3"
2017-04-18 14:40:50 +02:00
#endif
]])],[
bdb53path="${searchpath}"
2017-04-18 14:40:50 +02:00
break
],[])
done
if test "x$bdbpath" = "xX"; then
AC_MSG_RESULT([no])
2015-08-02 11:56:20 +02:00
AC_MSG_ERROR([libdb_cxx headers missing, Dogecoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
elif test "x$bdb53path" = "xX"; then
2017-04-18 14:40:50 +02:00
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 4.8])],[
AC_MSG_WARN([Found Berkeley DB other than 5.3; wallets opened by this build will not be portable!])
2017-04-18 14:40:50 +02:00
],[
AC_MSG_ERROR([Found Berkeley DB other than 5.3, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)])
2017-04-18 14:40:50 +02:00
])
else
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb53path}],db_cxx)
bdbpath="${bdb53path}"
2017-04-18 14:40:50 +02:00
fi
AC_SUBST(BDB_CPPFLAGS)
# TODO: Ideally this could find the library version and make sure it matches the headers being used
for searchlib in db_cxx-5.3 db_cxx; do
2017-04-18 14:40:50 +02:00
AC_CHECK_LIB([$searchlib],[main],[
BDB_LIBS="-l${searchlib}"
break
])
done
if test "x$BDB_LIBS" = "x"; then
2015-08-02 11:56:20 +02:00
AC_MSG_ERROR([libdb_cxx missing, Dogecoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
2017-04-18 14:40:50 +02:00
fi
AC_SUBST(BDB_LIBS)
])