File 1084-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
@@ -31,6 +31,15 @@ AC_PREREQ(2.59)
     cache_file=/dev/null
 fi
 
+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
@@ -593,7 +602,7 @@ if test "x$GCC" = xyes; then
   CFLAGS=$saved_CFLAGS
 else
   WFLAGS=""
-  WERRORFLAGS=""
+  WERRORFLAGS=${WERRORFLAGS:-""}
 fi
 
 AC_SUBST(DEBUG_CFLAGS)
@@ -4976,6 +4985,15 @@ AH_BOTTOM([
 #endif /* __ERTS_CONFIG_H__ */
 ])
 
+dnl ----------------------------------------------------------------------
+dnl Check for log2
+dnl ----------------------------------------------------------------------
+AC_CHECK_FUNCS([log2])
+
+dnl ----------------------------------------------------------------------
+dnl Enable any -Werror flags
+dnl ----------------------------------------------------------------------
+
 if test "x$GCC" = xyes; then
   CFLAGS="$WERRORFLAGS $CFLAGS"
 fi
@@ -5000,11 +5018,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

openSUSE Build Service is sponsored by