summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Network/PlatformNATTraversalWorker.cpp13
-rw-r--r--Swiften/Network/SConscript26
2 files changed, 27 insertions, 12 deletions
diff --git a/Swiften/Network/PlatformNATTraversalWorker.cpp b/Swiften/Network/PlatformNATTraversalWorker.cpp
index 40d6da6..133b006 100644
--- a/Swiften/Network/PlatformNATTraversalWorker.cpp
+++ b/Swiften/Network/PlatformNATTraversalWorker.cpp
@@ -14,8 +14,12 @@
#include <Swiften/Network/NATTraversalGetPublicIPRequest.h>
#include <Swiften/Network/NATTraversalForwardPortRequest.h>
#include <Swiften/Network/NATTraversalRemovePortForwardingRequest.h>
+#ifdef HAVE_LIBNATPMP
#include <Swiften/Network/NATPMPInterface.h>
+#endif
+#ifdef HAVE_LIBMINIUPNPC
#include <Swiften/Network/MiniUPnPInterface.h>
+#endif
namespace Swift {
@@ -117,12 +121,17 @@ PlatformNATTraversalWorker::~PlatformNATTraversalWorker() {
addRequestToQueue(boost::shared_ptr<PlatformNATTraversalRequest>());
thread->join();
delete thread;
+#ifdef HAVE_LIBNATPMP
delete natPMPInterface;
+#endif
+#ifdef HAVE_LIBMINIUPNPC
delete miniUPnPInterface;
+#endif
delete nullNATTraversalInterface;
}
NATTraversalInterface* PlatformNATTraversalWorker::getNATTraversalInterface() const {
+#ifdef HAVE_LIBMINIUPNPC
if (boost::logic::indeterminate(miniUPnPSupported)) {
miniUPnPInterface = new MiniUPnPInterface();
miniUPnPSupported = miniUPnPInterface->isAvailable();
@@ -130,8 +139,9 @@ NATTraversalInterface* PlatformNATTraversalWorker::getNATTraversalInterface() co
if (miniUPnPSupported) {
return miniUPnPInterface;
}
+#endif
-
+#ifdef HAVE_LIBNATPMP
if (boost::logic::indeterminate(natPMPSupported)) {
natPMPInterface = new NATPMPInterface();
natPMPSupported = natPMPInterface->isAvailable();
@@ -139,6 +149,7 @@ NATTraversalInterface* PlatformNATTraversalWorker::getNATTraversalInterface() co
if (natPMPSupported) {
return natPMPInterface;
}
+#endif
return nullNATTraversalInterface;
}
diff --git a/Swiften/Network/SConscript b/Swiften/Network/SConscript
index b742bfe..e0e5e63 100644
--- a/Swiften/Network/SConscript
+++ b/Swiften/Network/SConscript
@@ -72,20 +72,24 @@ else :
objects = myenv.SwiftenObject(sourceList)
-if myenv["experimental"] :
+if myenv["experimental"] :
# LibNATPMP classes
- natpmp_env = myenv.Clone()
- natpmp_env.Append(CPPDEFINES = natpmp_env["LIBNATPMP_FLAGS"].get("INTERNAL_CPPDEFINES", []))
- objects += natpmp_env.SwiftenObject([
- "NATPMPInterface.cpp",
- ])
+ if myenv.get("HAVE_LIBNATPMP", False) :
+ natpmp_env = myenv.Clone()
+ natpmp_env.Append(CPPDEFINES = natpmp_env["LIBNATPMP_FLAGS"].get("INTERNAL_CPPDEFINES", []))
+ myenv.Append(CPPDEFINES = ["HAVE_LIBNATPMP"])
+ objects += natpmp_env.SwiftenObject([
+ "NATPMPInterface.cpp",
+ ])
# LibMINIUPnP classes
- upnp_env = myenv.Clone()
- upnp_env.Append(CPPDEFINES = upnp_env["LIBMINIUPNPC_FLAGS"].get("INTERNAL_CPPDEFINES", []))
- objects += upnp_env.SwiftenObject([
- "MiniUPnPInterface.cpp",
- ])
+ if myenv.get("HAVE_LIBMINIUPNPC", False) :
+ upnp_env = myenv.Clone()
+ upnp_env.Append(CPPDEFINES = upnp_env["LIBMINIUPNPC_FLAGS"].get("INTERNAL_CPPDEFINES", []))
+ myenv.Append(CPPDEFINES = ["HAVE_LIBMINIUPNPC"])
+ objects += upnp_env.SwiftenObject([
+ "MiniUPnPInterface.cpp",
+ ])
objects += myenv.SwiftenObject([
"PlatformNATTraversalWorker.cpp",
])