File 0171-erts-Remove-Werror-from-CFLAGS-during-configure.patch of Package erlang
From 2e8ea6a10dc81d1d3c623dcf8921fe93bec0f445 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Mon, 2 Nov 2020 16:30:46 +0100
Subject: [PATCH 01/11] erts: Remove -Werror from CFLAGS during configure
We don't want the configure checks to run with -Werror in CFLAGS
so remove it and re-add it before compiling the emulator.
---
erts/configure.in | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/erts/configure.in b/erts/configure.in
index 09b4c0473d..f60bbd515e 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -26,6 +26,15 @@ AC_PREREQ(2.59)
LM_PRECIOUS_VARS
+dnl We check if -Werror was given on command line and if so
+dnl we disable it for the configure and only use it when
+dnl actually building erts
+no_werror_CFLAGS=$(echo "$CFLAGS" | sed 's/-Werror\([[^=]]\|$\)/ /g')
+if test "$CFLAGS" != "$no_werror_CFLAGS"; then
+ CFLAGS="$no_werror_CFLAGS"
+ WERRORFLAGS=-Werror
+fi
+
dnl How to set srcdir absolute is taken from the GNU Emacs distribution
#### Make srcdir absolute, if it isn't already. It's important to
#### avoid running the path through pwd unnecessary, since pwd can
@@ -551,7 +560,7 @@ if test "x$GCC" = xyes; then
LM_TRY_ENABLE_CFLAG([-fno-common], [CFLAGS])
else
WFLAGS=""
- WERRORFLAGS=""
+ WERRORFLAGS=${WERRORFLAGS:-""}
fi
AC_MSG_CHECKING([C99 support])
@@ -3542,6 +3551,14 @@ AH_BOTTOM([
#endif /* __ERTS_CONFIG_H__ */
])
+dnl ----------------------------------------------------------------------
+dnl Check for log2
+dnl ----------------------------------------------------------------------
+AC_CHECK_FUNCS([log2])
+
+dnl ----------------------------------------------------------------------
+dnl Enable any -Werror flags
+dnl ----------------------------------------------------------------------
dnl ----------------------------------------------------------------------
dnl Check for GCC diagnostic ignored "-Waddress-of-packed-member"
@@ -3586,11 +3603,6 @@ CFLAGS="$CFLAGS $sanitizers"
LDFLAGS="$LDFLAGS $sanitizers"
])
-dnl ----------------------------------------------------------------------
-dnl Check for log2
-dnl ----------------------------------------------------------------------
-AC_CHECK_FUNCS([log2])
-
dnl ----------------------------------------------------------------------
dnl Output the result.
dnl ----------------------------------------------------------------------
--
2.26.2