File u_autoconf-Don-t-modify-CFLAGS-in-configure-scripts.patch of Package glu

From: Egbert Eich <eich@suse.de>
Date: Tue Jul 12 07:36:18 2016 +0200
Subject: [PATCH]autoconf: Don't modify CFLAGS in configure scripts
Patch-mainline: to be upstreamed
Git-repo: git://anongit.freedesktop.org/git/mesa/glu
Git-commit: 2bc3b2f952c642445d32d7ae4422088d9d2e7619
References: 
Signed-off-by: Egbert Eich <eich@suse.com>

CFLAGS (and CXXFLAGS) may be overridden by the user at make time.
Therefore it is not advisable to set them explicitely in the
configure script.

Signed-off-by: Egbert Eich <eich@suse.de>
---
 Makefile.am  |  4 ++--
 configure.ac | 14 ++++++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 3050df1..834c7e2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -30,8 +30,8 @@ AM_CPPFLAGS = -DLIBRARYBUILD \
 	-I$(top_srcdir)/src/libnurbs/internals \
 	-I$(top_srcdir)/src/libnurbs/interface \
 	-I$(top_srcdir)/src/libnurbs/nurbtess
-AM_CFLAGS = $(GL_CFLAGS) $(OSMESA_CFLAGS) $(WARNCFLAGS) $(VISIBILITY_CFLAGS)
-AM_CXXFLAGS = $(GL_CFLAGS) $(OSMESA_CFLAGS) $(WARNCXXFLAGS) $(VISIBILITY_CXXFLAGS)
+AM_CFLAGS = $(GL_CFLAGS) $(OSMESA_CFLAGS) $(WARNCFLAGS) $(VISIBILITY_CFLAGS) $(DEBUGCFLAGS)
+AM_CXXFLAGS = $(GL_CFLAGS) $(OSMESA_CFLAGS) $(WARNCXXFLAGS) $(VISIBILITY_CXXFLAGS) $(DEBUGCXXFLAGS)
 
 GL_includedir = $(includedir)/GL
 GL_include_HEADERS = \
diff --git a/configure.ac b/configure.ac
index 45abf17..ab93d8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,10 +42,16 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 AC_ARG_ENABLE(debug,
               AS_HELP_STRING([--enable-debug],
                 [Enable debugging information]),
-              [CFLAGS="$CFLAGS -g -O0 -DDEBUG"
-               CXXFLAGS="$CXXFLAGS -g -O0 -DDEBUG"],
-              [CFLAGS="$CFLAGS -DNDEBUG"
-               CXXFLAGS="$CXXFLAGS -DNDEBUG"])
+              AS_IF([test "$enableval" = xyes],
+	      [DEBUGCFLAGS="-g -O0 -DDEBUG"
+	       DEBUGCXXFLAGS="-g -O0 -DDEBUG"],
+	      [test "$enableval" = xno],
+	      [DEBUGCFLAGS="-DNDEBUG"
+	       DEBUGCXXFLAGS="-DNDEBUG"]),
+              [DEBUGCFLAGS="-DNDEBUG"
+               DEBUGCXXFLAGS="-DNDEBUG"])
+AC_SUBST([DEBUGCFLAGS])
+AC_SUBST([DEBUGCXXFLAGS])
 
 dnl Make sure the pkg-config macros are defined
 m4_ifndef([PKG_PROG_PKG_CONFIG],