remove one line.
[heimdal.git] / cf / krb-ipv6.m4
bloba62f3a31585bac2fd5c5d677671f8559926c5281
1 dnl $Id$
2 dnl
3 dnl test for IPv6
4 dnl
5 AC_DEFUN([AC_KRB_IPV6], [
6 AC_ARG_WITH(ipv6,
7         AS_HELP_STRING([--without-ipv6],[do not enable IPv6 support]),[
8 if test "$withval" = "no"; then
9         ac_cv_lib_ipv6=no
10 fi])
11 save_CFLAGS="${CFLAGS}"
12 AC_CACHE_CHECK([for IPv6 stack type], v6type,
13 [dnl check for different v6 implementations (by itojun)
14 v6type=unknown
15 v6lib=none
17 for i in v6d toshiba kame inria zeta linux; do
18         case $i in
19         v6d)
20                 AC_EGREP_CPP(yes, [
21 #include </usr/local/v6/include/sys/types.h>
22 #ifdef __V6D__
23 yes
24 #endif],
25                         [v6type=$i; v6lib=v6;
26                         v6libdir=/usr/local/v6/lib;
27                         CFLAGS="-I/usr/local/v6/include $CFLAGS"])
28                 ;;
29         toshiba)
30                 AC_EGREP_CPP(yes, [
31 #include <sys/param.h>
32 #ifdef _TOSHIBA_INET6
33 yes
34 #endif],
35                         [v6type=$i; v6lib=inet6;
36                         v6libdir=/usr/local/v6/lib;
37                         CFLAGS="-DINET6 $CFLAGS"])
38                 ;;
39         kame)
40                 AC_EGREP_CPP(yes, [
41 #include <netinet/in.h>
42 #ifdef __KAME__
43 yes
44 #endif],
45                         [v6type=$i; v6lib=inet6;
46                         v6libdir=/usr/local/v6/lib;
47                         CFLAGS="-DINET6 $CFLAGS"])
48                 ;;
49         inria)
50                 AC_EGREP_CPP(yes, [
51 #include <netinet/in.h>
52 #ifdef IPV6_INRIA_VERSION
53 yes
54 #endif],
55                         [v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
56                 ;;
57         zeta)
58                 AC_EGREP_CPP(yes, [
59 #include <sys/param.h>
60 #ifdef _ZETA_MINAMI_INET6
61 yes
62 #endif],
63                         [v6type=$i; v6lib=inet6;
64                         v6libdir=/usr/local/v6/lib;
65                         CFLAGS="-DINET6 $CFLAGS"])
66                 ;;
67         linux)
68                 if test -d /usr/inet6; then
69                         v6type=$i
70                         v6lib=inet6
71                         v6libdir=/usr/inet6
72                         CFLAGS="-DINET6 $CFLAGS"
73                 fi
74                 ;;
75         esac
76         if test "$v6type" != "unknown"; then
77                 break
78         fi
79 done
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"
85                         break
86                 fi
87         done
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>
95 #endif
96 #ifdef HAVE_SYS_SOCKET_H
97 #include <sys/socket.h>
98 #endif
99 #ifdef HAVE_NETINET_IN_H
100 #include <netinet/in.h>
101 #endif
102 #ifdef HAVE_NETINET_IN6_H
103 #include <netinet/in6.h>
104 #endif
107  struct sockaddr_in6 sin6;
108  int s;
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));
116 ]])],
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.])
121 else
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>
131 #endif
132 #ifdef HAVE_SYS_SOCKET_H
133 #include <sys/socket.h>
134 #endif
135 #ifdef HAVE_NETINET_IN_H
136 #include <netinet/in.h>
137 #endif
138 #ifdef HAVE_NETINET_IN6_H
139 #include <netinet/in6.h>
140 #endif]],[[
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])
147         fi