Skip to content

Commit ddbb419

Browse files
committed
build: Use pkg-config in BITCOIN_QT_CONFIGURE for all hosts
This change adds to the BITCOIN_QT_CONFIGURE script ability to use pkg-config for MinGW. All of the non-pkg-config paths are removed as needless. If depends is built with DEBUG=1 the configure script fails to pickup Qt: - for macOS host (similar, but not the same as issue 16391) - for Windows host (regression)
1 parent 492971d commit ddbb419

File tree

3 files changed

+6
-187
lines changed

3 files changed

+6
-187
lines changed

build-aux/m4/bitcoin_qt.m4

Lines changed: 5 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,12 @@ AC_DEFUN([BITCOIN_QT_INIT],[
7979
AC_SUBST(QT_TRANSLATION_DIR,$qt_translation_path)
8080
])
8181

82-
dnl Find the appropriate version of Qt libraries and includes.
83-
dnl Inputs: $1: Whether or not pkg-config should be used. yes|no. Default: yes.
84-
dnl Inputs: $2: If $1 is "yes" and --with-gui=auto, which qt version should be
85-
dnl tried first.
86-
dnl Outputs: See _BITCOIN_QT_FIND_LIBS_*
82+
dnl Find Qt libraries and includes.
83+
dnl Outputs: See _BITCOIN_QT_FIND_LIBS
8784
dnl Outputs: Sets variables for all qt-related tools.
8885
dnl Outputs: bitcoin_enable_qt, bitcoin_enable_qt_dbus, bitcoin_enable_qt_test
8986
AC_DEFUN([BITCOIN_QT_CONFIGURE],[
90-
use_pkgconfig=$1
91-
92-
if test "x$use_pkgconfig" = x; then
93-
use_pkgconfig=yes
94-
fi
95-
96-
if test "x$use_pkgconfig" = xyes; then
97-
BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG])
98-
else
99-
BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG])
100-
fi
87+
BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS])
10188
10289
dnl This is ugly and complicated. Yuck. Works as follows:
10390
dnl For Qt5, we can check a header to find out whether Qt is build
@@ -139,7 +126,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
139126
CXXFLAGS=$TEMP_CXXFLAGS
140127
])
141128
142-
if test "x$use_pkgconfig$qt_bin_path" = xyes; then
129+
if test "x$qt_bin_path" = x; then
143130
qt_bin_path="`$PKG_CONFIG --variable=host_bins Qt5Core 2>/dev/null`"
144131
fi
145132
@@ -255,47 +242,6 @@ dnl All macros below are internal and should _not_ be used from the main
255242
dnl configure.ac.
256243
dnl ----
257244
258-
dnl Internal. Check included version of Qt against minimum specified in doc/dependencies.md
259-
dnl Requires: INCLUDES must be populated as necessary.
260-
dnl Output: bitcoin_cv_qt5=yes|no
261-
AC_DEFUN([_BITCOIN_QT_CHECK_QT5],[
262-
AC_CACHE_CHECK(for Qt 5, bitcoin_cv_qt5,[
263-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
264-
#include <QtCore/qconfig.h>
265-
#ifndef QT_VERSION
266-
# include <QtCore/qglobal.h>
267-
#endif
268-
]],
269-
[[
270-
#if QT_VERSION < 0x050501
271-
choke
272-
#endif
273-
]])],
274-
[bitcoin_cv_qt5=yes],
275-
[bitcoin_cv_qt5=no])
276-
])])
277-
278-
dnl Internal. Check if the included version of Qt is greater than Qt58.
279-
dnl Requires: INCLUDES must be populated as necessary.
280-
dnl Output: bitcoin_cv_qt58=yes|no
281-
AC_DEFUN([_BITCOIN_QT_CHECK_QT58],[
282-
AC_CACHE_CHECK(for > Qt 5.7, bitcoin_cv_qt58,[
283-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
284-
#include <QtCore/qconfig.h>
285-
#ifndef QT_VERSION
286-
# include <QtCore/qglobal.h>
287-
#endif
288-
]],
289-
[[
290-
#if QT_VERSION_MINOR < 8
291-
choke
292-
#endif
293-
]])],
294-
[bitcoin_cv_qt58=yes],
295-
[bitcoin_cv_qt58=no])
296-
])])
297-
298-
299245
dnl Internal. Check if the linked version of Qt was built as static libs.
300246
dnl Requires: Qt5.
301247
dnl Requires: INCLUDES and LIBS must be populated as necessary.
@@ -353,8 +299,6 @@ AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[
353299
if test -d "$qt_plugin_path/platforms/android"; then
354300
QT_LIBS="$QT_LIBS -L$qt_plugin_path/platforms/android -lqtfreetype -lEGL"
355301
fi
356-
if test "x$use_pkgconfig" = xyes; then
357-
: dnl
358302
m4_ifdef([PKG_CHECK_MODULES],[
359303
if test x$bitcoin_cv_qt58 = xno; then
360304
PKG_CHECK_MODULES([QTPLATFORM], [Qt5PlatformSupport], [QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS"])
@@ -374,49 +318,13 @@ AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[
374318
PKG_CHECK_MODULES([QTCGL], [Qt5CglSupport], [QT_LIBS="-lQt5CglSupport $QT_LIBS"])
375319
fi
376320
])
377-
else
378-
if test "x$TARGET_OS" = xwindows; then
379-
AC_CACHE_CHECK(for Qt >= 5.6, bitcoin_cv_need_platformsupport,[
380-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
381-
#include <QtCore/qconfig.h>
382-
#ifndef QT_VERSION
383-
# include <QtCore/qglobal.h>
384-
#endif
385-
]],
386-
[[
387-
#if QT_VERSION < 0x050600 || QT_VERSION_MINOR < 6
388-
choke
389-
#endif
390-
]])],
391-
[bitcoin_cv_need_platformsupport=yes],
392-
[bitcoin_cv_need_platformsupport=no])
393-
])
394-
if test "x$bitcoin_cv_need_platformsupport" = xyes; then
395-
if test x$bitcoin_cv_qt58 = xno; then
396-
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}PlatformSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXPlatformSupport not found)))
397-
else
398-
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}FontDatabaseSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXFontDatabaseSupport not found)))
399-
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}EventDispatcherSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXEventDispatcherSupport not found)))
400-
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}ThemeSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXThemeSupport not found)))
401-
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}FbSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXFbSupport not found)))
402-
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}DeviceDiscoverySupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXDeviceDiscoverySupport not found)))
403-
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}AccessibilitySupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXAccessibilitySupport not found)))
404-
QT_LIBS="$QT_LIBS -lversion -ldwmapi -luxtheme"
405-
fi
406-
fi
407-
fi
408-
fi
409321
fi
410322
])
411323
412324
dnl Internal. Find Qt libraries using pkg-config.
413-
dnl Inputs: bitcoin_qt_want_version (from --with-gui=). The version to check
414-
dnl first.
415-
dnl Inputs: $1: If bitcoin_qt_want_version is "auto", check for this version
416-
dnl first.
417325
dnl Outputs: All necessary QT_* variables are set.
418326
dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no.
419-
AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[
327+
AC_DEFUN([_BITCOIN_QT_FIND_LIBS],[
420328
m4_ifdef([PKG_CHECK_MODULES],[
421329
QT_LIB_PREFIX=Qt5
422330
qt5_modules="Qt5Core Qt5Gui Qt5Network Qt5Widgets"
@@ -437,83 +345,3 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[
437345
])
438346
true; dnl
439347
])
440-
441-
dnl Internal. Find Qt libraries without using pkg-config. Version is deduced
442-
dnl from the discovered headers.
443-
dnl Inputs: bitcoin_qt_want_version (from --with-gui=). The version to use.
444-
dnl If "auto", the version will be discovered by _BITCOIN_QT_CHECK_QT5.
445-
dnl Outputs: All necessary QT_* variables are set.
446-
dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no.
447-
AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[
448-
TEMP_CPPFLAGS="$CPPFLAGS"
449-
TEMP_CXXFLAGS="$CXXFLAGS"
450-
CXXFLAGS="$PIC_FLAGS $CXXFLAGS"
451-
TEMP_LIBS="$LIBS"
452-
BITCOIN_QT_CHECK([
453-
if test "x$qt_include_path" != x; then
454-
QT_INCLUDES="-I$qt_include_path -I$qt_include_path/QtCore -I$qt_include_path/QtGui -I$qt_include_path/QtWidgets -I$qt_include_path/QtNetwork -I$qt_include_path/QtTest -I$qt_include_path/QtDBus"
455-
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
456-
fi
457-
])
458-
459-
BITCOIN_QT_CHECK([AC_CHECK_HEADER([QtPlugin],,BITCOIN_QT_FAIL(QtCore headers missing))])
460-
BITCOIN_QT_CHECK([AC_CHECK_HEADER([QApplication],, BITCOIN_QT_FAIL(QtGui headers missing))])
461-
BITCOIN_QT_CHECK([AC_CHECK_HEADER([QLocalSocket],, BITCOIN_QT_FAIL(QtNetwork headers missing))])
462-
463-
BITCOIN_QT_CHECK([
464-
if test "x$bitcoin_qt_want_version" = xauto; then
465-
_BITCOIN_QT_CHECK_QT5
466-
_BITCOIN_QT_CHECK_QT58
467-
fi
468-
QT_LIB_PREFIX=Qt5
469-
])
470-
471-
BITCOIN_QT_CHECK([
472-
LIBS=
473-
if test "x$qt_lib_path" != x; then
474-
LIBS="$LIBS -L$qt_lib_path"
475-
fi
476-
477-
if test "x$TARGET_OS" = xwindows; then
478-
AC_CHECK_LIB([imm32], [main],, BITCOIN_QT_FAIL(libimm32 not found))
479-
fi
480-
])
481-
482-
BITCOIN_QT_CHECK(AC_CHECK_LIB([z] ,[main],,AC_MSG_WARN([zlib not found. Assuming qt has it built-in])))
483-
if test x$bitcoin_cv_qt58 = xno; then
484-
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([png_error] ,[qtpng png],,AC_MSG_WARN([libpng not found. Assuming qt has it built-in])))
485-
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([pcre16_exec], [qtpcre pcre16],,AC_MSG_WARN([libpcre16 not found. Assuming qt has it built-in])))
486-
else
487-
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([png_error] ,[qtlibpng png],,AC_MSG_WARN([libpng not found. Assuming qt has it built-in])))
488-
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([pcre2_match_16], [qtpcre2 libqtpcre2],,AC_MSG_WARN([libqtpcre2 not found. Assuming qt has it built-in])))
489-
fi
490-
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([hb_ot_tags_from_script] ,[qtharfbuzzng qtharfbuzz harfbuzz],,AC_MSG_WARN([libharfbuzz not found. Assuming qt has it built-in or support is disabled])))
491-
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Core] ,[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Core not found)))
492-
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Gui] ,[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Gui not found)))
493-
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Network],[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Network not found)))
494-
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Widgets],[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Widgets not found)))
495-
QT_LIBS="$LIBS"
496-
LIBS="$TEMP_LIBS"
497-
498-
BITCOIN_QT_CHECK([
499-
LIBS=
500-
if test "x$qt_lib_path" != x; then
501-
LIBS="-L$qt_lib_path"
502-
fi
503-
AC_CHECK_LIB([${QT_LIB_PREFIX}Test], [main],, have_qt_test=no)
504-
AC_CHECK_HEADER([QTest],, have_qt_test=no)
505-
QT_TEST_LIBS="$LIBS"
506-
if test "x$use_dbus" != xno; then
507-
LIBS=
508-
if test "x$qt_lib_path" != x; then
509-
LIBS="-L$qt_lib_path"
510-
fi
511-
AC_CHECK_LIB([${QT_LIB_PREFIX}DBus], [main],, have_qt_dbus=no)
512-
AC_CHECK_HEADER([QtDBus],, have_qt_dbus=no)
513-
QT_DBUS_LIBS="$LIBS"
514-
fi
515-
])
516-
CPPFLAGS="$TEMP_CPPFLAGS"
517-
CXXFLAGS="$TEMP_CXXFLAGS"
518-
LIBS="$TEMP_LIBS"
519-
])

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ else
10831083
BITCOIN_QT_INIT
10841084

10851085
dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus
1086-
BITCOIN_QT_CONFIGURE([$use_pkgconfig])
1086+
BITCOIN_QT_CONFIGURE
10871087
fi
10881088

10891089
if test x$enable_wallet != xno; then

depends/config.site.in

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ if test x@host_os@ = xdarwin; then
4242
PORT=no
4343
fi
4444

45-
if test x@host_os@ = xmingw32; then
46-
if test -z $with_qt_incdir; then
47-
with_qt_incdir=$depends_prefix/include
48-
fi
49-
if test -z $with_qt_libdir; then
50-
with_qt_libdir=$depends_prefix/lib
51-
fi
52-
fi
53-
5445
PATH=$depends_prefix/native/bin:$PATH
5546
PKG_CONFIG="`which pkg-config` --static"
5647

0 commit comments

Comments
 (0)