aboutsummaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2012-07-07 22:35:55 +0000
committerBill Meier <wmeier@newsguy.com>2012-07-07 22:35:55 +0000
commit88c8b9218d11c7088b4c6a1b88eb839f64b52413 (patch)
treebbab2eba192d27ac0a317ff713e2c02c7fc2cc63 /configure.in
parent9a2dc60d7265cea82873e0f5ab1439bd2ce1c33e (diff)
Use -D_FORTIFY_SOURCE=2 only if the gc optimization level is greater than 0.
Fixes Bug #7449: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7449 ----- Issue: Building Wireshark with '-O0 -D_FORTIFY_SOURCE=2 ...' fails The warning [error] message: /usr/include/features.h:314:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]` A bit of research shows that this warning was added to a recent version of glibc (on at least Fedora). See: http://sourceware.org/bugzilla/show_bug.cgi?id=13979 The warning message occurs if -D_FORTIFY_SOURCE=... is used and the gcc 'optimization level' == 0 (-O0). Unfortunately when building with -O0 this warning message: 1. Causes compiles to fail (if -Werror [stop on warning]) 2. Causes ./configure to fail with an (incorrect) message about the pcap header being older than the libpcap version. svn path=/trunk/; revision=43601
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in12
1 files changed, 7 insertions, 5 deletions
diff --git a/configure.in b/configure.in
index b6f9eeadb0..490571bed2 100644
--- a/configure.in
+++ b/configure.in
@@ -436,12 +436,14 @@ else
CPPFLAGS="-D_U_=\"\" $CPPFLAGS"
fi
-# If we're running GCC or CLang, always use FORTIFY_SOURCE=2
+# If we're running GCC or CLang, use FORTIFY_SOURCE=2
+# (only if the GCC 'optimization level' > 0).
+#
# See: http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html
-# Note: FORTIFY_SOURCE is only effective for gcc -O2 (and -O1 ?)
-if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
- CPPFLAGS="-D_FORTIFY_SOURCE=2 $CPPFLAGS"
-fi
+# See: http://sourceware.org/bugzilla/show_bug.cgi?id=13979
+#
+# Note: FORTIFY_SOURCE is only effective for gcc optimization level > 0 (-O1, etc)
+AC_WIRESHARK_GCC_FORTIFY_SOURCE_CHECK
#
# If the compiler supports GCC-style flags, enable a barrier "stop on