blob: 4fda7cba8f3fb38c5378b3a8a4a1de2a281769f2 [file] [log] [blame]
osdl.net!shemminger449bf1f2004-06-25 21:14:22 +00001#! /bin/bash
2# This is not an autconf generated configure
3#
osdl.net!shemminger4b1bbd92004-08-09 16:35:28 +00004INCLUDE=${1:-"$PWD/include"}
osdl.net!shemminger449bf1f2004-06-25 21:14:22 +00005
6echo "# Generated config based on" $INCLUDE >Config
7
osdl.net!shemmingerb9cb1c92004-07-30 22:27:50 +00008echo "TC schedulers"
osdl.net!shemminger449bf1f2004-06-25 21:14:22 +00009
osdl.net!shemmingerb9cb1c92004-07-30 22:27:50 +000010echo -n " ATM "
osdl.net!shemmingerc830d772004-07-02 17:47:53 +000011cat >/tmp/atmtest.c <<EOF
12#include <atm.h>
13int main(int argc, char **argv) {
14 struct atm_qos qos;
15 (void) text2qos("aal5,ubr:sdu=9180,rx:none",&qos,0);
16 return 0;
17}
18EOF
osdl.net!shemminger2979d522004-07-30 20:24:59 +000019gcc -I$INCLUDE -o /tmp/atmtest /tmp/atmtest.c -latm >/dev/null 2>&1
osdl.net!shemmingerc830d772004-07-02 17:47:53 +000020if [ $? -eq 0 ]
osdl.net!shemminger449bf1f2004-06-25 21:14:22 +000021then
osdl.net!shemmingerc830d772004-07-02 17:47:53 +000022 echo "TC_CONFIG_ATM:=y" >>Config
osdl.net!shemmingerb9cb1c92004-07-30 22:27:50 +000023 echo yes
osdl.net!shemminger449bf1f2004-06-25 21:14:22 +000024else
osdl.net!shemmingerb9cb1c92004-07-30 22:27:50 +000025 echo no
osdl.net!shemminger449bf1f2004-06-25 21:14:22 +000026fi
osdl.net!shemminger2979d522004-07-30 20:24:59 +000027rm -f /tmp/atmtest.c /tmp/atmtest
Jamal Hadi Salim63c7d262009-02-07 08:19:20 -050028
29echo -n " IPT "
30
Andreas Henrikssona36ceb82009-12-02 16:11:50 +010031#check if we have xtables from iptables >= 1.4.5.
32cat >/tmp/ipttest.c <<EOF
33#include <xtables.h>
34#include <linux/netfilter.h>
35static struct xtables_globals test_globals = {
36 .option_offset = 0,
37 .program_name = "tc-ipt",
38 .program_version = XTABLES_VERSION,
39 .orig_opts = NULL,
40 .opts = NULL,
41 .exit_err = NULL,
42};
43
44int main(int argc, char **argv)
45{
46 xtables_init_all(&test_globals, NFPROTO_IPV4);
47 return 0;
48}
49
50EOF
51
52if gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl -lxtables >/dev/null 2>&1
53then
54 echo "TC_CONFIG_XT:=y" >>Config
55 echo "using xtables instead of iptables"
56fi
57
Jamal Hadi Salim63c7d262009-02-07 08:19:20 -050058#check if we need dont our internal header ..
59cat >/tmp/ipttest.c <<EOF
60#include <xtables.h>
61char *lib_dir;
62unsigned int global_option_offset = 0;
63const char *program_version = XTABLES_VERSION;
64const char *program_name = "tc-ipt";
65struct afinfo afinfo = {
66 .libprefix = "libxt_",
67};
68
69void exit_error(enum exittype status, const char *msg, ...)
70{
71}
72
73int main(int argc, char **argv) {
74
75 return 0;
76}
77
78EOF
79gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl >/dev/null 2>&1
80
81if [ $? -eq 0 ]
82then
Andreas Henriksson80d689d2009-12-02 16:11:21 +010083 echo "TC_CONFIG_XT_OLD:=y" >>Config
Jamal Hadi Salim63c7d262009-02-07 08:19:20 -050084 echo "using xtables seems no need for internal.h"
85else
86 echo "failed test 2"
87fi
88
89#check if we need our own internal.h
90cat >/tmp/ipttest.c <<EOF
91#include <xtables.h>
92#include "xt-internal.h"
93char *lib_dir;
94unsigned int global_option_offset = 0;
95const char *program_version = XTABLES_VERSION;
96const char *program_name = "tc-ipt";
97struct afinfo afinfo = {
98 .libprefix = "libxt_",
99};
100
101void exit_error(enum exittype status, const char *msg, ...)
102{
103}
104
105int main(int argc, char **argv) {
106
107 return 0;
108}
109
110EOF
111gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl >/dev/null 2>&1
112
113if [ $? -eq 0 ]
114then
115 echo "using xtables instead of iptables (need for internal.h)"
Andreas Henriksson80d689d2009-12-02 16:11:21 +0100116 echo "TC_CONFIG_XT_OLD_H:=y" >>Config
Jamal Hadi Salim63c7d262009-02-07 08:19:20 -0500117
118else
119 echo "failed test 3 using iptables"
120fi
121rm -f /tmp/ipttest.c /tmp/ipttest