aboutsummaryrefslogtreecommitdiff
path: root/build-aux/m4/bitcoin_qt.m4
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/m4/bitcoin_qt.m4')
-rw-r--r--build-aux/m4/bitcoin_qt.m446
1 files changed, 45 insertions, 1 deletions
diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4
index 121e10bd37..2480267dc1 100644
--- a/build-aux/m4/bitcoin_qt.m4
+++ b/build-aux/m4/bitcoin_qt.m4
@@ -50,7 +50,7 @@ AC_DEFUN([BITCOIN_QT_INIT],[
dnl enable qt support
AC_ARG_WITH([gui],
[AS_HELP_STRING([--with-gui@<:@=no|qt4|qt5|auto@:>@],
- [build bitcoin-qt GUI (default=auto, qt4 tried first)])],
+ [build bitcoin-qt GUI (default=auto, qt5 tried first)])],
[
bitcoin_qt_want_version=$withval
if test x$bitcoin_qt_want_version = xyes; then
@@ -106,7 +106,9 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
dnl results to QT_LIBS.
BITCOIN_QT_CHECK([
TEMP_CPPFLAGS=$CPPFLAGS
+ TEMP_CXXFLAGS=$CXXFLAGS
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
+ CXXFLAGS="$PIC_FLAGS $CXXFLAGS"
if test x$bitcoin_qt_got_major_vers = x5; then
_BITCOIN_QT_IS_STATIC
if test x$bitcoin_cv_static_qt = xyes; then
@@ -149,6 +151,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
fi
fi
CPPFLAGS=$TEMP_CPPFLAGS
+ CXXFLAGS=$TEMP_CXXFLAGS
])
if test x$use_pkgconfig$qt_bin_path = xyes; then
@@ -157,6 +160,43 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
fi
fi
+ if test x$use_hardening != xno; then
+ 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"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QtCore/qconfig.h>]],
+ [[
+ #if defined(QT_REDUCE_RELOCATIONS)
+ choke;
+ #endif
+ ]])],
+ [ 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"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QtCore/qconfig.h>]],
+ [[
+ #if defined(QT_REDUCE_RELOCATIONS)
+ choke;
+ #endif
+ ]])],
+ [ AC_MSG_RESULT(no)],
+ [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIC_FLAGS]
+ )
+ CPPFLAGS=$TEMP_CPPFLAGS
+ ])
+ fi
+
BITCOIN_QT_PATH_PROGS([MOC], [moc-qt${bitcoin_qt_got_major_vers} moc${bitcoin_qt_got_major_vers} moc], $qt_bin_path)
BITCOIN_QT_PATH_PROGS([UIC], [uic-qt${bitcoin_qt_got_major_vers} uic${bitcoin_qt_got_major_vers} uic], $qt_bin_path)
BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt${bitcoin_qt_got_major_vers} rcc${bitcoin_qt_got_major_vers} rcc], $qt_bin_path)
@@ -202,6 +242,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
])
AC_MSG_RESULT([$bitcoin_enable_qt (Qt${bitcoin_qt_got_major_vers})])
+ AC_SUBST(QT_PIE_FLAGS)
AC_SUBST(QT_INCLUDES)
AC_SUBST(QT_LIBS)
AC_SUBST(QT_LDFLAGS)
@@ -373,6 +414,8 @@ dnl Outputs: bitcoin_qt_got_major_vers is set to "4" or "5".
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"
+ TEMP_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$PIC_FLAGS $CXXFLAGS"
TEMP_LIBS="$LIBS"
BITCOIN_QT_CHECK([
if test x$qt_include_path != x; then
@@ -442,6 +485,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[
fi
])
CPPFLAGS="$TEMP_CPPFLAGS"
+ CXXFLAGS="$TEMP_CXXFLAGS"
LIBS="$TEMP_LIBS"
])