[gupnp] Make the Unix context manager option, it doesn't work for Android
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp] Make the Unix context manager option, it doesn't work for Android
- Date: Sat, 15 Mar 2014 10:49:29 +0000 (UTC)
commit a74e61c667dee25119247e86a14326b435ec730b
Author: Olivier CrĂȘte <olivier crete collabora com>
Date: Wed Feb 5 16:21:57 2014 -0500
Make the Unix context manager option, it doesn't work for Android
Android does not provide ifaddrs.h
https://bugzilla.gnome.org/show_bug.cgi?id=723715
configure.ac | 10 +++++++++-
libgupnp/Makefile.am | 4 ++++
libgupnp/gupnp-context-manager.c | 9 +++++++++
3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 406d1fa..42b0c0a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,12 @@ AC_CHECK_HEADERS([sys/socket.h linux/rtnetlink.h],
AM_CONDITIONAL([HAVE_NETLINK], [test "x$HAVE_NETLINK" = "xyes"])
AC_SUBST(HAVE_NETLINK)
+AC_CHECK_HEADERS([ifaddrs.h],
+ [ HAVE_IFADDRS_H=yes ],
+ [ HAVE_IFADDRS_H=no ])
+AM_CONDITIONAL([HAVE_IFADDRS_H], [test "x$HAVE_IFADDRS_H" = "xyes"])
+AC_SUBST(HAVE_IFADDRS_H)
+
AC_CHECK_HEADERS([linux/wireless.h], [], [],
[ #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
@@ -112,7 +118,9 @@ fi
USE_NETLINK=no
AS_IF([test "x$with_context_manager" = "xlinux"],
[AS_IF([test "x$HAVE_NETLINK" = "xno"],
- [AC_MSG_NOTICE([No rtnetlink found, falling back to static context manager])],
+ [AS_IF([test "x$HAVE_IFADDRS" = "xyes"],
+ AC_MSG_NOTICE([No rtnetlink found, falling back to static context manager]),
+ AC_MSG_ERROR([No rtnetlink nor ifaddrs.h found]))],
[USE_NETLINK=yes])
],[])
diff --git a/libgupnp/Makefile.am b/libgupnp/Makefile.am
index 6d30acb..5f65373 100644
--- a/libgupnp/Makefile.am
+++ b/libgupnp/Makefile.am
@@ -7,8 +7,12 @@ CONTEXT_MANAGER_CFLAGS =
CONTEXT_MANAGER_LIBS = -lws2_32 -liphlpapi
WIN32_LDFLAGS = -no-undefined
else
+if HAVE_IFADDRS_H
CONTEXT_MANAGER_IMPL = gupnp-unix-context-manager.c \
gupnp-unix-context-manager.h
+else
+CONTEXT_MANAGER_IMPL =
+endif
if USE_NETWORK_MANAGER
CONTEXT_MANAGER_IMPL += gupnp-network-manager.c \
gupnp-network-manager.h
diff --git a/libgupnp/gupnp-context-manager.c b/libgupnp/gupnp-context-manager.c
index f28fb10..21a3a3d 100644
--- a/libgupnp/gupnp-context-manager.c
+++ b/libgupnp/gupnp-context-manager.c
@@ -45,7 +45,9 @@
#include "gupnp.h"
#include "gupnp-marshal.h"
+#ifdef HAVE_IFADDRS_H
#include "gupnp-unix-context-manager.h"
+#endif
#ifdef G_OS_WIN32
#include "gupnp-windows-context-manager.h"
@@ -564,12 +566,19 @@ gupnp_context_manager_create (guint port)
* are using one of the DBus managers but it's not available, so we
* fall-back to it. */
#if defined (USE_NETLINK) || defined (HAVE_LINUX_RTNETLINK_H)
+#if defined (HAVE_IFADDRS_H)
if (gupnp_linux_context_manager_is_available ())
impl_type = GUPNP_TYPE_LINUX_CONTEXT_MANAGER;
else
impl_type = GUPNP_TYPE_UNIX_CONTEXT_MANAGER;
#else
+ impl_type = GUPNP_TYPE_LINUX_CONTEXT_MANAGER;
+
+#endif
+#elif defined (HAVE_IFADDRS_H)
impl_type = GUPNP_TYPE_UNIX_CONTEXT_MANAGER;
+#else
+#error No context manager defined
#endif
}
#endif /* G_OS_WIN32 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]