From 4a8bc32a49c86660f8c7093af4e6dc1406b81e3e Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Thu, 23 Jan 2014 03:05:29 -0500 Subject: [PATCH] Add --disable-wifi ./configure option This allows us to build without depending on NetworkManager. --- configure.ac | 14 +++++++++++++- src/Makefile.am | 11 +++++++++-- src/gclue-locator.c | 15 +++++++++++---- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index a531fc5..ab8426c 100644 --- a/configure.ac +++ b/configure.ac @@ -54,9 +54,21 @@ PKG_CHECK_MODULES(GEOCLUE, [ gio-unix-2.0 >= $GLIB_MIN_VERSION json-glib-1.0 >= $JSON_GLIB_MIN_VERSION libsoup-2.4 - libnm-glib >= $LIBNM_GLIB_MIN_VERSION ]) +# Wifi support (requires NetworkManager) +AC_ARG_ENABLE(wifi, + AS_HELP_STRING([--disable-wifi], [Build without NetworkManager support]), + [enable_wifi=$enableval], + [enable_wifi=yes]) +if test "$enable_wifi" = "yes"; then + PKG_CHECK_MODULES(networkmanager, libnm-glib >= $LIBNM_GLIB_MIN_VERSION) + AC_DEFINE([BUILD_WIFI_BACKEND], [1], [Build wifi backend?]) +else + AC_DEFINE([BUILD_WIFI_BACKEND], [0], [Build wifi backend?]) +fi +AM_CONDITIONAL([BUILD_WIFI_BACKEND], [test "x$enable_wifi" = "xyes"]) + # Geoip server AC_ARG_ENABLE(geoip-server, AS_HELP_STRING([--enable-geoip-server=yes|no|auto], [Build geoip server]), diff --git a/src/Makefile.am b/src/Makefile.am index 1bc662b..b7364f4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,6 +35,7 @@ BUILT_SOURCES = \ noinst_LTLIBRARIES = libgeoclue.la AM_CPPFLAGS = $(GEOCLUE_CFLAGS) \ + $(networkmanager_CFLAGS) \ $(WARN_CFLAGS) \ -DLOCALEDIR="\"$(datadir)/locale\"" \ -DG_LOG_DOMAIN=\""Geoclue"\" \ @@ -61,20 +62,26 @@ libgeoclue_la_SOURCES = \ gclue-service-client.c \ gclue-service-location.h \ gclue-service-location.c \ - gclue-wifi.h \ - gclue-wifi.c \ gclue-web-source.c \ gclue-web-source.h \ gclue-enums.h \ geocode-location.c \ geocode-location.h \ + $(wifi_sources) \ $(NULL) libgeoclue_la_LIBADD = $(GEOCLUE_LIBS) $(LIBS) +if BUILD_WIFI_BACKEND +wifi_sources = \ + gclue-wifi.h \ + gclue-wifi.c +endif + geoclue_SOURCES = \ gclue-main.c \ $(NULL) geoclue_LDADD = $(GEOCLUE_LIBS) \ + $(networkmanager_LIBS) \ $(LIBS) \ $(builddir)/libgeoclue.la diff --git a/src/gclue-locator.c b/src/gclue-locator.c index f40333d..886ba70 100644 --- a/src/gclue-locator.c +++ b/src/gclue-locator.c @@ -20,6 +20,8 @@ * Authors: Zeeshan Ali (Khattak) */ +#include "config.h" + #include #include "gclue-locator.h" @@ -162,7 +164,6 @@ gclue_locator_start (GClueLocationSource *source) { GClueLocator *locator = GCLUE_LOCATOR (source); GClueIpclient *ipclient; - GClueWifi *wifi; GList *node; g_return_if_fail (GCLUE_IS_LOCATOR (locator)); @@ -171,9 +172,15 @@ gclue_locator_start (GClueLocationSource *source) ipclient = gclue_ipclient_new (); locator->priv->sources = g_list_append (locator->priv->sources, ipclient); - wifi = gclue_wifi_new (); - locator->priv->sources = g_list_append (locator->priv->sources, - wifi); + +#if BUILD_WIFI_BACKEND + { + GClueWifi *wifi; + wifi = gclue_wifi_new (); + locator->priv->sources = g_list_append (locator->priv->sources, + wifi); + } +#endif for (node = locator->priv->sources; node != NULL; node = node->next) { GClueLocationSource *source = GCLUE_LOCATION_SOURCE (node->data); -- 1.8.4.2