changeset 22848:4f6040bb6f7a

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.
author Richard Laager <rlaager@wiktel.com>
date Sat, 10 May 2008 03:32:58 +0000
parents 790c606ff8a9
children e6674df4cbf1 d214379806a5
files configure.ac libpurple/network.c pidgin/gtkdialogs.c
diffstat 3 files changed, 16 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sat May 10 03:29:15 2008 +0000
+++ b/configure.ac	Sat May 10 03:32:58 2008 +0000
@@ -1202,7 +1202,7 @@
 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-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 @@
 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
--- a/libpurple/network.c	Sat May 10 03:29:15 2008 +0000
+++ b/libpurple/network.c	Sat May 10 03:32:58 2008 +0000
@@ -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 @@
 	UPnPMappingAddRemove *mapping_data;
 };
 
-#ifdef HAVE_LIBNM
+#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
 static NMState nm_get_network_state(void);
 #endif
 
@@ -593,12 +593,12 @@
 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 @@
 	return TRUE;
 }
 
-#ifdef HAVE_LIBNM
+#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
 static void
 nm_update_state(NMState state)
 {
@@ -695,7 +695,7 @@
 void
 purple_network_init(void)
 {
-#ifdef HAVE_LIBNM
+#ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
 	GError *error = NULL;
 #endif
 #ifdef _WIN32
@@ -724,7 +724,7 @@
 	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 @@
 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));
--- a/pidgin/gtkdialogs.c	Sat May 10 03:29:15 2008 +0000
+++ b/pidgin/gtkdialogs.c	Sat May 10 03:32:58 2008 +0000
@@ -628,7 +628,7 @@
 #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/>");