diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-11-11 04:42:24 -0800 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-11-11 04:42:24 -0800 |
commit | bb8f9179ad5798dc65b1b86ec7b34361cabf8f70 (patch) | |
tree | 03d3868f279b2d0d76481da4b826a223e6f040e7 | |
parent | 59be91ae1e8da1e679adbb7c84e8bca749daa8a7 (diff) | |
parent | fcfbf547d32640ee786f9161545061cdcd244a72 (diff) |
Merge pull request #3233 from laanwj/2013_11_autoconf
Autoconf improvements
-rw-r--r-- | configure.ac | 120 | ||||
-rw-r--r-- | src/Makefile.am | 7 | ||||
-rw-r--r-- | src/Makefile.include | 8 | ||||
-rw-r--r-- | src/leveldbwrapper.cpp | 2 | ||||
-rw-r--r-- | src/qt/Makefile.am | 11 | ||||
-rw-r--r-- | src/qt/test/Makefile.am | 11 | ||||
-rw-r--r-- | src/test/Makefile.am | 6 |
7 files changed, 89 insertions, 76 deletions
diff --git a/configure.ac b/configure.ac index 68dbfdc146..4e105629e8 100644 --- a/configure.ac +++ b/configure.ac @@ -61,7 +61,32 @@ AC_ARG_WITH([qt], [AS_HELP_STRING([--with-qt], [enable qt (default is yes)])], [use_qt=$withval], - [use_qt=yes]) + [use_qt=auto]) +AC_DEFUN([BITCOIN_QT_FAIL],[ + if test "x$use_qt" = "xauto"; then + AC_MSG_WARN([$1; bitcoin-qt frontend will not be built]) + use_qt=no + else + AC_MSG_ERROR([$1]) + fi +]) +AC_DEFUN([BITCOIN_QT_CHECK],[ + if test "x$use_qt" != "xno"; then + true + $1 + else + true + $2 + fi +]) +AC_DEFUN([BITCOIN_QT_PATH_PROGS],[ + BITCOIN_QT_CHECK([ + AC_PATH_PROGS($1,$2,$3,$4) + if test "x$$1" = "x"; then + BITCOIN_QT_FAIL([$1 not found]) + fi + ]) +]) AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]), @@ -136,12 +161,12 @@ AC_PATH_PROG(LCOV, lcov) AC_PATH_PROG(JAVA, java) AC_PATH_PROG(GENHTML, genhtml) AC_PATH_PROG([GIT], [git]) -AC_PATH_PROGS([MOC], [moc-qt4 moc4 moc],, $qt_bin_path:$PATH) -AC_PATH_PROGS([UIC], [uic-qt4 uic4 uic],, $qt_bin_path:$PATH) -AC_PATH_PROGS([RCC], [rcc-qt4 rcc4 rcc],, $qt_bin_path:$PATH) -AC_PATH_PROGS([LRELEASE], [lrelease-qt4 lrelease4 lrelease],, $qt_bin_path:$PATH) -AC_PATH_PROGS([LUPDATE], [lupdate-qt4 lupdate4 lupdate],, $qt_bin_path:$PATH) -AC_PATH_PROG([PROTOC], [protoc],, $protoc_bin_path:$PATH) +BITCOIN_QT_PATH_PROGS([MOC], [moc-qt4 moc4 moc],, $qt_bin_path:$PATH) +BITCOIN_QT_PATH_PROGS([UIC], [uic-qt4 uic4 uic],, $qt_bin_path:$PATH) +BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt4 rcc4 rcc],, $qt_bin_path:$PATH) +BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt4 lrelease4 lrelease],, $qt_bin_path:$PATH) +BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt4 lupdate4 lupdate],, $qt_bin_path:$PATH) +BITCOIN_QT_PATH_PROGS([PROTOC], [protoc],, $protoc_bin_path:$PATH) AC_PATH_PROG(CCACHE,ccache) AC_PATH_PROG(XGETTEXT,xgettext) AC_PATH_PROG(HEXDUMP,hexdump) @@ -222,11 +247,11 @@ case $host in fi fi - if test x$use_qt = xyes; then + BITCOIN_QT_CHECK([ MOC_DEFS="-DQ_OS_MAC" base_frameworks="-framework Foundation -framework ApplicationServices -framework AppKit" AX_CHECK_LINK_FLAG([[$base_frameworks]],[LIBS="$LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)]) - fi + ]) CPPFLAGS="$CPPFLAGS -DMAC_OSX" TESTDEFS="-DBOOST_TEST_DYN_LINK" @@ -427,8 +452,11 @@ if test x$use_pkgconfig = xyes; then PKG_CHECK_MODULES([SSL], [libssl], [INCLUDES="$INCLUDES $SSL_CFLAGS"; LIBS="$LIBS $SSL_LIBS"], [AC_MSG_ERROR(openssl not found.)]) PKG_CHECK_MODULES([CRYPTO], [libcrypto], [INCLUDES="$INCLUDES $CRYPTO_CFLAGS"; LIBS="$LIBS $CRYPTO_LIBS"], [AC_MSG_ERROR(libcrypto not found.)]) - if test x$use_qt = xyes; then - PKG_CHECK_MODULES([QT], [QtCore QtGui QtNetwork], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes], [have_qt=no]) + BITCOIN_QT_CHECK([ + PKG_CHECK_MODULES([QT], [QtCore QtGui QtNetwork], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes],[ + have_qt=no + BITCOIN_QT_FAIL([Qt dependencies not found]) + ]) if test x$use_tests = xyes; then PKG_CHECK_MODULES([QT_TEST], [QtTest], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no]) fi @@ -439,7 +467,7 @@ if test x$use_pkgconfig = xyes; then PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no]) fi PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [AC_MSG_ERROR(libprotobuf not found.)]) - fi + ]) ] ) else @@ -449,7 +477,7 @@ else AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),) AC_CHECK_LIB([ssl], [main],, AC_MSG_ERROR(libssl missing)) - if test x$use_qt = xyes; then + BITCOIN_QT_CHECK([ TEMP_LIBS="$LIBS" LIBS= if test x$qt_lib_path != x; then @@ -462,22 +490,25 @@ else fi if test x$TARGET_OS == xwindows; then - AC_CHECK_LIB([imm32], [main],, AC_MSG_ERROR(libimm32 not found. Install it or use --without-qt.)) + AC_CHECK_LIB([imm32], [main],, BITCOIN_QT_FAIL(libimm32 not found)) fi + ]) #TODO: These are only needed when they're linked directly to parent libs. It really has nothing to do with windows. #Instead, check for missing functions in parent libs and assume static if they're absent. if test x$TARGET_OS == xwindows; then - AC_CHECK_LIB([qcncodecs], [main],, AC_MSG_ERROR(libqcncodecs not found. Install it or use --without-qt.)) - AC_CHECK_LIB([qjpcodecs], [main],, AC_MSG_ERROR(libqjpcodecs not found. Install it or use --without-qt.)) - AC_CHECK_LIB([qkrcodecs], [main],, AC_MSG_ERROR(libqkrcodecs not found. Install it or use --without-qt.)) - AC_CHECK_LIB([qtwcodecs], [main],, AC_MSG_ERROR(libqtwcodecs not found. Install it or use --without-qt.)) + BITCOIN_QT_CHECK(AC_CHECK_LIB([qcncodecs],[main],,BITCOIN_QT_FAIL(libqcncodecs not found))) + BITCOIN_QT_CHECK(AC_CHECK_LIB([qjpcodecs],[main],,BITCOIN_QT_FAIL(libqjpcodecs not found))) + BITCOIN_QT_CHECK(AC_CHECK_LIB([qkrcodecs],[main],,BITCOIN_QT_FAIL(libqkrcodecs not found))) + BITCOIN_QT_CHECK(AC_CHECK_LIB([qtwcodecs],[main],,BITCOIN_QT_FAIL(libqtwcodecs not found))) fi - AC_CHECK_LIB([QtCore], [main],, AC_MSG_ERROR(libQtCore not found. Install it or use --without-qt.)) - AC_CHECK_LIB([QtGui], [main],, AC_MSG_ERROR(libQtGui not found. Install it or use --without-qt.)) - AC_CHECK_LIB([QtNetwork], [main],, AC_MSG_ERROR(libQtNetwork not found. Install it or use --without-qt.)) - AC_CHECK_LIB([protobuf], [main],, AC_MSG_ERROR(libprotobuf not found. Install it or use --without-qt.)) + BITCOIN_QT_CHECK(AC_CHECK_LIB([QtCore] ,[main],,BITCOIN_QT_FAIL(libQtCore not found))) + BITCOIN_QT_CHECK(AC_CHECK_LIB([QtGui] ,[main],,BITCOIN_QT_FAIL(libQtGui not found))) + BITCOIN_QT_CHECK(AC_CHECK_LIB([QtNetwork],[main],,BITCOIN_QT_FAIL(libQtNetwork not found))) + BITCOIN_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],,BITCOIN_QT_FAIL(libprotobuf not found))) + + BITCOIN_QT_CHECK([ QT_LIBS="$LIBS" LIBS="$TEMP_LIBS" @@ -486,10 +517,13 @@ else QT_INCLUDES="-I$qt_include_path -I$qt_include_path/QtCore -I$qt_include_path/QtGui -I$qt_include_path/QtNetwork -I$qt_include_path/QtTest -I$qt_include_path/QtDBus" CPPFLAGS="$CPPFLAGS $QT_INCLUDES" fi - AC_CHECK_HEADER([QtPlugin],, AC_MSG_ERROR(QtCore headers missing. Install them or use --without-qt.),) - AC_CHECK_HEADER([QApplication],, AC_MSG_ERROR(QtGUI headers missing. Install them or use --without-qt.),) - AC_CHECK_HEADER([QLocalSocket],, AC_MSG_ERROR(QtNetwork headers missing. Install them or use --without-qt.),) + ]) + + BITCOIN_QT_CHECK(AC_CHECK_HEADER([QtPlugin],,BITCOIN_QT_FAIL(QtCore headers missing),)) + BITCOIN_QT_CHECK(AC_CHECK_HEADER([QApplication],, BITCOIN_QT_FAIL(QtGui headers missing),)) + BITCOIN_QT_CHECK(AC_CHECK_HEADER([QLocalSocket],, BITCOIN_QT_FAIL(QtNetwork headers missing),)) + BITCOIN_QT_CHECK([ if test x$use_tests = xyes; then TEMP_LIBS="$LIBS" LIBS= @@ -517,7 +551,7 @@ else AC_CHECK_LIB([qrencode], [main],, [have_qrencode=no]) AC_CHECK_HEADER([qrencode.h],, have_qrencode=no) fi - fi + ]) fi if test x$use_ipv6 = xyes; then @@ -604,35 +638,19 @@ fi dnl enable qt support AC_MSG_CHECKING([if qt should be enabled]) -if test x$use_qt = xyes; then - if test x$have_qt = xno; then - AC_MSG_ERROR("qt support requested but qt could not be located. use --without-qt") - fi - if test x$MOC = x; then - AC_MSG_ERROR("qt support requested but moc was not found. use --without-qt") - fi - if test x$PROTOC = x; then - AC_MSG_ERROR("qt support requested but protoc was not found. use --without-qt") - fi - if test x$UIC = x; then - AC_MSG_ERROR("qt support requested but uic was not found. use --without-qt") - fi - if test x$RCC = x; then - AC_MSG_ERROR("qt support requested but rcc was not found. use --without-qt") - fi - if test x$LRELEASE = x; then - AC_MSG_ERROR("qt support requested but lrelease was not found. use --without-qt") - fi +BITCOIN_QT_CHECK([ + use_qt=yes + BUILD_QT=qt if test x$use_tests = xyes; then if test x$have_qt_test = xno; then AC_MSG_ERROR("libQtTest not found. Use --disable-tests or --without-qt.") fi fi if test x$have_qt_dbus = xno; then - use_dbus=no if test x$use_dbus = xyes; then - AC_MSG_ERROR("libQtDBus not found. Use --without-qtdbus.") + AC_MSG_ERROR("libQtDBus not found. Install libQtDBus or remove --with-qtdbus.") fi + use_dbus=no fi if test x$XGETTEXT == x; then AC_MSG_WARN("xgettext is required to update qt translations") @@ -640,11 +658,9 @@ if test x$use_qt = xyes; then if test x$LUPDATE == x; then AC_MSG_WARN("lupdate is required to update qt translations") fi - - BUILD_QT=qt -else +],[ use_qt=no -fi +]) AC_MSG_RESULT($use_qt) @@ -678,7 +694,7 @@ if test x$use_qt = xyes; then fi fi - if test x$use_tests = xyes; then + if test x$use_tests$have_qt_test = xyesyes; then BUILD_TEST_QT="test" fi fi diff --git a/src/Makefile.am b/src/Makefile.am index d4d17b2a9b..24a95eed84 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,8 +1,7 @@ include Makefile.include -AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ - -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src/leveldb/helpers \ - -I$(builddir) $(BOOST_INCLUDES) $(BDB_CPPFLAGS) -AM_LDFLAGS = $(PTHREAD_CFLAGS) + +AM_CPPFLAGS += -I$(top_srcdir)/src/leveldb/helpers/memenv \ + -I$(builddir) noinst_LIBRARIES = libbitcoin.a diff --git a/src/Makefile.include b/src/Makefile.include index 352471061d..8c2274a287 100644 --- a/src/Makefile.include +++ b/src/Makefile.include @@ -1,5 +1,9 @@ -# Helper for rules and subdir Makefiles to find parent targets. -# Flags and other non-target variables should not be set here. +AM_CPPFLAGS = $(INCLUDES) \ + -I$(top_builddir)/src/obj \ + -I$(top_srcdir)/src/leveldb/include \ + $(BDB_CPPFLAGS) \ + $(BOOST_INCLUDES) +AM_LDFLAGS = $(PTHREAD_CFLAGS) LIBBITCOIN=$(top_builddir)/src/libbitcoin.a LIBLEVELDB=$(top_builddir)/src/leveldb/libleveldb.a diff --git a/src/leveldbwrapper.cpp b/src/leveldbwrapper.cpp index 39ed63b463..aff1ec0283 100644 --- a/src/leveldbwrapper.cpp +++ b/src/leveldbwrapper.cpp @@ -10,7 +10,7 @@ #include <leveldb/cache.h> #include <leveldb/env.h> #include <leveldb/filter_policy.h> -#include <memenv/memenv.h> +#include <memenv.h> void HandleError(const leveldb::Status &status) throw(leveldb_error) { if (status.ok()) diff --git a/src/qt/Makefile.am b/src/qt/Makefile.am index 4ecd5629ea..3ede99dfa3 100644 --- a/src/qt/Makefile.am +++ b/src/qt/Makefile.am @@ -1,11 +1,10 @@ include $(top_srcdir)/src/Makefile.include -AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ - -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src \ - -I$(top_srcdir)/src/leveldb/helpers -I$(top_builddir)/src/qt \ - -I$(top_builddir)/src/qt/forms $(BOOST_INCLUDES) $(PROTOBUF_CFLAGS) \ - $(QR_CFLAGS) $(BDB_CPPFLAGS) -AM_LDFLAGS = $(PTHREAD_CFLAGS) +AM_CPPFLAGS += -I$(top_srcdir)/src \ + -I$(top_builddir)/src/qt \ + -I$(top_builddir)/src/qt/forms \ + $(PROTOBUF_CFLAGS) \ + $(QR_CFLAGS) bin_PROGRAMS = bitcoin-qt noinst_LIBRARIES = libbitcoinqt.a SUBDIRS = $(BUILD_TEST_QT) diff --git a/src/qt/test/Makefile.am b/src/qt/test/Makefile.am index f8fe97462b..7891c3e975 100644 --- a/src/qt/test/Makefile.am +++ b/src/qt/test/Makefile.am @@ -1,11 +1,10 @@ include $(top_srcdir)/src/Makefile.include -AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ - -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src \ - -I$(top_srcdir)/src/leveldb/helpers -I$(top_srcdir)/src/qt \ - -I$(top_builddir)/src/qt $(BOOST_INCLUDES) $(PROTOBUF_CFLAGS) \ - $(QR_CFLAGS) $(BDB_CPPFLAGS) -AM_LDFLAGS = $(PTHREAD_CFLAGS) +AM_CPPFLAGS += -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/qt \ + -I$(top_builddir)/src/qt \ + $(PROTOBUF_CFLAGS) \ + $(QR_CFLAGS) bin_PROGRAMS = test_bitcoin-qt TESTS = test_bitcoin-qt diff --git a/src/test/Makefile.am b/src/test/Makefile.am index c3495095d9..180fd7effa 100644 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@ -1,10 +1,6 @@ include $(top_srcdir)/src/Makefile.include -AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ - -I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src/leveldb/helpers \ - -I$(top_srcdir)/src $(BOOST_INCLUDES) $(BDB_CPPFLAGS) - -AM_LDFLAGS = $(PTHREAD_CFLAGS) +AM_CPPFLAGS += -I$(top_srcdir)/src bin_PROGRAMS = test_bitcoin |