re-organize:

test for type of stack first so that we can find the libraries that we
might have to link the test program against.  not linking the test
program means we don't know if the right stuff is in the libraries.
also cosmetic changes to make sure we print the checking for... nicely


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7694 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-01-01 11:44:45 +00:00
parent 3a7d0a06cd
commit a41ba453ad

View File

@@ -8,43 +8,13 @@ AC_ARG_WITH(ipv6,
if test "$withval" = "no"; then if test "$withval" = "no"; then
ac_cv_lib_ipv6=no ac_cv_lib_ipv6=no
fi]) fi])
AC_CACHE_CHECK(for IPv6,ac_cv_lib_ipv6, AC_CACHE_VAL(ac_cv_lib_ipv6,
AC_TRY_LINK([ [dnl check for different v6 implementations (by itojun)
#ifdef HAVE_SYS_TYPES_H v6type=unknown
#include <sys/types.h> v6lib=none
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_IN6_H
#include <netinet/in6.h>
#endif
],
[
struct sockaddr_in6 sin6;
int s;
s = socket(AF_INET6, SOCK_DGRAM, 0); AC_MSG_CHECKING([ipv6 stack type])
for i in v6d toshiba kame inria zeta linux; do
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(17);
sin6.sin6_addr = in6addr_any;
bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
],
ac_cv_lib_ipv6=yes,
ac_cv_lib_ipv6=no))
if test "$ac_cv_lib_ipv6" = yes; then
AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6.])
dnl check for different v6 implementations (by itojun)
v6type=unknown
v6lib=none
AC_MSG_CHECKING([ipv6 stack type])
for i in v6d toshiba kame inria zeta linux; do
case $i in case $i in
v6d) v6d)
AC_EGREP_CPP(yes, [dnl AC_EGREP_CPP(yes, [dnl
@@ -106,23 +76,47 @@ yes
if test "$v6type" != "unknown"; then if test "$v6type" != "unknown"; then
break break
fi fi
done done
AC_MSG_RESULT($v6type) AC_MSG_RESULT($v6type)
if test "$v6lib" != "none"; then if test "$v6lib" != "none"; then
for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
if test -d $dir -a -f $dir/lib$v6lib.a; then if test -d $dir -a -f $dir/lib$v6lib.a; then
LIBS="-L$dir -l$v6lib $LIBS" LIBS="-L$dir -l$v6lib $LIBS"
break break
fi fi
done done
dnl AC_CHECK_LIB($v6lib, getaddrinfo, fi
dnl [SERVER_LIBS="-l$v6lib $SERVER_LIBS"], AC_TRY_LINK([
dnl [dnl #ifdef HAVE_SYS_TYPES_H
dnl echo "Fatal: no $v6lib library found. cannot continue." #include <sys/types.h>
dnl echo "You need to fetch lib$v6lib.a from appropriate v6 kit and" #endif
dnl echo 'compile beforehand.' #ifdef HAVE_SYS_SOCKET_H
dnl exit 1]) #include <sys/socket.h>
fi #endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_IN6_H
#include <netinet/in6.h>
#endif
],
[
struct sockaddr_in6 sin6;
int s;
s = socket(AF_INET6, SOCK_DGRAM, 0);
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(17);
sin6.sin6_addr = in6addr_any;
bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
],
ac_cv_lib_ipv6=yes,
ac_cv_lib_ipv6=no)])
AC_MSG_CHECKING(for IPv6)
AC_MSG_RESULT($ac_cv_lib_ipv6)
if test "$ac_cv_lib_ipv6" = yes; then
AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6.])
fi fi
]) ])