PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/crypto/heimdal/cf/krb-ipv6.m4

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