Blame SOURCES/cflags.patch

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