[svn] Added proper IPv6 configure detection.

By Mauro Tortonesi.
This commit is contained in:
hniksic 2003-09-16 05:24:29 -07:00
parent 469ab796ac
commit f5c82a6468
4 changed files with 224 additions and 66 deletions

View File

@ -1,3 +1,7 @@
2003-09-16 Mauro Tortonesi <mauro@deepspace6.net>
* configure.in, aclocal.m4: Added proper IPv6 detection.
2003-09-16 Hrvoje Niksic <hniksic@xemacs.org> 2003-09-16 Hrvoje Niksic <hniksic@xemacs.org>
* Makefile.in (all): Don't build configure.bat by default. * Makefile.in (all): Don't build configure.bat by default.

177
aclocal.m4 vendored
View File

@ -86,47 +86,156 @@ else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi]) fi])
dnl ************************************************************ dnl ************************************************************
dnl check for working getaddrinfo() dnl START OF IPv6 AUTOCONFIGURATION SUPPORT MACROS
dnl dnl ************************************************************
AC_DEFUN(WGET_CHECK_WORKING_GETADDRINFO,[
AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[ AC_DEFUN([TYPE_STRUCT_SOCKADDR_IN6],[
AC_TRY_RUN( [ ds6_have_sockaddr_in6=
#include <netdb.h> AC_CHECK_TYPES([struct sockaddr_in6],[
ds6_have_sockaddr_in6=yes
],[
ds6_have_sockaddr_in6=no
],[
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
])
if test "X$ds6_have_sockaddr_in6" = "Xyes"; then :
$1
else :
$2
fi
])
AC_DEFUN([MEMBER_SIN6_SCOPE_ID],[
AC_REQUIRE([TYPE_STRUCT_SOCKADDR_IN6])
ds6_member_sin6_scope_id=
if test "X$ds6_have_sockaddr_in6" = "Xyes"; then
AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id],[
ds6_member_sin6_scope_id=yes
],[
ds6_member_sin6_scope_id=no
],[
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
])
fi
if test "X$ds6_member_sin6_scope_id" = "Xyes"; then
AC_DEFINE([HAVE_SOCKADDR_IN6_SCOPE_ID], 1,
[Define if struct sockaddr_in6 has the sin6_scope_id member])
$1
else :
$2
fi
])
AC_DEFUN([PROTO_INET6],[
AC_CACHE_CHECK([for INET6 protocol support], [ds6_cv_proto_inet6],[
AC_TRY_CPP([
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
int main(void) { #ifndef PF_INET6
struct addrinfo hints, *ai; #error Missing PF_INET6
int error; #endif
#ifndef AF_INET6
#error Mlssing AF_INET6
#endif
],[
ds6_cv_proto_inet6=yes
],[
ds6_cv_proto_inet6=no
])
])
memset(&hints, 0, sizeof(hints)); if test "X$ds6_cv_proto_inet6" = "Xyes"; then :
hints.ai_family = AF_UNSPEC; $1
hints.ai_socktype = SOCK_STREAM; else :
error = getaddrinfo("127.0.0.1", "8080", &hints, &ai); $2
if (error) { fi
exit(1);
}
else {
exit(0);
}
}
],[
ac_cv_working_getaddrinfo="yes"
],[
ac_cv_working_getaddrinfo="no"
],[
ac_cv_working_getaddrinfo="yes"
])])
if test x"$ac_cv_working_getaddrinfo" = xyes; then
AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works])
AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
IPV6_ENABLED=1
AC_SUBST(IPV6_ENABLED)
fi
]) ])
AC_DEFUN([GETADDRINFO_AI_ADDRCONFIG],[
AC_CACHE_CHECK([if getaddrinfo supports AI_ADDRCONFIG],
[ds6_cv_gai_ai_addrconfig],[
AC_TRY_CPP([
#include <netdb.h>
#ifndef AI_ADDRCONFIG
#error Missing AI_ADDRCONFIG
#endif
],[
ds6_cv_gai_ai_addrconfig=yes
],[
ds6_cv_gai_ai_addrconfig=no
])
])
if test "X$ds6_cv_gai_ai_addrconfig" = "Xyes"; then :
$1
else :
$2
fi
])
AC_DEFUN([GETADDRINFO_AI_ALL],[
AC_CACHE_CHECK([if getaddrinfo supports AI_ALL],[ds6_cv_gai_ai_all],[
AC_TRY_CPP([
#include <netdb.h>
#ifndef AI_ALL
#error Missing AI_ALL
#endif
],[
ds6_cv_gai_ai_all=yes
],[
ds6_cv_gai_ai_all=no
])
])
if test "X$ds6_cv_gai_ai_all" = "Xyes"; then :
$1
else :
$2
fi
])
AC_DEFUN([GETADDRINFO_AI_V4MAPPED],[
AC_CACHE_CHECK([if getaddrinfo supports AI_V4MAPPED],[ds6_cv_gai_ai_v4mapped],[
AC_TRY_CPP([
#include <netdb.h>
#ifndef AI_V4MAPPED
#error Missing AI_V4MAPPED
#endif
],[
ds6_cv_gai_ai_v4mapped=yes
],[
ds6_cv_gai_ai_v4mapped=no
])
])
if test "X$ds6_cv_gai_ai_v4mapped" = "Xyes"; then :
$1
else :
$2
fi
])
dnl ************************************************************
dnl END OF IPv6 AUTOCONFIGURATION SUPPORT MACROS
dnl ************************************************************
# This code originates from Ulrich Drepper's AM_WITH_NLS. # This code originates from Ulrich Drepper's AM_WITH_NLS.

View File

@ -453,42 +453,72 @@ dnl whether it's possible to create an AF_INET6 socket and if yes, use
dnl IPv6. dnl IPv6.
dnl dnl
AC_MSG_CHECKING([whether to enable ipv6]) ipv6=
check_for_ipv6=no
AC_ARG_ENABLE(ipv6, AC_ARG_ENABLE(ipv6,
AC_HELP_STRING([--enable-ipv6],[Enable ipv6 support]) AC_HELP_STRING([--disable-ipv6],[disable IPv6 support]),
AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]), [case "${enable_ipv6}" in
[ case "$enableval" in
no) no)
AC_MSG_RESULT(no) AC_MSG_NOTICE([Disabling IPv6 at user request])
ipv6=no ipv6=no
;; ;;
*) AC_MSG_RESULT(yes) *)
ipv6=yes ipv6=yes
;; ;;
esac ], esac],
[check_for_ipv6=yes]
)
AC_TRY_RUN([ /* is AF_INET6 available? */ if test "X$ipv6" = "Xyes" -o "X$check_for_ipv6" = "Xyes"; then
#include <sys/types.h> AC_CHECK_FUNC(getaddrinfo,[
#include <sys/socket.h> AC_DEFINE([HAVE_GETADDRINFO], 1)
main() GETADDRINFO_AI_ADDRCONFIG(
{ AC_DEFINE(
if (socket(AF_INET6, SOCK_STREAM, 0) < 0) [HAVE_GETADDRINFO_AI_ADDRCONFIG], 1,
exit(1); [Define if the system headers support the AI_ADDRCONFIG flag.]
else )
exit(0); )
} GETADDRINFO_AI_V4MAPPED(
], AC_DEFINE(
AC_MSG_RESULT(yes) [HAVE_GETADDRINFO_AI_V4MAPPED], 1,
ipv6=yes, [Define if the system headers support the AI_V4MAPPED flag.]
AC_MSG_RESULT(no) )
ipv6=no, )
AC_MSG_RESULT(no) GETADDRINFO_AI_ALL(
ipv6=no AC_DEFINE(
)) [HAVE_GETADDRINFO_AI_ALL], 1,
[Define if the system headers support the AI_ALL flag.]
if test x"$ipv6" = xyes; then )
WGET_CHECK_WORKING_GETADDRINFO )
],[
AC_MSG_NOTICE([Disabling IPv6 support: your system does not support getaddrinfo(3)])
ipv6=no
])
fi fi
if test "X$ipv6" = "Xyes" -o "X$check_for_ipv6" = "Xyes"; then
PROTO_INET6(,[
AC_MSG_NOTICE([Disabling IPv6 support: your system does not support the PF_INET6 protocol family])
ipv6=no
])
fi
if test "X$ipv6" = "Xyes" -o "X$check_for_ipv6" = "Xyes"; then
TYPE_STRUCT_SOCKADDR_IN6([
ipv6=yes
],[
AC_MSG_NOTICE([Disabling IPv6 support: your system does not support 'struct sockaddr_in6'])
ipv6=no
])
if test "X$ipv6" = "Xyes"; then
MEMBER_SIN6_SCOPE_ID
fi
fi
if test "X$ipv6" = "Xyes"; then
AC_DEFINE([ENABLE_IPV6], 1, [Define if IPv6 support is enabled.])
fi
dnl dnl
dnl Set of available languages. dnl Set of available languages.

View File

@ -253,6 +253,21 @@ char *alloca ();
/* Define if you have the getaddrinfo function. */ /* Define if you have the getaddrinfo function. */
#undef HAVE_GETADDRINFO #undef HAVE_GETADDRINFO
/* Define if the system headers support the AI_ADDRCONFIG flag. */
#undef HAVE_GETADDRINFO_AI_ADDRCONFIG
/* Define if the system headers support the AI_V4MAPPED flag. */
#undef HAVE_GETADDRINFO_AI_V4MAPPED
/* Define if the system headers support the AI_ALL flag. */
#undef HAVE_GETADDRINFO_AI_ALL
/* Define if the system supports struct sockaddr_in6 */
#undef HAVE_HAVE_STRUCT_SOCKADDR_IN6
/* Define if struct sockaddr_in6 has the sin6_scope_id member */
#undef HAVE_SOCKADDR_IN6_SCOPE_ID
/* Define if you want to enable the IPv6 support. */ /* Define if you want to enable the IPv6 support. */
#undef ENABLE_IPV6 #undef ENABLE_IPV6