diff options
Diffstat (limited to 'BuildTools')
-rw-r--r-- | BuildTools/SCons/SConscript.boot | 1 | ||||
-rw-r--r-- | BuildTools/SCons/SConstruct | 29 |
2 files changed, 27 insertions, 3 deletions
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot index 098df0a..16c05c3 100644 --- a/BuildTools/SCons/SConscript.boot +++ b/BuildTools/SCons/SConscript.boot @@ -41,6 +41,7 @@ vars.Add(PathVariable("boost_libdir", "Boost library location", None, PathVariab vars.Add(PathVariable("expat_includedir", "Expat headers location", None, PathVariable.PathAccept)) vars.Add(PathVariable("expat_libdir", "Expat library location", None, PathVariable.PathAccept)) vars.Add("expat_libname", "Expat library name", "libexpat" if os.name == "nt" else "expat") +vars.Add(PackageVariable("icu", "ICU library location", "no")) vars.Add(PathVariable("libidn_includedir", "LibIDN headers location", None, PathVariable.PathAccept)) vars.Add(PathVariable("libidn_libdir", "LibIDN library location", None, PathVariable.PathAccept)) vars.Add("libidn_libname", "LibIDN library name", "libidn" if os.name == "nt" else "idn") diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct index e91dd6e..eef7a80 100644 --- a/BuildTools/SCons/SConstruct +++ b/BuildTools/SCons/SConstruct @@ -294,6 +294,27 @@ if not env.get("HAVE_EXPAT", 0) and not env.get("HAVE_LIBXML", 0) : env["HAVE_EXPAT"] = 1 env["EXPAT_BUNDLED"] = True +################################################################################ +# IDN library +################################################################################ + +# ICU +icu_env = conf_env.Clone() +use_icu = bool(env["icu"]) +icu_prefix = env["icu"] if isinstance(env["icu"], str) else "" +icu_flags = {} +if icu_prefix : + icu_flags = { "CPPPATH": [os.path.join(icu_prefix, "include")] } + icu_flags["LIBPATH"] = [os.path.join(icu_prefix, "lib")] + icu_env.MergeFlags(icu_flags) + +icu_conf = Configure(icu_env) +if use_icu and icu_conf.CheckCHeader("unicode/usprep.h") : + env["HAVE_ICU"] = 1 + env["ICU_FLAGS"] = icu_flags + env["ICU_FLAGS"]["LIBS"] = ["icuuc"] +icu_conf.Finish() + # LibIDN libidn_conf_env = conf_env.Clone() libidn_flags = {} @@ -303,14 +324,16 @@ if env.get("libidn_includedir", None) : libidn_flags["CPPPATH"] = [env["libidn_includedir"]] libidn_conf_env.MergeFlags(libidn_flags) conf = Configure(libidn_conf_env) -if conf.CheckCHeader("idna.h") and conf.CheckLib(env["libidn_libname"]) : +if not env.get("HAVE_ICU") and conf.CheckCHeader("idna.h") and conf.CheckLib(env["libidn_libname"]) : env["HAVE_LIBIDN"] = 1 env["LIBIDN_FLAGS"] = { "LIBS": [env["libidn_libname"]] } env["LIBIDN_FLAGS"].update(libidn_flags) -else : - env["LIBIDN_BUNDLED"] = 1 conf.Finish() +# Fallback to bundled LibIDN +if not env.get("HAVE_ICU", False) and not env.get("HAVE_LIBIDN", False) : + env["LIBIDN_BUNDLED"] = 1 + # LibMiniUPnPc if env["experimental"] : #libminiupnpc_conf_env = conf_env.Clone() |