From b6e77a03685c8cca575c026b8b3ae5a86bb0f828 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sun, 17 Apr 2011 13:13:43 +0200
Subject: Fixed Linux compilation.


diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 0ee1d0e..9ad5277 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -328,6 +328,12 @@ def checkObjCHeader(context, header) :
 if ARGUMENTS.get("force-configure", 0) :
   SCons.SConf.SetCacheMode("force")
 
+def CheckPKG(context, name):
+	context.Message( 'Checking for package %s... ' % name )
+	ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
+	context.Result( ret )
+	return ret
+
 conf = Configure(conf_env)
 
 if not conf.CheckCXX() or not conf.CheckCC() :
@@ -425,17 +431,26 @@ if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
 # GConf
 env["HAVE_GCONF"] = 0
 if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
-	gconf_env = Environment()
-	gconf_env.ParseConfig('pkg-config --cflags gconf-2.0 --libs gconf-2.0')
-	conf = Configure(gconf_env)
-	if conf.CheckCHeader("gconf/gconf-client.h") and conf.CheckLib("gconf-2") :
-		env["HAVE_GCONF"] = 1
-		env["GCONF_FLAGS"] = {
-			"LIBS": gconf_env["LIBS"],
-			"CCFLAGS": gconf_env["CCFLAGS"],
-			"CPPPATH": gconf_env["CPPPATH"],
-			"CPPDEFINES": gconf_env["CPPDEFINES"],
-		}
+	gconf_env = conf_env.Clone()
+	conf = Configure(gconf_env, custom_tests = {"CheckPKG": CheckPKG})
+	if conf.CheckPKG("gconf-2.0") :
+		gconf_bare_env = Environment()
+		gconf_bare_env.ParseConfig('pkg-config --cflags gconf-2.0 --libs gconf-2.0')
+		gconf_flags = {
+				"LIBS": gconf_bare_env["LIBS"],
+				"CCFLAGS": gconf_bare_env["CCFLAGS"],
+				"CPPPATH": gconf_bare_env["CPPPATH"],
+				"CPPDEFINES": gconf_bare_env["CPPDEFINES"],
+			}
+		gconf_env.MergeFlags(gconf_flags)
+		if conf.CheckCHeader("gconf/gconf-client.h") and conf.CheckLib("gconf-2") :
+			env["HAVE_GCONF"] = 1
+			env["GCONF_FLAGS"] = {
+				"LIBS": gconf_env["LIBS"],
+				"CCFLAGS": gconf_env["CCFLAGS"],
+				"CPPPATH": gconf_env["CPPPATH"],
+				"CPPDEFINES": gconf_env["CPPDEFINES"],
+			}
 	conf.Finish()
 
 # Sparkle
diff --git a/Swiften/Elements/StatusShow.cpp b/Swiften/Elements/StatusShow.cpp
new file mode 100644
index 0000000..656e5c4
--- /dev/null
+++ b/Swiften/Elements/StatusShow.cpp
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Elements/StatusShow.h>
+
+using namespace Swift;
+
+StatusShow::StatusShow(const Type& type) : type_(type) {
+}
diff --git a/Swiften/Elements/StatusShow.h b/Swiften/Elements/StatusShow.h
index 6ea8385..cd3477e 100644
--- a/Swiften/Elements/StatusShow.h
+++ b/Swiften/Elements/StatusShow.h
@@ -13,8 +13,7 @@ namespace Swift {
 		public:
 			enum Type { Online, Away, FFC, XA, DND, None };
 
-			StatusShow(const Type& type = Online) : type_(type) {
-			}
+			StatusShow(const Type& type = Online);
 
 			void setType(const Type& type) {
 				type_ = type;
@@ -37,6 +36,7 @@ namespace Swift {
 					case DND: return 3;
 					case None: return 0;
 				}
+				return 0;
 			}
 
 		private:
diff --git a/Swiften/Roster/XMPPRosterController.cpp b/Swiften/Roster/XMPPRosterController.cpp
index baa74ff..bd7e079 100644
--- a/Swiften/Roster/XMPPRosterController.cpp
+++ b/Swiften/Roster/XMPPRosterController.cpp
@@ -7,6 +7,7 @@
 #include "Swiften/Roster/XMPPRosterController.h"
 
 #include <boost/bind.hpp>
+#include <iostream>
 
 #include "Swiften/Base/foreach.h"
 #include "Swiften/Elements/RosterItemPayload.h"
diff --git a/Swiften/SConscript b/Swiften/SConscript
index f207c62..d2706f1 100644
--- a/Swiften/SConscript
+++ b/Swiften/SConscript
@@ -6,7 +6,7 @@ Import("env")
 # Flags
 ################################################################################
 
-swiften_dep_modules = ["BOOST", "LIBIDN", "ZLIB", "OPENSSL", "LIBXML", "EXPAT", "AVAHI"]
+swiften_dep_modules = ["BOOST", "GCONF", "LIBIDN", "ZLIB", "OPENSSL", "LIBXML", "EXPAT", "AVAHI"]
 
 if env["SCONS_STAGE"] == "flags" :
 	swiften_env = env.Clone()
@@ -76,6 +76,7 @@ if env["SCONS_STAGE"] == "build" :
 			"Elements/RosterItemExchangePayload.cpp",
 			"Elements/RosterPayload.cpp",
 			"Elements/Stanza.cpp",
+			"Elements/StatusShow.cpp",
 			"Elements/VCard.cpp",
 			"Elements/MUCOccupant.cpp",
 			"Entity/Entity.cpp",
-- 
cgit v0.10.2-6-g49f6