From b246788bc46cf7e9fe4d7d802f17f18c50acece5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 20 Sep 2013 20:48:45 +0200 Subject: [PATCH] config: make BlueZ 5 default and replace --enable-bluez5 with --enable-bluez4 Build now BlueZ 5 by default and rename the configure flag --enable-bluez5 to --enable-bluez4. Signed-off-by: Thomas Haller --- configure.ac | 16 +++++++------- src/Makefile.am | 8 +++---- src/bluez-manager/nm-bluez-common.h | 2 +- src/bluez-manager/nm-bluez-device.c | 34 ++++++++++++++--------------- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/configure.ac b/configure.ac index c17db5d4f6..424c904f6b 100644 --- a/configure.ac +++ b/configure.ac @@ -268,15 +268,15 @@ fi AC_SUBST(UDEV_BASE_DIR) # BlueZ -AC_ARG_ENABLE(bluez5, AS_HELP_STRING([--enable-bluez5], - [build with BlueZ 5 support instead of BlueZ 4]), - [enable_bluez5=${enableval}]) -if (test "${enable_bluez5}" = "yes"); then - AC_DEFINE(WITH_BLUEZ5, 1, [Define if you have BlueZ 5 support]) +AC_ARG_ENABLE(bluez4, AS_HELP_STRING([--enable-bluez4], + [build with BlueZ 4 support instead of BlueZ 5]), + [enable_bluez4=${enableval}]) +if (test "${enable_bluez4}" = "yes"); then + AC_DEFINE(WITH_BLUEZ4, 1, [Define if you have BlueZ 4 support]) else - AC_DEFINE(WITH_BLUEZ5, 0, [Define if you have BlueZ 5 support]) + AC_DEFINE(WITH_BLUEZ4, 0, [Define if you have BlueZ 4 support]) fi -AM_CONDITIONAL(WITH_BLUEZ5, test "${enable_bluez5}" = "yes") +AM_CONDITIONAL(WITH_BLUEZ4, test "${enable_bluez4}" = "yes") # systemd unit support AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], @@ -825,7 +825,7 @@ echo " modemmanager-1: $with_modem_manager_1" echo " concheck: $enable_concheck" echo " libndp: $libndp_location" echo " libteamdctl: $enable_teamdctl" -echo " bluez 5: $enable_bluez5" +echo " bluez 4: $enable_bluez4" echo echo "Configuration plugins" diff --git a/src/Makefile.am b/src/Makefile.am index 700afe3417..532c62fffe 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -264,14 +264,14 @@ nm_sources += \ bluez-manager/nm-bluez-device.h \ bluez-manager/nm-bluez-manager.h -if WITH_BLUEZ5 -nm_sources += \ - bluez-manager/nm-bluez5-manager.c -else +if WITH_BLUEZ4 nm_sources += \ bluez-manager/nm-bluez-adapter.h \ bluez-manager/nm-bluez-adapter.c \ bluez-manager/nm-bluez-manager.c +else +nm_sources += \ + bluez-manager/nm-bluez5-manager.c endif if WITH_MODEM_MANAGER_1 diff --git a/src/bluez-manager/nm-bluez-common.h b/src/bluez-manager/nm-bluez-common.h index 4bf029d9a4..ecc4d70947 100644 --- a/src/bluez-manager/nm-bluez-common.h +++ b/src/bluez-manager/nm-bluez-common.h @@ -31,7 +31,7 @@ #define BLUEZ_MANAGER_PATH "/" #define OBJECT_MANAGER_INTERFACE "org.freedesktop.DBus.ObjectManager" -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 #define BLUEZ_ADAPTER_INTERFACE "org.bluez.Adapter1" #define BLUEZ_DEVICE_INTERFACE "org.bluez.Device1" diff --git a/src/bluez-manager/nm-bluez-device.c b/src/bluez-manager/nm-bluez-device.c index 16f2fc77e4..b827aa3591 100644 --- a/src/bluez-manager/nm-bluez-device.c +++ b/src/bluez-manager/nm-bluez-device.c @@ -30,7 +30,7 @@ #include "nm-setting-bluetooth.h" #include "nm-bluez-common.h" -#if ! WITH_BLUEZ5 +#if WITH_BLUEZ4 #include "nm-dbus-manager.h" #include "nm-dbus-glib-types.h" #endif @@ -45,7 +45,7 @@ G_DEFINE_TYPE (NMBluezDevice, nm_bluez_device, G_TYPE_OBJECT) typedef struct { char *path; -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 GDBusProxy *proxy5; GDBusProxy *adapter; GDBusConnection *dbus_connection; @@ -270,13 +270,13 @@ check_emit_usable (NMBluezDevice *self) /* only expect the supported capabilities set. */ g_assert ((priv->capabilities & ~( NM_BT_CAPABILITY_NAP -#if ! WITH_BLUEZ5 +#if WITH_BLUEZ4 | NM_BT_CAPABILITY_DUN #endif )) == NM_BT_CAPABILITY_NONE); new_usable = (priv->initialized && priv->capabilities && priv->name && -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 priv->adapter && priv->dbus_connection && #endif priv->address); @@ -403,7 +403,7 @@ nm_bluez_device_disconnect (NMBluezDevice *self) { NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 g_return_if_fail (priv->dbus_connection); g_return_if_fail (priv->connection_bt_type == NM_BT_CAPABILITY_NAP); @@ -442,7 +442,7 @@ nm_bluez_device_disconnect (NMBluezDevice *self) } static void -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 bluez_connect_pan_cb (GDBusConnection *dbus_connection, GAsyncResult *res, gpointer user_data) @@ -458,7 +458,7 @@ bluez_connect_cb (DBusGProxy *proxy4, GError *error = NULL; char *device; -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 GVariant *variant; variant = g_dbus_connection_call_finish (dbus_connection, res, &error); @@ -503,13 +503,13 @@ nm_bluez_device_connect_async (NMBluezDevice *self, { GSimpleAsyncResult *simple; NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); -#if ! WITH_BLUEZ5 +#if WITH_BLUEZ4 DBusGConnection *connection; connection = nm_dbus_manager_get_connection (nm_dbus_manager_get ()); #endif -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 g_return_if_fail (connection_bt_type == NM_BT_CAPABILITY_NAP); simple = g_simple_async_result_new (G_OBJECT (self), @@ -609,7 +609,7 @@ convert_uuids_to_capabilities (const char **strings) parts = g_strsplit (*iter, "-", -1); if (parts && parts[0]) { switch (g_ascii_strtoull (parts[0], NULL, 16)) { -#if ! WITH_BLUEZ5 +#if WITH_BLUEZ4 case 0x1103: capabilities |= NM_BT_CAPABILITY_DUN; break; @@ -651,7 +651,7 @@ _set_property_capabilities (NMBluezDevice *self, const char **uuids, gboolean no } } -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 static void on_adapter_acquired (GObject *object, GAsyncResult *res, NMBluezDevice *self) { @@ -762,7 +762,7 @@ property_changed (DBusGProxy *proxy4, } #endif -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 static void query_properties (NMBluezDevice *self) { @@ -892,7 +892,7 @@ query_properties (NMBluezDevice *self) #endif -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 static void on_proxy_acquired (GObject *object, GAsyncResult *res, NMBluezDevice *self) { @@ -940,7 +940,7 @@ nm_bluez_device_new (const char *path, NMConnectionProvider *provider) { NMBluezDevice *self; NMBluezDevicePrivate *priv; -#if ! WITH_BLUEZ5 +#if WITH_BLUEZ4 DBusGConnection *connection; #endif @@ -977,7 +977,7 @@ nm_bluez_device_new (const char *path, NMConnectionProvider *provider) G_CALLBACK (cp_connections_loaded), self); -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 g_bus_get (G_BUS_TYPE_SYSTEM, NULL, (GAsyncReadyCallback) on_bus_acquired, @@ -1035,7 +1035,7 @@ dispose (GObject *object) g_signal_handlers_disconnect_by_func (priv->provider, cp_connection_updated, self); g_signal_handlers_disconnect_by_func (priv->provider, cp_connections_loaded, self); -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 g_clear_object (&priv->adapter); g_clear_object (&priv->dbus_connection); #else @@ -1054,7 +1054,7 @@ finalize (GObject *object) g_free (priv->address); g_free (priv->name); g_free (priv->bt_iface); -#if WITH_BLUEZ5 +#if ! WITH_BLUEZ4 g_object_unref (priv->proxy5); #else g_object_unref (priv->proxy4);