File: in6_guess_stack.m4

package info (click to toggle)
nc6 1.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,108 kB
  • ctags: 1,581
  • sloc: ansic: 12,966; sh: 6,695; makefile: 541; yacc: 288; sed: 16
file content (113 lines) | stat: -rw-r--r-- 2,786 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
dnl ====================================================
dnl IN6_GUESS_STACK(ipv6,ipv6libdir,ipv6lib)
dnl ====================================================
AC_DEFUN([IN6_GUESS_STACK],[
	AC_MSG_CHECKING([IPv6 stack type])
	AC_CACHE_VAL([ds6_cv_ipv6_stack],[
	ds6_cv_ipv6_stack=unknown
	dnl removed inria, linux_inet6, toshiba, v6d, zeta
	for inet6_i in kame usagi linux solaris7; do
		case ${inet6_i} in
		kame)	
			dnl http://www.kame.net/
			AC_EGREP_CPP(%%%yes%%%, [
#include <netinet/in.h>
#ifdef __KAME__
%%%yes%%%
#endif],
			[if test "X$ds6_cv_ipv6_stack" = "Xunknown"; then
				ds6_cv_ipv6_stack=${inet6_i}
			fi])
			;;
		usagi)
			dnl http://www.linux-ipv6.org/
			AC_EGREP_CPP(%%%yes%%%, [
#include <netinet/in.h>
#ifdef __USAGI__
%%%yes%%%
#endif],
			[if test "X$ds6_cv_ipv6_stack" = "Xunknown"; then
				ds6_cv_ipv6_stack=${inet6_i}
			fi])
			;;
		linux)
			dnl http://www.kernel.org/
			if test `uname -s` = "Linux"
			then
			  AC_EGREP_CPP(%%%yes%%%, [
#include <features.h>
#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
%%%yes%%%
#endif],
			  [if test "X$ds6_cv_ipv6_stack" = "Xunknown"; then
			  	ds6_cv_ipv6_stack=${inet6_i}
			  fi])
			fi
			;;
		solaris7)
			dnl This is broken. In autoconf 2.5x the $host variable does not seem
			dnl to be defined.
			case "$host" in
			*-*-solaris*)
				if test -c /devices/pseudo/ip6@0:ip6; then
					if test "X$ds6_cv_ipv6_stack" = "Xunknown"; then
						ds6_cv_ipv6_stack=${inet6_i}
					fi
				fi
			esac
			;;
		*)
			AC_MSG_WARN([Unknown stack type $inet6_i tested])
			;;
		esac
	done
	])

	inet6_ipv6type=$1
	if test "X$inet6_ipv6type" = "X"; then
		inet6_ipv6type=$ds6_cv_ipv6_stack
		AC_MSG_RESULT([$inet6_ipv6type (guessed)])
	elif test "X$ds6_cv_ipv6_stack" = "X$inet6_ipv6type"; then
		AC_MSG_RESULT([$inet6_ipv6type])
	else
		AC_MSG_RESULT([$inet6_ipv6type, while $ds6_cv_ipv6_stack is guessed])
	fi

	inet6_ipv6lib=
	inet6_ipv6libdir=
	inet6_cppflags=

	case "$inet6_ipv6type" in
	kame | usagi)
		if test -f /usr/local/v6/lib/libinet6.a; then
			inet6_ipv6lib=inet6
			inet6_ipv6libdir=/usr/local/v6/lib
		fi
		;;
	linux) ;;
	solaris7) ;;
	*)
		AC_MSG_WARN([Unknown stack type $inet6_ipv6type])
		;;
	esac

	if test "X$inet6_ipv6lib" != "X"; then
		INET6_LIBS="-l$inet6_ipv6lib"
		if test "X$inet6_ipv6libdir" != "X"; then
			if test -d $inet6_ipv6libdir -a -f $inet6_ipv6libdir/lib${inet6_ipv6lib}.a; then
				INET6_LIBS="-L$inet6_ipv6libdir $INET6_LIBS"
			else
				AC_MSG_ERROR([
Fatal: no $inet6_ipv6lib library found in $inet6_ipv6libdir
You need to fetch lib${inet6_ipv6lib}.a from the appropriate ipv6 kit
and compile beforehand.])
			fi
		fi
	fi
	if test "X$2" != "X"; then
		$2=$inet6_ipv6libdir
	fi
	if test "X$3" != "X"; then
		$3=$inet6_ipv6lib
	fi
])