From dad0795cd24ab5e0350fc96a4c8c51f97d1ab1dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sat, 6 Nov 2010 19:16:54 +0100
Subject: Added boost libdir and includedir flags.


diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 85a8205..8690eca 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -34,6 +34,8 @@ if os.name == "nt" :
 if os.name == "nt" :
 	vars.Add(PackageVariable("bonjour", "Bonjour SDK location", "yes"))
 vars.Add(PackageVariable("openssl", "OpenSSL location", "yes"))
+vars.Add(PathVariable("boost_includedir", "Boost headers location", None, PathVariable.PathAccept))
+vars.Add(PathVariable("boost_libdir", "Boost library location", None, PathVariable.PathAccept))
 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")
@@ -316,7 +318,23 @@ if conf.CheckCHeader("idna.h") and conf.CheckLib("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") :
+		env["HAVE_AVAHI"] = True
+		env["AVAHI_FLAGS"] = { "LIBS": ["avahi-client", "avahi-common"] }
+
+conf.Finish()
+
 # Boost
+boost_conf_env = conf_env.Clone()
+boost_flags = {}
+if env.get("boost_libdir", None) :
+	boost_flags["LIBPATH"] = [env["boost_libdir"]]
+if env.get("boost_includedir", None) :
+	boost_flags["CPPPATH"] = [env["boost_includedir"]]
+boost_conf_env.MergeFlags(boost_flags)
+conf = Configure(boost_conf_env)
 boostLibs = [("signals", None), ("thread", None), ("regex", None), ("program_options", None), ("filesystem", None), ("system", "system/system_error.hpp"), ("date_time", "date_time/date.hpp")]
 allLibsPresent = True
 libNames = []
@@ -328,29 +346,26 @@ for (lib, header) in boostLibs :
 	if not conf.CheckCXXHeader(header) :
 		allLibsPresent = False
 		break
-	libName = "boost_" + lib
-	if not conf.CheckLib(libName) :
-		libName += "-mt"
+	if env["PLATFORM"] != "win32" :
+		libName = "boost_" + lib
 		if not conf.CheckLib(libName) :
-			allLibsPresent = False
-			break
-	libNames.append(libName)
+			libName += "-mt"
+			if not conf.CheckLib(libName) :
+				allLibsPresent = False
+				break
+		libNames.append(libName)
 if allLibsPresent :
-	env["BOOST_FLAGS"] = { "LIBS": libNames }
+	env["BOOST_FLAGS"] = boost_flags
+	if env["PLATFORM"] != "win32" :
+		env["BOOST_FLAGS"].update({"LIBS": libNames})
 	if not conf.CheckCXXHeader("boost/uuid/uuid.hpp") :
 		# FIXME: Remove this workaround when UUID is available in most distros
 		env["BOOST_BUNDLED_UUID_ONLY"] = True
 else :
 	env["BOOST_BUNDLED"] = True
-
-# Avahi
-if env["PLATFORM"] != "darwin" :
-	if conf.CheckCHeader("avahi-client/client.h") and conf.CheckLib("avahi-client") and conf.CheckLib("avahi-common") :
-		env["HAVE_AVAHI"] = True
-		env["AVAHI_FLAGS"] = { "LIBS": ["avahi-client", "avahi-common"] }
-
 conf.Finish()
 
+
 # Xss
 env["HAVE_XSS"] = 0
 if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
-- 
cgit v0.10.2-6-g49f6