1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-08 23:37:47 +02:00

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: 02eb9fc9d5
Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2017-03-07 15:20:19 +01:00
parent c22a2a89d3
commit 4b57359ef3
No known key found for this signature in database
GPG Key ID: DD1A52F9DA8C9020

View File

@ -85,12 +85,14 @@ AB_INIT
AC_GNU_SOURCE AC_GNU_SOURCE
# Before we do anything with the C compiler, we first save the user's # Before we do anything with the C compiler, we first split the user's
# CFLAGS (they are restored at the end of the configure script). This # CFLAGS into two lists, one containing all flags matching '-Werror',
# is because some configure checks don't work with -Werror, but we'd # and the other one containing all remaing flags. They are recombined
# like to use -Werror with our build. # at the end of the configure script. This is because some configure
CFLAGS_orig=$CFLAGS # checks don't work with -Werror, but we'd like to use -Werror with
CFLAGS= # 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. # Some status variables.
have_gpg_error=no have_gpg_error=no
@ -1676,7 +1678,7 @@ fi
# #
# Add user CFLAGS. # Add user CFLAGS.
# #
CFLAGS="$CFLAGS $CFLAGS_orig" CFLAGS="$CFLAGS $CFLAGS_werror"
# #
# Decide what to build # Decide what to build