summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2006-01-02 22:23:13 (GMT)
committerSteven Knight <knight@baldmt.com>2006-01-02 22:23:13 (GMT)
commit94dbfd9cae5e8078e766c5aec8ae33b6fbeb2644 (patch)
tree775b1b395cd5fb93bf4809b787e21ba7545fc028
parentfda39509db065f7c935dd4442436dfa2f6bdc37e (diff)
downloadSCons-94dbfd9cae5e8078e766c5aec8ae33b6fbeb2644.zip
SCons-94dbfd9cae5e8078e766c5aec8ae33b6fbeb2644.tar.gz
SCons-94dbfd9cae5e8078e766c5aec8ae33b6fbeb2644.tar.bz2
Add code to set $CCVERSION when using gcc. (Anonymous)
-rw-r--r--src/CHANGES.txt2
-rw-r--r--src/engine/SCons/Tool/gcc.py8
2 files changed, 10 insertions, 0 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 6dcc38c..1153922 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 761082e..1be665a 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)