From 0271799a4a122b57640eb4d36fa02726871ed3b3 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Fri, 11 May 2012 12:31:31 +0000 Subject: [PATCH] Remove check for Linux from IPv6 tests. Replace GLIBC version test with a generic link test for "native" IPv6. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@177 13b04d17-f746-0410-82c6-800466cd88b0 --- Changelog | 3 +++ configure.in | 63 ++++++++++++++++++++++++++-------------------------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/Changelog b/Changelog index 15708d1..dda1b51 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,8 @@ [Changes 1.2c01] +* Fix known problem with IPv6 on FreeBSD and enable IPv6 on all supporting + platforms. Thanks to brabes and snadge. (caf) + * Improve connect() error handling. (caf) * Remove obsolete .spec files. (caf) diff --git a/configure.in b/configure.in index 91f1cd0..f0ea0b0 100644 --- a/configure.in +++ b/configure.in @@ -734,40 +734,39 @@ AC_ARG_ENABLE(ipv6, [ --enable-ipv6 Enable IPv6 support (Linux only)], [ case "$enableval" in yes) - case "$(uname -s)" in - Linux) - if test -d "/usr/inet6/include"; then - CFLAGS="$CFLAGS -I/usr/inet6/include" - LIBS="-L/usr/inet6/lib -linet6 $LIBS" - AC_MSG_RESULT(yes (libinet6)) - AC_DEFINE(IPV6, 1, Define this if you want IPV6 support.) - else - if test -d "/usr/local/v6/lib"; then - LIBS="-L/usr/local/v6/lib -linet6 $LIBS" - AC_MSG_RESULT(yes (freebsd+kame)) - AC_DEFINE(IPV6, 1, Define this if you want IPV6 support.) - else - AC_TRY_RUN([ - int main() - { - #if !defined(__GLIBC__) || (__GLIBC__ < 2) - #define NO_GLIBC_2 1 - #endif + AC_LINK_IFELSE([[ + #include + #include + #include - if (NO_GLIBC_2) - exit(0); - else - exit(1); - }],[ AC_MSG_RESULT(yes (glibc2)) - AC_DEFINE(IPV6, 1, Define this if you want IPV6 support.) - ], [AC_MSG_RESULT(no)], [AC_MSG_WARN(cross-compiling: assuming no ipv6)]) - fi + int main() + { + struct sockaddr_in6 sin6; + + sin6.sin6_family = AF_INET6; + sin6.sin6_addr = in6addr_any; + + return sin6.sin6_addr.s6_addr[0]; + }]], [ ac_cv_ipv6_type="native" ], [ + if test -d "/usr/inet6/include"; then + CFLAGS="$CFLAGS -I/usr/inet6/include" + LIBS="-L/usr/inet6/lib -linet6 $LIBS" + ac_cv_ipv6_type="libinet6" + else + if test -d "/usr/local/v6/lib"; then + LIBS="-L/usr/local/v6/lib -linet6 $LIBS" + ac_cv_ipv6_type="freebsd+kame" + else + ac_cv_ipv6_type="none" fi - ;; - *) - AC_MSG_RESULT(no (ipv6 support can currently be enabled on Linux only)) - ;; - esac + fi]) + + if test x"$ac_cv_ipv6_type" != x"none"; then + AC_MSG_RESULT(yes ($ac_cv_ipv6_type)) + AC_DEFINE(IPV6, 1, Define this if you want IPV6 support.) + else + AC_MSG_RESULT(none found) + fi ;; no) AC_MSG_RESULT(no)