From 0f11ce655ec68ff5290212d6c1b8ad96a3eaf776 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Thu, 7 May 2009 02:11:06 +0000 Subject: Fix #1673, CheckLib should prepend rather than append. --- src/RELEASE.txt | 12 ++++++++++++ src/engine/SCons/Conftest.py | 18 ++++++++++++++---- src/engine/SCons/SConf.py | 5 +++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/RELEASE.txt b/src/RELEASE.txt index 810bddd..5691dd7 100644 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -867,6 +867,18 @@ RELEASE 1.2.0.d20090223 - Mon, 23 Feb 2009 08:41:06 -0800 EnsureSConsVersion(0, 96, 93) + -- THE CheckLib Configure TEST WILL CHANGE BEHAVIOR + + The CheckLib() Configure test appends the lib(s) to the + Environment's LIBS list in 1.3 and earlier. In 1.3 there is a + new CheckLib argument, append, which defaults to True to + preserve the old behavior. In a future release, append will + be changed to default to False, to conform with autoconf and + user expectations, since it is usually used to build up + library lists in a right-to-left way. + + + SCons is developed with an extensive regression test suite, and a rigorous development methodology for continually improving that suite. Because of this, SCons is of sufficient quality that you can use it diff --git a/src/engine/SCons/Conftest.py b/src/engine/SCons/Conftest.py index 6327353..e995e77 100644 --- a/src/engine/SCons/Conftest.py +++ b/src/engine/SCons/Conftest.py @@ -64,13 +64,19 @@ Autoconf-like configuration support; low level implementation of tests. # Append "lib_name_list" to the value of LIBS. # "lib_namelist" is a list of strings. # Return the value of LIBS before changing it (any type -# can be used, it is passed to SetLIBS() later. +# can be used, it is passed to SetLIBS() later.) +# +# context.PrependLIBS(lib_name_list) +# Prepend "lib_name_list" to the value of LIBS. +# "lib_namelist" is a list of strings. +# Return the value of LIBS before changing it (any type +# can be used, it is passed to SetLIBS() later.) # # context.SetLIBS(value) # Set LIBS to "value". The type of "value" is what # AppendLIBS() returned. # Return the value of LIBS before changing it (any type -# can be used, it is passed to SetLIBS() later. +# can be used, it is passed to SetLIBS() later.) # # context.headerfilename # Name of file to append configure results to, usually @@ -572,7 +578,8 @@ int main() return st def CheckLib(context, libs, func_name = None, header = None, - extra_libs = None, call = None, language = None, autoadd = 1): + extra_libs = None, call = None, language = None, autoadd = 1, + append = True): """ Configure check for a C or C++ libraries "libs". Searches through the list of libraries, until one is found where the test succeeds. @@ -657,7 +664,10 @@ return 0; l = [ lib_name ] if extra_libs: l.extend(extra_libs) - oldLIBS = context.AppendLIBS(l) + if append: + oldLIBS = context.AppendLIBS(l) + else: + oldLIBS = context.PrependLIBS(l) sym = "HAVE_LIB" + lib_name else: oldLIBS = -1 diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index 8586402..3749e41 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -853,6 +853,11 @@ class CheckContext: self.env.Append(LIBS = lib_name_list) return oldLIBS + def PrependLIBS(self, lib_name_list): + oldLIBS = self.env.get( 'LIBS', [] ) + self.env.Prepend(LIBS = lib_name_list) + return oldLIBS + def SetLIBS(self, val): oldLIBS = self.env.get( 'LIBS', [] ) self.env.Replace(LIBS = val) -- cgit v0.12