Browse Source

Merge pull request #2979 from luke-jr/autoconf

Autoconf fixes
0.10
Gregory Maxwell 11 years ago
parent
commit
11a79680b1
  1. 12
      configure.ac
  2. 16
      doc/build-unix.md
  3. 3
      src/Makefile.am
  4. 3
      src/Makefile.include
  5. 66
      src/m4/bitcoin_find_bdb48.m4
  6. 12
      src/m4/bitcoin_subdir_to_include.m4
  7. 4
      src/test/Makefile.am
  8. 5
      src/test/alert_tests.cpp
  9. 2
      src/test/checkblock_tests.cpp
  10. 2
      src/test/script_tests.cpp

12
configure.ac

@ -128,6 +128,7 @@ dnl Checks for programs.
AC_PROG_CXX AC_PROG_CXX
AC_PROG_CC AC_PROG_CC
AC_PROG_CPP AC_PROG_CPP
AC_PROG_CXXCPP
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_OBJC AC_PROG_OBJC
m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX]) m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX])
@ -142,10 +143,10 @@ AC_PATH_PROG(LCOV, lcov)
AC_PATH_PROG(JAVA, java) AC_PATH_PROG(JAVA, java)
AC_PATH_PROG(GENHTML, genhtml) AC_PATH_PROG(GENHTML, genhtml)
AC_PATH_PROG([GIT], [git]) AC_PATH_PROG([GIT], [git])
AC_PATH_PROGS([MOC], [moc moc-qt4],, $qt_bin_path:$PATH) AC_PATH_PROGS([MOC], [moc-qt4 moc4 moc],, $qt_bin_path:$PATH)
AC_PATH_PROGS([UIC], [uic uic-qt4],, $qt_bin_path:$PATH) AC_PATH_PROGS([UIC], [uic-qt4 uic4 uic],, $qt_bin_path:$PATH)
AC_PATH_PROG([RCC], [rcc],, $qt_bin_path:$PATH) AC_PATH_PROGS([RCC], [rcc-qt4 rcc4 rcc],, $qt_bin_path:$PATH)
AC_PATH_PROG([LRELEASE], [lrelease],, $qt_bin_path:$PATH) AC_PATH_PROGS([LRELEASE], [lrelease-qt4 lrelease4 lrelease],, $qt_bin_path:$PATH)
AC_PATH_PROG([PROTOC], [protoc],, $protoc_bin_path:$PATH) AC_PATH_PROG([PROTOC], [protoc],, $protoc_bin_path:$PATH)
AC_PATH_PROG(CCACHE,ccache) AC_PATH_PROG(CCACHE,ccache)
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
@ -334,8 +335,7 @@ AC_TRY_COMPILE([#include <sys/socket.h>],
) )
dnl Check for libdb_cxx dnl Check for libdb_cxx
AC_CHECK_HEADER([db_cxx.h],,AC_MSG_ERROR(libdb_cxx headers missing)) BITCOIN_FIND_BDB48
AC_CHECK_LIB([db_cxx], [main],, AC_MSG_ERROR(libdb_cxx missing))
dnl Check for libminiupnpc (optional) dnl Check for libminiupnpc (optional)
if test x$use_upnp != xno; then if test x$use_upnp != xno; then

16
doc/build-unix.md

@ -75,22 +75,6 @@ Optional:
sudo apt-get install libminiupnpc-dev (see --with-miniupnpc and --enable-upnp-default) sudo apt-get install libminiupnpc-dev (see --with-miniupnpc and --enable-upnp-default)
Dependency Build Instructions: Gentoo
-------------------------------------
Note: If you just want to install bitcoind on Gentoo, you can add the Bitcoin overlay and use your package manager:
layman -a bitcoin && emerge bitcoind
emerge -av1 --noreplace boost glib openssl sys-libs/db:4.8
Take the following steps to build (no UPnP support):
cd ${BITCOIN_DIR}
./autogen.sh
./configure --without-miniupnpc CXXFLAGS="-i/usr/include/db4.8"
strip bitcoind
Notes Notes
----- -----
The release is built with GCC and then "strip bitcoind" to strip the debug The release is built with GCC and then "strip bitcoind" to strip the debug

3
src/Makefile.am

@ -47,6 +47,9 @@ bitcoind_LDADD = libbitcoin.a leveldb/libleveldb.a leveldb/libmemenv.a \
bitcoind_SOURCES = bitcoind.cpp bitcoind_SOURCES = bitcoind.cpp
# #
AM_CPPFLAGS += $(BDB_CPPFLAGS)
bitcoind_LDADD += $(BDB_LIBS)
leveldb/libleveldb.a: leveldb/libleveldb.a:
@echo "Building LevelDB ..." && cd leveldb && CXX="$(CXX)" CC="$(CC)" \ @echo "Building LevelDB ..." && cd leveldb && CXX="$(CXX)" CC="$(CC)" \
PLATFORM=$(TARGET_OS) AR="$(AR)" $(MAKE) $(LEVELDB_TARGET_FLAGS) OPT="$(CXXFLAGS) $(CPPFLAGS)" libleveldb.a PLATFORM=$(TARGET_OS) AR="$(AR)" $(MAKE) $(LEVELDB_TARGET_FLAGS) OPT="$(CXXFLAGS) $(CPPFLAGS)" libleveldb.a

3
src/Makefile.include

@ -5,6 +5,9 @@ LIBLEVELDB=$(top_builddir)/src/leveldb/libleveldb.a
LIBMEMENV=$(top_builddir)/src/leveldb/libmemenv.a LIBMEMENV=$(top_builddir)/src/leveldb/libmemenv.a
LIBBITCOINQT=$(top_builddir)/src/qt/libbitcoinqt.a LIBBITCOINQT=$(top_builddir)/src/qt/libbitcoinqt.a
INCLUDES += $(BDB_CPPFLAGS)
LIBBITCOIN += $(BDB_LIBS)
$(LIBBITCOIN): $(LIBBITCOIN):
$(MAKE) -C $(top_builddir)/src $(@F) $(MAKE) -C $(top_builddir)/src $(@F)

66
src/m4/bitcoin_find_bdb48.m4

@ -0,0 +1,66 @@
AC_DEFUN([BITCOIN_FIND_BDB48],[
AC_MSG_CHECKING([for Berkeley DB C++ headers])
BDB_CPPFLAGS=
BDB_LIBS=
bdbpath=X
bdb48path=X
bdbdirlist=
for _vn in 4.8 48 4 5 ''; do
for _pfx in b lib ''; do
bdbdirlist="$bdbdirlist ${_pfx}db${_vn}"
done
done
for searchpath in $bdbdirlist ''; do
test -n "${searchpath}" && searchpath="${searchpath}/"
AC_TRY_COMPILE([
#include <${searchpath}db_cxx.h>
],[
#if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4)
#error "failed to find bdb 4.8+"
#endif
],[
if test "x$bdbpath" = "xX"; then
bdbpath="${searchpath}"
fi
],[
continue
])
AC_TRY_COMPILE([
#include <${searchpath}db_cxx.h>
],[
#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8)
#error "failed to find bdb 4.8"
#endif
],[
bdb48path="${searchpath}"
break
])
done
if test "x$bdbpath" = "xX"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR(libdb_cxx headers missing)
elif test "x$bdb48path" = "xX"; then
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_MSG_WARN([Found Berkeley DB other than 4.8; 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)])
])
else
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx)
bdbpath="${bdb48path}"
fi
AC_SUBST(BDB_CPPFLAGS)
# 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; do
AC_CHECK_LIB([$searchlib],[main],[
BDB_LIBS="-l${searchlib}"
break
])
done
if test "x$BDB_LIBS" = "x"; then
AC_MSG_ERROR(libdb_cxx missing)
fi
AC_SUBST(BDB_LIBS)
])

12
src/m4/bitcoin_subdir_to_include.m4

@ -0,0 +1,12 @@
dnl BITCOIN_SUBDIR_TO_INCLUDE([CPPFLAGS-VARIABLE-NAME],[SUBDIRECTORY-NAME],[HEADER-FILE])
dnl SUBDIRECTORY-NAME must end with a path separator
AC_DEFUN([BITCOIN_SUBDIR_TO_INCLUDE],[
if test "x$2" = "x"; then
AC_MSG_RESULT([default])
else
echo "#include <$2$3.h>" >conftest.cpp
newinclpath=`${CXXCPP} -M conftest.cpp 2>/dev/null | [ tr -d '\\n\\r\\\\' | sed -e 's/^.*[[:space:]:]\(\/[^[:space:]]*\)]$3[\.h[[:space:]].*$/\1/' -e t -e d`]
AC_MSG_RESULT([${newinclpath}])
eval "$1=\"\$$1\"' -I${newinclpath}'"
fi
])

4
src/test/Makefile.am

@ -10,7 +10,7 @@ bin_PROGRAMS = test_bitcoin
TESTS = test_bitcoin TESTS = test_bitcoin
TEST_DATA_DIR=$(top_srcdir)/src/test/data TEST_DATA_DIR=$(srcdir)/data
TEST_DATA_FILES= $(TEST_DATA_DIR)/script_valid.json \ TEST_DATA_FILES= $(TEST_DATA_DIR)/script_valid.json \
$(TEST_DATA_DIR)/base58_keys_valid.json $(TEST_DATA_DIR)/sig_canonical.json \ $(TEST_DATA_DIR)/base58_keys_valid.json $(TEST_DATA_DIR)/sig_canonical.json \
@ -22,7 +22,7 @@ TEST_DATA_FILES= $(TEST_DATA_DIR)/script_valid.json \
# test_bitcoin binary # # test_bitcoin binary #
test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(TESTDEFS) \ test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(TESTDEFS) \
-DTEST_DATA_DIR=$(TEST_DATA_DIR) -DTEST_DATA_DIR=$(abs_srcdir)/data
test_bitcoin_LDADD = $(LIBBITCOIN) $(LIBLEVELDB) $(LIBMEMENV) \ test_bitcoin_LDADD = $(LIBBITCOIN) $(LIBLEVELDB) $(LIBMEMENV) \
$(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB)
test_bitcoin_SOURCES = accounting_tests.cpp alert_tests.cpp \ test_bitcoin_SOURCES = accounting_tests.cpp alert_tests.cpp \

5
src/test/alert_tests.cpp

@ -73,7 +73,7 @@ struct ReadAlerts
{ {
std::string filename("alertTests"); std::string filename("alertTests");
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
fs::path testFile = fs::current_path() / "test" / "data" / filename; fs::path testFile = fs::current_path() / "data" / filename;
#ifdef TEST_DATA_DIR #ifdef TEST_DATA_DIR
if (!fs::exists(testFile)) if (!fs::exists(testFile))
{ {
@ -125,6 +125,9 @@ BOOST_AUTO_TEST_CASE(AlertApplies)
{ {
BOOST_CHECK(alert.CheckSignature()); BOOST_CHECK(alert.CheckSignature());
} }
BOOST_CHECK(alerts.size() >= 3);
// Matches: // Matches:
BOOST_CHECK(alerts[0].AppliesTo(1, "")); BOOST_CHECK(alerts[0].AppliesTo(1, ""));
BOOST_CHECK(alerts[0].AppliesTo(70001, "")); BOOST_CHECK(alerts[0].AppliesTo(70001, ""));

2
src/test/checkblock_tests.cpp

@ -19,7 +19,7 @@ bool
read_block(const std::string& filename, CBlock& block) read_block(const std::string& filename, CBlock& block)
{ {
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
fs::path testFile = fs::current_path() / "test" / "data" / filename; fs::path testFile = fs::current_path() / "data" / filename;
#ifdef TEST_DATA_DIR #ifdef TEST_DATA_DIR
if (!fs::exists(testFile)) if (!fs::exists(testFile))
{ {

2
src/test/script_tests.cpp

@ -93,7 +93,7 @@ Array
read_json(const std::string& filename) read_json(const std::string& filename)
{ {
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
fs::path testFile = fs::current_path() / "test" / "data" / filename; fs::path testFile = fs::current_path() / "data" / filename;
#ifdef TEST_DATA_DIR #ifdef TEST_DATA_DIR
if (!fs::exists(testFile)) if (!fs::exists(testFile))

Loading…
Cancel
Save