Blame SOURCES/cflags.patch

f2be37
From 629e05d8dc795a70fd2bcd3d0301641105bf0b06 Mon Sep 17 00:00:00 2001
f2be37
From: John Dennis <jdennis@redhat.com>
f2be37
Date: Wed, 15 Jun 2016 11:50:24 -0400
f2be37
Subject: [PATCH] enable user supplied CFLAGS
f2be37
Content-Type: text/plain; charset="utf-8"
f2be37
Content-Transfer-Encoding: 8bit
f2be37
f2be37
CFLAGS is initialized to the empty string in configure.ac, this
f2be37
effectively turned off user supplied values for CFLAGS preventing site
f2be37
specific values from being used. A further complicating factor was of
f2be37
all the user supplied values documented in Automake only CFLAGS was
f2be37
disabled allowing all other user supplied variables to take
f2be37
effect. Some variables must be coordinated (e.g. CFLAGS with LDFLAGS),
f2be37
the fact LDFLAGS was picked up from the environment but CFLAGS was
f2be37
discarded caused build failures due to incompatible combination of
f2be37
compiler and linker options.
f2be37
f2be37
The problem was first introduced in commit: 73d9c98f "Reset CFLAGS
f2be37
when --enable-debugging is used". This patch simply removes hardcoding
f2be37
CFLAGS to the empty string and appends the debug options
f2be37
(--enable-debugging) to the existing CFLAGS.
f2be37
f2be37
Proper use of the variables is described in the Automake documentation
f2be37
in the section "Flag Variables Ordering"
f2be37
https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
f2be37
f2be37
Although the Automake documentation claims manipulating CFLAGS
f2be37
directly is improper use there are many examples of this in the
f2be37
existing configure.ac, this patch makes no attempt at addressing this
f2be37
issue, rather it makes existing usage consistent. In the particular
f2be37
case of debug flags appending to CFLAGS is probably the only valid
f2be37
solution because the debug flags must appear at the end of the list of
f2be37
flags in order to override earlier flags, CFLAGS always appears last
f2be37
in the Makefile (see above Automake doc).
f2be37
f2be37
Signed-off-by: John Dennis <jdennis@redhat.com>
f2be37
License: MIT
f2be37
---
f2be37
 configure.ac | 3 +--
f2be37
 1 file changed, 1 insertion(+), 2 deletions(-)
f2be37
f2be37
diff --git a/configure.ac b/configure.ac
f2be37
index 7c58870..cf86262 100644
f2be37
--- a/configure.ac
f2be37
+++ b/configure.ac
f2be37
@@ -91,7 +91,6 @@ dnl
f2be37
 dnl Check for programs
f2be37
 dnl
f2be37
 AC_PROG_CC
f2be37
-CFLAGS=""
f2be37
 AM_CFLAGS=""
f2be37
 AC_HEADER_STDC
f2be37
 LT_AC_PROG_RC
f2be37
@@ -702,7 +701,7 @@ AC_ARG_ENABLE(debugging,   [  --enable-debugging      enable debuging optimizati
f2be37
 if test "z$enable_debugging" = "zyes" ; then
f2be37
     enable_debugging=yes
f2be37
     LASSO_DEFINES="$LASSO_DEFINES -DLASSO_DEBUG"
f2be37
-    AM_CFLAGS="-O0 -g -Wall -Wextra -Werror"
f2be37
+    CFLAGS="$CFLAGS -O0 -g -Wall -Wextra -Werror"
f2be37
 else
f2be37
     enable_debugging=no
f2be37
 fi    
f2be37
-- 
f2be37
2.5.5
f2be37