GSS_S_PROMPTING_NEEDED is a bit
[cyrus-sasl.git] / cmulocal / ipv6.m4
1 dnl See whether we can use IPv6 related functions
2 dnl contributed by Hajimu UMEMOTO
3
4 AC_DEFUN([IPv6_CHECK_FUNC], [
5 AC_CHECK_FUNC($1, [dnl
6   ac_cv_lib_socket_$1=no
7   ac_cv_lib_inet6_$1=no
8 ], [dnl
9   AC_CHECK_LIB(socket, $1, [dnl
10     LIBS="$LIBS -lsocket"
11     ac_cv_lib_inet6_$1=no
12   ], [dnl
13     AC_MSG_CHECKING([whether your system has IPv6 directory])
14     AC_CACHE_VAL(ipv6_cv_dir, [dnl
15       for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
16         if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
17           break
18         fi
19       done])dnl
20     AC_MSG_RESULT($ipv6_cv_dir)
21     if test $ipv6_cv_dir = no; then
22       ac_cv_lib_inet6_$1=no
23     else
24       if test x$ipv6_libinet6 = x; then
25         ipv6_libinet6=no
26         SAVELDFLAGS="$LDFLAGS"
27         LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
28       fi
29       AC_CHECK_LIB(inet6, $1, [dnl
30         if test $ipv6_libinet6 = no; then
31           ipv6_libinet6=yes
32           LIBS="$LIBS -linet6"
33         fi],)dnl
34       if test $ipv6_libinet6 = no; then
35         LDFLAGS="$SAVELDFLAGS"
36       fi
37     fi])dnl
38 ])dnl
39 ipv6_cv_$1=no
40 if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \
41      -o $ac_cv_lib_inet6_$1 = yes
42 then
43   ipv6_cv_$1=yes
44 fi
45 if test $ipv6_cv_$1 = no; then
46   if test $1 = getaddrinfo; then
47     for ipv6_cv_pfx in o n; do
48       AC_EGREP_HEADER(${ipv6_cv_pfx}$1, netdb.h,
49                       [AC_CHECK_FUNC(${ipv6_cv_pfx}$1)])
50       if eval test X\$ac_cv_func_${ipv6_cv_pfx}$1 = Xyes; then
51         AC_DEFINE(HAVE_GETADDRINFO,[],[Do we have a getaddrinfo?])
52         ipv6_cv_$1=yes
53         break
54       fi
55     done
56   fi
57 fi
58 if test $ipv6_cv_$1 = yes; then
59   ifelse([$2], , :, [$2])
60 else
61   ifelse([$3], , :, [$3])
62 fi])
63
64
65 dnl See whether we have ss_family in sockaddr_storage
66 AC_DEFUN([IPv6_CHECK_SS_FAMILY], [
67 AC_MSG_CHECKING([whether you have ss_family in struct sockaddr_storage])
68 AC_CACHE_VAL(ipv6_cv_ss_family, [dnl
69 AC_TRY_COMPILE([#include <sys/types.h>
70 #include <sys/socket.h>],
71         [struct sockaddr_storage ss; int i = ss.ss_family;],
72         [ipv6_cv_ss_family=yes], [ipv6_cv_ss_family=no])])dnl
73 if test $ipv6_cv_ss_family = yes; then
74   ifelse([$1], , AC_DEFINE(HAVE_SS_FAMILY,[],[Is there an ss_family in sockaddr_storage?]), [$1])
75 else
76   ifelse([$2], , :, [$2])
77 fi
78 AC_MSG_RESULT($ipv6_cv_ss_family)])
79
80
81 dnl whether you have sa_len in struct sockaddr
82 AC_DEFUN([IPv6_CHECK_SA_LEN], [
83 AC_MSG_CHECKING([whether you have sa_len in struct sockaddr])
84 AC_CACHE_VAL(ipv6_cv_sa_len, [dnl
85 AC_TRY_COMPILE([#include <sys/types.h>
86 #include <sys/socket.h>],
87                [struct sockaddr sa; int i = sa.sa_len;],
88                [ipv6_cv_sa_len=yes], [ipv6_cv_sa_len=no])])dnl
89 if test $ipv6_cv_sa_len = yes; then
90   ifelse([$1], , AC_DEFINE(HAVE_SOCKADDR_SA_LEN,[],[Does sockaddr have an sa_len?]), [$1])
91 else
92   ifelse([$2], , :, [$2])
93 fi
94 AC_MSG_RESULT($ipv6_cv_sa_len)])
95
96
97 dnl See whether sys/socket.h has socklen_t
98 AC_DEFUN([IPv6_CHECK_SOCKLEN_T], [
99 AC_MSG_CHECKING(for socklen_t)
100 AC_CACHE_VAL(ipv6_cv_socklen_t, [dnl
101 AC_TRY_LINK([#include <sys/types.h>
102 #include <sys/socket.h>],
103             [socklen_t len = 0;],
104             [ipv6_cv_socklen_t=yes], [ipv6_cv_socklen_t=no])])dnl
105 if test $ipv6_cv_socklen_t = yes; then
106   ifelse([$1], , AC_DEFINE(HAVE_SOCKLEN_T,[],[Do we have a socklen_t?]), [$1])
107 else
108   ifelse([$2], , :, [$2])
109 fi
110 AC_MSG_RESULT($ipv6_cv_socklen_t)])
111