2016-09-29 07:57:47 +02:00
dnl Copyright (c) 2013-2016 The Bitcoin Core developers
dnl Distributed under the MIT software license, see the accompanying
dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.
2013-12-13 21:19:02 +01:00
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.
AC_DEFUN([BITCOIN_QT_FAIL],[
2018-01-29 15:37:08 +01:00
if test "x$bitcoin_qt_want_version" = xauto && test "x$bitcoin_qt_force" != xyes; then
if test "x$bitcoin_enable_qt" != xno; then
2015-03-19 15:15:08 +01:00
AC_MSG_WARN([$1; dash-qt frontend will not be built])
2013-12-13 21:19:02 +01:00
fi
bitcoin_enable_qt=no
2015-04-29 16:09:56 +02:00
bitcoin_enable_qt_test=no
2013-12-13 21:19:02 +01:00
else
AC_MSG_ERROR([$1])
fi
])
AC_DEFUN([BITCOIN_QT_CHECK],[
2018-01-29 15:37:08 +01:00
if test "x$bitcoin_enable_qt" != xno && test "x$bitcoin_qt_want_version" != xno; then
2013-12-13 21:19:02 +01:00
true
$1
else
true
$2
fi
])
dnl BITCOIN_QT_PATH_PROGS([FOO], [foo foo2], [/path/to/search/first], [continue if missing])
2014-01-18 21:04:11 +01:00
dnl Helper for finding the path of programs needed for Qt.
2013-12-13 21:19:02 +01:00
dnl Inputs: $1: Variable to be set
dnl Inputs: $2: List of programs to search for
dnl Inputs: $3: Look for $2 here before $PATH
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.
AC_DEFUN([BITCOIN_QT_PATH_PROGS],[
BITCOIN_QT_CHECK([
2018-01-29 15:37:08 +01:00
if test "x$3" != x; then
2013-12-13 21:19:02 +01:00
AC_PATH_PROGS($1,$2,,$3)
else
AC_PATH_PROGS($1,$2)
fi
2018-01-29 15:37:08 +01:00
if test "x$$1" = x && test "x$4" != xyes; then
2013-12-13 21:19:02 +01:00
BITCOIN_QT_FAIL([$1 not found])
fi
])
])
dnl Initialize qt input.
dnl This must be called before any other BITCOIN_QT* macros to ensure that
dnl input variables are set correctly.
dnl CAUTION: Do not use this inside of a conditional.
AC_DEFUN([BITCOIN_QT_INIT],[
dnl enable qt support
2014-01-18 21:11:05 +01:00
AC_ARG_WITH([gui],
2018-06-24 15:56:00 +02:00
[AS_HELP_STRING([--with-gui@<:@=no|qt5|auto@:>@],
[build dash-qt GUI (default=auto)])],
2014-01-10 22:28:57 +01:00
[
bitcoin_qt_want_version=$withval
2018-01-29 15:37:08 +01:00
if test "x$bitcoin_qt_want_version" = xyes; then
2014-01-10 22:28:57 +01:00
bitcoin_qt_force=yes
bitcoin_qt_want_version=auto
fi
],
2013-12-13 21:19:02 +01:00
[bitcoin_qt_want_version=auto])
2014-01-23 14:05:04 +01:00
AC_ARG_WITH([qt-incdir],[AS_HELP_STRING([--with-qt-incdir=INC_DIR],[specify qt include path (overridden by pkgconfig)])], [qt_include_path=$withval], [])
AC_ARG_WITH([qt-libdir],[AS_HELP_STRING([--with-qt-libdir=LIB_DIR],[specify qt lib path (overridden by pkgconfig)])], [qt_lib_path=$withval], [])
AC_ARG_WITH([qt-plugindir],[AS_HELP_STRING([--with-qt-plugindir=PLUGIN_DIR],[specify qt plugin path (overridden by pkgconfig)])], [qt_plugin_path=$withval], [])
2014-08-04 20:39:13 +02:00
AC_ARG_WITH([qt-translationdir],[AS_HELP_STRING([--with-qt-translationdir=PLUGIN_DIR],[specify qt translation path (overridden by pkgconfig)])], [qt_translation_path=$withval], [])
2014-01-23 14:05:04 +01:00
AC_ARG_WITH([qt-bindir],[AS_HELP_STRING([--with-qt-bindir=BIN_DIR],[specify qt bin path])], [qt_bin_path=$withval], [])
2013-12-13 21:19:02 +01:00
AC_ARG_WITH([qtdbus],
[AS_HELP_STRING([--with-qtdbus],
[enable DBus support (default is yes if qt is enabled and QtDBus is found)])],
[use_dbus=$withval],
[use_dbus=auto])
2014-08-04 20:39:13 +02:00
AC_SUBST(QT_TRANSLATION_DIR,$qt_translation_path)
2013-12-13 21:19:02 +01:00
])
dnl Find the appropriate version of Qt libraries and includes.
dnl Inputs: $1: Whether or not pkg-config should be used. yes|no. Default: yes.
2014-01-18 21:11:05 +01:00
dnl Inputs: $2: If $1 is "yes" and --with-gui=auto, which qt version should be
2013-12-13 21:19:02 +01:00
dnl tried first.
dnl Outputs: See _BITCOIN_QT_FIND_LIBS_*
dnl Outputs: Sets variables for all qt-related tools.
dnl Outputs: bitcoin_enable_qt, bitcoin_enable_qt_dbus, bitcoin_enable_qt_test
AC_DEFUN([BITCOIN_QT_CONFIGURE],[
use_pkgconfig=$1
2018-01-29 15:37:08 +01:00
if test "x$use_pkgconfig" = x; then
2013-12-13 21:19:02 +01:00
use_pkgconfig=yes
fi
2018-01-29 15:37:08 +01:00
if test "x$use_pkgconfig" = xyes; then
2018-06-24 15:56:00 +02:00
BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG])
2013-12-13 21:19:02 +01:00
else
BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG])
fi
2014-06-04 05:42:53 +02:00
dnl This is ugly and complicated. Yuck. Works as follows:
2018-06-24 15:56:00 +02:00
dnl For Qt5, we can check a header to find out whether Qt is build
dnl statically. When Qt is built statically, some plugins must be linked into
dnl the final binary as well.
dnl With Qt5, languages moved into core and the WindowsIntegration plugin was
dnl added.
2014-06-04 05:42:53 +02:00
dnl _BITCOIN_QT_CHECK_STATIC_PLUGINS does a quick link-check and appends the
dnl results to QT_LIBS.
BITCOIN_QT_CHECK([
TEMP_CPPFLAGS=$CPPFLAGS
2015-11-10 02:50:25 +01:00
TEMP_CXXFLAGS=$CXXFLAGS
2015-07-23 23:10:15 +02:00
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
2015-11-10 02:50:25 +01:00
CXXFLAGS="$PIC_FLAGS $CXXFLAGS"
2018-06-24 15:56:00 +02:00
_BITCOIN_QT_IS_STATIC
if test "x$bitcoin_cv_static_qt" = xyes; then
_BITCOIN_QT_FIND_STATIC_PLUGINS
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static])
_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])
2018-01-29 15:37:08 +01:00
if test "x$TARGET_OS" = xwindows; then
2018-06-24 15:56:00 +02:00
_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])
elif test "x$TARGET_OS" = xlinux; then
_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])
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)])
_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])
2014-06-04 05:42:53 +02:00
fi
fi
CPPFLAGS=$TEMP_CPPFLAGS
2015-11-10 02:50:25 +01:00
CXXFLAGS=$TEMP_CXXFLAGS
2014-06-04 05:42:53 +02:00
])
2014-09-29 21:26:31 +02:00
2018-01-29 15:37:08 +01:00
if test "x$use_pkgconfig$qt_bin_path" = xyes; then
2018-06-24 15:56:00 +02:00
qt_bin_path="`$PKG_CONFIG --variable=host_bins Qt5Core 2>/dev/null`"
2014-09-29 21:26:31 +02:00
fi
2018-01-29 15:37:08 +01:00
if test "x$use_hardening" != xno; then
2015-11-10 02:52:37 +01:00
BITCOIN_QT_CHECK([
AC_MSG_CHECKING(whether -fPIE can be used with this Qt config)
TEMP_CPPFLAGS=$CPPFLAGS
TEMP_CXXFLAGS=$CXXFLAGS
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
CXXFLAGS="$PIE_FLAGS $CXXFLAGS"
2018-01-29 15:37:08 +01:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QtCore/qconfig.h>
#ifndef QT_VERSION
# include <QtCore/qglobal.h>
#endif
]],
2015-11-10 02:52:37 +01:00
[[
2018-01-29 15:37:08 +01:00
#if defined(QT_REDUCE_RELOCATIONS)
choke
#endif
2015-11-10 02:52:37 +01:00
]])],
[ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIE_FLAGS ],
[ AC_MSG_RESULT(no); QT_PIE_FLAGS=$PIC_FLAGS]
)
CPPFLAGS=$TEMP_CPPFLAGS
CXXFLAGS=$TEMP_CXXFLAGS
])
else
BITCOIN_QT_CHECK([
AC_MSG_CHECKING(whether -fPIC is needed with this Qt config)
TEMP_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
2018-01-29 15:37:08 +01:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QtCore/qconfig.h>
#ifndef QT_VERSION
# include <QtCore/qglobal.h>
#endif
]],
2015-11-10 02:52:37 +01:00
[[
2018-01-29 15:37:08 +01:00
#if defined(QT_REDUCE_RELOCATIONS)
choke
#endif
2015-11-10 02:52:37 +01:00
]])],
[ AC_MSG_RESULT(no)],
[ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIC_FLAGS]
)
CPPFLAGS=$TEMP_CPPFLAGS
])
fi
2018-06-24 15:56:00 +02:00
BITCOIN_QT_PATH_PROGS([MOC], [moc-qt5 moc5 moc], $qt_bin_path)
BITCOIN_QT_PATH_PROGS([UIC], [uic-qt5 uic5 uic], $qt_bin_path)
BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt5 rcc5 rcc], $qt_bin_path)
BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt5 lrelease5 lrelease], $qt_bin_path)
BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt5 lupdate5 lupdate],$qt_bin_path, yes)
2013-12-13 21:19:02 +01:00
2017-12-15 16:21:44 +01:00
BITCOIN_QT_CHECK([
AC_CACHE_CHECK([whether $RCC accepts --format-version option],
[ac_cv_prog_rcc_accepts_format_version],
[ac_cv_prog_rcc_accepts_format_version=no
echo '<!DOCTYPE RCC><RCC version="1.0"/>' > conftest.qrc
$RCC --format-version 1 conftest.qrc >/dev/null 2>&1 && ac_cv_prog_rcc_accepts_format_version=yes
rm -f conftest.qrc])
if test "$ac_cv_prog_rcc_accepts_format_version" = yes; then
RCCFLAGS="--format-version 1"
else
RCCFLAGS=
fi
AC_SUBST(RCCFLAGS)
])
2014-06-05 20:22:54 +02:00
MOC_DEFS='-DHAVE_CONFIG_H -I$(srcdir)'
2013-12-13 21:19:02 +01:00
case $host in
*darwin*)
BITCOIN_QT_CHECK([
2014-01-13 10:30:20 +01:00
MOC_DEFS="${MOC_DEFS} -DQ_OS_MAC"
2013-12-13 21:19:02 +01:00
base_frameworks="-framework Foundation -framework ApplicationServices -framework AppKit"
AX_CHECK_LINK_FLAG([[$base_frameworks]],[QT_LIBS="$QT_LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)])
])
;;
2014-01-27 21:30:51 +01:00
*mingw*)
BITCOIN_QT_CHECK([
AX_CHECK_LINK_FLAG([[-mwindows]],[QT_LDFLAGS="$QT_LDFLAGS -mwindows"],[AC_MSG_WARN(-mwindows linker support not detected)])
])
2013-12-13 21:19:02 +01:00
esac
dnl enable qt support
2016-02-04 13:41:58 +01:00
AC_MSG_CHECKING(whether to build ]AC_PACKAGE_NAME[ GUI)
2013-12-13 21:19:02 +01:00
BITCOIN_QT_CHECK([
bitcoin_enable_qt=yes
bitcoin_enable_qt_test=yes
2018-01-29 15:37:08 +01:00
if test "x$have_qt_test" = xno; then
2013-12-13 21:19:02 +01:00
bitcoin_enable_qt_test=no
fi
2014-03-16 02:33:49 +01:00
bitcoin_enable_qt_dbus=no
2018-01-29 15:37:08 +01:00
if test "x$use_dbus" != xno && test "x$have_qt_dbus" = xyes; then
2014-03-16 02:33:49 +01:00
bitcoin_enable_qt_dbus=yes
fi
2018-01-29 15:37:08 +01:00
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.])
2013-12-13 21:19:02 +01:00
fi
2018-01-29 15:37:08 +01:00
if test "x$LUPDATE" = x; then
AC_MSG_WARN([lupdate is required to update qt translations])
2013-12-13 21:19:02 +01:00
fi
],[
bitcoin_enable_qt=no
])
2018-06-24 15:56:00 +02:00
AC_MSG_RESULT([$bitcoin_enable_qt (Qt5)])
2013-12-13 21:19:02 +01:00
2015-11-10 02:52:37 +01:00
AC_SUBST(QT_PIE_FLAGS)
2013-12-13 21:19:02 +01:00
AC_SUBST(QT_INCLUDES)
AC_SUBST(QT_LIBS)
2014-01-27 21:30:51 +01:00
AC_SUBST(QT_LDFLAGS)
2013-12-13 21:19:02 +01:00
AC_SUBST(QT_DBUS_INCLUDES)
AC_SUBST(QT_DBUS_LIBS)
AC_SUBST(QT_TEST_INCLUDES)
AC_SUBST(QT_TEST_LIBS)
2018-06-24 15:56:00 +02:00
AC_SUBST(QT_SELECT, qt5)
2014-01-13 10:30:20 +01:00
AC_SUBST(MOC_DEFS)
2013-12-13 21:19:02 +01:00
])
dnl All macros below are internal and should _not_ be used from the main
dnl configure.ac.
dnl ----
2019-02-14 21:17:40 +01:00
dnl Internal. Check included version of Qt against minimum specified in doc/dependencies.md
2013-12-13 21:19:02 +01:00
dnl Requires: INCLUDES must be populated as necessary.
dnl Output: bitcoin_cv_qt5=yes|no
AC_DEFUN([_BITCOIN_QT_CHECK_QT5],[
2014-01-18 21:04:11 +01:00
AC_CACHE_CHECK(for Qt 5, bitcoin_cv_qt5,[
2018-01-29 15:37:08 +01:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QtCore/qconfig.h>
#ifndef QT_VERSION
# include <QtCore/qglobal.h>
#endif
]],
2014-08-26 23:25:33 +02:00
[[
2018-05-19 16:22:47 +02:00
#if QT_VERSION < 0x050501 || QT_VERSION_MAJOR < 5
2018-01-29 15:37:08 +01:00
choke
2013-12-13 21:19:02 +01:00
#endif
2014-08-26 23:25:33 +02:00
]])],
[bitcoin_cv_qt5=yes],
[bitcoin_cv_qt5=no])
2013-12-13 21:19:02 +01:00
])])
2018-05-19 16:22:47 +02:00
dnl Internal. Check if the included version of Qt is greater than Qt58.
dnl Requires: INCLUDES must be populated as necessary.
dnl Output: bitcoin_cv_qt5=yes|no
AC_DEFUN([_BITCOIN_QT_CHECK_QT58],[
AC_CACHE_CHECK(for > Qt 5.7, bitcoin_cv_qt58,[
2018-01-29 15:37:08 +01:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QtCore/qconfig.h>
#ifndef QT_VERSION
# include <QtCore/qglobal.h>
#endif
]],
2014-08-26 23:25:33 +02:00
[[
2018-05-19 16:22:47 +02:00
#if QT_VERSION_MINOR < 8
2018-01-29 15:37:08 +01:00
choke
2013-12-13 21:19:02 +01:00
#endif
2014-08-26 23:25:33 +02:00
]])],
2018-05-19 16:22:47 +02:00
[bitcoin_cv_qt58=yes],
[bitcoin_cv_qt58=no])
])])
dnl Internal. Check if the linked version of Qt was built as static libs.
dnl Requires: Qt5.
dnl Requires: INCLUDES and LIBS must be populated as necessary.
dnl Output: bitcoin_cv_static_qt=yes|no
dnl Output: Defines QT_STATICPLUGIN if plugins are static.
AC_DEFUN([_BITCOIN_QT_IS_STATIC],[
AC_CACHE_CHECK(for static Qt, bitcoin_cv_static_qt,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QtCore/qconfig.h>
#ifndef QT_VERSION OR QT_VERSION_STR
# include <QtCore/qglobal.h>
#endif
]],
[[
#if !defined(QT_STATIC)
choke
#endif
]])],
[bitcoin_cv_static_qt=yes],
[bitcoin_cv_static_qt=no])
])
2018-01-29 15:37:08 +01:00
if test "x$bitcoin_cv_static_qt" = xyes; then
2014-01-18 21:04:11 +01:00
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol for static Qt plugins])
2013-12-13 21:19:02 +01:00
fi
])
dnl Internal. Check if the link-requirements for static plugins are met.
dnl Requires: INCLUDES and LIBS must be populated as necessary.
dnl Inputs: $1: A series of Q_IMPORT_PLUGIN().
dnl Inputs: $2: The libraries that resolve $1.
dnl Output: QT_LIBS is prepended or configure exits.
AC_DEFUN([_BITCOIN_QT_CHECK_STATIC_PLUGINS],[
2014-01-18 21:04:11 +01:00
AC_MSG_CHECKING(for static Qt plugins: $2)
2013-12-13 21:19:02 +01:00
CHECK_STATIC_PLUGINS_TEMP_LIBS="$LIBS"
LIBS="$2 $QT_LIBS $LIBS"
2014-08-26 23:25:33 +02:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2013-12-13 21:19:02 +01:00
#define QT_STATICPLUGIN
#include <QtPlugin>
2014-08-26 23:25:33 +02:00
$1]],
[[return 0;]])],
2013-12-13 21:19:02 +01:00
[AC_MSG_RESULT(yes); QT_LIBS="$2 $QT_LIBS"],
2014-08-26 23:25:33 +02:00
[AC_MSG_RESULT(no); BITCOIN_QT_FAIL(Could not resolve: $2)])
2013-12-13 21:19:02 +01:00
LIBS="$CHECK_STATIC_PLUGINS_TEMP_LIBS"
])
2015-08-01 05:21:34 +02:00
dnl Internal. Find paths necessary for linking qt static plugins
dnl Inputs: qt_plugin_path. optional.
dnl Outputs: QT_LIBS is appended
AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[
2018-06-24 15:56:00 +02:00
if test "x$qt_plugin_path" != x; then
QT_LIBS="$QT_LIBS -L$qt_plugin_path/platforms"
if test -d "$qt_plugin_path/accessible"; then
QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible"
2015-08-01 05:21:34 +02:00
fi
2018-05-19 16:22:47 +02:00
if test "x$use_pkgconfig" = xyes; then
: dnl
m4_ifdef([PKG_CHECK_MODULES],[
if test x$bitcoin_cv_qt58 = xno; then
PKG_CHECK_MODULES([QTPLATFORM], [Qt5PlatformSupport], [QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS"])
else
PKG_CHECK_MODULES([QTFONTDATABASE], [Qt5FontDatabaseSupport], [QT_LIBS="-lQt5FontDatabaseSupport $QT_LIBS"])
PKG_CHECK_MODULES([QTEVENTDISPATCHER], [Qt5EventDispatcherSupport], [QT_LIBS="-lQt5EventDispatcherSupport $QT_LIBS"])
PKG_CHECK_MODULES([QTTHEME], [Qt5ThemeSupport], [QT_LIBS="-lQt5ThemeSupport $QT_LIBS"])
PKG_CHECK_MODULES([QTDEVICEDISCOVERY], [Qt5DeviceDiscoverySupport], [QT_LIBS="-lQt5DeviceDiscoverySupport $QT_LIBS"])
PKG_CHECK_MODULES([QTACCESSIBILITY], [Qt5AccessibilitySupport], [QT_LIBS="-lQt5AccessibilitySupport $QT_LIBS"])
PKG_CHECK_MODULES([QTFB], [Qt5FbSupport], [QT_LIBS="-lQt5FbSupport $QT_LIBS"])
fi
if test "x$TARGET_OS" = xlinux; then
PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"])
PKG_CHECK_MODULES([QTXCBQPA], [Qt5XcbQpa], [QT_LIBS="$QTXCBQPA_LIBS $QT_LIBS"])
elif test "x$TARGET_OS" = xdarwin; then
PKG_CHECK_MODULES([QTCLIPBOARD], [Qt5ClipboardSupport], [QT_LIBS="-lQt5ClipboardSupport $QT_LIBS"])
PKG_CHECK_MODULES([QTGRAPHICS], [Qt5GraphicsSupport], [QT_LIBS="-lQt5GraphicsSupport $QT_LIBS"])
PKG_CHECK_MODULES([QTCGL], [Qt5CglSupport], [QT_LIBS="-lQt5CglSupport $QT_LIBS"])
fi
])
else
if test "x$TARGET_OS" = xwindows; then
AC_CACHE_CHECK(for Qt >= 5.6, bitcoin_cv_need_platformsupport,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QtCore/qconfig.h>
#ifndef QT_VERSION
# include <QtCore/qglobal.h>
#endif
]],
[[
#if QT_VERSION < 0x050600 || QT_VERSION_MINOR < 6
choke
#endif
]])],
[bitcoin_cv_need_platformsupport=yes],
[bitcoin_cv_need_platformsupport=no])
])
if test "x$bitcoin_cv_need_platformsupport" = xyes; then
if test x$bitcoin_cv_qt58 = xno; then
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}PlatformSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXPlatformSupport not found)))
else
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}FontDatabaseSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXFontDatabaseSupport not found)))
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}EventDispatcherSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXEventDispatcherSupport not found)))
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}ThemeSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXThemeSupport not found)))
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}FbSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXFbSupport not found)))
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}DeviceDiscoverySupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXDeviceDiscoverySupport not found)))
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}AccessibilitySupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXAccessibilitySupport not found)))
QT_LIBS="$QT_LIBS -lversion -ldwmapi -luxtheme"
fi
fi
2016-06-20 13:31:17 +02:00
fi
2015-08-01 05:21:34 +02:00
fi
2018-06-24 15:56:00 +02:00
fi
2015-08-01 05:21:34 +02:00
])
2013-12-13 21:19:02 +01:00
dnl Internal. Find Qt libraries using pkg-config.
2014-01-18 21:11:05 +01:00
dnl Inputs: bitcoin_qt_want_version (from --with-gui=). The version to check
2013-12-13 21:19:02 +01:00
dnl first.
dnl Inputs: $1: If bitcoin_qt_want_version is "auto", check for this version
dnl first.
dnl Outputs: All necessary QT_* variables are set.
dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no.
AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[
m4_ifdef([PKG_CHECK_MODULES],[
2018-06-24 15:56:00 +02:00
QT_LIB_PREFIX=Qt5
2013-12-13 21:19:02 +01:00
qt5_modules="Qt5Core Qt5Gui Qt5Network Qt5Widgets"
BITCOIN_QT_CHECK([
2018-06-24 15:56:00 +02:00
PKG_CHECK_MODULES([QT5], [$qt5_modules], [QT_INCLUDES="$QT5_CFLAGS"; QT_LIBS="$QT5_LIBS" have_qt=yes],[have_qt=no])
2013-12-13 21:19:02 +01:00
2018-01-29 15:37:08 +01:00
if test "x$have_qt" != xyes; then
2013-12-13 21:19:02 +01:00
have_qt=no
BITCOIN_QT_FAIL([Qt dependencies not found])
fi
])
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])
2018-01-29 15:37:08 +01:00
if test "x$use_dbus" != xno; then
2013-12-13 21:19:02 +01:00
PKG_CHECK_MODULES([QT_DBUS], [${QT_LIB_PREFIX}DBus], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no])
fi
])
])
true; dnl
])
dnl Internal. Find Qt libraries without using pkg-config. Version is deduced
dnl from the discovered headers.
2014-01-18 21:11:05 +01:00
dnl Inputs: bitcoin_qt_want_version (from --with-gui=). The version to use.
2013-12-13 21:19:02 +01:00
dnl If "auto", the version will be discovered by _BITCOIN_QT_CHECK_QT5.
dnl Outputs: All necessary QT_* variables are set.
dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no.
AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[
TEMP_CPPFLAGS="$CPPFLAGS"
2015-11-10 02:50:25 +01:00
TEMP_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$PIC_FLAGS $CXXFLAGS"
2013-12-13 21:19:02 +01:00
TEMP_LIBS="$LIBS"
BITCOIN_QT_CHECK([
2018-01-29 15:37:08 +01:00
if test "x$qt_include_path" != x; then
2013-12-13 21:19:02 +01:00
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"
fi
])
BITCOIN_QT_CHECK([AC_CHECK_HEADER([QtPlugin],,BITCOIN_QT_FAIL(QtCore headers missing))])
BITCOIN_QT_CHECK([AC_CHECK_HEADER([QApplication],, BITCOIN_QT_FAIL(QtGui headers missing))])
BITCOIN_QT_CHECK([AC_CHECK_HEADER([QLocalSocket],, BITCOIN_QT_FAIL(QtNetwork headers missing))])
BITCOIN_QT_CHECK([
2018-01-29 15:37:08 +01:00
if test "x$bitcoin_qt_want_version" = xauto; then
2013-12-13 21:19:02 +01:00
_BITCOIN_QT_CHECK_QT5
2018-05-19 16:22:47 +02:00
_BITCOIN_QT_CHECK_QT58
2013-12-13 21:19:02 +01:00
fi
2018-06-24 15:56:00 +02:00
QT_LIB_PREFIX=Qt5
2013-12-13 21:19:02 +01:00
])
BITCOIN_QT_CHECK([
LIBS=
2018-01-29 15:37:08 +01:00
if test "x$qt_lib_path" != x; then
2013-12-13 21:19:02 +01:00
LIBS="$LIBS -L$qt_lib_path"
fi
2018-01-29 15:37:08 +01:00
if test "x$TARGET_OS" = xwindows; then
2013-12-13 21:19:02 +01:00
AC_CHECK_LIB([imm32], [main],, BITCOIN_QT_FAIL(libimm32 not found))
fi
])
2014-06-04 05:42:53 +02:00
BITCOIN_QT_CHECK(AC_CHECK_LIB([z] ,[main],,AC_MSG_WARN([zlib not found. Assuming qt has it built-in])))
2017-01-30 09:00:51 +01:00
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([jpeg_create_decompress] ,[qtjpeg jpeg],,AC_MSG_WARN([libjpeg not found. Assuming qt has it built-in])))
2018-05-19 16:22:47 +02:00
if test x$bitcoin_cv_qt58 = xno; then
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([png_error] ,[qtpng png],,AC_MSG_WARN([libpng 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])))
else
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([png_error] ,[qtlibpng png],,AC_MSG_WARN([libpng not found. Assuming qt has it built-in])))
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([pcre2_match_16], [qtpcre2 libqtpcre2],,AC_MSG_WARN([libqtpcre2 not found. Assuming qt has it built-in])))
fi
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])))
2018-01-29 15:37:08 +01:00
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_PREFIX}Gui not found)))
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Network],[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Network not found)))
2018-06-24 15:56:00 +02:00
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Widgets],[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Widgets not found)))
2013-12-13 21:19:02 +01:00
QT_LIBS="$LIBS"
LIBS="$TEMP_LIBS"
BITCOIN_QT_CHECK([
LIBS=
2018-01-29 15:37:08 +01:00
if test "x$qt_lib_path" != x; then
2013-12-13 21:19:02 +01:00
LIBS="-L$qt_lib_path"
fi
AC_CHECK_LIB([${QT_LIB_PREFIX}Test], [main],, have_qt_test=no)
AC_CHECK_HEADER([QTest],, have_qt_test=no)
QT_TEST_LIBS="$LIBS"
2018-01-29 15:37:08 +01:00
if test "x$use_dbus" != xno; then
2013-12-13 21:19:02 +01:00
LIBS=
2018-01-29 15:37:08 +01:00
if test "x$qt_lib_path" != x; then
2013-12-13 21:19:02 +01:00
LIBS="-L$qt_lib_path"
fi
AC_CHECK_LIB([${QT_LIB_PREFIX}DBus], [main],, have_qt_dbus=no)
AC_CHECK_HEADER([QtDBus],, have_qt_dbus=no)
QT_DBUS_LIBS="$LIBS"
fi
])
CPPFLAGS="$TEMP_CPPFLAGS"
2015-11-10 02:50:25 +01:00
CXXFLAGS="$TEMP_CXXFLAGS"
2013-12-13 21:19:02 +01:00
LIBS="$TEMP_LIBS"
])