gnucash maint: Add _FORTIFY_SOURCE directive only when compiling with optimization enabled
Geert Janssens
gjanssens at code.gnucash.org
Fri May 2 09:58:52 EDT 2014
Updated via https://github.com/Gnucash/gnucash/commit/ca480862 (commit)
from https://github.com/Gnucash/gnucash/commit/08c59b58 (commit)
commit ca48086287045c0af08b0dde62ce121e00a8e0c0
Author: Geert Janssens <janssens-geert at telenet.be>
Date: Fri May 2 15:55:48 2014 +0200
Add _FORTIFY_SOURCE directive only when compiling with optimization enabled
diff --git a/configure.ac b/configure.ac
index 7a8032e..48f3ecd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1319,8 +1319,18 @@ then
else if test "`echo ${GCC_VERSION} | cut -d. -f1`" -ge 4; then
# This is gcc >= 4.x.x
warnFLAGS="${warnFLAGS} -Wdeclaration-after-statement -Wno-pointer-sign"
- # rpmbuild on FC4 forces this flag. Can't hurt to always compile with it.
- warnFLAGS="${warnFLAGS} -D_FORTIFY_SOURCE=2"
+ # rpmbuild on FC4 forces this flag. Only add it when optimizing
+ have_optimization=
+ for flag in $CFLAGS; do
+ tmp_flag=`echo $flag | sed -e 's,-O.,,'`
+ if `echo $flag | grep -q -- '-O'` ; then
+ have_optimization=yes
+ fi
+ done
+
+ if test "x${have_optimization}" = xyes; then
+ warnFLAGS="${warnFLAGS} -D_FORTIFY_SOURCE=2"
+ fi
fi
fi
CFLAGS="${warnFLAGS} ${CFLAGS}"
Summary of changes:
configure.ac | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
More information about the gnucash-changes
mailing list