Merge #11711: bitcoin_qt.m4: Minor fixes and clean-ups.

06abcbf scripted-diff: Orthogonalize string quoting (Werner Lemberg)
e0496d3 bitcoin_qt.m4: Add missing dollar sign for variable. (Werner Lemberg)
079f4b2 bitcoin_qt.m4: Add missing braces around variables in autoconf messages. (Werner Lemberg)
8695315 bitcoin_qt.m4: Use correct M4 quoting characters. (Werner Lemberg)
db32a4f bitcoin_qt.m4: Improve QT_VERSION tests. (Werner Lemberg)

Pull request description:

  Replaces #11222.

  Dropped the last commit, and converted e90d91c (now 06abcbf) into a scripted-diff using @theuni's suggestion.

Tree-SHA512: f2e1713bda96e8875be08839af914b24b3240f2eecf18cb268f83c82d965ebf544a0022af4f6f73b88b637a4fdd404a96b9fcf8e5bdd11c507b5bb425eeb7e1d
This commit is contained in:
Wladimir J. van der Laan 2018-01-29 15:37:08 +01:00 committed by Pasta
parent 2f8888a86e
commit 4e230811b6
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -5,8 +5,8 @@ dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.
dnl Helper for cases where a qt dependency is not met. dnl Helper for cases where a qt dependency is not met.
dnl Output: If qt version is auto, set bitcoin_enable_qt to false. Else, exit. dnl Output: If qt version is auto, set bitcoin_enable_qt to false. Else, exit.
AC_DEFUN([BITCOIN_QT_FAIL],[ AC_DEFUN([BITCOIN_QT_FAIL],[
if test "x$bitcoin_qt_want_version" = "xauto" && test x$bitcoin_qt_force != xyes; then if test "x$bitcoin_qt_want_version" = xauto && test "x$bitcoin_qt_force" != xyes; then
if test x$bitcoin_enable_qt != xno; then if test "x$bitcoin_enable_qt" != xno; then
AC_MSG_WARN([$1; dash-qt frontend will not be built]) AC_MSG_WARN([$1; dash-qt frontend will not be built])
fi fi
bitcoin_enable_qt=no bitcoin_enable_qt=no
@ -17,7 +17,7 @@ AC_DEFUN([BITCOIN_QT_FAIL],[
]) ])
AC_DEFUN([BITCOIN_QT_CHECK],[ AC_DEFUN([BITCOIN_QT_CHECK],[
if test "x$bitcoin_enable_qt" != "xno" && test x$bitcoin_qt_want_version != xno; then if test "x$bitcoin_enable_qt" != xno && test "x$bitcoin_qt_want_version" != xno; then
true true
$1 $1
else else
@ -35,12 +35,12 @@ dnl Inputs: $4: If "yes", don't fail if $2 is not found.
dnl Output: $1 is set to the path of $2 if found. $2 are searched in order. dnl Output: $1 is set to the path of $2 if found. $2 are searched in order.
AC_DEFUN([BITCOIN_QT_PATH_PROGS],[ AC_DEFUN([BITCOIN_QT_PATH_PROGS],[
BITCOIN_QT_CHECK([ BITCOIN_QT_CHECK([
if test "x$3" != "x"; then if test "x$3" != x; then
AC_PATH_PROGS($1,$2,,$3) AC_PATH_PROGS($1,$2,,$3)
else else
AC_PATH_PROGS($1,$2) AC_PATH_PROGS($1,$2)
fi fi
if test "x$$1" = "x" && test "x$4" != "xyes"; then if test "x$$1" = x && test "x$4" != xyes; then
BITCOIN_QT_FAIL([$1 not found]) BITCOIN_QT_FAIL([$1 not found])
fi fi
]) ])
@ -57,7 +57,7 @@ AC_DEFUN([BITCOIN_QT_INIT],[
[build dash-qt GUI (default=auto, qt5 tried first)])], [build dash-qt GUI (default=auto, qt5 tried first)])],
[ [
bitcoin_qt_want_version=$withval bitcoin_qt_want_version=$withval
if test x$bitcoin_qt_want_version = xyes; then if test "x$bitcoin_qt_want_version" = xyes; then
bitcoin_qt_force=yes bitcoin_qt_force=yes
bitcoin_qt_want_version=auto bitcoin_qt_want_version=auto
fi fi
@ -89,11 +89,11 @@ dnl Outputs: bitcoin_enable_qt, bitcoin_enable_qt_dbus, bitcoin_enable_qt_test
AC_DEFUN([BITCOIN_QT_CONFIGURE],[ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
use_pkgconfig=$1 use_pkgconfig=$1
if test x$use_pkgconfig = x; then if test "x$use_pkgconfig" = x; then
use_pkgconfig=yes use_pkgconfig=yes
fi fi
if test x$use_pkgconfig = xyes; then if test "x$use_pkgconfig" = xyes; then
BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG([$2])]) BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG([$2])])
else else
BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG]) BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG])
@ -113,39 +113,45 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
TEMP_CXXFLAGS=$CXXFLAGS TEMP_CXXFLAGS=$CXXFLAGS
CPPFLAGS="$QT_INCLUDES $CPPFLAGS" CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
CXXFLAGS="$PIC_FLAGS $CXXFLAGS" CXXFLAGS="$PIC_FLAGS $CXXFLAGS"
if test x$bitcoin_qt_got_major_vers = x5; then if test "x$bitcoin_qt_got_major_vers" = x5; then
_BITCOIN_QT_IS_STATIC _BITCOIN_QT_IS_STATIC
if test x$bitcoin_cv_static_qt = xyes; then if test "x$bitcoin_cv_static_qt" = xyes; then
_BITCOIN_QT_FIND_STATIC_PLUGINS _BITCOIN_QT_FIND_STATIC_PLUGINS
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static]) 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( AC_CACHE_CHECK(for Qt < 5.4, bitcoin_cv_need_acc_widget,[
[[#include <QtCore>]],[[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if QT_VERSION >= 0x050400 #include <QtCore/qconfig.h>
choke; #ifndef QT_VERSION
#endif # include <QtCore/qglobal.h>
#endif
]],
[[
#if QT_VERSION >= 0x050400
choke
#endif
]])], ]])],
[bitcoin_cv_need_acc_widget=yes], [bitcoin_cv_need_acc_widget=yes],
[bitcoin_cv_need_acc_widget=no]) [bitcoin_cv_need_acc_widget=no])
]) ])
if test "x$bitcoin_cv_need_acc_widget" = "xyes"; then if test "x$bitcoin_cv_need_acc_widget" = xyes; then
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(AccessibleFactory)], [-lqtaccessiblewidgets]) _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(AccessibleFactory)], [-lqtaccessiblewidgets])
fi fi
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin)],[-lqminimal]) _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin)],[-lqminimal])
AC_DEFINE(QT_QPA_PLATFORM_MINIMAL, 1, [Define this symbol if the minimal qt platform exists]) AC_DEFINE(QT_QPA_PLATFORM_MINIMAL, 1, [Define this symbol if the minimal qt platform exists])
if test x$TARGET_OS = xwindows; then if test "x$TARGET_OS" = xwindows; then
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)],[-lqwindows]) _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)],[-lqwindows])
AC_DEFINE(QT_QPA_PLATFORM_WINDOWS, 1, [Define this symbol if the qt platform is windows]) AC_DEFINE(QT_QPA_PLATFORM_WINDOWS, 1, [Define this symbol if the qt platform is windows])
elif test x$TARGET_OS = xlinux; then elif test "x$TARGET_OS" = xlinux; then
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)],[-lqxcb -lxcb-static]) _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)],[-lqxcb -lxcb-static])
AC_DEFINE(QT_QPA_PLATFORM_XCB, 1, [Define this symbol if the qt platform is xcb]) AC_DEFINE(QT_QPA_PLATFORM_XCB, 1, [Define this symbol if the qt platform is xcb])
elif test x$TARGET_OS = xdarwin; then elif test "x$TARGET_OS" = xdarwin; then
AX_CHECK_LINK_FLAG([[-framework IOKit]],[QT_LIBS="$QT_LIBS -framework IOKit"],[AC_MSG_ERROR(could not iokit framework)]) AX_CHECK_LINK_FLAG([[-framework IOKit]],[QT_LIBS="$QT_LIBS -framework IOKit"],[AC_MSG_ERROR(could not iokit framework)])
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)],[-lqcocoa]) _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)],[-lqcocoa])
AC_DEFINE(QT_QPA_PLATFORM_COCOA, 1, [Define this symbol if the qt platform is cocoa]) AC_DEFINE(QT_QPA_PLATFORM_COCOA, 1, [Define this symbol if the qt platform is cocoa])
fi fi
fi fi
else else
if test x$TARGET_OS = xwindows; then if test "x$TARGET_OS" = xwindows; then
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static]) AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static])
_BITCOIN_QT_CHECK_STATIC_PLUGINS([ _BITCOIN_QT_CHECK_STATIC_PLUGINS([
Q_IMPORT_PLUGIN(qcncodecs) Q_IMPORT_PLUGIN(qcncodecs)
@ -160,24 +166,29 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
CXXFLAGS=$TEMP_CXXFLAGS CXXFLAGS=$TEMP_CXXFLAGS
]) ])
if test x$use_pkgconfig$qt_bin_path = xyes; then if test "x$use_pkgconfig$qt_bin_path" = xyes; then
if test x$bitcoin_qt_got_major_vers = x5; then if test "x$bitcoin_qt_got_major_vers" = x5; then
qt_bin_path="`$PKG_CONFIG --variable=host_bins Qt5Core 2>/dev/null`" qt_bin_path="`$PKG_CONFIG --variable=host_bins Qt5Core 2>/dev/null`"
fi fi
fi fi
if test x$use_hardening != xno; then if test "x$use_hardening" != xno; then
BITCOIN_QT_CHECK([ BITCOIN_QT_CHECK([
AC_MSG_CHECKING(whether -fPIE can be used with this Qt config) AC_MSG_CHECKING(whether -fPIE can be used with this Qt config)
TEMP_CPPFLAGS=$CPPFLAGS TEMP_CPPFLAGS=$CPPFLAGS
TEMP_CXXFLAGS=$CXXFLAGS TEMP_CXXFLAGS=$CXXFLAGS
CPPFLAGS="$QT_INCLUDES $CPPFLAGS" CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
CXXFLAGS="$PIE_FLAGS $CXXFLAGS" 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) #if defined(QT_REDUCE_RELOCATIONS)
choke; choke
#endif #endif
]])], ]])],
[ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIE_FLAGS ], [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIE_FLAGS ],
[ AC_MSG_RESULT(no); QT_PIE_FLAGS=$PIC_FLAGS] [ AC_MSG_RESULT(no); QT_PIE_FLAGS=$PIC_FLAGS]
@ -190,11 +201,16 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
AC_MSG_CHECKING(whether -fPIC is needed with this Qt config) AC_MSG_CHECKING(whether -fPIC is needed with this Qt config)
TEMP_CPPFLAGS=$CPPFLAGS TEMP_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$QT_INCLUDES $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) #if defined(QT_REDUCE_RELOCATIONS)
choke; choke
#endif #endif
]])], ]])],
[ AC_MSG_RESULT(no)], [ AC_MSG_RESULT(no)],
[ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIC_FLAGS] [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIC_FLAGS]
@ -245,18 +261,18 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
BITCOIN_QT_CHECK([ BITCOIN_QT_CHECK([
bitcoin_enable_qt=yes bitcoin_enable_qt=yes
bitcoin_enable_qt_test=yes bitcoin_enable_qt_test=yes
if test x$have_qt_test = xno; then if test "x$have_qt_test" = xno; then
bitcoin_enable_qt_test=no bitcoin_enable_qt_test=no
fi fi
bitcoin_enable_qt_dbus=no bitcoin_enable_qt_dbus=no
if test x$use_dbus != xno && test x$have_qt_dbus = xyes; then if test "x$use_dbus" != xno && test "x$have_qt_dbus" = xyes; then
bitcoin_enable_qt_dbus=yes bitcoin_enable_qt_dbus=yes
fi fi
if test x$use_dbus = xyes && test x$have_qt_dbus = xno; then if test "x$use_dbus" = xyes && test "x$have_qt_dbus" = xno; then
AC_MSG_ERROR("libQtDBus not found. Install libQtDBus or remove --with-qtdbus.") AC_MSG_ERROR([libQtDBus not found. Install libQtDBus or remove --with-qtdbus.])
fi fi
if test x$LUPDATE = x; then if test "x$LUPDATE" = x; then
AC_MSG_WARN("lupdate is required to update qt translations") AC_MSG_WARN([lupdate is required to update qt translations])
fi fi
],[ ],[
bitcoin_enable_qt=no bitcoin_enable_qt=no
@ -284,13 +300,15 @@ dnl Requires: INCLUDES must be populated as necessary.
dnl Output: bitcoin_cv_qt5=yes|no dnl Output: bitcoin_cv_qt5=yes|no
AC_DEFUN([_BITCOIN_QT_CHECK_QT5],[ AC_DEFUN([_BITCOIN_QT_CHECK_QT5],[
AC_CACHE_CHECK(for Qt 5, bitcoin_cv_qt5,[ AC_CACHE_CHECK(for Qt 5, bitcoin_cv_qt5,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM( AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
[[#include <QtCore>]], #include <QtCore/qconfig.h>
#ifndef QT_VERSION
# include <QtCore/qglobal.h>
#endif
]],
[[ [[
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
choke me choke
#else
return 0;
#endif #endif
]])], ]])],
[bitcoin_cv_qt5=yes], [bitcoin_cv_qt5=yes],
@ -304,19 +322,21 @@ dnl Output: bitcoin_cv_static_qt=yes|no
dnl Output: Defines QT_STATICPLUGIN if plugins are static. dnl Output: Defines QT_STATICPLUGIN if plugins are static.
AC_DEFUN([_BITCOIN_QT_IS_STATIC],[ AC_DEFUN([_BITCOIN_QT_IS_STATIC],[
AC_CACHE_CHECK(for static Qt, bitcoin_cv_static_qt,[ AC_CACHE_CHECK(for static Qt, bitcoin_cv_static_qt,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM( AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
[[#include <QtCore>]], #include <QtCore/qconfig.h>
#ifndef QT_VERSION
# include <QtCore/qglobal.h>
#endif
]],
[[ [[
#if defined(QT_STATIC) #if !defined(QT_STATIC)
return 0; choke
#else
choke me
#endif #endif
]])], ]])],
[bitcoin_cv_static_qt=yes], [bitcoin_cv_static_qt=yes],
[bitcoin_cv_static_qt=no]) [bitcoin_cv_static_qt=no])
]) ])
if test xbitcoin_cv_static_qt = xyes; then if test "x$bitcoin_cv_static_qt" = xyes; then
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol for static Qt plugins]) AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol for static Qt plugins])
fi fi
]) ])
@ -345,44 +365,50 @@ dnl Inputs: bitcoin_qt_got_major_vers. 4 or 5.
dnl Inputs: qt_plugin_path. optional. dnl Inputs: qt_plugin_path. optional.
dnl Outputs: QT_LIBS is appended dnl Outputs: QT_LIBS is appended
AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[ AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[
if test x$bitcoin_qt_got_major_vers = x5; then if test "x$bitcoin_qt_got_major_vers" = x5; then
if test x$qt_plugin_path != x; then if test "x$qt_plugin_path" != x; then
QT_LIBS="$QT_LIBS -L$qt_plugin_path/platforms" QT_LIBS="$QT_LIBS -L$qt_plugin_path/platforms"
if test -d "$qt_plugin_path/accessible"; then if test -d "$qt_plugin_path/accessible"; then
QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible" QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible"
fi fi
fi fi
if test x$use_pkgconfig = xyes; then if test "x$use_pkgconfig" = xyes; then
: dnl : dnl
m4_ifdef([PKG_CHECK_MODULES],[ m4_ifdef([PKG_CHECK_MODULES],[
PKG_CHECK_MODULES([QTPLATFORM], [Qt5PlatformSupport], [QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS"]) PKG_CHECK_MODULES([QTPLATFORM], [Qt5PlatformSupport], [QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS"])
if test x$TARGET_OS = xlinux; then if test "x$TARGET_OS" = xlinux; then
PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"]) PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"])
if ${PKG_CONFIG} --exists "Qt5Core >= 5.5" 2>/dev/null; then if ${PKG_CONFIG} --exists "Qt5Core >= 5.5" 2>/dev/null; then
PKG_CHECK_MODULES([QTXCBQPA], [Qt5XcbQpa], [QT_LIBS="$QTXCBQPA_LIBS $QT_LIBS"]) PKG_CHECK_MODULES([QTXCBQPA], [Qt5XcbQpa], [QT_LIBS="$QTXCBQPA_LIBS $QT_LIBS"])
fi fi
elif test x$TARGET_OS = xdarwin; then elif test "x$TARGET_OS" = xdarwin; then
PKG_CHECK_MODULES([QTPRINT], [Qt5PrintSupport], [QT_LIBS="$QTPRINT_LIBS $QT_LIBS"]) PKG_CHECK_MODULES([QTPRINT], [Qt5PrintSupport], [QT_LIBS="$QTPRINT_LIBS $QT_LIBS"])
fi fi
]) ])
else else
if test x$TARGET_OS = xwindows; then if test "x$TARGET_OS" = xwindows; then
AC_CACHE_CHECK(for Qt >= 5.6, bitcoin_cv_need_platformsupport,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( AC_CACHE_CHECK(for Qt >= 5.6, bitcoin_cv_need_platformsupport,[
[[#include <QtCore>]],[[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if QT_VERSION < 0x050600 #include <QtCore/qconfig.h>
choke; #ifndef QT_VERSION
#endif # include <QtCore/qglobal.h>
#endif
]],
[[
#if QT_VERSION < 0x050600
choke
#endif
]])], ]])],
[bitcoin_cv_need_platformsupport=yes], [bitcoin_cv_need_platformsupport=yes],
[bitcoin_cv_need_platformsupport=no]) [bitcoin_cv_need_platformsupport=no])
]) ])
if test x$bitcoin_cv_need_platformsupport = xyes; then if test "x$bitcoin_cv_need_platformsupport" = xyes; then
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}PlatformSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXPlatformSupport not found))) BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}PlatformSupport],[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}PlatformSupport not found)))
fi fi
fi fi
fi fi
else else
if test x$qt_plugin_path != x; then if test "x$qt_plugin_path" != x; then
QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible" QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible"
QT_LIBS="$QT_LIBS -L$qt_plugin_path/codecs" QT_LIBS="$QT_LIBS -L$qt_plugin_path/codecs"
fi fi
@ -400,10 +426,10 @@ dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no.
AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[
m4_ifdef([PKG_CHECK_MODULES],[ m4_ifdef([PKG_CHECK_MODULES],[
auto_priority_version=$1 auto_priority_version=$1
if test x$auto_priority_version = x; then if test "x$auto_priority_version" = x; then
auto_priority_version=qt5 auto_priority_version=qt5
fi fi
if test x$bitcoin_qt_want_version = xqt5 || ( test x$bitcoin_qt_want_version = xauto && test x$auto_priority_version = xqt5 ); then if test "x$bitcoin_qt_want_version" = xqt5 || ( test "x$bitcoin_qt_want_version" = xauto && test "x$auto_priority_version" = xqt5 ); then
QT_LIB_PREFIX=Qt5 QT_LIB_PREFIX=Qt5
bitcoin_qt_got_major_vers=5 bitcoin_qt_got_major_vers=5
else else
@ -413,28 +439,28 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[
qt5_modules="Qt5Core Qt5Gui Qt5Network Qt5Widgets" qt5_modules="Qt5Core Qt5Gui Qt5Network Qt5Widgets"
qt4_modules="QtCore QtGui QtNetwork" qt4_modules="QtCore QtGui QtNetwork"
BITCOIN_QT_CHECK([ BITCOIN_QT_CHECK([
if test x$bitcoin_qt_want_version = xqt5 || ( test x$bitcoin_qt_want_version = xauto && test x$auto_priority_version = xqt5 ); then if test "x$bitcoin_qt_want_version" = xqt5 || ( test "x$bitcoin_qt_want_version" = xauto && test "x$auto_priority_version" = xqt5 ); then
PKG_CHECK_MODULES([QT5], [$qt5_modules], [QT_INCLUDES="$QT5_CFLAGS"; QT_LIBS="$QT5_LIBS" have_qt=yes],[have_qt=no]) PKG_CHECK_MODULES([QT5], [$qt5_modules], [QT_INCLUDES="$QT5_CFLAGS"; QT_LIBS="$QT5_LIBS" have_qt=yes],[have_qt=no])
elif test x$bitcoin_qt_want_version = xqt4 || ( test x$bitcoin_qt_want_version = xauto && test x$auto_priority_version = xqt4 ); then elif test "x$bitcoin_qt_want_version" = xqt4 || ( test "x$bitcoin_qt_want_version" = xauto && test "x$auto_priority_version" = xqt4 ); then
PKG_CHECK_MODULES([QT4], [$qt4_modules], [QT_INCLUDES="$QT4_CFLAGS"; QT_LIBS="$QT4_LIBS" ; have_qt=yes], [have_qt=no]) PKG_CHECK_MODULES([QT4], [$qt4_modules], [QT_INCLUDES="$QT4_CFLAGS"; QT_LIBS="$QT4_LIBS" ; have_qt=yes], [have_qt=no])
fi fi
dnl qt version is set to 'auto' and the preferred version wasn't found. Now try the other. dnl qt version is set to 'auto' and the preferred version wasn't found. Now try the other.
if test x$have_qt = xno && test x$bitcoin_qt_want_version = xauto; then if test "x$have_qt" = xno && test "x$bitcoin_qt_want_version" = xauto; then
if test x$auto_priority_version = xqt5; then if test "x$auto_priority_version" = xqt5; then
PKG_CHECK_MODULES([QT4], [$qt4_modules], [QT_INCLUDES="$QT4_CFLAGS"; QT_LIBS="$QT4_LIBS" ; have_qt=yes; QT_LIB_PREFIX=Qt; bitcoin_qt_got_major_vers=4], [have_qt=no]) PKG_CHECK_MODULES([QT4], [$qt4_modules], [QT_INCLUDES="$QT4_CFLAGS"; QT_LIBS="$QT4_LIBS" ; have_qt=yes; QT_LIB_PREFIX=Qt; bitcoin_qt_got_major_vers=4], [have_qt=no])
else else
PKG_CHECK_MODULES([QT5], [$qt5_modules], [QT_INCLUDES="$QT5_CFLAGS"; QT_LIBS="$QT5_LIBS" ; have_qt=yes; QT_LIB_PREFIX=Qt5; bitcoin_qt_got_major_vers=5], [have_qt=no]) PKG_CHECK_MODULES([QT5], [$qt5_modules], [QT_INCLUDES="$QT5_CFLAGS"; QT_LIBS="$QT5_LIBS" ; have_qt=yes; QT_LIB_PREFIX=Qt5; bitcoin_qt_got_major_vers=5], [have_qt=no])
fi fi
fi fi
if test x$have_qt != xyes; then if test "x$have_qt" != xyes; then
have_qt=no have_qt=no
BITCOIN_QT_FAIL([Qt dependencies not found]) BITCOIN_QT_FAIL([Qt dependencies not found])
fi fi
]) ])
BITCOIN_QT_CHECK([ BITCOIN_QT_CHECK([
PKG_CHECK_MODULES([QT_TEST], [${QT_LIB_PREFIX}Test], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no]) PKG_CHECK_MODULES([QT_TEST], [${QT_LIB_PREFIX}Test], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no])
if test x$use_dbus != xno; then if test "x$use_dbus" != xno; then
PKG_CHECK_MODULES([QT_DBUS], [${QT_LIB_PREFIX}DBus], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no]) PKG_CHECK_MODULES([QT_DBUS], [${QT_LIB_PREFIX}DBus], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no])
fi fi
]) ])
@ -455,7 +481,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[
CXXFLAGS="$PIC_FLAGS $CXXFLAGS" CXXFLAGS="$PIC_FLAGS $CXXFLAGS"
TEMP_LIBS="$LIBS" TEMP_LIBS="$LIBS"
BITCOIN_QT_CHECK([ BITCOIN_QT_CHECK([
if test x$qt_include_path != x; then if test "x$qt_include_path" != x; then
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" 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"
CPPFLAGS="$QT_INCLUDES $CPPFLAGS" CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
fi fi
@ -466,10 +492,10 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[
BITCOIN_QT_CHECK([AC_CHECK_HEADER([QLocalSocket],, BITCOIN_QT_FAIL(QtNetwork headers missing))]) BITCOIN_QT_CHECK([AC_CHECK_HEADER([QLocalSocket],, BITCOIN_QT_FAIL(QtNetwork headers missing))])
BITCOIN_QT_CHECK([ BITCOIN_QT_CHECK([
if test x$bitcoin_qt_want_version = xauto; then if test "x$bitcoin_qt_want_version" = xauto; then
_BITCOIN_QT_CHECK_QT5 _BITCOIN_QT_CHECK_QT5
fi fi
if test x$bitcoin_cv_qt5 = xyes || test x$bitcoin_qt_want_version = xqt5; then if test "x$bitcoin_cv_qt5" = xyes || test "x$bitcoin_qt_want_version" = xqt5; then
QT_LIB_PREFIX=Qt5 QT_LIB_PREFIX=Qt5
bitcoin_qt_got_major_vers=5 bitcoin_qt_got_major_vers=5
else else
@ -480,11 +506,11 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[
BITCOIN_QT_CHECK([ BITCOIN_QT_CHECK([
LIBS= LIBS=
if test x$qt_lib_path != x; then if test "x$qt_lib_path" != x; then
LIBS="$LIBS -L$qt_lib_path" LIBS="$LIBS -L$qt_lib_path"
fi fi
if test x$TARGET_OS = xwindows; then if test "x$TARGET_OS" = xwindows; then
AC_CHECK_LIB([imm32], [main],, BITCOIN_QT_FAIL(libimm32 not found)) AC_CHECK_LIB([imm32], [main],, BITCOIN_QT_FAIL(libimm32 not found))
fi fi
]) ])
@ -494,26 +520,26 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([jpeg_create_decompress] ,[qtjpeg jpeg],,AC_MSG_WARN([libjpeg not found. Assuming qt has it built-in]))) BITCOIN_QT_CHECK(AC_SEARCH_LIBS([jpeg_create_decompress] ,[qtjpeg jpeg],,AC_MSG_WARN([libjpeg not found. Assuming qt has it built-in])))
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([pcre16_exec], [qtpcre pcre16],,AC_MSG_WARN([libpcre16 not found. Assuming qt has it built-in]))) BITCOIN_QT_CHECK(AC_SEARCH_LIBS([pcre16_exec], [qtpcre pcre16],,AC_MSG_WARN([libpcre16 not found. Assuming qt has it built-in])))
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([hb_ot_tags_from_script] ,[qtharfbuzzng harfbuzz],,AC_MSG_WARN([libharfbuzz not found. Assuming qt has it built-in or support is disabled]))) BITCOIN_QT_CHECK(AC_SEARCH_LIBS([hb_ot_tags_from_script] ,[qtharfbuzzng harfbuzz],,AC_MSG_WARN([libharfbuzz not found. Assuming qt has it built-in or support is disabled])))
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Core] ,[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXCore not found))) BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Core] ,[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Core not found)))
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Gui] ,[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXGui not found))) BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Gui] ,[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Gui not found)))
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Network],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXNetwork not found))) BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Network],[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Network not found)))
if test x$bitcoin_qt_got_major_vers = x5; then if test "x$bitcoin_qt_got_major_vers" = x5; then
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Widgets],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXWidgets not found))) BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Widgets],[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Widgets not found)))
fi fi
QT_LIBS="$LIBS" QT_LIBS="$LIBS"
LIBS="$TEMP_LIBS" LIBS="$TEMP_LIBS"
BITCOIN_QT_CHECK([ BITCOIN_QT_CHECK([
LIBS= LIBS=
if test x$qt_lib_path != x; then if test "x$qt_lib_path" != x; then
LIBS="-L$qt_lib_path" LIBS="-L$qt_lib_path"
fi fi
AC_CHECK_LIB([${QT_LIB_PREFIX}Test], [main],, have_qt_test=no) AC_CHECK_LIB([${QT_LIB_PREFIX}Test], [main],, have_qt_test=no)
AC_CHECK_HEADER([QTest],, have_qt_test=no) AC_CHECK_HEADER([QTest],, have_qt_test=no)
QT_TEST_LIBS="$LIBS" QT_TEST_LIBS="$LIBS"
if test x$use_dbus != xno; then if test "x$use_dbus" != xno; then
LIBS= LIBS=
if test x$qt_lib_path != x; then if test "x$qt_lib_path" != x; then
LIBS="-L$qt_lib_path" LIBS="-L$qt_lib_path"
fi fi
AC_CHECK_LIB([${QT_LIB_PREFIX}DBus], [main],, have_qt_dbus=no) AC_CHECK_LIB([${QT_LIB_PREFIX}DBus], [main],, have_qt_dbus=no)