diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-06-17 20:43:13 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-06-17 20:44:11 (GMT) |
commit | 005c59b39500b0b1cb9a0917325a3de7dbc41760 (patch) | |
tree | ad2b9e1ad57b4f664dbc757a3df875c551465ee9 | |
parent | c130b82659c902c05c9812d1340f85c8a998a527 (diff) | |
download | swift-contrib-005c59b39500b0b1cb9a0917325a3de7dbc41760.zip swift-contrib-005c59b39500b0b1cb9a0917325a3de7dbc41760.tar.bz2 |
Check for LibXML version >= 2.6.23.
Earlier versions have a bug in non-namespaced attribute handling.
-rw-r--r-- | BuildTools/SCons/SConstruct | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct index 2eefbc9..2ad78d8 100644 --- a/BuildTools/SCons/SConstruct +++ b/BuildTools/SCons/SConstruct @@ -343,6 +343,21 @@ def CheckPKG(context, name): context.Result( ret ) return ret +def CheckVersion(context, library, version, define, header, value) : + context.Message("Checking " + library + " version (>= " + version + ") ...") + ret = context.TryRun(""" +#include <%(header)s> +#include <stdio.h> + +int main(int argc, char* argv[]) { + printf("%%d\\n", %(define)s); + return 0; +} +""" % { "header" : header, "define": define }, ".c") + ok = ret[0] and int(ret[1]) >= value + context.Result(ok) + return ok + conf = Configure(conf_env) if not conf.CheckCXX() or not conf.CheckCC() : @@ -499,8 +514,8 @@ if env["PLATFORM"] == "win32" : env["HAVE_SNARL"] = True # LibXML -conf = Configure(conf_env) -if conf.CheckCHeader("libxml/parser.h") and conf.CheckLib("xml2") : +conf = Configure(conf_env, custom_tests = {"CheckVersion": CheckVersion}) +if conf.CheckCHeader("libxml/parser.h") and conf.CheckLib("xml2") and conf.CheckVersion("LibXML", "2.6.23", "LIBXML_VERSION", "libxml/xmlversion.h", 20623) : env["HAVE_LIBXML"] = 1 env["LIBXML_FLAGS"] = { "LIBS": ["xml2"] } conf.Finish() @@ -508,8 +523,8 @@ conf.Finish() if not env.get("HAVE_LIBXML", 0) : libxml_env = conf_env.Clone() libxml_env.Append(CPPPATH = ["/usr/include/libxml2"]) - conf = Configure(libxml_env) - if conf.CheckCHeader("libxml/parser.h") and conf.CheckLib("xml2") : + conf = Configure(libxml_env, custom_tests = {"CheckVersion": CheckVersion}) + if conf.CheckCHeader("libxml/parser.h") and conf.CheckLib("xml2") and conf.CheckVersion("LibXML", "2.6.23", "LIBXML_VERSION", "libxml/xmlversion.h", 20623): env["HAVE_LIBXML"] = 1 env["LIBXML_FLAGS"] = { "CPPPATH": ["/usr/include/libxml2"], "LIBS": ["xml2"] } conf.Finish() |