pidgin: 5800923d: Update configure.ac to properly detect N...

rlaager at pidgin.im rlaager at pidgin.im
Fri May 9 23:45:58 EDT 2008


-----------------------------------------------------------------
Revision: 5800923dc413a26c68576e06ea89148d645fa4a9
Ancestor: fe68f3cef0f055a97a7b4425baae5c7711cfb4e7
Author: rlaager at pidgin.im
Date: 2008-05-10T03:32:58
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5800923dc413a26c68576e06ea89148d645fa4a9

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

ChangeLog: 

Update configure.ac to properly detect Network Manager (via NetworkManager.h instead of libnm_glib).  Also, change the code so that if NetworkManager is dead, we'll assume we're connected to the network and try anyway.

Comments: 

Also, this commit enables NetworkManager support by default (as long as D-Bus support is compiled in and NetworkManager.h is around).

-------------- next part --------------
============================================================
--- configure.ac	3b26612e7eafb66176ebfdaf09f681359fdfca4a
+++ configure.ac	e2681b64a3a051a78b5233623ab858126df85154
@@ -1202,7 +1202,7 @@ AC_ARG_ENABLE(dbus, [AC_HELP_STRING([--e
 dnl #######################################################################
 
 AC_ARG_ENABLE(dbus, [AC_HELP_STRING([--enable-dbus], [enable D-Bus support])], , enable_dbus=yes)
-AC_ARG_ENABLE(nm, [AC_HELP_STRING([--enable-nm], [enable NetworkManager support (buggy) (requires D-Bus)])], enable_libnm=$enableval, enable_libnm=no)
+AC_ARG_ENABLE(nm, [AC_HELP_STRING([--enable-nm], [enable NetworkManager support (requires D-Bus)])], enable_nm=$enableval, enable_nm=yes)
 
 if test "x$enable_dbus" = "xyes" ; then
 	AC_CHECK_PROG(enable_dbus, dbus-binding-tool, yes, no)
@@ -1219,26 +1219,12 @@ Use --disable-dbus if you do not need D-
 Use --disable-dbus if you do not need D-Bus support.
 ])])
 
-dnl Check for libnm_glib; if we don't have it, oh well
-	if test "x$enable_libnm" = "xyes" ; then
-		LIBNM_CFLAGS=""
-		LIBNM_LIBS=""
-		PKG_CHECK_MODULES(LIBNM, libnm_glib,
-		[
-			AC_DEFINE(HAVE_LIBNM, 1, [Define if you have NetworkManager])
-			enable_libnm=yes
-		],
-		[
-			AC_MSG_RESULT(no)
-			AC_MSG_ERROR([
-NetworkManager development headers not found.
-Use --disable-nm if you do not need NetworkManager support.
-])])
-		AC_SUBST(LIBNM_CFLAGS)
-		AC_SUBST(LIBNM_LIBS)
+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)
 	fi
 else
-	enable_libnm=no
+	enable_nm=no
 fi
 
 dnl #######################################################################
@@ -2411,7 +2397,7 @@ fi
 if test "x$enable_dbus" = "xyes" ; then
 	eval eval echo D-Bus services directory...... : $DBUS_SERVICES_DIR
 fi
-echo Build with NetworkManager..... : $enable_libnm
+echo Build with NetworkManager..... : $enable_nm
 echo SSL Library/Libraries......... : $msg_ssl
 echo Build with Cyrus SASL support. : $enable_cyrus_sasl
 echo Use kerberos 4 with zephyr.... : $kerberos
============================================================
--- libpurple/network.c	5c015178cc377e1fe622bbb2a1bdfd10f327b9d8
+++ libpurple/network.c	767335e157aea41377a41fb7ea35ac45d497782d
@@ -59,9 +59,9 @@
 #  define HX_SIZE_OF_IFREQ(a) sizeof(a)
 #endif
 
-#ifdef HAVE_LIBNM
+#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
 #include <dbus/dbus-glib.h>
-#include <NetworkManager.h>
+#include <NetworkManager/NetworkManager.h>
 
 static DBusGConnection *nm_conn = NULL;
 static DBusGProxy *nm_proxy = NULL;
@@ -81,7 +81,7 @@ struct _PurpleNetworkListenData {
 	UPnPMappingAddRemove *mapping_data;
 };
 
-#ifdef HAVE_LIBNM
+#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
 static NMState nm_get_network_state(void);
 #endif
 
@@ -593,12 +593,12 @@ purple_network_is_available(void)
 gboolean
 purple_network_is_available(void)
 {
-#ifdef HAVE_LIBNM
+#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
 	/* Try NetworkManager first, maybe we'll get lucky */
 	if (nm_get_network_state() != NM_STATE_CONNECTED)
 	{
 		purple_debug_warning("network", "NetworkManager not active or reports no connection\n");
-		return FALSE;
+		return TRUE;
 	} else
 		return TRUE;
 #elif defined _WIN32
@@ -607,7 +607,7 @@ purple_network_is_available(void)
 	return TRUE;
 }
 
-#ifdef HAVE_LIBNM
+#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
 static void
 nm_update_state(NMState state)
 {
@@ -695,7 +695,7 @@ purple_network_init(void)
 void
 purple_network_init(void)
 {
-#ifdef HAVE_LIBNM
+#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
 	GError *error = NULL;
 #endif
 #ifdef _WIN32
@@ -724,7 +724,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_LIBNM
+#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
 	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);
@@ -757,7 +757,7 @@ purple_network_uninit(void)
 void
 purple_network_uninit(void)
 {
-#ifdef HAVE_LIBNM
+#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
 	if (nm_proxy) {
 		dbus_g_proxy_disconnect_signal(nm_proxy, NM_DBUS_SIGNAL_STATE_CHANGE, G_CALLBACK(nm_state_change_cb), NULL);
 		g_object_unref(G_OBJECT(nm_proxy));
============================================================
--- pidgin/gtkdialogs.c	0f6724c189b9802299a51957f426d926048ec704
+++ pidgin/gtkdialogs.c	2f2a0c9f027297354e0d7ac142b3ec2fca9d47c4
@@ -628,7 +628,7 @@ g_string_append(str, "<br/>  <b>Library 
 #endif
 
 #ifndef _WIN32
-#ifdef HAVE_LIBNM
+#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
 	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