File 0003-build-avoid-overriding-user-s-CFLAGS.patch of Package libsocketcan

From ac258ff2403e43a3b29bedea117fa6b2e22c84a0 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Sun, 30 Dec 2012 08:16:30 +0100
Subject: [PATCH 3/3] build: avoid overriding user's CFLAGS

When attempting to `./configure CFLAGS=-O3`, -O2 is still taking
precedence. CFLAGS *must* *not* be touched - this is a user variable.
This patch fixes that.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
 configure.ac       |    7 ++++---
 src/GNUmakefile.am |    1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index fb9253b..f60a06d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,7 +10,7 @@ AC_CONFIG_AUX_DIR([config/autoconf])
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 
-CFLAGS="${CFLAGS} -Wall"
+my_CFLAGS="-Wall"
 
 #
 # libtool library versioning stuff
@@ -99,11 +99,12 @@ AC_ARG_ENABLE(debug,
     [CONFIG_DEBUG=no])
 AC_MSG_RESULT([${CONFIG_DEBUG}])
 if test "${CONFIG_DEBUG}" = "yes"; then
-    CFLAGS="${CFLAGS} -Werror -Wsign-compare -Wfloat-equal -Wformat-security -g -O1"
+    my_CFLAGS="$my_CFLAGS -Werror -Wsign-compare -Wfloat-equal -Wformat-security -g -O1"
     AC_DEFINE(DEBUG, 1, [debugging])
 else
-    CFLAGS="${CFLAGS} -O2"
+    my_CFLAGS="$my_CFLAGS -O2"
 fi
+AC_SUBST([my_CFLAGS])
 
 
 AC_CONFIG_FILES([
diff --git a/src/GNUmakefile.am b/src/GNUmakefile.am
index 1709bbe..32ff3a1 100644
--- a/src/GNUmakefile.am
+++ b/src/GNUmakefile.am
@@ -1,5 +1,6 @@
 lib_LTLIBRARIES = libsocketcan.la
 
+AM_CFLAGS = ${my_CFLAGS}
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_builddir)/include
-- 
1.7.10.4

openSUSE Build Service is sponsored by