aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--configure.ac16
1 files changed, 9 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index 6d35450b0..8e2fc4348 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,12 +85,14 @@ AB_INIT
AC_GNU_SOURCE
-# Before we do anything with the C compiler, we first save the user's
-# CFLAGS (they are restored at the end of the configure script). This
-# is because some configure checks don't work with -Werror, but we'd
-# like to use -Werror with our build.
-CFLAGS_orig=$CFLAGS
-CFLAGS=
+# Before we do anything with the C compiler, we first split the user's
+# CFLAGS into two lists, one containing all flags matching '-Werror',
+# and the other one containing all remaing flags. They are recombined
+# at the end of the configure script. This is because some configure
+# checks don't work with -Werror, but we'd like to use -Werror with
+# our build.
+CFLAGS_werror="$(echo $CFLAGS | tr '[[:space:]]' '\n' | grep -e -Werror | tr '\n' ' ')"
+CFLAGS="$(echo $CFLAGS | tr '[[:space:]]' '\n' | grep -v -e -Werror | tr '\n' ' ')"
# Some status variables.
have_gpg_error=no
@@ -1676,7 +1678,7 @@ fi
#
# Add user CFLAGS.
#
-CFLAGS="$CFLAGS $CFLAGS_orig"
+CFLAGS="$CFLAGS $CFLAGS_werror"
#
# Decide what to build