From 4a290b526cb064fd698ddb339f6da820d5a60d86 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 12 Nov 2013 20:09:55 +0000 Subject: [PATCH] Cleanup LevelDB library dependencies --- configure.ac | 8 ++++++++ src/Makefile.am | 8 ++++---- src/Makefile.include | 13 ++++++++++--- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 994c74858..15b67173e 100644 --- a/configure.ac +++ b/configure.ac @@ -328,6 +328,14 @@ AC_TRY_COMPILE([#include ], [ 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 9917be248..846de05d1 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 b9e6c262c..dae7db780 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)