aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac8
-rw-r--r--src/Makefile.am8
-rw-r--r--src/Makefile.include13
3 files changed, 22 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index 994c74858a..15b67173ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -328,6 +328,14 @@ AC_TRY_COMPILE([#include <sys/socket.h>],
[ AC_MSG_RESULT(no)]
)
+LEVELDB_CPPFLAGS=
+LIBLEVELDB=
+LIBMEMENV=
+AM_CONDITIONAL([EMBEDDED_LEVELDB],[true])
+AC_SUBST(LEVELDB_CPPFLAGS)
+AC_SUBST(LIBLEVELDB)
+AC_SUBST(LIBMEMENV)
+
if test x$enable_wallet != xno; then
dnl Check for libdb_cxx only if wallet enabled
BITCOIN_FIND_BDB48
diff --git a/src/Makefile.am b/src/Makefile.am
index 9917be2481..846de05d10 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,6 @@
include Makefile.include
-AM_CPPFLAGS += -I$(top_srcdir)/src/leveldb/helpers/memenv \
- -I$(builddir)
+AM_CPPFLAGS += -I$(builddir)
noinst_LIBRARIES = \
libbitcoin_server.a \
@@ -140,8 +139,8 @@ bitcoind_LDADD = \
libbitcoin_server.a \
libbitcoin_cli.a \
libbitcoin_common.a \
- leveldb/libleveldb.a \
- leveldb/libmemenv.a
+ $(LIBLEVELDB) \
+ $(LIBMEMENV)
if ENABLE_WALLET
bitcoind_LDADD += libbitcoin_wallet.a
endif
@@ -167,6 +166,7 @@ if TARGET_WINDOWS
bitcoin_cli_SOURCES += bitcoin-cli-res.rc
endif
+# NOTE: This dependency is not strictly necessary, but without it make may try to build both in parallel, which breaks the LevelDB build system in a race
leveldb/libleveldb.a: leveldb/libmemenv.a
leveldb/%.a:
diff --git a/src/Makefile.include b/src/Makefile.include
index b9e6c262ca..dae7db7804 100644
--- a/src/Makefile.include
+++ b/src/Makefile.include
@@ -1,23 +1,30 @@
+if EMBEDDED_LEVELDB
+LEVELDB_CPPFLAGS += -I$(top_srcdir)/src/leveldb/include
+LEVELDB_CPPFLAGS += -I$(top_srcdir)/src/leveldb/helpers/memenv
+LIBLEVELDB += $(top_builddir)/src/leveldb/libleveldb.a
+LIBMEMENV += $(top_builddir)/src/leveldb/libmemenv.a
+endif
+
AM_CPPFLAGS = $(INCLUDES) \
-I$(top_builddir)/src/obj \
- -I$(top_srcdir)/src/leveldb/include \
$(BDB_CPPFLAGS) \
$(BOOST_INCLUDES)
+AM_CPPFLAGS += $(LEVELDB_CPPFLAGS)
AM_LDFLAGS = $(PTHREAD_CFLAGS)
LIBBITCOIN_SERVER=$(top_builddir)/src/libbitcoin_server.a
LIBBITCOIN_WALLET=$(top_builddir)/src/libbitcoin_wallet.a
LIBBITCOIN_COMMON=$(top_builddir)/src/libbitcoin_common.a
LIBBITCOIN_CLI=$(top_builddir)/src/libbitcoin_cli.a
-LIBLEVELDB=$(top_builddir)/src/leveldb/libleveldb.a
-LIBMEMENV=$(top_builddir)/src/leveldb/libmemenv.a
LIBBITCOINQT=$(top_builddir)/src/qt/libbitcoinqt.a
$(LIBBITCOIN):
$(MAKE) -C $(top_builddir)/src $(@F)
+if EMBEDDED_LEVELDB
$(LIBLEVELDB) $(LIBMEMENV):
$(MAKE) -C $(top_builddir)/src leveldb/$(@F)
+endif
$(LIBBITCOINQT):
$(MAKE) -C $(top_builddir)/src/qt $(@F)