1 dnl See whether we can use IPv6 related functions
2 dnl contributed by Hajimu UMEMOTO
4 AC_DEFUN([IPv6_CHECK_FUNC], [
9 AC_CHECK_LIB(socket, $1, [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
20 AC_MSG_RESULT($ipv6_cv_dir)
21 if test $ipv6_cv_dir = no; then
24 if test x$ipv6_libinet6 = x; then
26 SAVELDFLAGS="$LDFLAGS"
27 LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
29 AC_CHECK_LIB(inet6, $1, [dnl
30 if test $ipv6_libinet6 = no; then
34 if test $ipv6_libinet6 = no; then
35 LDFLAGS="$SAVELDFLAGS"
40 if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \
41 -o $ac_cv_lib_inet6_$1 = yes
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?])
58 if test $ipv6_cv_$1 = yes; then
59 ifelse([$2], , :, [$2])
61 ifelse([$3], , :, [$3])
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])
76 ifelse([$2], , :, [$2])
78 AC_MSG_RESULT($ipv6_cv_ss_family)])
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])
92 ifelse([$2], , :, [$2])
94 AC_MSG_RESULT($ipv6_cv_sa_len)])
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])
108 ifelse([$2], , :, [$2])
110 AC_MSG_RESULT($ipv6_cv_socklen_t)])