pidgin: e74f183a: Use pkg-config to detect NetworkManager....

rlaager at pidgin.im rlaager at pidgin.im
Sat May 10 20:30:44 EDT 2008


-----------------------------------------------------------------
Revision: e74f183a9d3d3dc37ee95c98cc5e665a10b41b31
Ancestor: 44294687939645ecf10678eec62bb5f78e801362
Author: rlaager at pidgin.im
Date: 2008-05-11T00:27:18
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e74f183a9d3d3dc37ee95c98cc5e665a10b41b31

Modified files:
        configure.ac libpurple/Makefile.am libpurple/network.c
        pidgin/gtkdialogs.c

ChangeLog: 

Use pkg-config to detect NetworkManager.  Also, fail if it isn't present,
suggesting the use of --disable-nm in that case.

-------------- next part --------------
============================================================
--- configure.ac	e2681b64a3a051a78b5233623ab858126df85154
+++ configure.ac	c23f8410d2355c1a0e091cca430117b27f4aceef
@@ -1221,7 +1221,15 @@ dnl Check for NetworkManager.h; if we do
 
 dnl Check for NetworkManager.h; if we don't have it, oh well
 	if test "x$enable_nm" = "xyes" ; then
-		AC_CHECK_HEADERS(NetworkManager/NetworkManager.h, [], enable_nm=no)
+		PKG_CHECK_MODULES(NETWORKMANAGER, [NetworkManager], [
+			AC_SUBST(NETWORKMANAGER_CFLAGS)
+			AC_SUBST(NETWORKMANAGER_LIBS)
+			AC_DEFINE(HAVE_NETWORKMANAGER, 1, [Define if we have NetworkManager.])
+		], [
+			AC_MSG_ERROR([
+NetworkManager development headers not found.
+Use --disable-nm if you do not need NetworkManager support.
+])])
 	fi
 else
 	enable_nm=no
============================================================
--- libpurple/Makefile.am	970eb388b52914c9e0287f4010996ba5ce7524c9
+++ libpurple/Makefile.am	1e5b6746912ce6db2c94403c4086c84300c657ea
@@ -244,7 +244,7 @@ libpurple_la_LIBADD = \
 	$(DBUS_LIBS) \
 	$(GLIB_LIBS) \
 	$(LIBXML_LIBS) \
-	$(LIBNM_LIBS) \
+	$(NETWORKMANAGER_LIBS) \
 	$(INTLLIBS) \
 	-lm
 
@@ -258,4 +258,4 @@ AM_CPPFLAGS = \
 	$(DEBUG_CFLAGS) \
 	$(DBUS_CFLAGS) \
 	$(LIBXML_CFLAGS) \
+	$(NETWORKMANAGER_CFLAGS)
-	$(LIBNM_CFLAGS)
============================================================
--- libpurple/network.c	74f137777281a813fb5c9a6156745b2997f07dcc
+++ libpurple/network.c	5f1f51d4414a631e2d744d6d7ea5fdc95accec12
@@ -59,9 +59,9 @@
 #  define HX_SIZE_OF_IFREQ(a) sizeof(a)
 #endif
 
-#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
+#ifdef HAVE_NETWORKMANAGER
 #include <dbus/dbus-glib.h>
-#include <NetworkManager/NetworkManager.h>
+#include <NetworkManager.h>
 
 static DBusGConnection *nm_conn = NULL;
 static DBusGProxy *nm_proxy = NULL;
@@ -81,7 +81,7 @@ struct _PurpleNetworkListenData {
 	UPnPMappingAddRemove *mapping_data;
 };
 
-#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
+#ifdef HAVE_NETWORKMANAGER
 static NMState nm_get_network_state(void);
 #endif
 
@@ -593,7 +593,7 @@ purple_network_is_available(void)
 gboolean
 purple_network_is_available(void)
 {
-#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
+#ifdef HAVE_NETWORKMANAGER
 	NMState state = nm_get_network_state();
 	if (state == NM_STATE_UNKNOWN)
 	{
@@ -612,7 +612,7 @@ purple_network_is_available(void)
 #endif
 }
 
-#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
+#ifdef HAVE_NETWORKMANAGER
 static void
 nm_update_state(NMState state)
 {
@@ -700,7 +700,7 @@ purple_network_init(void)
 void
 purple_network_init(void)
 {
-#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
+#ifdef HAVE_NETWORKMANAGER
 	GError *error = NULL;
 #endif
 #ifdef _WIN32
@@ -729,7 +729,7 @@ purple_network_init(void)
 	if(purple_prefs_get_bool("/purple/network/map_ports") || purple_prefs_get_bool("/purple/network/auto_ip"))
 		purple_upnp_discover(NULL, NULL);
 
-#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
+#ifdef HAVE_NETWORKMANAGER
 	nm_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
 	if (!nm_conn) {
 		purple_debug_warning("network", "Error connecting to DBus System service: %s.\n", error->message);
@@ -762,7 +762,7 @@ purple_network_uninit(void)
 void
 purple_network_uninit(void)
 {
-#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
+#ifdef HAVE_NETWORKMANAGER
 	if (nm_proxy) {
 		dbus_g_proxy_disconnect_signal(nm_proxy, "StateChange", G_CALLBACK(nm_state_change_cb), NULL);
 		g_object_unref(G_OBJECT(nm_proxy));
============================================================
--- pidgin/gtkdialogs.c	aca3583e65b7a09ecd448656657b61bfb179b097
+++ pidgin/gtkdialogs.c	0e898ef7e78734d9ce8bde39cb614c4a918a37b7
@@ -629,7 +629,7 @@ g_string_append(str, "<br/>  <b>Library 
 #endif
 
 #ifndef _WIN32
-#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
+#ifdef HAVE_NETWORKMANAGER
 	g_string_append(str, "    <b>NetworkManager:</b> Enabled<br/>");
 #else
 	g_string_append(str, "    <b>NetworkManager:</b> Disabled<br/>");


More information about the Commits mailing list