From 91f344444c54f11de132cf22a7ba323727104989 Mon Sep 17 00:00:00 2001
From: Vlad Voicu <vladv@rosedu.org>
Date: Mon, 5 Mar 2012 22:08:54 +0200
Subject: Added HAVE_HUNSPELL to flags when building


diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 1412b56..3f15695 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -418,6 +418,14 @@ else :
 
 openssl_conf.Finish()
 
+#Hunspell
+env["HAVE_HUNSPELL"] = 0;
+conf = Configure(conf_env.Clone())
+if conf.CheckLib("hunspell-1.3") :
+	env["HAVE_HUNSPELL"] = 1
+	env["HUNSPELL_FLAGS"] = {"LIBS": ["libhunspell-1.3"]}
+
+
 # Bonjour
 if env["PLATFORM"] == "darwin" :
 	env["HAVE_BONJOUR"] = 1
diff --git a/SwifTools/SConscript b/SwifTools/SConscript
index 41e5b74..d7cff9e 100644
--- a/SwifTools/SConscript
+++ b/SwifTools/SConscript
@@ -7,8 +7,10 @@ Import("env")
 if env["SCONS_STAGE"] == "flags" :
 	env["SWIFTOOLS_FLAGS"] = {
 			"LIBPATH": [Dir(".")],
-			"LIBS": ["SwifTools", "libhunspell-1.3"]
+			"LIBS": ["SwifTools"]
 		}
+	if env["HAVE_HUNSPELL"] :
+		env.MergeFlags(env["HUNSPELL_FLAGS"])
 
 ################################################################################
 # Build
@@ -16,6 +18,7 @@ if env["SCONS_STAGE"] == "flags" :
 
 if env["SCONS_STAGE"] == "build" :
 	swiftools_env = env.Clone()
+		
 	swiftools_env.MergeFlags(swiftools_env["BOOST_FLAGS"])
 
 	sources = [
@@ -28,11 +31,18 @@ if env["SCONS_STAGE"] == "build" :
 			"Linkify.cpp",
 			"TabComplete.cpp",
 			"LastLineTracker.cpp",
+		]
+	
+	if swiftools_env["HAVE_HUNSPELL"] :
+		swiftools_env.MergeFlags(swiftools_env["HUNSPELL_FLAGS"])
+		swiftools_env.Append(CPPDEFINES = ["HAVE_HUNSPELL"])
+		sources += [
 			"SpellCheckerFactory.cpp",
 			"HunspellChecker.cpp",
 			"SpellParser.cpp",
 		]
 
+
 	if swiftools_env.get("HAVE_SPARKLE", 0) :
 		swiftools_env.MergeFlags(swiftools_env["SPARKLE_FLAGS"])
 		swiftools_env.Append(CPPDEFINES = ["HAVE_SPARKLE"])
diff --git a/SwifTools/SpellCheckerFactory.h b/SwifTools/SpellCheckerFactory.h
index 85aa8b6..d58a9ec 100644
--- a/SwifTools/SpellCheckerFactory.h
+++ b/SwifTools/SpellCheckerFactory.h
@@ -6,8 +6,6 @@
 
 #pragma once
 
-#define HAVE_HUNSPELL
-
 namespace Swift {
 	class SpellChecker;
 	class SpellCheckerFactory {
-- 
cgit v0.10.2-6-g49f6