[Pkg-gnupg-commit] [gnupg2] 38/124: build: Improve CFLAGS handling.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Apr 5 15:55:31 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gnupg2.
commit 4b57359ef3ce0b87e15889e12ef0fcd23f62dcb4
Author: Justus Winter <justus at g10code.com>
Date: Tue Mar 7 15:20:19 2017 +0100
build: Improve CFLAGS handling.
* configure.ac: Strip any flags matching '-Werror' from CFLAGS before
running the tests, and add them back later on.
--
Previously, the tests were run with empty CFLAGS. This caused
problems, e.g. on Fedora mmap was not detected due to some missing
CFLAGS while running the tests.
GnuPG-bug-id: 2423
Fixes-commit: 02eb9fc9d5863abcfed6af704e618f8cac7cc2e8
Signed-off-by: Justus Winter <justus at g10code.com>
---
configure.ac | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6d35450..8e2fc43 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
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list