scons: Work around a scons bug when calling TryCompile.
authorGabe Black <gabeblack@google.com>
Fri, 12 Feb 2021 01:42:36 +0000 (17:42 -0800)
committerGabe Black <gabe.black@gmail.com>
Sat, 13 Feb 2021 13:09:05 +0000 (13:09 +0000)
commitde4487f848cc62c6c527707f87efd3ccbb8872a2
tree51ebb4a7d3caec1725df947adc0514ffe9bbef27
parente16301f96b46799a5a9b1c43bf312aa19171f617
scons: Work around a scons bug when calling TryCompile.

When calling TryCompile with an empty string for the source, useful
when just testing a build flag, some versions of SCons will apparently
create some sort of equivalence between Value('') and Value(0). That
shows itself when creating config file headers, where Value(0) is
switched with Value(''), and the header defines a macro with which
expands to nothing rather than a macro which expands to 0. Later uses
of the macro of the form:

 #if CONFIG_VARIABLE

fail because CONFIG_VARIABLE expands to nothing. If it expanded to 0
like it's supposed to, then the guarded block of code would be excluded
correctly.

Change-Id: Ie324ec5f8dd307c65745b9326a11230e10caa0bd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41213
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
site_scons/gem5_scons/configure.py