glib-2.0: fix compilation for !IPv6
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Tue, 4 Jan 2011 04:02:05 +0000 (04:02 +0000)
committerKhem Raj <raj.khem@gmail.com>
Fri, 7 Jan 2011 22:42:37 +0000 (14:42 -0800)
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
recipes/glib-2.0/glib-2.0-2.26.1/configure-ipv6.patch [new file with mode: 0644]
recipes/glib-2.0/glib-2.0_2.26.1.bb

diff --git a/recipes/glib-2.0/glib-2.0-2.26.1/configure-ipv6.patch b/recipes/glib-2.0/glib-2.0-2.26.1/configure-ipv6.patch
new file mode 100644 (file)
index 0000000..548e0dc
--- /dev/null
@@ -0,0 +1,92 @@
+From a619a217e3e5aa5345db631213aec5a3684a3001 Mon Sep 17 00:00:00 2001
+Subject: [PATCH] autodetect in6addr_{any,loopback} availability
+
+Fixes linking error on systems which choose not to support ipv6:
+./.libs/libgio-2.0.so: undefined reference to `in6addr_loopback'
+./.libs/libgio-2.0.so: undefined reference to `in6addr_any'
+
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+ configure.ac       |   31 +++++++++++++++++++++++++++++++
+ gio/ginetaddress.c |   16 ++++++++++++++--
+ 2 files changed, 45 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 7114014..023db49 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1019,6 +1019,37 @@ if test $glib_native_win32 = no; then
+   AC_SUBST(LIBASYNCNS_LIBADD)
+ fi
++dnl handle --disable-ipv6
++AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]))
++if test "$ipv6" != "no"; then
++  AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 is available])
++
++  AC_MSG_CHECKING([for struct in6addr_any])
++  AC_TRY_LINK(
++   [#define IN_AUTOCONF
++     #include <sys/types.h>
++     #include <sys/socket.h>
++     #include <netinet/in.h>],
++   [struct in6_addr a = in6addr_any;
++    return a.s6_addr[0];],
++   [AC_MSG_RESULT(yes)
++    AC_DEFINE(HAVE_IN6ADDR_ANY, 1, [Define if in6addr_any is available])],
++   [AC_MSG_RESULT(no)]
++  )
++  AC_MSG_CHECKING([for struct in6addr_loopback])
++  AC_TRY_LINK(
++   [#define IN_AUTOCONF
++     #include <sys/types.h>
++     #include <sys/socket.h>
++     #include <netinet/in.h>],
++   [struct in6_addr a = in6addr_loopback;
++    return a.s6_addr[0];],
++   [AC_MSG_RESULT(yes)
++    AC_DEFINE(HAVE_IN6ADDR_LOOPBACK, 1, [Define if in6addr_loopback is available])],
++   [AC_MSG_RESULT(no)]
++  )
++fi
++
+ case $host in
+   *-*-solaris* )
+      AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Needed to get declarations for msg_control and msg_controllen on Solaris)
+diff --git a/gio/ginetaddress.c b/gio/ginetaddress.c
+index 0f67e4f..ed29be2 100644
+--- a/gio/ginetaddress.c
++++ b/gio/ginetaddress.c
+@@ -484,7 +484,13 @@ g_inet_address_new_loopback (GSocketFamily family)
+       return g_inet_address_new_from_bytes (addr, family);
+     }
+   else
+-    return g_inet_address_new_from_bytes (in6addr_loopback.s6_addr, family);
++    {
++#ifdef HAVE_IN6ADDR_LOOPBACK
++      return g_inet_address_new_from_bytes (in6addr_loopback.s6_addr, family);
++#else
++      return NULL;
++#endif
++    }
+ }
+ /**
+@@ -511,7 +517,13 @@ g_inet_address_new_any (GSocketFamily family)
+       return g_inet_address_new_from_bytes (addr, family);
+     }
+   else
+-    return g_inet_address_new_from_bytes (in6addr_any.s6_addr, family);
++    {
++#ifdef HAVE_IN6ADDR_ANY
++      return g_inet_address_new_from_bytes (in6addr_any.s6_addr, family);
++#else
++      return NULL;
++#endif
++    }
+ }
+-- 
+1.7.2.3
+
index 8788258..caccfde 100644 (file)
@@ -10,7 +10,7 @@ DEPENDS = "glib-2.0-native gtk-doc zlib"
 DEPENDS_virtclass-native = "gettext-native gtk-doc-native \
                             pkgconfig-native"
 
-PR = "r2"
+PR = "r3"
 
 SRC_URI = "\
   http://ftp.gnome.org/pub/GNOME/sources/glib/2.26/glib-${PV}.tar.bz2;name=archive \
@@ -21,6 +21,7 @@ SRC_URI = "\
   file://60_wait-longer-for-threads-to-die.patch \
   file://glib-mkenums-interpreter.patch \
   file://libglib2-fix-compilation-with-no-builtin-atomic.patch \
+  file://configure-ipv6.patch \
 "
 
 SRC_URI[archive.md5sum] = "17535accceef55bcb17a74d73f9c2aef"