diff options
author | Werner Lemberg <wl@gnu.org> | 2017-08-22 16:48:26 +0200 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2017-11-17 22:18:55 +0800 |
commit | db32a4fd6bd53ef66c8693cf273a8418e463c61b (patch) | |
tree | 9a1693d0d790e40ba0097a6200bbdd80a7d74808 /build-aux/m4/bitcoin_qt.m4 | |
parent | ea68190132b241feebdccc7bac715d92b9bc71bc (diff) |
bitcoin_qt.m4: Improve QT_VERSION tests.
Use '<QtCore/qconfig.h> and '<QtCore/qglobal.h>' for testing QT_VERSION.
This makes the tests work with both Qt4 and Qt5, even if '-fPIC' or '-fPIE'
is not used (the compiler might choke otherwise if QT_REDUCE_RELOCATIONS is
active).
Diffstat (limited to 'build-aux/m4/bitcoin_qt.m4')
-rw-r--r-- | build-aux/m4/bitcoin_qt.m4 | 84 |
1 files changed, 55 insertions, 29 deletions
diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index f83dba076f..52d46a385b 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -118,11 +118,17 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ if test x$bitcoin_cv_static_qt = xyes; then _BITCOIN_QT_FIND_STATIC_PLUGINS AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static]) - AC_CACHE_CHECK(for Qt < 5.4, bitcoin_cv_need_acc_widget,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include <QtCore>]],[[ - #if QT_VERSION >= 0x050400 - choke; - #endif + AC_CACHE_CHECK(for Qt < 5.4, bitcoin_cv_need_acc_widget,[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include <QtCore/qconfig.h> + #ifndef QT_VERSION + # include <QtCore/qglobal.h> + #endif + ]], + [[ + #if QT_VERSION >= 0x050400 + choke + #endif ]])], [bitcoin_cv_need_acc_widget=yes], [bitcoin_cv_need_acc_widget=no]) @@ -173,11 +179,16 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ TEMP_CXXFLAGS=$CXXFLAGS CPPFLAGS="$QT_INCLUDES $CPPFLAGS" CXXFLAGS="$PIE_FLAGS $CXXFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QtCore/qconfig.h>]], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include <QtCore/qconfig.h> + #ifndef QT_VERSION + # include <QtCore/qglobal.h> + #endif + ]], [[ - #if defined(QT_REDUCE_RELOCATIONS) - choke; - #endif + #if defined(QT_REDUCE_RELOCATIONS) + choke + #endif ]])], [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIE_FLAGS ], [ AC_MSG_RESULT(no); QT_PIE_FLAGS=$PIC_FLAGS] @@ -190,11 +201,16 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ AC_MSG_CHECKING(whether -fPIC is needed with this Qt config) TEMP_CPPFLAGS=$CPPFLAGS CPPFLAGS="$QT_INCLUDES $CPPFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QtCore/qconfig.h>]], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include <QtCore/qconfig.h> + #ifndef QT_VERSION + # include <QtCore/qglobal.h> + #endif + ]], [[ - #if defined(QT_REDUCE_RELOCATIONS) - choke; - #endif + #if defined(QT_REDUCE_RELOCATIONS) + choke + #endif ]])], [ AC_MSG_RESULT(no)], [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIC_FLAGS] @@ -269,13 +285,15 @@ dnl Requires: INCLUDES must be populated as necessary. dnl Output: bitcoin_cv_qt5=yes|no AC_DEFUN([_BITCOIN_QT_CHECK_QT5],[ AC_CACHE_CHECK(for Qt 5, bitcoin_cv_qt5,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include <QtCore>]], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include <QtCore/qconfig.h> + #ifndef QT_VERSION + # include <QtCore/qglobal.h> + #endif + ]], [[ #if QT_VERSION < 0x050000 - choke me - #else - return 0; + choke #endif ]])], [bitcoin_cv_qt5=yes], @@ -289,13 +307,15 @@ dnl Output: bitcoin_cv_static_qt=yes|no dnl Output: Defines QT_STATICPLUGIN if plugins are static. AC_DEFUN([_BITCOIN_QT_IS_STATIC],[ AC_CACHE_CHECK(for static Qt, bitcoin_cv_static_qt,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include <QtCore>]], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include <QtCore/qconfig.h> + #ifndef QT_VERSION + # include <QtCore/qglobal.h> + #endif + ]], [[ - #if defined(QT_STATIC) - return 0; - #else - choke me + #if !defined(QT_STATIC) + choke #endif ]])], [bitcoin_cv_static_qt=yes], @@ -352,11 +372,17 @@ AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[ ]) else if test x$TARGET_OS = xwindows; then - AC_CACHE_CHECK(for Qt >= 5.6, bitcoin_cv_need_platformsupport,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include <QtCore>]],[[ - #if QT_VERSION < 0x050600 - choke; - #endif + AC_CACHE_CHECK(for Qt >= 5.6, bitcoin_cv_need_platformsupport,[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include <QtCore/qconfig.h> + #ifndef QT_VERSION + # include <QtCore/qglobal.h> + #endif + ]], + [[ + #if QT_VERSION < 0x050600 + choke + #endif ]])], [bitcoin_cv_need_platformsupport=yes], [bitcoin_cv_need_platformsupport=no]) |