@@ -178,6 +178,43 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
178178 fi
179179 fi
180180
181+ if test x$use_hardening != xno; then
182+ BITCOIN_QT_CHECK([
183+ AC_MSG_CHECKING ( whether - fPIE can be used with this Qt config )
184+ TEMP_CPPFLAGS=$CPPFLAGS
185+ TEMP_CXXFLAGS=$CXXFLAGS
186+ CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
187+ CXXFLAGS="$PIE_FLAGS $CXXFLAGS"
188+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ [ #include <QtCore/qconfig.h>] ] ,
189+ [ [
190+ #if defined(QT_REDUCE_RELOCATIONS)
191+ choke;
192+ #endif
193+ ] ] ) ] ,
194+ [ AC_MSG_RESULT ( yes ) ; QT_PIE_FLAGS=$PIE_FLAGS ] ,
195+ [ AC_MSG_RESULT ( no ) ; QT_PIE_FLAGS=$PIC_FLAGS]
196+ )
197+ CPPFLAGS=$TEMP_CPPFLAGS
198+ CXXFLAGS=$TEMP_CXXFLAGS
199+ ] )
200+ else
201+ BITCOIN_QT_CHECK([
202+ AC_MSG_CHECKING ( whether - fPIC is needed with this Qt config )
203+ TEMP_CPPFLAGS=$CPPFLAGS
204+ CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
205+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ [ #include <QtCore/qconfig.h>] ] ,
206+ [ [
207+ #if defined(QT_REDUCE_RELOCATIONS)
208+ choke;
209+ #endif
210+ ] ] ) ] ,
211+ [ AC_MSG_RESULT ( no ) ] ,
212+ [ AC_MSG_RESULT ( yes ) ; QT_PIE_FLAGS=$PIC_FLAGS]
213+ )
214+ CPPFLAGS=$TEMP_CPPFLAGS
215+ ] )
216+ fi
217+
181218 BITCOIN_QT_PATH_PROGS([ MOC] , [ moc-qt${bitcoin_qt_got_major_vers} moc${bitcoin_qt_got_major_vers} moc] , $qt_bin_path)
182219 BITCOIN_QT_PATH_PROGS([ UIC] , [ uic-qt${bitcoin_qt_got_major_vers} uic${bitcoin_qt_got_major_vers} uic] , $qt_bin_path)
183220 BITCOIN_QT_PATH_PROGS([ RCC] , [ rcc-qt${bitcoin_qt_got_major_vers} rcc${bitcoin_qt_got_major_vers} rcc] , $qt_bin_path)
@@ -223,6 +260,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
223260 ] )
224261 AC_MSG_RESULT ( [ $bitcoin_enable_qt (Qt${bitcoin_qt_got_major_vers})] )
225262
263+ AC_SUBST ( QT_PIE_FLAGS )
226264 AC_SUBST ( QT_INCLUDES )
227265 AC_SUBST ( QT_LIBS )
228266 AC_SUBST ( QT_LDFLAGS )
0 commit comments