7 AC_DEFUN([AC_KRB_IPV6], [
9 AS_HELP_STRING([--without-ipv6],[do not enable IPv6 support]),[
10 ac_cv_lib_ipv6="$withval"
12 save_CFLAGS="${CFLAGS}"
14 if test "X$ac_cv_lib_ipv6" != "Xno"; then
16 AC_CACHE_CHECK([for IPv6 stack type], rk_cv_v6type,
17 [dnl check for different v6 implementations (by itojun)
21 for i in v6d toshiba kame inria zeta linux; do
25 #include </usr/local/v6/include/sys/types.h>
30 v6libdir=/usr/local/v6/lib;
31 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
35 #include <sys/param.h>
39 [v6type=$i; v6lib=inet6;
40 v6libdir=/usr/local/v6/lib;
41 CFLAGS="-DINET6 $CFLAGS"])
45 #include <netinet/in.h>
49 [v6type=$i; v6lib=inet6;
50 v6libdir=/usr/local/v6/lib;
51 CFLAGS="-DINET6 $CFLAGS"])
55 #include <netinet/in.h>
56 #ifdef IPV6_INRIA_VERSION
59 [v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
63 #include <sys/param.h>
64 #ifdef _ZETA_MINAMI_INET6
67 [v6type=$i; v6lib=inet6;
68 v6libdir=/usr/local/v6/lib;
69 CFLAGS="-DINET6 $CFLAGS"])
72 if test -d /usr/inet6; then
76 CFLAGS="-DINET6 $CFLAGS"
80 if test "$v6type" != "unknown"; then
85 if test "$v6lib" != "none"; then
86 for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
87 if test -d $dir -a -f $dir/lib$v6lib.a; then
88 LIBS="-L$dir -l$v6lib $LIBS"
94 AC_CACHE_CHECK([for IPv6], rk_cv_lib_ipv6, [
95 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
96 #ifdef HAVE_SYS_TYPES_H
97 #include <sys/types.h>
99 #ifdef HAVE_SYS_SOCKET_H
100 #include <sys/socket.h>
102 #ifdef HAVE_NETINET_IN_H
103 #include <netinet/in.h>
105 #ifdef HAVE_NETINET_IN6_H
106 #include <netinet/in6.h>
110 struct sockaddr_in6 sin6;
113 s = socket(AF_INET6, SOCK_DGRAM, 0);
115 sin6.sin6_family = AF_INET6;
116 sin6.sin6_port = htons(17);
117 sin6.sin6_addr = in6addr_any;
118 bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
120 [ac_cv_lib_ipv6=yes],
121 [ac_cv_lib_ipv6=no])])
124 if test "$ac_cv_lib_ipv6" = yes; then
125 AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6.])
127 CFLAGS="${save_CFLAGS}"
130 ## test for AIX missing in6addr_loopback
131 if test "$ac_cv_lib_ipv6" = yes; then
132 AC_CACHE_CHECK([for in6addr_loopback],[rk_cv_var_in6addr_loopback],[
133 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
134 #ifdef HAVE_SYS_TYPES_H
135 #include <sys/types.h>
137 #ifdef HAVE_SYS_SOCKET_H
138 #include <sys/socket.h>
140 #ifdef HAVE_NETINET_IN_H
141 #include <netinet/in.h>
143 #ifdef HAVE_NETINET_IN6_H
144 #include <netinet/in6.h>
146 struct sockaddr_in6 sin6;
147 sin6.sin6_addr = in6addr_loopback;
148 ]])],[ac_cv_var_in6addr_loopback=yes],[ac_cv_var_in6addr_loopback=no])])
149 if test "$ac_cv_var_in6addr_loopback" = yes; then
150 AC_DEFINE(HAVE_IN6ADDR_LOOPBACK, 1,
151 [Define if you have the in6addr_loopback variable])