summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2018-12-24 20:14:58 -0800
committerFred Wright <fw@fwright.net>2018-12-25 19:27:24 -0800
commit62714ccce87c488bb6aac8aa1332eb26ca8fe732 (patch)
treee9c2dcbd05b6966db69de9c06884a5351a43b3d5 /SConstruct
parentda4a2b80309c541df26637d585a04acb346ec4e5 (diff)
downloadgpsd-62714ccce87c488bb6aac8aa1332eb26ca8fe732.tar.gz
Fixes unreliability in CheckCompilerOption().
The code to restore the old CFLAGS when an option test failed was sometimes a victim of Python's "list by reference rather than value" issue. The effect was that the removal of the failing option sometimes didn't work. The bug was only observed when the build was being run by MacPorts, for some unknown reason. This has apparently been broken ever since the introduction of CheckCompilerOption(), though it didn't cause trouble until "Wvla" was added to the option list, where it broke builds on OSX 10.5 and 10.6, whose compilers don't support the option. The fix is simply to use the "[:]" construct to copy the list. TESTED: Tested both "bare" build and MacPorts "destroot" on MacPro 10.9, and VMs for macOS 10.5-10.13. Failures on 10.5 and 10.6 are now gone.
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct2
1 files changed, 1 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index c0256e5d..6e6caf96 100644
--- a/SConstruct
+++ b/SConstruct
@@ -566,7 +566,7 @@ def CheckXsltproc(context):
def CheckCompilerOption(context, option):
context.Message('Checking if compiler accepts %s... ' % (option,))
- old_CFLAGS = context.env['CFLAGS']
+ old_CFLAGS = context.env['CFLAGS'][:] # Get a *copy* of the old list
context.env.Append(CFLAGS=option)
ret = context.TryLink("""
int main(int argc, char **argv) {