Allow disabling BDB in configure with --without-bdb

This commit is contained in:
Andrew Chow 2020-10-19 14:17:58 -04:00
parent ee47f11f73
commit 99309ab3e9
5 changed files with 43 additions and 11 deletions

View file

@ -6,7 +6,9 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
AC_ARG_VAR(BDB_CFLAGS, [C compiler flags for BerkeleyDB, bypasses autodetection]) AC_ARG_VAR(BDB_CFLAGS, [C compiler flags for BerkeleyDB, bypasses autodetection])
AC_ARG_VAR(BDB_LIBS, [Linker flags for BerkeleyDB, bypasses autodetection]) AC_ARG_VAR(BDB_LIBS, [Linker flags for BerkeleyDB, bypasses autodetection])
if test "x$BDB_CFLAGS" = "x"; then if test "x$use_bdb" = "xno"; then
use_bdb=no
elif test "x$BDB_CFLAGS" = "x"; then
AC_MSG_CHECKING([for Berkeley DB C++ headers]) AC_MSG_CHECKING([for Berkeley DB C++ headers])
BDB_CPPFLAGS= BDB_CPPFLAGS=
bdbpath=X bdbpath=X
@ -44,25 +46,30 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
],[]) ],[])
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$bdb48path" = "xX"; then elif test "x$bdb48path" = "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 4.8])],[ 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 4.8; wallets opened by this build will not be portable!]) AC_MSG_WARN([Found Berkeley DB other than 4.8; BDB wallets opened by this build will not be portable!])
],[ ],[
AC_MSG_ERROR([Found Berkeley DB other than 4.8, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)]) AC_MSG_ERROR([Found Berkeley DB other than 4.8, required for portable BDB wallets (--with-incompatible-bdb to ignore or --without-bdb to disable BDB wallet support)])
]) ])
use_bdb=yes
else else
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx) BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx)
bdbpath="${bdb48path}" bdbpath="${bdb48path}"
use_bdb=yes
fi fi
else else
BDB_CPPFLAGS=${BDB_CFLAGS} BDB_CPPFLAGS=${BDB_CFLAGS}
fi fi
AC_SUBST(BDB_CPPFLAGS) AC_SUBST(BDB_CPPFLAGS)
if test "x$BDB_LIBS" = "x"; then if test "x$use_bdb" = "xno"; then
use_bdb=no
elif test "x$BDB_LIBS" = "x"; then
# TODO: Ideally this could find the library version and make sure it matches the headers being used # TODO: Ideally this could find the library version and make sure it matches the headers being used
for searchlib in db_cxx-4.8 db_cxx db4_cxx; do for searchlib in db_cxx-4.8 db_cxx db4_cxx; do
AC_CHECK_LIB([$searchlib],[main],[ AC_CHECK_LIB([$searchlib],[main],[
@ -71,8 +78,12 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
]) ])
done done
if test "x$BDB_LIBS" = "x"; then 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)]) 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
fi fi
AC_SUBST(BDB_LIBS) 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
]) ])

View file

@ -62,6 +62,10 @@
Replace="@EXEEXT@" By=".exe"></ReplaceInFile> Replace="@EXEEXT@" By=".exe"></ReplaceInFile>
<ReplaceInFile FilePath="$(ConfigIniOut)" <ReplaceInFile FilePath="$(ConfigIniOut)"
Replace="@ENABLE_WALLET_TRUE@" By=""></ReplaceInFile> Replace="@ENABLE_WALLET_TRUE@" By=""></ReplaceInFile>
<ReplaceInFile FilePath="$(ConfigIniOut)"
Replace="@USE_BDB_TRUE@" By=""></ReplaceInFile>
<ReplaceInFile FilePath="$(ConfigIniOut)"
Replace="@USE_SQLITE_TRUE@" By=""></ReplaceInFile>
<ReplaceInFile FilePath="$(ConfigIniOut)" <ReplaceInFile FilePath="$(ConfigIniOut)"
Replace="@BUILD_BITCOIN_CLI_TRUE@" By=""></ReplaceInFile> Replace="@BUILD_BITCOIN_CLI_TRUE@" By=""></ReplaceInFile>
<ReplaceInFile FilePath="$(ConfigIniOut)" <ReplaceInFile FilePath="$(ConfigIniOut)"

View file

@ -126,7 +126,7 @@ AC_ARG_ENABLE([wallet],
[AS_HELP_STRING([--disable-wallet], [AS_HELP_STRING([--disable-wallet],
[disable wallet (enabled by default)])], [disable wallet (enabled by default)])],
[enable_wallet=$enableval], [enable_wallet=$enableval],
[enable_wallet=yes]) [enable_wallet=auto])
AC_ARG_WITH([sqlite], AC_ARG_WITH([sqlite],
[AS_HELP_STRING([--with-sqlite=yes|no|auto], [AS_HELP_STRING([--with-sqlite=yes|no|auto],
@ -134,6 +134,12 @@ AC_ARG_WITH([sqlite],
[use_sqlite=$withval], [use_sqlite=$withval],
[use_sqlite=auto]) [use_sqlite=auto])
AC_ARG_WITH([bdb],
[AS_HELP_STRING([--without-bdb],
[disable bdb wallet support (default is enabled if wallet is enabled)])],
[use_bdb=$withval],
[use_bdb=auto])
AC_ARG_WITH([miniupnpc], AC_ARG_WITH([miniupnpc],
[AS_HELP_STRING([--with-miniupnpc], [AS_HELP_STRING([--with-miniupnpc],
[enable UPNP (default is yes if libminiupnpc is found)])], [enable UPNP (default is yes if libminiupnpc is found)])],
@ -1248,6 +1254,14 @@ if test x$enable_wallet != xno; then
fi fi
fi fi
AC_MSG_RESULT([$use_sqlite]) AC_MSG_RESULT([$use_sqlite])
dnl Disable wallet if both --without-bdb and --without-sqlite
if test "x$use_bdb$use_sqlite" = "xnono"; then
if test "x$enable_wallet" = "xyes"; then
AC_MSG_ERROR([wallet functionality requested but no BDB or SQLite support available.])
fi
enable_wallet=no
fi
fi fi
dnl Check for libminiupnpc (optional) dnl Check for libminiupnpc (optional)
@ -1503,6 +1517,7 @@ AC_MSG_CHECKING([if wallet should be enabled])
if test x$enable_wallet != xno; then if test x$enable_wallet != xno; then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED([ENABLE_WALLET],[1],[Define to 1 to enable wallet functions]) AC_DEFINE_UNQUOTED([ENABLE_WALLET],[1],[Define to 1 to enable wallet functions])
enable_wallet=yes
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
@ -1602,7 +1617,7 @@ AM_CONDITIONAL([TARGET_LINUX], [test x$TARGET_OS = xlinux])
AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows]) AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes]) AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes])
AM_CONDITIONAL([USE_SQLITE], [test "x$use_sqlite" = "xyes"]) AM_CONDITIONAL([USE_SQLITE], [test "x$use_sqlite" = "xyes"])
AM_CONDITIONAL([USE_BDB], [true]) AM_CONDITIONAL([USE_BDB], [test "x$use_bdb" = "xyes"])
AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes]) AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes])
AM_CONDITIONAL([ENABLE_FUZZ],[test x$enable_fuzz = xyes]) AM_CONDITIONAL([ENABLE_FUZZ],[test x$enable_fuzz = xyes])
AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes]) AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes])
@ -1669,6 +1684,7 @@ AC_SUBST(SHANI_CXXFLAGS)
AC_SUBST(ARM_CRC_CXXFLAGS) AC_SUBST(ARM_CRC_CXXFLAGS)
AC_SUBST(LIBTOOL_APP_LDFLAGS) AC_SUBST(LIBTOOL_APP_LDFLAGS)
AC_SUBST(USE_SQLITE) AC_SUBST(USE_SQLITE)
AC_SUBST(USE_BDB)
AC_SUBST(USE_UPNP) AC_SUBST(USE_UPNP)
AC_SUBST(USE_QRCODE) AC_SUBST(USE_QRCODE)
AC_SUBST(BOOST_LIBS) AC_SUBST(BOOST_LIBS)
@ -1746,6 +1762,7 @@ echo " multiprocess = $build_multiprocess"
echo " with wallet = $enable_wallet" echo " with wallet = $enable_wallet"
if test "x$enable_wallet" != "xno"; then if test "x$enable_wallet" != "xno"; then
echo " with sqlite = $use_sqlite" echo " with sqlite = $use_sqlite"
echo " with bdb = $use_bdb"
fi fi
echo " with gui / qt = $bitcoin_enable_qt" echo " with gui / qt = $bitcoin_enable_qt"
if test x$bitcoin_enable_qt != xno; then if test x$bitcoin_enable_qt != xno; then

View file

@ -41,7 +41,7 @@ Optional dependencies:
Library | Purpose | Description Library | Purpose | Description
------------|------------------|---------------------- ------------|------------------|----------------------
miniupnpc | UPnP Support | Firewall-jumping support miniupnpc | UPnP Support | Firewall-jumping support
libdb4.8 | Berkeley DB | Wallet storage (only needed when wallet enabled) libdb4.8 | Berkeley DB | Optional, wallet storage (only needed when wallet enabled)
qt | GUI | GUI toolkit (only needed when GUI enabled) qt | GUI | GUI toolkit (only needed when GUI enabled)
libqrencode | QR codes in GUI | Optional for generating QR codes (only needed when GUI enabled) libqrencode | QR codes in GUI | Optional for generating QR codes (only needed when GUI enabled)
univalue | Utility | JSON parsing and encoding (bundled version will be used unless --with-system-univalue passed to configure) univalue | Utility | JSON parsing and encoding (bundled version will be used unless --with-system-univalue passed to configure)

View file

@ -33,7 +33,7 @@ Some dependencies are not needed in all configurations. The following are some f
#### Options passed to `./configure` #### Options passed to `./configure`
* MiniUPnPc is not needed with `--with-miniupnpc=no`. * MiniUPnPc is not needed with `--with-miniupnpc=no`.
* Berkeley DB is not needed with `--disable-wallet`. * Berkeley DB is not needed with `--disable-wallet` or `--without-bdb`.
* SQLite is not needed with `--disable-wallet` or `--without-sqlite`. * SQLite is not needed with `--disable-wallet` or `--without-sqlite`.
* Qt is not needed with `--without-gui`. * Qt is not needed with `--without-gui`.
* If the qrencode dependency is absent, QR support won't be added. To force an error when that happens, pass `--with-qrencode`. * If the qrencode dependency is absent, QR support won't be added. To force an error when that happens, pass `--with-qrencode`.