diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2014-08-23 20:28:44 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2014-08-23 20:28:44 (GMT) |
commit | a7d764ed831fa3243aa0bd3307f641e1e1f9f8a8 (patch) | |
tree | 0193d9406107790a66098254869e4b070aa6cacc /src/engine/SCons/Tool/g++.py | |
parent | a6ea2d760464092ea91a0dd01ba6260288aa3587 (diff) | |
parent | 6db60dbe1c3dc28f24bfca48135bcb4bc9bd66d6 (diff) | |
download | SCons-a7d764ed831fa3243aa0bd3307f641e1e1f9f8a8.zip SCons-a7d764ed831fa3243aa0bd3307f641e1e1f9f8a8.tar.gz SCons-a7d764ed831fa3243aa0bd3307f641e1e1f9f8a8.tar.bz2 |
Merged default branch into python3-port to keep it up to date.
Hand-updated a few things to keep them python3-safe, and handled
several merge conflicts.
Diffstat (limited to 'src/engine/SCons/Tool/g++.py')
-rw-r--r-- | src/engine/SCons/Tool/g++.py | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/src/engine/SCons/Tool/g++.py b/src/engine/SCons/Tool/g++.py index 0e1c181..c5eb579 100644 --- a/src/engine/SCons/Tool/g++.py +++ b/src/engine/SCons/Tool/g++.py @@ -40,16 +40,19 @@ import subprocess import SCons.Tool import SCons.Util +from . import gcc cplusplus = __import__(__package__+'.c++', globals(), locals(), ['*']) + compilers = ['g++'] def generate(env): """Add Builders and construction variables for g++ to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - cplusplus.generate(env) + if 'CXX' not in env: + env['CXX'] = env.Detect(compilers) or compilers[0] - env['CXX'] = env.Detect(compilers) + cplusplus.generate(env) # platform specific settings if env['PLATFORM'] == 'aix': @@ -61,26 +64,13 @@ def generate(env): elif env['PLATFORM'] == 'sunos': env['SHOBJSUFFIX'] = '.pic.o' # determine compiler version - if env['CXX']: - #pipe = SCons.Action._subproc(env, [env['CXX'], '-dumpversion'], - pipe = SCons.Action._subproc(env, [env['CXX'], '--version'], - stdin = 'devnull', - stderr = 'devnull', - stdout = subprocess.PIPE) - if pipe.wait() != 0: return - # -dumpversion was added in GCC 3.0. As long as we're supporting - # GCC versions older than that, we should use --version and a - # regular expression. - #line = pipe.stdout.read().strip() - #if line: - # env['CXXVERSION'] = line - line = SCons.Util.to_str (pipe.stdout.readline()) - match = re.search(r'[0-9]+(\.[0-9]+)+', line) - if match: - env['CXXVERSION'] = match.group(0) + version = gcc.detect_version(env, env['CXX']) + if version: + env['CXXVERSION'] = version def exists(env): - return env.Detect(compilers) + # is executable, and is a GNU compiler (or accepts '--version' at least) + return gcc.detect_version(env, env.Detect(env.get('CXX', compilers))) # Local Variables: # tab-width:4 |