1dnl See whether we can use IPv6 related functions 2dnl contributed by Hajimu UMEMOTO 3 4AC_DEFUN([IPv6_CHECK_FUNC], [ 5AC_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 39ipv6_cv_$1=no 40if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \ 41 -o $ac_cv_lib_inet6_$1 = yes 42then 43 ipv6_cv_$1=yes 44fi 45if 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 57fi 58if test $ipv6_cv_$1 = yes; then 59 ifelse([$2], , :, [$2]) 60else 61 ifelse([$3], , :, [$3]) 62fi]) 63 64 65dnl See whether we have ss_family in sockaddr_storage 66AC_DEFUN([IPv6_CHECK_SS_FAMILY], [ 67AC_MSG_CHECKING([whether you have ss_family in struct sockaddr_storage]) 68AC_CACHE_VAL(ipv6_cv_ss_family, [dnl 69AC_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 73if test $ipv6_cv_ss_family = yes; then 74 ifelse([$1], , AC_DEFINE(HAVE_SS_FAMILY,[],[Is there an ss_family in sockaddr_storage?]), [$1]) 75else 76 ifelse([$2], , :, [$2]) 77fi 78AC_MSG_RESULT($ipv6_cv_ss_family)]) 79 80 81dnl whether you have sa_len in struct sockaddr 82AC_DEFUN([IPv6_CHECK_SA_LEN], [ 83AC_MSG_CHECKING([whether you have sa_len in struct sockaddr]) 84AC_CACHE_VAL(ipv6_cv_sa_len, [dnl 85AC_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 89if test $ipv6_cv_sa_len = yes; then 90 ifelse([$1], , AC_DEFINE(HAVE_SOCKADDR_SA_LEN,[],[Does sockaddr have an sa_len?]), [$1]) 91else 92 ifelse([$2], , :, [$2]) 93fi 94AC_MSG_RESULT($ipv6_cv_sa_len)]) 95 96 97dnl See whether sys/socket.h has socklen_t 98AC_DEFUN([IPv6_CHECK_SOCKLEN_T], [ 99AC_MSG_CHECKING(for socklen_t) 100AC_CACHE_VAL(ipv6_cv_socklen_t, [dnl 101AC_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 105if test $ipv6_cv_socklen_t = yes; then 106 ifelse([$1], , AC_DEFINE(HAVE_SOCKLEN_T,[],[Do we have a socklen_t?]), [$1]) 107else 108 ifelse([$2], , :, [$2]) 109fi 110AC_MSG_RESULT($ipv6_cv_socklen_t)]) 111 112