| 1 |
AC_DEFUN([AC_TNY_IPV6_CHECK], |
|---|
| 2 |
[ |
|---|
| 3 |
|
|---|
| 4 |
AC_CACHE_CHECK([if system supports getaddrinfo and getnameinfo], have_addrinfo, |
|---|
| 5 |
[ |
|---|
| 6 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
|---|
| 7 |
#include "confdefs.h" |
|---|
| 8 |
#include <sys/types.h> |
|---|
| 9 |
#include <sys/socket.h> |
|---|
| 10 |
#include <netinet/in.h> |
|---|
| 11 |
#include <netdb.h> |
|---|
| 12 |
#include <stddef.h> |
|---|
| 13 |
|
|---|
| 14 |
]], [[ |
|---|
| 15 |
struct addrinfo hints, *res; |
|---|
| 16 |
struct sockaddr_in6 sin6; |
|---|
| 17 |
int af = AF_INET6; |
|---|
| 18 |
char host[NI_MAXHOST]; |
|---|
| 19 |
char serv[NI_MAXSERV]; |
|---|
| 20 |
|
|---|
| 21 |
getaddrinfo ("www.ximian.com", NULL, &hints, &res); |
|---|
| 22 |
freeaddrinfo (res); |
|---|
| 23 |
getnameinfo((struct sockaddr *)&sin6, sizeof(sin6), host, sizeof(host), serv, sizeof(serv), 0); |
|---|
| 24 |
]])],[ |
|---|
| 25 |
have_addrinfo=yes |
|---|
| 26 |
],[ |
|---|
| 27 |
have_addrinfo=no |
|---|
| 28 |
]) |
|---|
| 29 |
]) |
|---|
| 30 |
|
|---|
| 31 |
if test x"$have_addrinfo" = "xno" ; then |
|---|
| 32 |
AC_DEFINE(NEED_ADDRINFO,1,[Enable getaddrinfo emulation]) |
|---|
| 33 |
if test x"$enable_ipv6" = "xyes" ; then |
|---|
| 34 |
AC_MSG_ERROR([system doesn't support necessary interfaces for ipv6 support]) |
|---|
| 35 |
fi |
|---|
| 36 |
msg_ipv6=no |
|---|
| 37 |
else |
|---|
| 38 |
AC_ARG_ENABLE(ipv6, [ --enable-ipv6=[no/yes] Enable support for resolving IPv6 addresses.],,enable_ipv6=yes) |
|---|
| 39 |
if test x"$enable_ipv6" = "xyes"; then |
|---|
| 40 |
msg_ipv6=yes |
|---|
| 41 |
AC_DEFINE(ENABLE_IPv6,1,[Enable IPv6 support]) |
|---|
| 42 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
]], [[ |
|---|
| 50 |
struct addrinfo hints; |
|---|
| 51 |
|
|---|
| 52 |
hints.ai_flags = AI_ADDRCONFIG; |
|---|
| 53 |
]])],[ |
|---|
| 54 |
AC_DEFINE(HAVE_AI_ADDRCONFIG,1,[Define if the system defines the AI_ADDRCONFIG flag for getaddrinfo]) |
|---|
| 55 |
],[]) |
|---|
| 56 |
else |
|---|
| 57 |
msg_ipv6=no |
|---|
| 58 |
fi |
|---|
| 59 |
fi |
|---|
| 60 |
|
|---|
| 61 |
AM_CONDITIONAL(ENABLE_IPv6, test "x$enable_ipv6" = "xyes") |
|---|
| 62 |
|
|---|
| 63 |
]) |
|---|