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 <neal@g10code.com>

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.
This commit is contained in:
Neal H. Walfield 2015-12-17 12:49:06 +01:00
parent 1cceba163b
commit 02eb9fc9d5
1 changed files with 12 additions and 0 deletions

View File

@ -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
#