Skip to content

Commit 99309ab

Browse files
committed
Allow disabling BDB in configure with --without-bdb
1 parent ee47f11 commit 99309ab

File tree

5 files changed

+43
-11
lines changed

5 files changed

+43
-11
lines changed

build-aux/m4/bitcoin_find_bdb48.m4

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
66
AC_ARG_VAR(BDB_CFLAGS, [C compiler flags for BerkeleyDB, bypasses autodetection])
77
AC_ARG_VAR(BDB_LIBS, [Linker flags for BerkeleyDB, bypasses autodetection])
88
9-
if test "x$BDB_CFLAGS" = "x"; then
9+
if test "x$use_bdb" = "xno"; then
10+
use_bdb=no
11+
elif test "x$BDB_CFLAGS" = "x"; then
1012
AC_MSG_CHECKING([for Berkeley DB C++ headers])
1113
BDB_CPPFLAGS=
1214
bdbpath=X
@@ -44,25 +46,30 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
4446
],[])
4547
done
4648
if test "x$bdbpath" = "xX"; then
49+
use_bdb=no
4750
AC_MSG_RESULT([no])
48-
AC_MSG_ERROR([libdb_cxx headers missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
51+
AC_MSG_ERROR([libdb_cxx headers missing, ]AC_PACKAGE_NAME[ requires this library for BDB wallet support (--without-bdb to disable BDB wallet support)])
4952
elif test "x$bdb48path" = "xX"; then
5053
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx)
5154
AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[
52-
AC_MSG_WARN([Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!])
55+
AC_MSG_WARN([Found Berkeley DB other than 4.8; BDB wallets opened by this build will not be portable!])
5356
],[
54-
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)])
57+
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)])
5558
])
59+
use_bdb=yes
5660
else
5761
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx)
5862
bdbpath="${bdb48path}"
63+
use_bdb=yes
5964
fi
6065
else
6166
BDB_CPPFLAGS=${BDB_CFLAGS}
6267
fi
6368
AC_SUBST(BDB_CPPFLAGS)
6469
65-
if test "x$BDB_LIBS" = "x"; then
70+
if test "x$use_bdb" = "xno"; then
71+
use_bdb=no
72+
elif test "x$BDB_LIBS" = "x"; then
6673
# TODO: Ideally this could find the library version and make sure it matches the headers being used
6774
for searchlib in db_cxx-4.8 db_cxx db4_cxx; do
6875
AC_CHECK_LIB([$searchlib],[main],[
@@ -71,8 +78,12 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
7178
])
7279
done
7380
if test "x$BDB_LIBS" = "x"; then
74-
AC_MSG_ERROR([libdb_cxx missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
81+
AC_MSG_ERROR([libdb_cxx missing, ]AC_PACKAGE_NAME[ requires this library for BDB wallet support (--without-bdb to disable BDB wallet support)])
7582
fi
7683
fi
77-
AC_SUBST(BDB_LIBS)
84+
if test "x$use_bdb" != "xno"; then
85+
AC_SUBST(BDB_LIBS)
86+
AC_DEFINE([USE_BDB], [1], [Define if BDB support should be compiled in])
87+
use_bdb=yes
88+
fi
7889
])

build_msvc/bitcoind/bitcoind.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@
6262
Replace="@EXEEXT@" By=".exe"></ReplaceInFile>
6363
<ReplaceInFile FilePath="$(ConfigIniOut)"
6464
Replace="@ENABLE_WALLET_TRUE@" By=""></ReplaceInFile>
65+
<ReplaceInFile FilePath="$(ConfigIniOut)"
66+
Replace="@USE_BDB_TRUE@" By=""></ReplaceInFile>
67+
<ReplaceInFile FilePath="$(ConfigIniOut)"
68+
Replace="@USE_SQLITE_TRUE@" By=""></ReplaceInFile>
6569
<ReplaceInFile FilePath="$(ConfigIniOut)"
6670
Replace="@BUILD_BITCOIN_CLI_TRUE@" By=""></ReplaceInFile>
6771
<ReplaceInFile FilePath="$(ConfigIniOut)"

configure.ac

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,20 @@ AC_ARG_ENABLE([wallet],
126126
[AS_HELP_STRING([--disable-wallet],
127127
[disable wallet (enabled by default)])],
128128
[enable_wallet=$enableval],
129-
[enable_wallet=yes])
129+
[enable_wallet=auto])
130130

131131
AC_ARG_WITH([sqlite],
132132
[AS_HELP_STRING([--with-sqlite=yes|no|auto],
133133
[enable sqlite wallet support (default: auto, i.e., enabled if wallet is enabled and sqlite is found)])],
134134
[use_sqlite=$withval],
135135
[use_sqlite=auto])
136136

137+
AC_ARG_WITH([bdb],
138+
[AS_HELP_STRING([--without-bdb],
139+
[disable bdb wallet support (default is enabled if wallet is enabled)])],
140+
[use_bdb=$withval],
141+
[use_bdb=auto])
142+
137143
AC_ARG_WITH([miniupnpc],
138144
[AS_HELP_STRING([--with-miniupnpc],
139145
[enable UPNP (default is yes if libminiupnpc is found)])],
@@ -1248,6 +1254,14 @@ if test x$enable_wallet != xno; then
12481254
fi
12491255
fi
12501256
AC_MSG_RESULT([$use_sqlite])
1257+
1258+
dnl Disable wallet if both --without-bdb and --without-sqlite
1259+
if test "x$use_bdb$use_sqlite" = "xnono"; then
1260+
if test "x$enable_wallet" = "xyes"; then
1261+
AC_MSG_ERROR([wallet functionality requested but no BDB or SQLite support available.])
1262+
fi
1263+
enable_wallet=no
1264+
fi
12511265
fi
12521266

12531267
dnl Check for libminiupnpc (optional)
@@ -1503,6 +1517,7 @@ AC_MSG_CHECKING([if wallet should be enabled])
15031517
if test x$enable_wallet != xno; then
15041518
AC_MSG_RESULT(yes)
15051519
AC_DEFINE_UNQUOTED([ENABLE_WALLET],[1],[Define to 1 to enable wallet functions])
1520+
enable_wallet=yes
15061521

15071522
else
15081523
AC_MSG_RESULT(no)
@@ -1602,7 +1617,7 @@ AM_CONDITIONAL([TARGET_LINUX], [test x$TARGET_OS = xlinux])
16021617
AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
16031618
AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes])
16041619
AM_CONDITIONAL([USE_SQLITE], [test "x$use_sqlite" = "xyes"])
1605-
AM_CONDITIONAL([USE_BDB], [true])
1620+
AM_CONDITIONAL([USE_BDB], [test "x$use_bdb" = "xyes"])
16061621
AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes])
16071622
AM_CONDITIONAL([ENABLE_FUZZ],[test x$enable_fuzz = xyes])
16081623
AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes])
@@ -1669,6 +1684,7 @@ AC_SUBST(SHANI_CXXFLAGS)
16691684
AC_SUBST(ARM_CRC_CXXFLAGS)
16701685
AC_SUBST(LIBTOOL_APP_LDFLAGS)
16711686
AC_SUBST(USE_SQLITE)
1687+
AC_SUBST(USE_BDB)
16721688
AC_SUBST(USE_UPNP)
16731689
AC_SUBST(USE_QRCODE)
16741690
AC_SUBST(BOOST_LIBS)
@@ -1746,6 +1762,7 @@ echo " multiprocess = $build_multiprocess"
17461762
echo " with wallet = $enable_wallet"
17471763
if test "x$enable_wallet" != "xno"; then
17481764
echo " with sqlite = $use_sqlite"
1765+
echo " with bdb = $use_bdb"
17491766
fi
17501767
echo " with gui / qt = $bitcoin_enable_qt"
17511768
if test x$bitcoin_enable_qt != xno; then

doc/build-unix.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Optional dependencies:
4141
Library | Purpose | Description
4242
------------|------------------|----------------------
4343
miniupnpc | UPnP Support | Firewall-jumping support
44-
libdb4.8 | Berkeley DB | Wallet storage (only needed when wallet enabled)
44+
libdb4.8 | Berkeley DB | Optional, wallet storage (only needed when wallet enabled)
4545
qt | GUI | GUI toolkit (only needed when GUI enabled)
4646
libqrencode | QR codes in GUI | Optional for generating QR codes (only needed when GUI enabled)
4747
univalue | Utility | JSON parsing and encoding (bundled version will be used unless --with-system-univalue passed to configure)

doc/dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Some dependencies are not needed in all configurations. The following are some f
3333

3434
#### Options passed to `./configure`
3535
* MiniUPnPc is not needed with `--with-miniupnpc=no`.
36-
* Berkeley DB is not needed with `--disable-wallet`.
36+
* Berkeley DB is not needed with `--disable-wallet` or `--without-bdb`.
3737
* SQLite is not needed with `--disable-wallet` or `--without-sqlite`.
3838
* Qt is not needed with `--without-gui`.
3939
* If the qrencode dependency is absent, QR support won't be added. To force an error when that happens, pass `--with-qrencode`.

0 commit comments

Comments
 (0)