Home | History | Annotate | Line # | Download | only in cf
krb-ipv6.m4 revision 1.1
      1  1.1  elric dnl $Id: krb-ipv6.m4,v 1.1 2011/04/13 18:14:32 elric Exp $
      2  1.1  elric dnl
      3  1.1  elric dnl test for IPv6
      4  1.1  elric dnl
      5  1.1  elric ac_cv_lib_ipv6=check
      6  1.1  elric 
      7  1.1  elric AC_DEFUN([AC_KRB_IPV6], [
      8  1.1  elric AC_ARG_WITH(ipv6,
      9  1.1  elric 	AS_HELP_STRING([--without-ipv6],[do not enable IPv6 support]),[
     10  1.1  elric         ac_cv_lib_ipv6="$withval"
     11  1.1  elric ])
     12  1.1  elric save_CFLAGS="${CFLAGS}"
     13  1.1  elric 
     14  1.1  elric if test "X$ac_cv_lib_ipv6" != "Xno"; then
     15  1.1  elric 
     16  1.1  elric 	AC_CACHE_CHECK([for IPv6 stack type], rk_cv_v6type, 
     17  1.1  elric 	[dnl check for different v6 implementations (by itojun)
     18  1.1  elric 	v6type=unknown
     19  1.1  elric 	v6lib=none
     20  1.1  elric 
     21  1.1  elric 	for i in v6d toshiba kame inria zeta linux; do
     22  1.1  elric 		case $i in
     23  1.1  elric 		v6d)
     24  1.1  elric 			AC_EGREP_CPP(yes, [
     25  1.1  elric #include </usr/local/v6/include/sys/types.h>
     26  1.1  elric #ifdef __V6D__
     27  1.1  elric yes
     28  1.1  elric #endif],
     29  1.1  elric 				[v6type=$i; v6lib=v6;
     30  1.1  elric 				v6libdir=/usr/local/v6/lib;
     31  1.1  elric 				CFLAGS="-I/usr/local/v6/include $CFLAGS"])
     32  1.1  elric 			;;
     33  1.1  elric 		toshiba)
     34  1.1  elric 			AC_EGREP_CPP(yes, [
     35  1.1  elric #include <sys/param.h>
     36  1.1  elric #ifdef _TOSHIBA_INET6
     37  1.1  elric yes
     38  1.1  elric #endif],
     39  1.1  elric 				[v6type=$i; v6lib=inet6;
     40  1.1  elric 				v6libdir=/usr/local/v6/lib;
     41  1.1  elric 				CFLAGS="-DINET6 $CFLAGS"])
     42  1.1  elric 			;;
     43  1.1  elric 		kame)
     44  1.1  elric 			AC_EGREP_CPP(yes, [
     45  1.1  elric #include <netinet/in.h>
     46  1.1  elric #ifdef __KAME__
     47  1.1  elric yes
     48  1.1  elric #endif],
     49  1.1  elric 				[v6type=$i; v6lib=inet6;
     50  1.1  elric 				v6libdir=/usr/local/v6/lib;
     51  1.1  elric 				CFLAGS="-DINET6 $CFLAGS"])
     52  1.1  elric 			;;
     53  1.1  elric 		inria)
     54  1.1  elric 			AC_EGREP_CPP(yes, [
     55  1.1  elric #include <netinet/in.h>
     56  1.1  elric #ifdef IPV6_INRIA_VERSION
     57  1.1  elric yes
     58  1.1  elric #endif],
     59  1.1  elric 				[v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
     60  1.1  elric 			;;
     61  1.1  elric 		zeta)
     62  1.1  elric 			AC_EGREP_CPP(yes, [
     63  1.1  elric #include <sys/param.h>
     64  1.1  elric #ifdef _ZETA_MINAMI_INET6
     65  1.1  elric yes
     66  1.1  elric #endif],
     67  1.1  elric 				[v6type=$i; v6lib=inet6;
     68  1.1  elric 				v6libdir=/usr/local/v6/lib;
     69  1.1  elric 				CFLAGS="-DINET6 $CFLAGS"])
     70  1.1  elric 			;;
     71  1.1  elric 		linux)
     72  1.1  elric 			if test -d /usr/inet6; then
     73  1.1  elric 				v6type=$i
     74  1.1  elric 				v6lib=inet6
     75  1.1  elric 				v6libdir=/usr/inet6
     76  1.1  elric 				CFLAGS="-DINET6 $CFLAGS"
     77  1.1  elric 			fi
     78  1.1  elric 			;;
     79  1.1  elric 		esac
     80  1.1  elric 		if test "$v6type" != "unknown"; then
     81  1.1  elric 			break
     82  1.1  elric 		fi
     83  1.1  elric 	done
     84  1.1  elric 
     85  1.1  elric 	if test "$v6lib" != "none"; then
     86  1.1  elric 		for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
     87  1.1  elric 			if test -d $dir -a -f $dir/lib$v6lib.a; then
     88  1.1  elric 				LIBS="-L$dir -l$v6lib $LIBS"
     89  1.1  elric 				break
     90  1.1  elric 			fi
     91  1.1  elric 		done
     92  1.1  elric 	fi])
     93  1.1  elric 
     94  1.1  elric 	AC_CACHE_CHECK([for IPv6], rk_cv_lib_ipv6, [
     95  1.1  elric 	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
     96  1.1  elric #ifdef HAVE_SYS_TYPES_H
     97  1.1  elric #include <sys/types.h>
     98  1.1  elric #endif
     99  1.1  elric #ifdef HAVE_SYS_SOCKET_H
    100  1.1  elric #include <sys/socket.h>
    101  1.1  elric #endif
    102  1.1  elric #ifdef HAVE_NETINET_IN_H
    103  1.1  elric #include <netinet/in.h>
    104  1.1  elric #endif
    105  1.1  elric #ifdef HAVE_NETINET_IN6_H
    106  1.1  elric #include <netinet/in6.h>
    107  1.1  elric #endif
    108  1.1  elric ]],
    109  1.1  elric 	[[
    110  1.1  elric  struct sockaddr_in6 sin6;
    111  1.1  elric  int s;
    112  1.1  elric 
    113  1.1  elric  s = socket(AF_INET6, SOCK_DGRAM, 0);
    114  1.1  elric 
    115  1.1  elric  sin6.sin6_family = AF_INET6;
    116  1.1  elric  sin6.sin6_port = htons(17);
    117  1.1  elric  sin6.sin6_addr = in6addr_any;
    118  1.1  elric  bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
    119  1.1  elric ]])],
    120  1.1  elric 	[ac_cv_lib_ipv6=yes],
    121  1.1  elric 	[ac_cv_lib_ipv6=no])])
    122  1.1  elric fi
    123  1.1  elric 
    124  1.1  elric if test "$ac_cv_lib_ipv6" = yes; then
    125  1.1  elric   AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6.])
    126  1.1  elric else
    127  1.1  elric   CFLAGS="${save_CFLAGS}"
    128  1.1  elric fi
    129  1.1  elric 
    130  1.1  elric ## test for AIX missing in6addr_loopback
    131  1.1  elric if test "$ac_cv_lib_ipv6" = yes; then
    132  1.1  elric 	AC_CACHE_CHECK([for in6addr_loopback],[rk_cv_var_in6addr_loopback],[
    133  1.1  elric 	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
    134  1.1  elric #ifdef HAVE_SYS_TYPES_H
    135  1.1  elric #include <sys/types.h>
    136  1.1  elric #endif
    137  1.1  elric #ifdef HAVE_SYS_SOCKET_H
    138  1.1  elric #include <sys/socket.h>
    139  1.1  elric #endif
    140  1.1  elric #ifdef HAVE_NETINET_IN_H
    141  1.1  elric #include <netinet/in.h>
    142  1.1  elric #endif
    143  1.1  elric #ifdef HAVE_NETINET_IN6_H
    144  1.1  elric #include <netinet/in6.h>
    145  1.1  elric #endif]],[[
    146  1.1  elric struct sockaddr_in6 sin6;
    147  1.1  elric sin6.sin6_addr = in6addr_loopback;
    148  1.1  elric ]])],[ac_cv_var_in6addr_loopback=yes],[ac_cv_var_in6addr_loopback=no])])
    149  1.1  elric 	if test "$ac_cv_var_in6addr_loopback" = yes; then
    150  1.1  elric 		AC_DEFINE(HAVE_IN6ADDR_LOOPBACK, 1, 
    151  1.1  elric 			[Define if you have the in6addr_loopback variable])
    152  1.1  elric 	fi
    153  1.1  elric fi
    154  1.1  elric ])