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).
This commit is contained in:
Werner Lemberg 2017-08-22 16:48:26 +02:00 committed by fanquake
parent ea68190132
commit db32a4fd6b
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -118,10 +118,16 @@ 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>]],[[
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;
choke
#endif
]])],
[bitcoin_cv_need_acc_widget=yes],
@ -173,10 +179,15 @@ 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;
choke
#endif
]])],
[ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIE_FLAGS ],
@ -190,10 +201,15 @@ 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;
choke
#endif
]])],
[ AC_MSG_RESULT(no)],
@ -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,10 +372,16 @@ 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>]],[[
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;
choke
#endif
]])],
[bitcoin_cv_need_platformsupport=yes],