[farsight2/master] tests: Make it build against GUPnP 0.13

Olivier Crête olivier.crete at collabora.co.uk
Fri Nov 13 16:44:25 PST 2009


---
 configure.ac                          |    4 ++++
 tests/check/transmitter/rawudp-upnp.c |   24 ++++++++++--------------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6a977c5..a3c7595 100644
--- a/configure.ac
+++ b/configure.ac
@@ -367,6 +367,10 @@ fi
 
 if test "x$HAVE_GUPNP" = "xyes"; then
    AC_DEFINE(HAVE_GUPNP,,[Have the GUPnP IGD library])
+
+   PKG_CHECK_MODULES(GUPNP_013, gupnp-1.0 >= 0.13,
+	 [AC_DEFINE([HAVE_GUPNP_013], [1], [Have GUPnP 0.13 or higher])],
+	 [true])
 fi
 
 SHAVE_INIT([common],[enable])
diff --git a/tests/check/transmitter/rawudp-upnp.c b/tests/check/transmitter/rawudp-upnp.c
index 57170e5..327fec1 100644
--- a/tests/check/transmitter/rawudp-upnp.c
+++ b/tests/check/transmitter/rawudp-upnp.c
@@ -125,28 +125,24 @@ start_upnp_server (void)
   GUPnPServiceInfo *service;
   GUPnPDeviceInfo *subdev1;
   GUPnPDeviceInfo *subdev2;
+  const gchar *upnp_xml_path;
 
   context = gupnp_context_new (NULL, NULL, 0, NULL);
   ts_fail_if (context == NULL, "Can't get gupnp context");
 
   if (g_getenv ("UPNP_XML_PATH"))
-  {
-    gchar **paths = g_strsplit (g_getenv ("UPNP_XML_PATH"), ":", 0);
-    gint i;
-
-    for (i=0; paths[i]; i++)
-    {
-      gupnp_context_host_path (context, paths[i], "");
-    }
-    g_strfreev (paths);
-  }
+    upnp_xml_path = g_getenv ("UPNP_XML_PATH");
   else
-  {
-    gupnp_context_host_path (context, "upnp/InternetGatewayDevice.xml", "/InternetGatewayDevice.xml");
-    gupnp_context_host_path (context, "upnp/WANIPConnection.xml", "/WANIPConnection.xml");
-  }
+    upnp_xml_path  = ".";
 
+  gupnp_context_host_path (context, upnp_xml_path, "");
+
+#ifdef HAVE_GUPNP_013
+  dev = gupnp_root_device_new (context, "InternetGatewayDevice.xml",
+      upnp_xml_path);
+#else
   dev = gupnp_root_device_new (context, "/InternetGatewayDevice.xml");
+#endif
   ts_fail_if (dev == NULL, "could not get root dev");
 
   subdev1 = gupnp_device_info_get_device (GUPNP_DEVICE_INFO (dev),
-- 
1.5.6.5




More information about the farsight-commits mailing list