]> git.proxmox.com Git - mirror_iproute2.git/blob - configure
Test for HTB version match
[mirror_iproute2.git] / configure
1 #! /bin/bash
2 # This is not an autconf generated configure
3 #
4 INCLUDE=${1:-"/usr/include"}
5
6 echo "# Generated config based on" $INCLUDE >Config
7
8 echo "TC"
9 PKT_SCHED=$INCLUDE/linux/pkt_sched.h
10 if [ ! -r $PKT_SCHED ];
11 then
12 echo " can't find file" $PKT_SCHED
13 exit 1
14 fi
15
16 echo -n " netem scheduler... "
17 cat >/tmp/netemtest.c <<EOF
18 #include <asm/types.h>
19 #include <linux/pkt_sched.h>
20 int main(int argc, char **argv) {
21 static struct tc_netem_qopt qopt;
22 exit(qopt.latency | qopt.limit | qopt.loss | qopt.gap | qopt.duplicate | qopt.jitter);
23 }
24 EOF
25 gcc -I$INCLUDE -c /tmp/netemtest.c >/dev/null 2>&1
26 if [ $? -eq 0 ]
27 then
28 echo "TC_CONFIG_NETEM:=y" >>Config
29 echo y
30 else
31 echo n
32 fi
33 rm -f /tmp/netemtest.c /tmp/netemtest.o
34
35 echo -n " ATM... "
36 cat >/tmp/atmtest.c <<EOF
37 #include <atm.h>
38 int main(int argc, char **argv) {
39 struct atm_qos qos;
40 (void) text2qos("aal5,ubr:sdu=9180,rx:none",&qos,0);
41 return 0;
42 }
43 EOF
44 gcc -I$INCLUDE -o /tmp/atmtest /tmp/atmtest.c -latm >/dev/null 2>&1
45 if [ $? -eq 0 ]
46 then
47 echo "TC_CONFIG_ATM:=y" >>Config
48 echo y
49 else
50 echo n
51 fi
52 rm -f /tmp/atmtest.c /tmp/atmtest
53
54 echo -n " HTB... "
55 DEF_HTB=`grep '^#define HTB_TC_VER' tc/q_htb.c`
56 cat >/tmp/htbtest.c <<EOF
57 #include <stdio.h>
58 #include <asm/types.h>
59 #include <linux/pkt_sched.h>
60 $DEF_HTB
61 int main(int argc, char **argv) {
62 if (HTB_TC_VER >>16 != TC_HTB_PROTOVER) {
63 fprintf(stderr, "different kernel and TC HTB versions\n");
64 return 1;
65 }
66 return 0;
67 }
68 EOF
69 gcc -I$INCLUDE -o /tmp/htbtest /tmp/htbtest.c
70 if [ $? -eq 0 -a /tmp/htbtest ]
71 then
72 echo "TC_CONFIG_HTB:=y" >>Config
73 echo y
74 else
75 echo n
76 fi
77 rm -f /tmp/htbtest /tmp/htbtest.c
78
79 # See if we know about TCP Vegas
80 echo "SS"
81 echo -n " TCP Vegas... "
82 if grep -q TCPDIAG_VEGASINFO $INCLUDE/linux/tcp_diag.h >/dev/null 2>&1
83 then
84 echo "SS_CONFIG_VEGAS:=y" >>Config
85 echo y
86 else
87 echo n
88 fi
89
90 echo -n " TCP DRS... "
91 if grep -q tcpi_rcv_space $INCLUDE/linux/tcp.h
92 then
93 echo "SS_CONFIG_DRS:=y" >>Config
94 echo y
95 else
96 echo n
97 fi
98
99