Commit ed7eedde authored by Zeeshan Ali (Khattak)'s avatar Zeeshan Ali (Khattak)

Build-time option to select ContextManager.

Provide a configure option for user (packager) to select the Context
Manager implemenation to be used. By default, it is NetworkManager.
parent 372ef806
......@@ -22,6 +22,20 @@ PKG_CHECK_MODULES(LIBGUPNP, glib-2.0 >= 2.18 \
PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
AC_ARG_WITH([context_manager],
AS_HELP_STRING([--context-manager=@<:@network-manager/unix@:>@],
[Context Manager backend to use]),,
[with_context_manager="network-manager"])
AC_MSG_CHECKING([Context Manager backend to use])
AC_MSG_RESULT([${with_context_manager}])
if test "x$with_context_manager" = "xnetwork-manager"; then
PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= 0.76)
fi
AM_CONDITIONAL([USE_NETWORK_MANAGER],
[test "x$with_context_manager" = "xnetwork-manager"])
# glib-genmarshal
GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
AC_SUBST(GLIB_GENMARSHAL)
......
LTVERSION = 2:0:0
AM_CFLAGS = $(LIBGUPNP_CFLAGS) $(DBUS_GLIB_CFLAGS) -I$(top_srcdir)
if USE_NETWORK_MANAGER
CONTEXT_MANAGER_IMPL = gupnp-network-manager.c \
gupnp-network-manager.h
CONTEXT_MANAGER_CFLAGS = -DUSE_NETWORK_MANAGER
else
CONTEXT_MANAGER_IMPL = gupnp-unix-context-manager.c \
gupnp-unix-context-manager.h
CONTEXT_MANAGER_CFLAGS =
endif
AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
-I$(top_srcdir) \
$(CONTEXT_MANAGER_CFLAGS)
libgupnpincdir = $(includedir)/gupnp-1.0/libgupnp
......@@ -38,8 +51,7 @@ libgupnp_1_0_la_SOURCES = http-headers.c \
gupnp-context-private.h \
gupnp-context-manager.c \
gupnp-context-manager-private.h \
gupnp-unix-context-manager.c \
gupnp-unix-context-manager.h \
$(CONTEXT_MANAGER_IMPL) \
gupnp-control-point.c \
gupnp-device.c \
gupnp-device-info.c \
......@@ -66,7 +78,11 @@ libgupnp_1_0_la_SOURCES = http-headers.c \
libgupnp_1_0_la_LIBADD = $(LIBGUPNP_LIBS) $(DBUS_GLIB_LIBS)
EXTRA_DIST = gupnp-marshal.list
EXTRA_DIST = gupnp-marshal.list \
gupnp-network-manager.c \
gupnp-network-manager.h \
gupnp-unix-context-manager.c \
gupnp-unix-context-manager.h
CLEANFILES = $(BUILT_SOURCES)
DISTCLEANFILES = $(BUILT_SOURCES)
......
......@@ -41,7 +41,6 @@
#include "gupnp-context-manager.h"
#include "gupnp-context-manager-private.h"
#include "gupnp-unix-context-manager.h"
#include "gupnp-context.h"
#include "gupnp-marshal.h"
......@@ -380,8 +379,19 @@ gupnp_context_manager_new (GMainContext *main_context,
{
GUPnPContextManager *manager;
GUPnPContextManager *impl;
GType impl_type;
#ifdef USE_NETWORK_MANAGER
#include "gupnp-network-manager.h"
impl_type = GUPNP_TYPE_NETWORK_MANAGER;
#else
#include "gupnp-unix-context-manager.h"
impl_type = GUPNP_TYPE_UNIX_CONTEXT_MANAGER;
#endif
impl = g_object_new (GUPNP_TYPE_UNIX_CONTEXT_MANAGER,
impl = g_object_new (impl_type,
"main-context", main_context,
"port", port,
NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment