summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haubenwallner <haubi@gentoo.org>2014-05-15 10:36:33 +0200
committerMichael Haubenwallner <haubi@gentoo.org>2014-05-15 10:36:33 +0200
commit5bc9a827da4b9058469b0c779d704d769ac87d07 (patch)
treef8a34aefefd34f1ef1a52ff21c9f2668518a77d5
parent8ba875c2d0a5954a0f29a6260cb4c109de17f641 (diff)
downloadscons-5bc9a827da4b9058469b0c779d704d769ac87d07.tar.gz
Delegate linker Tool.exists() to CC/CXX Tool.exists().
Even for linking, need to respect CC/CXX specified by the user (issue#1723). And when CC is specified but not CXX, assume the user knows there is nothing to link with CXX, and delegate to CC Tool.exists() only. However, this somehow should be synchronized with link.smart_link() to choose the correct linker.
-rw-r--r--src/engine/SCons/Tool/aixlink.py15
-rw-r--r--src/engine/SCons/Tool/gnulink.py11
2 files changed, 16 insertions, 10 deletions
diff --git a/src/engine/SCons/Tool/aixlink.py b/src/engine/SCons/Tool/aixlink.py
index 35125220..4e9db21b 100644
--- a/src/engine/SCons/Tool/aixlink.py
+++ b/src/engine/SCons/Tool/aixlink.py
@@ -37,7 +37,6 @@ import os.path
import SCons.Util
-import aixcc
import link
cplusplus = __import__('c++', globals(), locals(), [])
@@ -62,12 +61,14 @@ def generate(env):
env['SHLIBSUFFIX'] = '.a'
def exists(env):
- path, _cc, _shcc, version = aixcc.get_xlc(env)
- if path and _cc:
- xlc = os.path.join(path, _cc)
- if os.path.exists(xlc):
- return xlc
- return None
+ # TODO: sync with link.smart_link() to choose a linker
+ linkers = { 'CXX': ['aixc++'], 'CC': ['aixcc'] }
+ alltools = []
+ for langvar, linktools in linkers.items():
+ if langvar in env: # use CC over CXX when user specified CC but not CXX
+ return SCons.Tool.FindTool(linktools, env)
+ alltools.extend(linktools)
+ return SCons.Tool.FindTool(alltools, env)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Tool/gnulink.py b/src/engine/SCons/Tool/gnulink.py
index bf71270f..3dc8f51b 100644
--- a/src/engine/SCons/Tool/gnulink.py
+++ b/src/engine/SCons/Tool/gnulink.py
@@ -37,8 +37,6 @@ import SCons.Util
import link
-linkers = ['g++', 'gcc']
-
def generate(env):
"""Add Builders and construction variables for gnulink to an Environment."""
link.generate(env)
@@ -53,7 +51,14 @@ def generate(env):
env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}'
def exists(env):
- return env.Detect(linkers)
+ # TODO: sync with link.smart_link() to choose a linker
+ linkers = { 'CXX': ['g++'], 'CC': ['gcc'] }
+ alltools = []
+ for langvar, linktools in linkers.items():
+ if langvar in env: # use CC over CXX when user specified CC but not CXX
+ return SCons.Tool.FindTool(linktools, env)
+ alltools.extend(linktools)
+ return SCons.Tool.FindTool(alltools, env) # find CXX or CC
# Local Variables:
# tab-width:4