summaryrefslogtreecommitdiff
path: root/mcon/U/d_iptos.U
blob: ddb6d50eb5da11ff24f85a8682e1aa119e5a4fdc (plain)
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
?RCS: $Id: d_iptos.U 170 2013-08-30 16:47:47Z rmanfredi $
?RCS:
?RCS: Copyright (c) 2006, Christian Biere
?RCS:
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?MAKE:d_iptos: cat rm contains cppstdin cppflags cppminus d_windows \
	i_niin i_sysin i_niip i_syssock i_winsock2 i_ws2tcpip test Setvar
?MAKE:	-pick add $@ %<
?S:d_iptos:
?S:	This variable conditionally defines the USE_IP_TOS symbol, which
?S:	indicates to the C program that the IP TOS services are available.
?S:.
?C:USE_IP_TOS:
?C:	This symbol, if defined, indicates that the IP TOS services are
?C:	available and can be used.  Be prepared to include <sys/socket.h>,
?C: either <netinet/in.h> or <sys/in.h>, and <netinet/ip.h> when
?C:	I_NETINET_IP is defined.
?C:.
?H:#$d_iptos USE_IP_TOS		/**/
?H:.
?F:!iptos !iptos.h
?T:inh
?LINT:set d_iptos
?LINT:usefile iptos.h
: check for IP TOS support
echo " "
echo "Checking whether IP TOS (Type of Service) support is available..." >&4
case "$i_niin" in
"$define") inh=netinet/in.h;;
*)
	case "$i_sysin" in
	"$define") inh=sys/in.h;;
	*)
		case "$i_ws2tcpip" in
		"$define") inh=Ws2tcpip.h;;
		esac
		;;
	esac
	;;
esac
$cat >iptos <<EOM
#$i_syssock I_SYS_SOCKET
#$i_winsock2 I_WINSOCK2
#$d_windows WINDOWS_SYSTEM
#ifdef WINDOWS_SYSTEM
#define WINVER 0x0501
#endif
#ifdef I_SYS_SOCKET
#include <sys/socket.h>
#endif
#ifdef I_WINSOCK2
#include <Winsock2.h>
#endif
#include <$inh>
#if defined(IP_TOS) && defined(IPTOS_LOWDELAY) && defined(IPTOS_THROUGHPUT)
YES
#endif
EOM
$cppstdin $cppflags $cppminus <iptos >iptos.h 2>/dev/null
val="$undef"
if $contains YES iptos.h >/dev/null 2>&1; then
	val="$define"
	echo "You have IP TOS support in <$inh>." >&4
elif $test "x$i_niip" = "x$define"; then
	$cat >iptos <<EOM
#$i_syssock I_SYS_SOCKET
#ifdef I_SYS_SOCKET
#include <sys/socket.h>
#endif
#include <$inh>
#include <netinet/ip.h>
#if defined(IP_TOS) && defined(IPTOS_LOWDELAY) && defined(IPTOS_THROUGHPUT)
YES
#endif
EOM
	$cppstdin $cppflags $cppminus <iptos >iptos.h 2>/dev/null
	if $contains YES iptos.h >/dev/null 2>&1; then
		val="$define"
		echo "You have IP TOS support in <netinet/ip.h>." >&4
	fi
fi
case "$val" in
"$define") ;;
*) echo "Sorry, you seem to be lacking IP TOS support." >&4;;
esac
set d_iptos
eval $setvar
$rm -f iptos iptos.h