From 4e4a68c5aecc2bbe9b07f6092d06f836650b2eb9 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Mon, 2 Jan 2006 22:23:13 +0000 Subject: [PATCH] Add code to set $CCVERSION when using gcc. (Anonymous) git-svn-id: http://scons.tigris.org/svn/scons/trunk@1409 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 2 ++ src/engine/SCons/Tool/gcc.py | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6dcc38cb..1153922f 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -20,6 +20,8 @@ RELEASE 0.97 - XXX - Fix the intelc.py Tool module to not throw an exception if the only installed version is something other than ia32. + - Set $CCVERSION when using gcc. + From Erling Andersen: - Fix interpretation of Node.FS objects wrapped in Proxy instances, diff --git a/src/engine/SCons/Tool/gcc.py b/src/engine/SCons/Tool/gcc.py index 761082e8..1be665a9 100644 --- a/src/engine/SCons/Tool/gcc.py +++ b/src/engine/SCons/Tool/gcc.py @@ -36,6 +36,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Util import cc +import os +import re compilers = ['gcc', 'cc'] @@ -48,6 +50,12 @@ def generate(env): env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') else: env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -fPIC') + # determine compiler version + if env['CC']: + line = os.popen(env['CC'] + ' --version').readline() + match = re.search(r'[0-9]+(\.[0-9]+)+', line) + if match: + env['CCVERSION'] = match.group(0) def exists(env): return env.Detect(compilers) -- 2.26.2