diff options
author | Steven Knight <knight@baldmt.com> | 2004-04-04 10:31:02 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-04-04 10:31:02 (GMT) |
commit | 3a0ca2e66fd1449d3a9b400aabe17fee0eb7f496 (patch) | |
tree | 5c8da26b597fef5f74c31741063eb4d20bb1b8fa /src/engine/SCons/Conftest.py | |
parent | 548e7108e2bc2363aaf1fee7366765faa630be60 (diff) | |
download | SCons-3a0ca2e66fd1449d3a9b400aabe17fee0eb7f496.zip SCons-3a0ca2e66fd1449d3a9b400aabe17fee0eb7f496.tar.gz SCons-3a0ca2e66fd1449d3a9b400aabe17fee0eb7f496.tar.bz2 |
Allow CheckLib to search a list of libraries. (sam th)
Diffstat (limited to 'src/engine/SCons/Conftest.py')
-rw-r--r-- | src/engine/SCons/Conftest.py | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/src/engine/SCons/Conftest.py b/src/engine/SCons/Conftest.py index a6bedf5..7260a52 100644 --- a/src/engine/SCons/Conftest.py +++ b/src/engine/SCons/Conftest.py @@ -305,10 +305,11 @@ def CheckType(context, type_name, fallback = None, return ret -def CheckLib(context, lib_name, func_name, header = None, +def CheckLib(context, libs, func_name, header = None, extra_libs = None, call = None, language = None, autoadd = 1): """ - Configure check for a C or C++ library "lib_name". + Configure check for a C or C++ libraries "libs". Searches through + the list of libraries, until one is found where the test succeeds. Tests if "func_name" or "call" exists in the library. Note: if it exists in another library the test succeeds anyway! Optional "header" can be defined to include a header file. If not given a @@ -333,11 +334,6 @@ def CheckLib(context, lib_name, func_name, header = None, if not header: header = "" - lang, suffix, msg = _lang2suffix(language) - if msg: - context.Display("Cannot check for library %s: %s\n" % (lib_name, msg)) - return msg - text = """ %s %s """ % (includetext, header) @@ -369,27 +365,36 @@ def CheckLib(context, lib_name, func_name, header = None, else: calltext = call - context.Display("Checking for %s in %s library %s... " - % (calltext, lang, lib_name)) - if lib_name: - l = [ lib_name ] - if extra_libs: - l.extend(extra_libs) - oldLIBS = context.AppendLIBS(l) - sym = "HAVE_LIB" + lib_name - else: - oldLIBS = -1 - sym = None + for lib_name in libs: + + lang, suffix, msg = _lang2suffix(language) + if msg: + context.Display("Cannot check for library %s: %s\n" % (lib_name, msg)) + return msg + + context.Display("Checking for %s in %s library %s... " + % (calltext, lang, lib_name)) + if lib_name: + l = [ lib_name ] + if extra_libs: + l.extend(extra_libs) + oldLIBS = context.AppendLIBS(l) + sym = "HAVE_LIB" + lib_name + else: + oldLIBS = -1 + sym = None - ret = context.BuildProg(text, suffix) + ret = context.BuildProg(text, suffix) - _YesNoResult(context, ret, sym, text) - if oldLIBS != -1 and (ret or not autoadd): - context.SetLIBS(oldLIBS) + _YesNoResult(context, ret, sym, text) + if oldLIBS != -1 and (ret or not autoadd): + context.SetLIBS(oldLIBS) + + if ret == "": + return ret return ret - # # END OF PUBLIC FUNCTIONS # |