Commit d079041b authored by Stef Walter's avatar Stef Walter

build: Only enable _FORTIFY_SOURCE if optimization enabled

Otherwise we get a spew of warnings when building non-optimized

https://bugzilla.gnome.org/show_bug.cgi?id=677373
parent f2a9d3a4
......@@ -312,9 +312,22 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
-Wuninitialized \
-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
-Wnested-externs -Wpointer-arith \
-Wcast-align -Wsign-compare -Wp,-D_FORTIFY_SOURCE=2 \
-Wcast-align -Wsign-compare \
$CFLAGS"
# Only add this when optimizing is enabled (default)
AC_MSG_CHECKING([whether optimization is enabled])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if __OPTIMIZE__ == 0
#error No optimization
#endif
]], [[]])],
[has_optimization=yes],
[has_optimization=no])
if test $has_optimization = yes; then
CFLAGS="$CFLAGS -Wp,-D_FORTIFY_SOURCE=2"
fi
AC_MSG_RESULT($has_optimization)
for option in -Wno-strict-aliasing -Wno-sign-compare; do
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $option"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment