add kafs.3
[heimdal.git] / cf / krb-ipv6.m4
blob6d4ed79efa24f4073c428a91050c09344bcf1a16
1 dnl $Id$
2 dnl
3 dnl test for IPv6
4 dnl
5 AC_DEFUN(AC_KRB_IPV6, [
6 AC_ARG_WITH(ipv6,
7 [  --without-ipv6       do not enable IPv6 support],[
8 if test "$withval" = "no"; then
9         ac_cv_lib_ipv6=no
10 fi])
11 AC_CACHE_VAL(ac_cv_lib_ipv6,
12 [dnl check for different v6 implementations (by itojun)
13 v6type=unknown
14 v6lib=none
16 AC_MSG_CHECKING([ipv6 stack type])
17 for i in v6d toshiba kame inria zeta linux; do
18         case $i in
19         v6d)
20                 AC_EGREP_CPP(yes, [dnl
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, [dnl
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, [dnl
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, [dnl
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, [dnl
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
80 AC_MSG_RESULT($v6type)
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
90 AC_TRY_LINK([
91 #ifdef HAVE_SYS_TYPES_H
92 #include <sys/types.h>
93 #endif
94 #ifdef HAVE_SYS_SOCKET_H
95 #include <sys/socket.h>
96 #endif
97 #ifdef HAVE_NETINET_IN_H
98 #include <netinet/in.h>
99 #endif
100 #ifdef HAVE_NETINET_IN6_H
101 #include <netinet/in6.h>
102 #endif
105  struct sockaddr_in6 sin6;
106  int s;
108  s = socket(AF_INET6, SOCK_DGRAM, 0);
110  sin6.sin6_family = AF_INET6;
111  sin6.sin6_port = htons(17);
112  sin6.sin6_addr = in6addr_any;
113  bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
115 ac_cv_lib_ipv6=yes,
116 ac_cv_lib_ipv6=no)])
117 AC_MSG_CHECKING(for IPv6)
118 AC_MSG_RESULT($ac_cv_lib_ipv6)
119 if test "$ac_cv_lib_ipv6" = yes; then
120   AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6.])