Skip to content

Commit db32a4f

Browse files
lemzwergfanquake
authored andcommitted
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).
1 parent ea68190 commit db32a4f

File tree

1 file changed

+55
-29
lines changed

1 file changed

+55
-29
lines changed

build-aux/m4/bitcoin_qt.m4

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,17 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
118118
if test x$bitcoin_cv_static_qt = xyes; then
119119
_BITCOIN_QT_FIND_STATIC_PLUGINS
120120
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static])
121-
AC_CACHE_CHECK(for Qt < 5.4, bitcoin_cv_need_acc_widget,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
122-
[[#include <QtCore>]],[[
123-
#if QT_VERSION >= 0x050400
124-
choke;
125-
#endif
121+
AC_CACHE_CHECK(for Qt < 5.4, bitcoin_cv_need_acc_widget,[
122+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
123+
#include <QtCore/qconfig.h>
124+
#ifndef QT_VERSION
125+
# include <QtCore/qglobal.h>
126+
#endif
127+
]],
128+
[[
129+
#if QT_VERSION >= 0x050400
130+
choke
131+
#endif
126132
]])],
127133
[bitcoin_cv_need_acc_widget=yes],
128134
[bitcoin_cv_need_acc_widget=no])
@@ -173,11 +179,16 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
173179
TEMP_CXXFLAGS=$CXXFLAGS
174180
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
175181
CXXFLAGS="$PIE_FLAGS $CXXFLAGS"
176-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QtCore/qconfig.h>]],
182+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
183+
#include <QtCore/qconfig.h>
184+
#ifndef QT_VERSION
185+
# include <QtCore/qglobal.h>
186+
#endif
187+
]],
177188
[[
178-
#if defined(QT_REDUCE_RELOCATIONS)
179-
choke;
180-
#endif
189+
#if defined(QT_REDUCE_RELOCATIONS)
190+
choke
191+
#endif
181192
]])],
182193
[ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIE_FLAGS ],
183194
[ AC_MSG_RESULT(no); QT_PIE_FLAGS=$PIC_FLAGS]
@@ -190,11 +201,16 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
190201
AC_MSG_CHECKING(whether -fPIC is needed with this Qt config)
191202
TEMP_CPPFLAGS=$CPPFLAGS
192203
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
193-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QtCore/qconfig.h>]],
204+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
205+
#include <QtCore/qconfig.h>
206+
#ifndef QT_VERSION
207+
# include <QtCore/qglobal.h>
208+
#endif
209+
]],
194210
[[
195-
#if defined(QT_REDUCE_RELOCATIONS)
196-
choke;
197-
#endif
211+
#if defined(QT_REDUCE_RELOCATIONS)
212+
choke
213+
#endif
198214
]])],
199215
[ AC_MSG_RESULT(no)],
200216
[ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIC_FLAGS]
@@ -269,13 +285,15 @@ dnl Requires: INCLUDES must be populated as necessary.
269285
dnl Output: bitcoin_cv_qt5=yes|no
270286
AC_DEFUN([_BITCOIN_QT_CHECK_QT5],[
271287
AC_CACHE_CHECK(for Qt 5, bitcoin_cv_qt5,[
272-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
273-
[[#include <QtCore>]],
288+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
289+
#include <QtCore/qconfig.h>
290+
#ifndef QT_VERSION
291+
# include <QtCore/qglobal.h>
292+
#endif
293+
]],
274294
[[
275295
#if QT_VERSION < 0x050000
276-
choke me
277-
#else
278-
return 0;
296+
choke
279297
#endif
280298
]])],
281299
[bitcoin_cv_qt5=yes],
@@ -289,13 +307,15 @@ dnl Output: bitcoin_cv_static_qt=yes|no
289307
dnl Output: Defines QT_STATICPLUGIN if plugins are static.
290308
AC_DEFUN([_BITCOIN_QT_IS_STATIC],[
291309
AC_CACHE_CHECK(for static Qt, bitcoin_cv_static_qt,[
292-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
293-
[[#include <QtCore>]],
310+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
311+
#include <QtCore/qconfig.h>
312+
#ifndef QT_VERSION
313+
# include <QtCore/qglobal.h>
314+
#endif
315+
]],
294316
[[
295-
#if defined(QT_STATIC)
296-
return 0;
297-
#else
298-
choke me
317+
#if !defined(QT_STATIC)
318+
choke
299319
#endif
300320
]])],
301321
[bitcoin_cv_static_qt=yes],
@@ -352,11 +372,17 @@ AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[
352372
])
353373
else
354374
if test x$TARGET_OS = xwindows; then
355-
AC_CACHE_CHECK(for Qt >= 5.6, bitcoin_cv_need_platformsupport,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
356-
[[#include <QtCore>]],[[
357-
#if QT_VERSION < 0x050600
358-
choke;
359-
#endif
375+
AC_CACHE_CHECK(for Qt >= 5.6, bitcoin_cv_need_platformsupport,[
376+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
377+
#include <QtCore/qconfig.h>
378+
#ifndef QT_VERSION
379+
# include <QtCore/qglobal.h>
380+
#endif
381+
]],
382+
[[
383+
#if QT_VERSION < 0x050600
384+
choke
385+
#endif
360386
]])],
361387
[bitcoin_cv_need_platformsupport=yes],
362388
[bitcoin_cv_need_platformsupport=no])

0 commit comments

Comments
 (0)