diff options
author | Remko Tronçon <git@el-tramo.be> | 2012-06-04 17:15:34 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-06-05 07:32:01 (GMT) |
commit | e43999d275ff27970ba973edd2be68fb6b998aaf (patch) | |
tree | b3442e40a221b19f60535028e04712396dabe7ed /BuildTools/SCons/SConstruct | |
parent | 1514e787b28ee09ea28d75828bf41049696fd5c7 (diff) | |
download | swift-e43999d275ff27970ba973edd2be68fb6b998aaf.zip swift-e43999d275ff27970ba973edd2be68fb6b998aaf.tar.bz2 |
Added ICU support.
Diffstat (limited to 'BuildTools/SCons/SConstruct')
-rw-r--r-- | BuildTools/SCons/SConstruct | 29 |
1 files changed, 26 insertions, 3 deletions
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() |