Browse Source

Merge pull request #3233 from laanwj/2013_11_autoconf

Autoconf improvements
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
bb8f9179ad
  1. 120
      configure.ac
  2. 7
      src/Makefile.am
  3. 8
      src/Makefile.include
  4. 2
      src/leveldbwrapper.cpp
  5. 11
      src/qt/Makefile.am
  6. 11
      src/qt/test/Makefile.am
  7. 6
      src/test/Makefile.am

120
configure.ac

@ -61,7 +61,32 @@ AC_ARG_WITH([qt],
[AS_HELP_STRING([--with-qt], [AS_HELP_STRING([--with-qt],
[enable qt (default is yes)])], [enable qt (default is yes)])],
[use_qt=$withval], [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, AC_ARG_ENABLE(tests,
AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]), 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(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-qt4 moc4 moc],, $qt_bin_path:$PATH) BITCOIN_QT_PATH_PROGS([MOC], [moc-qt4 moc4 moc],, $qt_bin_path:$PATH)
AC_PATH_PROGS([UIC], [uic-qt4 uic4 uic],, $qt_bin_path:$PATH) BITCOIN_QT_PATH_PROGS([UIC], [uic-qt4 uic4 uic],, $qt_bin_path:$PATH)
AC_PATH_PROGS([RCC], [rcc-qt4 rcc4 rcc],, $qt_bin_path:$PATH) BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt4 rcc4 rcc],, $qt_bin_path:$PATH)
AC_PATH_PROGS([LRELEASE], [lrelease-qt4 lrelease4 lrelease],, $qt_bin_path:$PATH) BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt4 lrelease4 lrelease],, $qt_bin_path:$PATH)
AC_PATH_PROGS([LUPDATE], [lupdate-qt4 lupdate4 lupdate],, $qt_bin_path:$PATH) BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt4 lupdate4 lupdate],, $qt_bin_path:$PATH)
AC_PATH_PROG([PROTOC], [protoc],, $protoc_bin_path:$PATH) BITCOIN_QT_PATH_PROGS([PROTOC], [protoc],, $protoc_bin_path:$PATH)
AC_PATH_PROG(CCACHE,ccache) AC_PATH_PROG(CCACHE,ccache)
AC_PATH_PROG(XGETTEXT,xgettext) AC_PATH_PROG(XGETTEXT,xgettext)
AC_PATH_PROG(HEXDUMP,hexdump) AC_PATH_PROG(HEXDUMP,hexdump)
@ -222,11 +247,11 @@ case $host in
fi fi
fi fi
if test x$use_qt = xyes; then BITCOIN_QT_CHECK([
MOC_DEFS="-DQ_OS_MAC" MOC_DEFS="-DQ_OS_MAC"
base_frameworks="-framework Foundation -framework ApplicationServices -framework AppKit" 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)]) AX_CHECK_LINK_FLAG([[$base_frameworks]],[LIBS="$LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)])
fi ])
CPPFLAGS="$CPPFLAGS -DMAC_OSX" CPPFLAGS="$CPPFLAGS -DMAC_OSX"
TESTDEFS="-DBOOST_TEST_DYN_LINK" 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([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.)]) 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 BITCOIN_QT_CHECK([
PKG_CHECK_MODULES([QT], [QtCore QtGui QtNetwork], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes], [have_qt=no]) 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 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]) PKG_CHECK_MODULES([QT_TEST], [QtTest], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no])
fi fi
@ -439,7 +467,7 @@ if test x$use_pkgconfig = xyes; then
PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no]) PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])
fi fi
PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [AC_MSG_ERROR(libprotobuf not found.)]) PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [AC_MSG_ERROR(libprotobuf not found.)])
fi ])
] ]
) )
else else
@ -449,7 +477,7 @@ else
AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),) AC_CHECK_HEADER([openssl/ssl.h],, AC_MSG_ERROR(libssl headers missing),)
AC_CHECK_LIB([ssl], [main],, AC_MSG_ERROR(libssl missing)) AC_CHECK_LIB([ssl], [main],, AC_MSG_ERROR(libssl missing))
if test x$use_qt = xyes; then BITCOIN_QT_CHECK([
TEMP_LIBS="$LIBS" TEMP_LIBS="$LIBS"
LIBS= LIBS=
if test x$qt_lib_path != x; then if test x$qt_lib_path != x; then
@ -462,22 +490,25 @@ else
fi fi
if test x$TARGET_OS == xwindows; then 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 fi
])
#TODO: These are only needed when they're linked directly to parent libs. It really has nothing to do with windows. #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. #Instead, check for missing functions in parent libs and assume static if they're absent.
if test x$TARGET_OS == xwindows; then if test x$TARGET_OS == xwindows; then
AC_CHECK_LIB([qcncodecs], [main],, AC_MSG_ERROR(libqcncodecs not found. Install it or use --without-qt.)) BITCOIN_QT_CHECK(AC_CHECK_LIB([qcncodecs],[main],,BITCOIN_QT_FAIL(libqcncodecs not found)))
AC_CHECK_LIB([qjpcodecs], [main],, AC_MSG_ERROR(libqjpcodecs not found. Install it or use --without-qt.)) BITCOIN_QT_CHECK(AC_CHECK_LIB([qjpcodecs],[main],,BITCOIN_QT_FAIL(libqjpcodecs not found)))
AC_CHECK_LIB([qkrcodecs], [main],, AC_MSG_ERROR(libqkrcodecs not found. Install it or use --without-qt.)) BITCOIN_QT_CHECK(AC_CHECK_LIB([qkrcodecs],[main],,BITCOIN_QT_FAIL(libqkrcodecs not found)))
AC_CHECK_LIB([qtwcodecs], [main],, AC_MSG_ERROR(libqtwcodecs not found. Install it or use --without-qt.)) BITCOIN_QT_CHECK(AC_CHECK_LIB([qtwcodecs],[main],,BITCOIN_QT_FAIL(libqtwcodecs not found)))
fi fi
AC_CHECK_LIB([QtCore], [main],, AC_MSG_ERROR(libQtCore not found. Install it or use --without-qt.)) BITCOIN_QT_CHECK(AC_CHECK_LIB([QtCore] ,[main],,BITCOIN_QT_FAIL(libQtCore not found)))
AC_CHECK_LIB([QtGui], [main],, AC_MSG_ERROR(libQtGui not found. Install it or use --without-qt.)) BITCOIN_QT_CHECK(AC_CHECK_LIB([QtGui] ,[main],,BITCOIN_QT_FAIL(libQtGui not found)))
AC_CHECK_LIB([QtNetwork], [main],, AC_MSG_ERROR(libQtNetwork not found. Install it or use --without-qt.)) BITCOIN_QT_CHECK(AC_CHECK_LIB([QtNetwork],[main],,BITCOIN_QT_FAIL(libQtNetwork not found)))
AC_CHECK_LIB([protobuf], [main],, AC_MSG_ERROR(libprotobuf not found. Install it or use --without-qt.)) BITCOIN_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],,BITCOIN_QT_FAIL(libprotobuf not found)))
BITCOIN_QT_CHECK([
QT_LIBS="$LIBS" QT_LIBS="$LIBS"
LIBS="$TEMP_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" 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" CPPFLAGS="$CPPFLAGS $QT_INCLUDES"
fi 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 if test x$use_tests = xyes; then
TEMP_LIBS="$LIBS" TEMP_LIBS="$LIBS"
LIBS= LIBS=
@ -517,7 +551,7 @@ else
AC_CHECK_LIB([qrencode], [main],, [have_qrencode=no]) AC_CHECK_LIB([qrencode], [main],, [have_qrencode=no])
AC_CHECK_HEADER([qrencode.h],, have_qrencode=no) AC_CHECK_HEADER([qrencode.h],, have_qrencode=no)
fi fi
fi ])
fi fi
if test x$use_ipv6 = xyes; then if test x$use_ipv6 = xyes; then
@ -604,35 +638,19 @@ fi
dnl enable qt support dnl enable qt support
AC_MSG_CHECKING([if qt should be enabled]) AC_MSG_CHECKING([if qt should be enabled])
if test x$use_qt = xyes; then BITCOIN_QT_CHECK([
if test x$have_qt = xno; then use_qt=yes
AC_MSG_ERROR("qt support requested but qt could not be located. use --without-qt") BUILD_QT=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
if test x$use_tests = xyes; then if test x$use_tests = xyes; then
if test x$have_qt_test = xno; then if test x$have_qt_test = xno; then
AC_MSG_ERROR("libQtTest not found. Use --disable-tests or --without-qt.") AC_MSG_ERROR("libQtTest not found. Use --disable-tests or --without-qt.")
fi fi
fi fi
if test x$have_qt_dbus = xno; then if test x$have_qt_dbus = xno; then
use_dbus=no
if test x$use_dbus = xyes; then 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 fi
use_dbus=no
fi fi
if test x$XGETTEXT == x; then if test x$XGETTEXT == x; then
AC_MSG_WARN("xgettext is required to update qt translations") 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 if test x$LUPDATE == x; then
AC_MSG_WARN("lupdate is required to update qt translations") AC_MSG_WARN("lupdate is required to update qt translations")
fi fi
],[
BUILD_QT=qt
else
use_qt=no use_qt=no
fi ])
AC_MSG_RESULT($use_qt) AC_MSG_RESULT($use_qt)
@ -678,7 +694,7 @@ if test x$use_qt = xyes; then
fi fi
fi fi
if test x$use_tests = xyes; then if test x$use_tests$have_qt_test = xyesyes; then
BUILD_TEST_QT="test" BUILD_TEST_QT="test"
fi fi
fi fi

7
src/Makefile.am

@ -1,8 +1,7 @@
include Makefile.include include Makefile.include
AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \
-I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src/leveldb/helpers \ AM_CPPFLAGS += -I$(top_srcdir)/src/leveldb/helpers/memenv \
-I$(builddir) $(BOOST_INCLUDES) $(BDB_CPPFLAGS) -I$(builddir)
AM_LDFLAGS = $(PTHREAD_CFLAGS)
noinst_LIBRARIES = libbitcoin.a noinst_LIBRARIES = libbitcoin.a

8
src/Makefile.include

@ -1,5 +1,9 @@
# Helper for rules and subdir Makefiles to find parent targets. AM_CPPFLAGS = $(INCLUDES) \
# Flags and other non-target variables should not be set here. -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 LIBBITCOIN=$(top_builddir)/src/libbitcoin.a
LIBLEVELDB=$(top_builddir)/src/leveldb/libleveldb.a LIBLEVELDB=$(top_builddir)/src/leveldb/libleveldb.a

2
src/leveldbwrapper.cpp

@ -10,7 +10,7 @@
#include <leveldb/cache.h> #include <leveldb/cache.h>
#include <leveldb/env.h> #include <leveldb/env.h>
#include <leveldb/filter_policy.h> #include <leveldb/filter_policy.h>
#include <memenv/memenv.h> #include <memenv.h>
void HandleError(const leveldb::Status &status) throw(leveldb_error) { void HandleError(const leveldb::Status &status) throw(leveldb_error) {
if (status.ok()) if (status.ok())

11
src/qt/Makefile.am

@ -1,11 +1,10 @@
include $(top_srcdir)/src/Makefile.include include $(top_srcdir)/src/Makefile.include
AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ AM_CPPFLAGS += -I$(top_srcdir)/src \
-I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src \ -I$(top_builddir)/src/qt \
-I$(top_srcdir)/src/leveldb/helpers -I$(top_builddir)/src/qt \ -I$(top_builddir)/src/qt/forms \
-I$(top_builddir)/src/qt/forms $(BOOST_INCLUDES) $(PROTOBUF_CFLAGS) \ $(PROTOBUF_CFLAGS) \
$(QR_CFLAGS) $(BDB_CPPFLAGS) $(QR_CFLAGS)
AM_LDFLAGS = $(PTHREAD_CFLAGS)
bin_PROGRAMS = bitcoin-qt bin_PROGRAMS = bitcoin-qt
noinst_LIBRARIES = libbitcoinqt.a noinst_LIBRARIES = libbitcoinqt.a
SUBDIRS = $(BUILD_TEST_QT) SUBDIRS = $(BUILD_TEST_QT)

11
src/qt/test/Makefile.am

@ -1,11 +1,10 @@
include $(top_srcdir)/src/Makefile.include include $(top_srcdir)/src/Makefile.include
AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ AM_CPPFLAGS += -I$(top_srcdir)/src \
-I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src \ -I$(top_srcdir)/src/qt \
-I$(top_srcdir)/src/leveldb/helpers -I$(top_srcdir)/src/qt \ -I$(top_builddir)/src/qt \
-I$(top_builddir)/src/qt $(BOOST_INCLUDES) $(PROTOBUF_CFLAGS) \ $(PROTOBUF_CFLAGS) \
$(QR_CFLAGS) $(BDB_CPPFLAGS) $(QR_CFLAGS)
AM_LDFLAGS = $(PTHREAD_CFLAGS)
bin_PROGRAMS = test_bitcoin-qt bin_PROGRAMS = test_bitcoin-qt
TESTS = test_bitcoin-qt TESTS = test_bitcoin-qt

6
src/test/Makefile.am

@ -1,10 +1,6 @@
include $(top_srcdir)/src/Makefile.include include $(top_srcdir)/src/Makefile.include
AM_CPPFLAGS = $(INCLUDES) -I$(top_builddir)/src/obj \ AM_CPPFLAGS += -I$(top_srcdir)/src
-I$(top_srcdir)/src/leveldb/include -I$(top_srcdir)/src/leveldb/helpers \
-I$(top_srcdir)/src $(BOOST_INCLUDES) $(BDB_CPPFLAGS)
AM_LDFLAGS = $(PTHREAD_CFLAGS)
bin_PROGRAMS = test_bitcoin bin_PROGRAMS = test_bitcoin

Loading…
Cancel
Save