Skip to content

Commit bf24774

Browse files
committed
build, qt: Refactor internal _BITCOIN_QT_CHECK_STATIC_PLUGINS macro
This change puts Q_IMPORT_PLUGIN(...) boilerplate into the macro, which now accepts only one plugin to check, and it is renamed (plural -> singular).
1 parent b4d2265 commit bf24774

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

build-aux/m4/bitcoin_qt.m4

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
111111
dnl For Qt5, we can check a header to find out whether Qt is build
112112
dnl statically. When Qt is built statically, some plugins must be linked into
113113
dnl the final binary as well.
114-
dnl With Qt5, languages moved into core and the WindowsIntegration plugin was
115-
dnl added.
116-
dnl _BITCOIN_QT_CHECK_STATIC_PLUGINS does a quick link-check and appends the
114+
dnl _BITCOIN_QT_CHECK_STATIC_PLUGIN does a quick link-check and appends the
117115
dnl results to QT_LIBS.
118116
BITCOIN_QT_CHECK([
119117
TEMP_CPPFLAGS=$CPPFLAGS
@@ -125,17 +123,17 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
125123
_BITCOIN_QT_FIND_STATIC_PLUGINS
126124
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static])
127125
if test "x$TARGET_OS" != xandroid; then
128-
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin)],[-lqminimal])
126+
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QMinimalIntegrationPlugin], [-lqminimal])
129127
AC_DEFINE(QT_QPA_PLATFORM_MINIMAL, 1, [Define this symbol if the minimal qt platform exists])
130128
fi
131129
if test "x$TARGET_OS" = xwindows; then
132-
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)],[-lqwindows])
130+
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QWindowsIntegrationPlugin], [-lqwindows])
133131
AC_DEFINE(QT_QPA_PLATFORM_WINDOWS, 1, [Define this symbol if the qt platform is windows])
134132
elif test "x$TARGET_OS" = xlinux; then
135-
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)],[-lqxcb -lxcb-static])
133+
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QXcbIntegrationPlugin], [-lqxcb -lxcb-static])
136134
AC_DEFINE(QT_QPA_PLATFORM_XCB, 1, [Define this symbol if the qt platform is xcb])
137135
elif test "x$TARGET_OS" = xdarwin; then
138-
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)],[-lqcocoa])
136+
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QCocoaIntegrationPlugin], [-lqcocoa])
139137
AC_DEFINE(QT_QPA_PLATFORM_COCOA, 1, [Define this symbol if the qt platform is cocoa])
140138
elif test "x$TARGET_OS" = xandroid; then
141139
QT_LIBS="-Wl,--export-dynamic,--undefined=JNI_OnLoad -lqtforandroid -ljnigraphics -landroid -lqtfreetype -lQt5EglSupport $QT_LIBS"
@@ -284,22 +282,22 @@ AC_DEFUN([_BITCOIN_QT_IS_STATIC],[
284282
])
285283
])
286284

287-
dnl Internal. Check if the link-requirements for static plugins are met.
285+
dnl Internal. Check if the link-requirements for a static plugin are met.
286+
dnl
287+
dnl _BITCOIN_QT_CHECK_STATIC_PLUGIN(PLUGIN, LIBRARIES)
288+
dnl --------------------------------------------------
289+
dnl
288290
dnl Requires: INCLUDES and LIBS must be populated as necessary.
289-
dnl Inputs: $1: A series of Q_IMPORT_PLUGIN().
291+
dnl Inputs: $1: A static plugin name.
290292
dnl Inputs: $2: The libraries that resolve $1.
291293
dnl Output: QT_LIBS is prepended or configure exits.
292-
AC_DEFUN([_BITCOIN_QT_CHECK_STATIC_PLUGINS],[
293-
AC_MSG_CHECKING(for static Qt plugins: $2)
294+
AC_DEFUN([_BITCOIN_QT_CHECK_STATIC_PLUGIN], [
295+
AC_MSG_CHECKING([for $1 ($2)])
294296
CHECK_STATIC_PLUGINS_TEMP_LIBS="$LIBS"
295297
LIBS="$2${qt_lib_suffix} $QT_LIBS $LIBS"
296-
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
297-
#define QT_STATICPLUGIN
298-
#include <QtPlugin>
299-
$1]],
300-
[[return 0;]])],
301-
[AC_MSG_RESULT(yes); QT_LIBS="$2${qt_lib_suffix} $QT_LIBS"],
302-
[AC_MSG_RESULT(no); BITCOIN_QT_FAIL(Could not resolve: $2)])
298+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <QtPlugin> Q_IMPORT_PLUGIN($1)]])],
299+
[AC_MSG_RESULT([yes]); QT_LIBS="$2${qt_lib_suffix} $QT_LIBS"],
300+
[AC_MSG_RESULT([no]); BITCOIN_QT_FAIL([$1 not found.])])
303301
LIBS="$CHECK_STATIC_PLUGINS_TEMP_LIBS"
304302
])
305303

0 commit comments

Comments
 (0)