From 884e831ed07607097614276f6bbf192993228100 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Date: Tue, 2 Jun 2015 11:08:17 +0200
Subject: [PATCH 3/4] 004-use-env.patch

---
 build_common/SConscript | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

--- a/build_common/SConscript
+++ b/build_common/SConscript
@@ -151,6 +151,26 @@ tc_set_msg = '''
 * cause inexplicable errors.                                                  *
 *******************************************************************************
 '''
+env['ENV'] = os.environ
+if 'CC' in os.environ:
+	env['CC'] = Split(os.environ['CC'])
+	print "using CC from environment: %s" % env['CC']
+if 'CXX' in os.environ:
+	env['CXX'] = Split(os.environ['CXX'])
+	print "using CXX from environment: %s" % env['CXX']
+if 'CFLAGS' in os.environ:
+	env['CFLAGS'] = Split(os.environ['CFLAGS'])
+	print "using CFLAGS from environment: %s" % env['CFLAGS']
+if 'CXXFLAGS' in os.environ:
+	env['CXXFLAGS'] = Split(os.environ['CXXFLAGS'])
+	print "using CXXFLAGS from environment: %s" % env['CXXFLAGS']
+if 'CPPFLAGS' in os.environ:
+	env['CPPFLAGS'] = Split(os.environ['CPPFLAGS'])
+	print "using CPPFLAGS from environment: %s" % env['CPPFLAGS']
+if 'LDFLAGS' in os.environ:
+	env['LINKFLAGS'] = Split(os.environ['LDFLAGS'])
+	print "using LDFLAGS/LINKFLAGS from environment: %s" % env['LINKFLAGS']
+
 if env.get('VERBOSE') == False:
 	env['CCCOMSTR'] = "Compiling $TARGET"
 	env['SHCCCOMSTR'] = "Compiling $TARGET"
