add import/export type for private keys
[heimdal.git] / cf / krb-ipv6.m4
blob4fbe2d67fbc354a980ce9c3271a2002a9387345a
1 dnl $Id$
2 dnl
3 dnl test for IPv6
4 dnl
5 ac_cv_lib_ipv6=check
7 AC_DEFUN([AC_KRB_IPV6], [
8 AC_ARG_WITH(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)
18         v6type=unknown
19         v6lib=none
21         for i in v6d toshiba kame inria zeta linux; do
22                 case $i in
23                 v6d)
24                         AC_EGREP_CPP(yes, [
25 #include </usr/local/v6/include/sys/types.h>
26 #ifdef __V6D__
27 yes
28 #endif],
29                                 [v6type=$i; v6lib=v6;
30                                 v6libdir=/usr/local/v6/lib;
31                                 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
32                         ;;
33                 toshiba)
34                         AC_EGREP_CPP(yes, [
35 #include <sys/param.h>
36 #ifdef _TOSHIBA_INET6
37 yes
38 #endif],
39                                 [v6type=$i; v6lib=inet6;
40                                 v6libdir=/usr/local/v6/lib;
41                                 CFLAGS="-DINET6 $CFLAGS"])
42                         ;;
43                 kame)
44                         AC_EGREP_CPP(yes, [
45 #include <netinet/in.h>
46 #ifdef __KAME__
47 yes
48 #endif],
49                                 [v6type=$i; v6lib=inet6;
50                                 v6libdir=/usr/local/v6/lib;
51                                 CFLAGS="-DINET6 $CFLAGS"])
52                         ;;
53                 inria)
54                         AC_EGREP_CPP(yes, [
55 #include <netinet/in.h>
56 #ifdef IPV6_INRIA_VERSION
57 yes
58 #endif],
59                                 [v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
60                         ;;
61                 zeta)
62                         AC_EGREP_CPP(yes, [
63 #include <sys/param.h>
64 #ifdef _ZETA_MINAMI_INET6
65 yes
66 #endif],
67                                 [v6type=$i; v6lib=inet6;
68                                 v6libdir=/usr/local/v6/lib;
69                                 CFLAGS="-DINET6 $CFLAGS"])
70                         ;;
71                 linux)
72                         if test -d /usr/inet6; then
73                                 v6type=$i
74                                 v6lib=inet6
75                                 v6libdir=/usr/inet6
76                                 CFLAGS="-DINET6 $CFLAGS"
77                         fi
78                         ;;
79                 esac
80                 if test "$v6type" != "unknown"; then
81                         break
82                 fi
83         done
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"
89                                 break
90                         fi
91                 done
92         fi])
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>
98 #endif
99 #ifdef HAVE_SYS_SOCKET_H
100 #include <sys/socket.h>
101 #endif
102 #ifdef HAVE_NETINET_IN_H
103 #include <netinet/in.h>
104 #endif
105 #ifdef HAVE_NETINET_IN6_H
106 #include <netinet/in6.h>
107 #endif
109         [[
110  struct sockaddr_in6 sin6;
111  int s;
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));
119 ]])],
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.])
126 else
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>
136 #endif
137 #ifdef HAVE_SYS_SOCKET_H
138 #include <sys/socket.h>
139 #endif
140 #ifdef HAVE_NETINET_IN_H
141 #include <netinet/in.h>
142 #endif
143 #ifdef HAVE_NETINET_IN6_H
144 #include <netinet/in6.h>
145 #endif]],[[
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])
152         fi