aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Cook <busterb@gmail.com>2015-01-05 21:21:23 -0600
committerBrent Cook <bcook@openbsd.org>2015-01-05 21:22:36 -0600
commit4b7e78153c47ae08420558e7e6d8b0bc2591039c (patch)
tree47efde5dbbd607b5ad21eb8192341f5de5cb8152
parent872ecfd856b120347508bf66c492609d1536d256 (diff)
downloadportable-4b7e78153c47ae08420558e7e6d8b0bc2591039c.tar.gz
portable-4b7e78153c47ae08420558e7e6d8b0bc2591039c.tar.bz2
portable-4b7e78153c47ae08420558e7e6d8b0bc2591039c.zip
quoting and ensure old_*flags are restored before the 'else'
-rw-r--r--configure.ac18
1 files changed, 10 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index bee17af..51e35a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,7 +94,7 @@ AC_ARG_ENABLE([hardening],
94 [Disable options to frustrate memory corruption exploits])], 94 [Disable options to frustrate memory corruption exploits])],
95 [], [enable_hardening=yes]) 95 [], [enable_hardening=yes])
96 96
97AC_DEFUN([CHECK_CFLAG], 97AC_DEFUN([CHECK_CFLAG], [
98 AC_LANG_ASSERT(C) 98 AC_LANG_ASSERT(C)
99 AC_MSG_CHECKING([if $saved_CC supports "$1"]) 99 AC_MSG_CHECKING([if $saved_CC supports "$1"])
100 old_cflags="$CFLAGS" 100 old_cflags="$CFLAGS"
@@ -104,13 +104,14 @@ AC_DEFUN([CHECK_CFLAG],
104 ], 104 ],
105 [printf("Hello")], 105 [printf("Hello")],
106 AC_MSG_RESULT([yes]) 106 AC_MSG_RESULT([yes])
107 CFLAGS=$old_cflags
107 HARDEN_CFLAGS="$HARDEN_CFLAGS $1", 108 HARDEN_CFLAGS="$HARDEN_CFLAGS $1",
108 AC_MSG_RESULT([no]) 109 AC_MSG_RESULT([no])
109 $2) 110 CFLAGS=$old_cflags
110 CFLAGS=$old_cflags 111 [$2])
111) 112])
112 113
113AC_DEFUN([CHECK_LDFLAG], 114AC_DEFUN([CHECK_LDFLAG], [
114 AC_LANG_ASSERT(C) 115 AC_LANG_ASSERT(C)
115 AC_MSG_CHECKING([if $saved_LD supports "$1"]) 116 AC_MSG_CHECKING([if $saved_LD supports "$1"])
116 old_ldflags="$LDFLAGS" 117 old_ldflags="$LDFLAGS"
@@ -120,11 +121,12 @@ AC_DEFUN([CHECK_LDFLAG],
120 ], 121 ],
121 [printf("Hello")], 122 [printf("Hello")],
122 AC_MSG_RESULT([yes]) 123 AC_MSG_RESULT([yes])
124 LDFLAGS=$old_ldflags
123 HARDEN_LDFLAGS="$HARDEN_LDFLAGS $1", 125 HARDEN_LDFLAGS="$HARDEN_LDFLAGS $1",
124 AC_MSG_RESULT([no]) 126 AC_MSG_RESULT([no])
125 $2) 127 LDFLAGS=$old_ldflags
126 LDFLAGS=$old_ldflags 128 [$2])
127) 129])
128 130
129AS_IF([test "x$enable_hardening" == "xyes"], [ 131AS_IF([test "x$enable_hardening" == "xyes"], [
130 # Tell GCC to NOT optimize based on signed arithmetic overflow 132 # Tell GCC to NOT optimize based on signed arithmetic overflow