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(a)google.com>
---
ChangeLog | 3 +++
configure.ac | 6 +++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f2b5c8fa17e0..1ec202ac9ae4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
2016-05-02 Filipe Brandenburger <filbranden(a)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(a)redhat.com>
diff --git a/configure.ac b/configure.ac
index 72cb22e82d8a..07c04637adaa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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"])
--
2.8.0.rc3.226.g39d4020