Skip to content

Commit 0c928cb

Browse files
committed
build: Fix Qt5PlatformSupport check without pkg-config
The non-pkg-config case can't use pkg-config to check the version. Also, make sure that the check is properly guarded in the case of missing pkg-config macros.
1 parent 91abb77 commit 0c928cb

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

build-aux/m4/bitcoin_qt.m4

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,9 @@ AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[
331331
QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible"
332332
fi
333333
fi
334-
m4_ifdef([PKG_CHECK_MODULES],[
335334
if test x$use_pkgconfig = xyes; then
335+
: dnl
336+
m4_ifdef([PKG_CHECK_MODULES],[
336337
PKG_CHECK_MODULES([QTPLATFORM], [Qt5PlatformSupport], [QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS"])
337338
if test x$TARGET_OS = xlinux; then
338339
PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"])
@@ -342,12 +343,23 @@ AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[
342343
elif test x$TARGET_OS = xdarwin; then
343344
PKG_CHECK_MODULES([QTPRINT], [Qt5PrintSupport], [QT_LIBS="$QTPRINT_LIBS $QT_LIBS"])
344345
fi
346+
])
345347
else
346-
if ${PKG_CONFIG} --exists "Qt5Core >= 5.6" 2>/dev/null; then
347-
QT_LIBS="-lQt5PlatformSupport $QT_LIBS"
348+
if test x$TARGET_OS = xwindows; then
349+
AC_CACHE_CHECK(for Qt >= 5.6, bitcoin_cv_need_platformsupport,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
350+
[[#include <QtCore>]],[[
351+
#if QT_VERSION < 0x050600
352+
choke;
353+
#endif
354+
]])],
355+
[bitcoin_cv_need_platformsupport=yes],
356+
[bitcoin_cv_need_platformsupport=no])
357+
])
358+
if test x$bitcoin_cv_need_platformsupport = xyes; then
359+
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}PlatformSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXPlatformSupport not found)))
360+
fi
348361
fi
349362
fi
350-
])
351363
else
352364
if test x$qt_plugin_path != x; then
353365
QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible"

0 commit comments

Comments
 (0)