From 239cd48bc87ffbf95e6fe2dd6bd708b3fc9b1855 Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Mon, 2 May 2016 13:26:13 -0700 Subject: [PATCH] config: Pass the compiler -Werror during warning detection 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 --- ChangeLog | 3 +++ configure.ac | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f2b5c8f..1ec202a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2016-05-02 Filipe Brandenburger * 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 diff --git a/configure.ac b/configure.ac index 72cb22e..07c0463 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.7.4