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 |
if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \ |
40 |
-o $ac_cv_lib_inet6_$1 = yes |
41 |
then |
42 |
ipv6_cv_$1=yes |
43 |
ifelse([$2], , :, [$2]) |
44 |
else |
45 |
ipv6_cv_$1=no |
46 |
ifelse([$3], , :, [$3]) |
47 |
fi]) |
48 |
|
49 |
|
50 |
dnl See whether we have ss_family in sockaddr_storage |
51 |
AC_DEFUN(IPv6_CHECK_SS_FAMILY, [ |
52 |
AC_MSG_CHECKING([whether you have ss_family in struct sockaddr_storage]) |
53 |
AC_CACHE_VAL(ipv6_cv_ss_family, [dnl |
54 |
AC_TRY_COMPILE([#include <sys/types.h> |
55 |
#include <sys/socket.h>], |
56 |
[struct sockaddr_storage ss; int i = ss.ss_family;], |
57 |
[ipv6_cv_ss_family=yes], [ipv6_cv_ss_family=no])])dnl |
58 |
if test $ipv6_cv_ss_family = yes; then |
59 |
ifelse([$1], , AC_DEFINE(HAVE_SS_FAMILY), [$1]) |
60 |
else |
61 |
ifelse([$2], , :, [$2]) |
62 |
fi |
63 |
AC_MSG_RESULT($ipv6_cv_ss_family)]) |
64 |
|
65 |
|
66 |
dnl whether you have sa_len in struct sockaddr |
67 |
AC_DEFUN(IPv6_CHECK_SA_LEN, [ |
68 |
AC_MSG_CHECKING([whether you have sa_len in struct sockaddr]) |
69 |
AC_CACHE_VAL(ipv6_cv_sa_len, [dnl |
70 |
AC_TRY_COMPILE([#include <sys/types.h> |
71 |
#include <sys/socket.h>], |
72 |
[struct sockaddr sa; int i = sa.sa_len;], |
73 |
[ipv6_cv_sa_len=yes], [ipv6_cv_sa_len=no])])dnl |
74 |
if test $ipv6_cv_sa_len = yes; then |
75 |
ifelse([$1], , AC_DEFINE(HAVE_SOCKADDR_SA_LEN), [$1]) |
76 |
else |
77 |
ifelse([$2], , :, [$2]) |
78 |
fi |
79 |
AC_MSG_RESULT($ipv6_cv_sa_len)]) |
80 |
|
81 |
|
82 |
dnl See whether sys/socket.h has socklen_t |
83 |
AC_DEFUN(IPv6_CHECK_SOCKLEN_T, [ |
84 |
AC_MSG_CHECKING(for socklen_t) |
85 |
AC_CACHE_VAL(ipv6_cv_socklen_t, [dnl |
86 |
AC_TRY_LINK([#include <sys/types.h> |
87 |
#include <sys/socket.h>], |
88 |
[socklen_t len = 0;], |
89 |
[ipv6_cv_socklen_t=yes], [ipv6_cv_socklen_t=no])])dnl |
90 |
if test $ipv6_cv_socklen_t = yes; then |
91 |
ifelse([$1], , AC_DEFINE(HAVE_SOCKLEN_T), [$1]) |
92 |
else |
93 |
ifelse([$2], , :, [$2]) |
94 |
fi |
95 |
AC_MSG_RESULT($ipv6_cv_socklen_t)]) |