From: Gabe Black Date: Thu, 11 Feb 2021 06:21:06 +0000 (-0800) Subject: scons: In Check(Cxx|Link)Flag, only install the flag if it exists. X-Git-Tag: develop-gem5-snapshot~89 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1828a6e7e35e3247a2b5c9c42dcea6ae09a9b220;p=gem5.git scons: In Check(Cxx|Link)Flag, only install the flag if it exists. These functions where correctly returning whether a flag had existed, and also correctly not installing it if asked not to. Unfortunately if they *were* asked to install the flag, they ignored whether or not it had actually existed to begin with. Change-Id: I2dca0e1a0ddbc182576d48237aeea5452a02c51b Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41159 Maintainer: Gabe Black Maintainer: Jason Lowe-Power Tested-by: kokoro Reviewed-by: Jason Lowe-Power --- diff --git a/site_scons/gem5_scons/configure.py b/site_scons/gem5_scons/configure.py index e539c73a2..cebbb12ed 100644 --- a/site_scons/gem5_scons/configure.py +++ b/site_scons/gem5_scons/configure.py @@ -47,7 +47,7 @@ def CheckCxxFlag(context, flag, autoadd=True): last_cxxflags = context.env['CXXFLAGS'] context.env.Append(CXXFLAGS=[flag]) ret = context.TryCompile('', '.cc') - if not autoadd: + if not (ret and autoadd): context.env['CXXFLAGS'] = last_cxxflags context.Result(ret) return ret @@ -57,7 +57,7 @@ def CheckLinkFlag(context, flag, autoadd=True, set_for_shared=True): last_linkflags = context.env['LINKFLAGS'] context.env.Append(LINKFLAGS=[flag]) ret = context.TryLink('int main(int, char *[]) { return 0; }', '.cc') - if not autoadd: + if not (ret and autoadd): context.env['LINKFLAGS'] = last_linkflags if set_for_shared: assert(autoadd)