From 5349e609e1ee23549a390e3ef85f2e9964dd0ef9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Wed, 8 Dec 2010 18:48:49 +0100
Subject: Added LibIDN include/libflags.


diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index bdb7d48..75129b7 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -39,6 +39,9 @@ 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(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")
 vars.Add(PathVariable("qt", "Qt location", "", PathVariable.PathAccept))
 vars.Add(PathVariable("docbook_xml", "DocBook XML", None, PathVariable.PathAccept))
 vars.Add(PathVariable("docbook_xsl", "DocBook XSL", None, PathVariable.PathAccept))
@@ -318,12 +321,6 @@ if conf.CheckLib("c") :
 if conf.CheckLib("stdc++") :
 	env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["stdc++"]
 
-# LibIDN
-if conf.CheckCHeader("idna.h") and conf.CheckLib("idn") :
-	env["LIBIDN_FLAGS"] = { "LIBS": ["idn"] }
-else :
-	env["LIBIDN_BUNDLED"] = 1
-
 # Avahi
 if env["PLATFORM"] != "darwin" :
 	if conf.CheckCHeader("avahi-client/client.h") and conf.CheckLib("avahi-client") and conf.CheckLib("avahi-common") :
@@ -463,6 +460,23 @@ if not env.get("HAVE_EXPAT", 0) and not env.get("HAVE_LIBXML", 0) :
 	env["HAVE_EXPAT"] = 1
 	env["EXPAT_BUNDLED"] = True
 
+# LibIDN
+libidn_conf_env = conf_env.Clone()
+libidn_flags = {}
+if env.get("libidn_libdir", None) :
+	libidn_flags["LIBPATH"] = [env["libidn_libdir"]]
+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"]) :
+	env["HAVE_LIBIDN"] = 1
+	env["LIBIDN_FLAGS"] = { "LIBS": [env["libidn_libname"]] }
+	env["LIBIDN_FLAGS"].update(libidn_flags)
+else :
+	env["LIBIDN_BUNDLED"] = 1
+conf.Finish()
+
 # Qt
 if env["qt"] :
 	env["QTDIR"] = env["qt"]
-- 
cgit v0.10.2-6-g49f6