5 AC_DEFUN([AC_KRB_IPV6], [
7 AS_HELP_STRING([--without-ipv6],[do not enable IPv6 support]),[
8 if test "$withval" = "no"; then
11 save_CFLAGS="${CFLAGS}"
12 AC_CACHE_CHECK([for IPv6 stack type], v6type,
13 [dnl check for different v6 implementations (by itojun)
17 for i in v6d toshiba kame inria zeta linux; do
21 #include </usr/local/v6/include/sys/types.h>
26 v6libdir=/usr/local/v6/lib;
27 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
31 #include <sys/param.h>
35 [v6type=$i; v6lib=inet6;
36 v6libdir=/usr/local/v6/lib;
37 CFLAGS="-DINET6 $CFLAGS"])
41 #include <netinet/in.h>
45 [v6type=$i; v6lib=inet6;
46 v6libdir=/usr/local/v6/lib;
47 CFLAGS="-DINET6 $CFLAGS"])
51 #include <netinet/in.h>
52 #ifdef IPV6_INRIA_VERSION
55 [v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
59 #include <sys/param.h>
60 #ifdef _ZETA_MINAMI_INET6
63 [v6type=$i; v6lib=inet6;
64 v6libdir=/usr/local/v6/lib;
65 CFLAGS="-DINET6 $CFLAGS"])
68 if test -d /usr/inet6; then
72 CFLAGS="-DINET6 $CFLAGS"
76 if test "$v6type" != "unknown"; then
81 if test "$v6lib" != "none"; then
82 for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
83 if test -d $dir -a -f $dir/lib$v6lib.a; then
84 LIBS="-L$dir -l$v6lib $LIBS"
91 AC_CACHE_CHECK([for IPv6], ac_cv_lib_ipv6, [
92 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
93 #ifdef HAVE_SYS_TYPES_H
94 #include <sys/types.h>
96 #ifdef HAVE_SYS_SOCKET_H
97 #include <sys/socket.h>
99 #ifdef HAVE_NETINET_IN_H
100 #include <netinet/in.h>
102 #ifdef HAVE_NETINET_IN6_H
103 #include <netinet/in6.h>
107 struct sockaddr_in6 sin6;
110 s = socket(AF_INET6, SOCK_DGRAM, 0);
112 sin6.sin6_family = AF_INET6;
113 sin6.sin6_port = htons(17);
114 sin6.sin6_addr = in6addr_any;
115 bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
117 [ac_cv_lib_ipv6=yes],
118 [ac_cv_lib_ipv6=no])])
119 if test "$ac_cv_lib_ipv6" = yes; then
120 AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6.])
122 CFLAGS="${save_CFLAGS}"
125 ## test for AIX missing in6addr_loopback
126 if test "$ac_cv_lib_ipv6" = yes; then
127 AC_CACHE_CHECK([for in6addr_loopback],[ac_cv_var_in6addr_loopback],[
128 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
129 #ifdef HAVE_SYS_TYPES_H
130 #include <sys/types.h>
132 #ifdef HAVE_SYS_SOCKET_H
133 #include <sys/socket.h>
135 #ifdef HAVE_NETINET_IN_H
136 #include <netinet/in.h>
138 #ifdef HAVE_NETINET_IN6_H
139 #include <netinet/in6.h>
141 struct sockaddr_in6 sin6;
142 sin6.sin6_addr = in6addr_loopback;
143 ]])],[ac_cv_var_in6addr_loopback=yes],[ac_cv_var_in6addr_loopback=no])])
144 if test "$ac_cv_var_in6addr_loopback" = yes; then
145 AC_DEFINE(HAVE_IN6ADDR_LOOPBACK, 1,
146 [Define if you have the in6addr_loopback variable])