From 02eb9fc9d5863abcfed6af704e618f8cac7cc2e8 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Thu, 17 Dec 2015 12:49:06 +0100 Subject: [PATCH] Only add the user supplied CFLAGS after running any autoconf tests. * configure.ac: Only add the user supplied CFLAGS after running any autoconf tests. -- Signed-off-by: Neal H. Walfield If the user's CFLAGS include -Werror, then some configure tests fail. To avoid this, we only add the user's CFLAGS after all of the configure tests have run. --- configure.ac | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/configure.ac b/configure.ac index 77487b23c..266eae5bf 100644 --- a/configure.ac +++ b/configure.ac @@ -85,6 +85,13 @@ 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= + # Some status variables. have_gpg_error=no have_libgcrypt=no @@ -1575,6 +1582,11 @@ AC_ARG_ENABLE(optimization, CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g` fi]) +# +# Add user CFLAGS. +# +CFLAGS="$CFLAGS $CFLAGS_orig" + # # Decide what to build #