summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorMichael Haubenwallner <haubi@gentoo.org>2014-05-15 08:36:33 (GMT)
committerMichael Haubenwallner <haubi@gentoo.org>2014-05-15 08:36:33 (GMT)
commit67355d075084e82e1e36caa3dfbbdf81a7b4182e (patch)
treef8a34aefefd34f1ef1a52ff21c9f2668518a77d5 /src/engine
parent5036e8048daeb6aaa3e46065d04f80e49bce3ec1 (diff)
downloadSCons-67355d075084e82e1e36caa3dfbbdf81a7b4182e.zip
SCons-67355d075084e82e1e36caa3dfbbdf81a7b4182e.tar.gz
SCons-67355d075084e82e1e36caa3dfbbdf81a7b4182e.tar.bz2
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.
Diffstat (limited to 'src/engine')
-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 3512522..4e9db21 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 bf71270..3dc8f51 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