config: Pass the compiler -Werror during warning detection
authorFilipe Brandenburger <filbranden@google.com>
Mon, 2 May 2016 20:26:13 +0000 (13:26 -0700)
committerMark Wielaard <mjw@redhat.com>
Tue, 3 May 2016 09:00:27 +0000 (11:00 +0200)
Otherwise the compilation prints a warning but exits with 0 return code.
However, later during the compilation, when -Werror is enforced to about
every file, the unsupported options start breaking the builds.

Tested: Ran configure with clang-3.5 and built libelf/ tree with it.

  $ autoreconf -i
  $ ./configure CC=clang-3.5 ...
  $ make -C libelf

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
ChangeLog
configure.ac

index f2b5c8f..1ec202a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 2016-05-02  Filipe Brandenburger  <filbranden@google.com>
 
        * configure.ac (argp check): Pass pass &argv.
+       * configure.ac (-W<...> checks): Pass -Werror to the warning checks,
+       to ensure unsupported warning options are noticed during ./configure
+       time and not only later during build.
 
 2016-03-31  Mark Wielaard  <mjw@redhat.com>
 
index 72cb22e..07c0463 100644 (file)
@@ -298,7 +298,7 @@ AS_IF([test "x$enable_symbol_versioning" = "xno"],
 
 AC_CACHE_CHECK([whether gcc accepts -Wstack-usage], ac_cv_stack_usage, [dnl
 old_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wstack-usage=262144"
+CFLAGS="$CFLAGS -Wstack-usage=262144 -Werror"
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
                  ac_cv_stack_usage=yes, ac_cv_stack_usage=no)
 CFLAGS="$old_CFLAGS"])
@@ -319,7 +319,7 @@ AM_CONDITIONAL(SANE_LOGICAL_OP_WARNING,
 # -Wduplicated-cond was added by GCC6
 AC_CACHE_CHECK([whether gcc accepts -Wduplicated-cond], ac_cv_duplicated_cond, [dnl
 old_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wduplicated-cond"
+CFLAGS="$CFLAGS -Wduplicated-cond -Werror"
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
                  ac_cv_duplicated_cond=yes, ac_cv_duplicated_cond=no)
 CFLAGS="$old_CFLAGS"])
@@ -329,7 +329,7 @@ AM_CONDITIONAL(HAVE_DUPLICATED_COND_WARNING,
 # -Wnull-dereference was added by GCC6
 AC_CACHE_CHECK([whether gcc accepts -Wnull-dereference], ac_cv_null_dereference, [dnl
 old_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wnull-dereference"
+CFLAGS="$CFLAGS -Wnull-dereference -Werror"
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
                  ac_cv_null_dereference=yes, ac_cv_null_dereference=no)
 CFLAGS="$old_CFLAGS"])