aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2015-11-09 20:50:25 -0500
committerCory Fields <cory-nospam-@coryfields.com>2015-11-09 22:50:31 -0500
commit17c4d9d1647bbac4b0557136b1c3d98c951feb79 (patch)
tree52d40429bc8a781199595ee2a8cac6472163cb57 /configure.ac
parent503ff6e1ae6932b63892099b4c63e92a9263fed6 (diff)
build: Split hardening/fPIE options out
This allows for fPIE to be used selectively.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac19
1 files changed, 12 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index d94dd0c3dc..e8aea902ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -326,6 +326,7 @@ case $host in
AX_CHECK_LINK_FLAG([[-Wl,-headerpad_max_install_names]], [LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"])
CPPFLAGS="$CPPFLAGS -DMAC_OSX"
+ OBJCXXFLAGS="$CXXFLAGS"
;;
*linux*)
TARGET_OS=linux
@@ -424,6 +425,11 @@ if test x$use_glibc_compat != xno; then
fi
+if test x$TARGET_OS != xwindows; then
+ # All windows code is PIC, forcing it on just adds useless compile warnings
+ AX_CHECK_COMPILE_FLAG([-fPIC],[PIC_FLAGS="-fPIC"])
+fi
+
if test x$use_hardening != xno; then
AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"])
@@ -441,8 +447,7 @@ if test x$use_hardening != xno; then
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"])
if test x$TARGET_OS != xwindows; then
- # All windows code is PIC, forcing it on just adds useless compile warnings
- AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"])
+ AX_CHECK_COMPILE_FLAG([-fPIE],[PIE_FLAGS="-fPIE"])
AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"])
fi
@@ -451,11 +456,6 @@ if test x$use_hardening != xno; then
AC_CHECK_LIB([ssp], [main],, AC_MSG_ERROR(lib missing))
;;
esac
-
- CXXFLAGS="$CXXFLAGS $HARDENED_CXXFLAGS"
- CPPFLAGS="$CPPFLAGS $HARDENED_CPPFLAGS"
- LDFLAGS="$LDFLAGS $HARDENED_LDFLAGS"
- OBJCXXFLAGS="$CXXFLAGS"
fi
dnl this flag screws up non-darwin gcc even when the check fails. special-case it.
@@ -915,6 +915,11 @@ AC_SUBST(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE)
AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR)
AC_SUBST(RELDFLAGS)
+AC_SUBST(HARDENED_CXXFLAGS)
+AC_SUBST(HARDENED_CPPFLAGS)
+AC_SUBST(HARDENED_LDFLAGS)
+AC_SUBST(PIC_FLAGS)
+AC_SUBST(PIE_FLAGS)
AC_SUBST(LIBTOOL_APP_LDFLAGS)
AC_SUBST(USE_UPNP)
AC_SUBST(USE_QRCODE)