From: garyo Date: Thu, 7 May 2009 02:11:06 +0000 (+0000) Subject: Fix #1673, CheckLib should prepend rather than append. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=77e8ae403ee61a295ac9946c1a97f1560156aa85;p=scons.git Fix #1673, CheckLib should prepend rather than append. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4175 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/RELEASE.txt b/src/RELEASE.txt index 810bdddd..5691dd70 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 63273530..e995e77a 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 85864028..3749e41a 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)