Skip to content

Commit 4f9e993

Browse files
committed
Add --disable-wallet option to build system
Make it possible to build Bitcoin without wallet (and thus without BDB) so that it only functions as node.
1 parent d004d72 commit 4f9e993

File tree

6 files changed

+77
-14
lines changed

6 files changed

+77
-14
lines changed

configure.ac

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ AM_MAINTAINER_MODE([enable])
3737
dnl make the compilation flags quiet unless V=1 is used
3838
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
3939

40+
# Enable wallet
41+
AC_ARG_ENABLE([wallet],
42+
[AS_HELP_STRING([--enable-wallet],
43+
[enable wallet (default is yes)])],
44+
[enable_wallet=$enableval],
45+
[enable_wallet=yes])
46+
4047
AC_ARG_WITH([miniupnpc],
4148
[AS_HELP_STRING([--with-miniupnpc],
4249
[enable UPNP (default is yes if libminiupnpc is found)])],
@@ -362,8 +369,10 @@ AC_TRY_COMPILE([#include <sys/socket.h>],
362369
[ AC_MSG_RESULT(no)]
363370
)
364371

365-
dnl Check for libdb_cxx
366-
BITCOIN_FIND_BDB48
372+
if test x$enable_wallet != xno; then
373+
dnl Check for libdb_cxx only if wallet enabled
374+
BITCOIN_FIND_BDB48
375+
fi
367376

368377
dnl Check for libminiupnpc (optional)
369378
if test x$use_upnp != xno; then
@@ -593,6 +602,20 @@ if test "x$use_ccache" != "xno"; then
593602
AC_MSG_RESULT($use_ccache)
594603
fi
595604

605+
dnl enable wallet
606+
AC_MSG_CHECKING([if wallet should be enabled])
607+
if test x$enable_wallet != xno; then
608+
AC_MSG_RESULT(yes)
609+
AC_DEFINE_UNQUOTED([ENABLE_WALLET],[1],[Define to 1 to enable wallet functions])
610+
611+
else
612+
AC_MSG_RESULT(no)
613+
614+
if test "x$use_qt" != "xno"; then
615+
AC_MSG_ERROR([Cannot currently build Qt GUI with wallet disabled. Use --without-qt.])
616+
fi
617+
fi
618+
596619
dnl enable ipv6 support
597620
AC_MSG_CHECKING([if ipv6 should be enabled])
598621
if test x$have_ipv6 = xno; then
@@ -705,6 +728,7 @@ fi
705728

706729
AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin])
707730
AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
731+
AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet == xyes])
708732
AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes])
709733
AM_CONDITIONAL([USE_LCOV],[test x$use_lcov == xyes])
710734
AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno])

src/Makefile.am

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ AM_CPPFLAGS += -I$(top_srcdir)/src/leveldb/helpers/memenv \
44
-I$(builddir)
55

66
noinst_LIBRARIES = libbitcoin_server.a libbitcoin_common.a libbitcoin_cli.a
7+
if ENABLE_WALLET
8+
noinst_LIBRARIES += libbitcoin_wallet.a
9+
endif
710

811
bin_PROGRAMS = bitcoind bitcoin-cli
912

@@ -33,14 +36,37 @@ obj/build.h: FORCE
3336
$(abs_top_srcdir)
3437
version.o: obj/build.h
3538

36-
libbitcoin_server_a_SOURCES = addrman.cpp alert.cpp \
39+
libbitcoin_server_a_SOURCES = \
40+
addrman.cpp \
41+
alert.cpp \
42+
crypter.cpp \
3743
rpcserver.cpp \
3844
bloom.cpp \
39-
chainparams.cpp checkpoints.cpp coins.cpp crypter.cpp db.cpp \
40-
init.cpp keystore.cpp leveldbwrapper.cpp main.cpp miner.cpp \
41-
net.cpp noui.cpp rpcblockchain.cpp rpcdump.cpp \
42-
rpcmining.cpp rpcnet.cpp rpcrawtransaction.cpp rpcwallet.cpp \
43-
txdb.cpp txmempool.cpp wallet.cpp walletdb.cpp $(JSON_H) \
45+
chainparams.cpp \
46+
checkpoints.cpp \
47+
coins.cpp \
48+
init.cpp \
49+
keystore.cpp \
50+
leveldbwrapper.cpp \
51+
main.cpp \
52+
net.cpp \
53+
noui.cpp \
54+
rpcblockchain.cpp \
55+
rpcnet.cpp \
56+
rpcrawtransaction.cpp \
57+
txdb.cpp \
58+
txmempool.cpp \
59+
$(JSON_H) \
60+
$(BITCOIN_CORE_H)
61+
62+
libbitcoin_wallet_a_SOURCES = \
63+
db.cpp \
64+
miner.cpp \
65+
rpcdump.cpp \
66+
rpcmining.cpp \
67+
rpcwallet.cpp \
68+
wallet.cpp \
69+
walletdb.cpp \
4470
$(BITCOIN_CORE_H)
4571

4672
libbitcoin_common_a_SOURCES = \
@@ -68,6 +94,9 @@ nodist_libbitcoin_common_a_SOURCES = $(top_srcdir)/src/obj/build.h
6894
# bitcoind binary #
6995
bitcoind_LDADD = libbitcoin_server.a libbitcoin_cli.a libbitcoin_common.a leveldb/libleveldb.a leveldb/libmemenv.a \
7096
$(BOOST_LIBS)
97+
if ENABLE_WALLET
98+
bitcoind_LDADD += libbitcoin_wallet.a
99+
endif
71100
bitcoind_SOURCES = bitcoind.cpp
72101
#
73102

src/Makefile.include

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ AM_CPPFLAGS = $(INCLUDES) \
66
AM_LDFLAGS = $(PTHREAD_CFLAGS)
77

88
LIBBITCOIN_SERVER=$(top_builddir)/src/libbitcoin_server.a
9+
LIBBITCOIN_WALLET=$(top_builddir)/src/libbitcoin_wallet.a
910
LIBBITCOIN_COMMON=$(top_builddir)/src/libbitcoin_common.a
1011
LIBBITCOIN_CLI=$(top_builddir)/src/libbitcoin_cli.a
1112
LIBLEVELDB=$(top_builddir)/src/leveldb/libleveldb.a

src/qt/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ endif
197197
bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(QT_INCLUDES) \
198198
-I$(top_srcdir)/src/qt/forms
199199
bitcoin_qt_SOURCES = bitcoin.cpp
200-
bitcoin_qt_LDADD = libbitcoinqt.a $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) $(LIBMEMENV) \
200+
bitcoin_qt_LDADD = libbitcoinqt.a $(LIBBITCOIN_SERVER) $(LIBBITCOIN_WALLET) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) $(LIBMEMENV) \
201201
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS)
202202

203203
# forms/foo.h -> forms/ui_foo.h

src/qt/test/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ BUILT_SOURCES = $(TEST_QT_MOC_CPP)
1717
test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(QT_INCLUDES) $(QT_TEST_INCLUDES)
1818
test_bitcoin_qt_SOURCES = test_main.cpp uritests.cpp paymentservertests.cpp $(TEST_QT_H)
1919
nodist_test_bitcoin_qt_SOURCES = $(TEST_QT_MOC_CPP)
20-
test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) \
20+
test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER) $(LIBBITCOIN_WALLET) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) \
2121
$(LIBMEMENV) $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) \
2222
$(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS)
2323

src/test/Makefile.am

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,25 @@ BUILT_SOURCES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h)
2121
# test_bitcoin binary #
2222
test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(TESTDEFS)
2323
test_bitcoin_LDADD = $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) $(LIBMEMENV) \
24-
$(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(BDB_LIBS)
25-
test_bitcoin_SOURCES = accounting_tests.cpp alert_tests.cpp \
24+
$(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB)
25+
if ENABLE_WALLET
26+
test_bitcoin_LDADD += $(LIBBITCOIN_WALLET)
27+
endif
28+
test_bitcoin_LDADD += $(BDB_LIBS)
29+
30+
test_bitcoin_SOURCES = alert_tests.cpp \
2631
allocator_tests.cpp base32_tests.cpp base58_tests.cpp base64_tests.cpp \
2732
bignum_tests.cpp bloom_tests.cpp canonical_tests.cpp checkblock_tests.cpp \
2833
Checkpoints_tests.cpp compress_tests.cpp DoS_tests.cpp getarg_tests.cpp \
29-
key_tests.cpp miner_tests.cpp mruset_tests.cpp multisig_tests.cpp \
34+
key_tests.cpp mruset_tests.cpp multisig_tests.cpp \
3035
netbase_tests.cpp pmt_tests.cpp rpc_tests.cpp script_P2SH_tests.cpp \
3136
script_tests.cpp serialize_tests.cpp sigopcount_tests.cpp test_bitcoin.cpp \
3237
transaction_tests.cpp uint160_tests.cpp uint256_tests.cpp util_tests.cpp \
33-
wallet_tests.cpp sighash_tests.cpp $(JSON_TEST_FILES) $(RAW_TEST_FILES)
38+
sighash_tests.cpp $(JSON_TEST_FILES) $(RAW_TEST_FILES)
39+
40+
if ENABLE_WALLET
41+
test_bitcoin_SOURCES += accounting_tests.cpp wallet_tests.cpp miner_tests.cpp
42+
endif
3443

3544
nodist_test_bitcoin_SOURCES = $(BUILT_SOURCES)
3645

0 commit comments

Comments
 (0)