No empty .Rs/.Re
[netbsd-mini2440.git] / crypto / dist / heimdal / cf / krb-ipv6.m4
blobf4082b961d6e54644b786e86c1c13559613fb111
1 dnl $Heimdal: krb-ipv6.m4 14166 2004-08-26 12:35:42Z joda $
2 dnl $NetBSD$
3 dnl
4 dnl test for IPv6
5 dnl
6 AC_DEFUN([AC_KRB_IPV6], [
7 AC_ARG_WITH(ipv6,
8         AS_HELP_STRING([--without-ipv6],[do not enable IPv6 support]),[
9 if test "$withval" = "no"; then
10         ac_cv_lib_ipv6=no
11 fi])
12 save_CFLAGS="${CFLAGS}"
13 AC_CACHE_CHECK([for IPv6 stack type], v6type,
14 [dnl check for different v6 implementations (by itojun)
15 v6type=unknown
16 v6lib=none
18 for i in v6d toshiba kame inria zeta linux; do
19         case $i in
20         v6d)
21                 AC_EGREP_CPP(yes, [
22 #include </usr/local/v6/include/sys/types.h>
23 #ifdef __V6D__
24 yes
25 #endif],
26                         [v6type=$i; v6lib=v6;
27                         v6libdir=/usr/local/v6/lib;
28                         CFLAGS="-I/usr/local/v6/include $CFLAGS"])
29                 ;;
30         toshiba)
31                 AC_EGREP_CPP(yes, [
32 #include <sys/param.h>
33 #ifdef _TOSHIBA_INET6
34 yes
35 #endif],
36                         [v6type=$i; v6lib=inet6;
37                         v6libdir=/usr/local/v6/lib;
38                         CFLAGS="-DINET6 $CFLAGS"])
39                 ;;
40         kame)
41                 AC_EGREP_CPP(yes, [
42 #include <netinet/in.h>
43 #ifdef __KAME__
44 yes
45 #endif],
46                         [v6type=$i; v6lib=inet6;
47                         v6libdir=/usr/local/v6/lib;
48                         CFLAGS="-DINET6 $CFLAGS"])
49                 ;;
50         inria)
51                 AC_EGREP_CPP(yes, [
52 #include <netinet/in.h>
53 #ifdef IPV6_INRIA_VERSION
54 yes
55 #endif],
56                         [v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
57                 ;;
58         zeta)
59                 AC_EGREP_CPP(yes, [
60 #include <sys/param.h>
61 #ifdef _ZETA_MINAMI_INET6
62 yes
63 #endif],
64                         [v6type=$i; v6lib=inet6;
65                         v6libdir=/usr/local/v6/lib;
66                         CFLAGS="-DINET6 $CFLAGS"])
67                 ;;
68         linux)
69                 if test -d /usr/inet6; then
70                         v6type=$i
71                         v6lib=inet6
72                         v6libdir=/usr/inet6
73                         CFLAGS="-DINET6 $CFLAGS"
74                 fi
75                 ;;
76         esac
77         if test "$v6type" != "unknown"; then
78                 break
79         fi
80 done
82 if test "$v6lib" != "none"; then
83         for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
84                 if test -d $dir -a -f $dir/lib$v6lib.a; then
85                         LIBS="-L$dir -l$v6lib $LIBS"
86                         break
87                 fi
88         done
92 AC_CACHE_CHECK([for IPv6], ac_cv_lib_ipv6, [
93 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
94 #ifdef HAVE_SYS_TYPES_H
95 #include <sys/types.h>
96 #endif
97 #ifdef HAVE_SYS_SOCKET_H
98 #include <sys/socket.h>
99 #endif
100 #ifdef HAVE_NETINET_IN_H
101 #include <netinet/in.h>
102 #endif
103 #ifdef HAVE_NETINET_IN6_H
104 #include <netinet/in6.h>
105 #endif
108  struct sockaddr_in6 sin6;
109  int s;
111  s = socket(AF_INET6, SOCK_DGRAM, 0);
113  sin6.sin6_family = AF_INET6;
114  sin6.sin6_port = htons(17);
115  sin6.sin6_addr = in6addr_any;
116  bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
117 ]])],
118 [ac_cv_lib_ipv6=yes],
119 [ac_cv_lib_ipv6=no])])
120 if test "$ac_cv_lib_ipv6" = yes; then
121   AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6.])
122 else
123   CFLAGS="${save_CFLAGS}"
126 ## test for AIX missing in6addr_loopback
127 if test "$ac_cv_lib_ipv6" = yes; then
128         AC_CACHE_CHECK([for in6addr_loopback],[ac_cv_var_in6addr_loopback],[
129         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
130 #ifdef HAVE_SYS_TYPES_H
131 #include <sys/types.h>
132 #endif
133 #ifdef HAVE_SYS_SOCKET_H
134 #include <sys/socket.h>
135 #endif
136 #ifdef HAVE_NETINET_IN_H
137 #include <netinet/in.h>
138 #endif
139 #ifdef HAVE_NETINET_IN6_H
140 #include <netinet/in6.h>
141 #endif]],[[
142 struct sockaddr_in6 sin6;
143 sin6.sin6_addr = in6addr_loopback;
144 ]])],[ac_cv_var_in6addr_loopback=yes],[ac_cv_var_in6addr_loopback=no])])
145         if test "$ac_cv_var_in6addr_loopback" = yes; then
146                 AC_DEFINE(HAVE_IN6ADDR_LOOPBACK, 1, 
147                         [Define if you have the in6addr_loopback variable])
148         fi