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.m438
1 files changed, 38 insertions, 0 deletions
diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4
index 6f9c0ae218..2480267dc1 100644
--- a/build-aux/m4/bitcoin_qt.m4
+++ b/build-aux/m4/bitcoin_qt.m4
@@ -160,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)
@@ -205,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)