From 67355d075084e82e1e36caa3dfbbdf81a7b4182e Mon Sep 17 00:00:00 2001 From: Michael Haubenwallner Date: Thu, 15 May 2014 10:36:33 +0200 Subject: 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. --- src/engine/SCons/Tool/aixlink.py | 15 ++++++++------- src/engine/SCons/Tool/gnulink.py | 11 ++++++++--- 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 -- cgit v0.12