]> git.proxmox.com Git - mirror_iproute2.git/blame - configure
tc: respect LDFLAGS for %.so targets
[mirror_iproute2.git] / configure
CommitLineData
449bf1f3
SH
1#! /bin/bash
2# This is not an autconf generated configure
3#
4b1bbd9c 4INCLUDE=${1:-"$PWD/include"}
449bf1f3 5
f1a0125b
AH
6function check_atm
7{
c830d77b
SH
8cat >/tmp/atmtest.c <<EOF
9#include <atm.h>
10int main(int argc, char **argv) {
11 struct atm_qos qos;
12 (void) text2qos("aal5,ubr:sdu=9180,rx:none",&qos,0);
13 return 0;
14}
15EOF
2979d52f 16gcc -I$INCLUDE -o /tmp/atmtest /tmp/atmtest.c -latm >/dev/null 2>&1
c830d77b 17if [ $? -eq 0 ]
449bf1f3 18then
c830d77b 19 echo "TC_CONFIG_ATM:=y" >>Config
b9cb1c9a 20 echo yes
449bf1f3 21else
b9cb1c9a 22 echo no
449bf1f3 23fi
2979d52f 24rm -f /tmp/atmtest.c /tmp/atmtest
f1a0125b 25}
63c7d26f 26
f1a0125b
AH
27function check_xt
28{
a36ceb85
AH
29#check if we have xtables from iptables >= 1.4.5.
30cat >/tmp/ipttest.c <<EOF
31#include <xtables.h>
32#include <linux/netfilter.h>
33static struct xtables_globals test_globals = {
34 .option_offset = 0,
35 .program_name = "tc-ipt",
36 .program_version = XTABLES_VERSION,
37 .orig_opts = NULL,
38 .opts = NULL,
39 .exit_err = NULL,
40};
41
42int main(int argc, char **argv)
43{
44 xtables_init_all(&test_globals, NFPROTO_IPV4);
45 return 0;
46}
47
48EOF
49
50if gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl -lxtables >/dev/null 2>&1
51then
52 echo "TC_CONFIG_XT:=y" >>Config
f1a0125b
AH
53 echo "using xtables"
54fi
55rm -f /tmp/ipttest.c /tmp/ipttest
56}
57
58function check_xt_old
59{
60# bail if previous XT checks has already succeded.
61if grep TC_CONFIG_XT Config > /dev/null
62then
63 return
a36ceb85
AH
64fi
65
63c7d26f
JHS
66#check if we need dont our internal header ..
67cat >/tmp/ipttest.c <<EOF
68#include <xtables.h>
69char *lib_dir;
70unsigned int global_option_offset = 0;
71const char *program_version = XTABLES_VERSION;
72const char *program_name = "tc-ipt";
73struct afinfo afinfo = {
74 .libprefix = "libxt_",
75};
76
77void exit_error(enum exittype status, const char *msg, ...)
78{
79}
80
81int main(int argc, char **argv) {
82
83 return 0;
84}
85
86EOF
87gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl >/dev/null 2>&1
88
89if [ $? -eq 0 ]
90then
80d689d0 91 echo "TC_CONFIG_XT_OLD:=y" >>Config
f1a0125b
AH
92 echo "using old xtables (no need for xt-internal.h)"
93fi
94rm -f /tmp/ipttest.c /tmp/ipttest
95}
96
97function check_xt_old_internal_h
98{
99# bail if previous XT checks has already succeded.
100if grep TC_CONFIG_XT Config > /dev/null
101then
102 return
63c7d26f
JHS
103fi
104
105#check if we need our own internal.h
106cat >/tmp/ipttest.c <<EOF
107#include <xtables.h>
108#include "xt-internal.h"
109char *lib_dir;
110unsigned int global_option_offset = 0;
111const char *program_version = XTABLES_VERSION;
112const char *program_name = "tc-ipt";
113struct afinfo afinfo = {
114 .libprefix = "libxt_",
115};
116
117void exit_error(enum exittype status, const char *msg, ...)
118{
119}
120
121int main(int argc, char **argv) {
122
123 return 0;
124}
125
126EOF
127gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl >/dev/null 2>&1
128
129if [ $? -eq 0 ]
130then
f1a0125b 131 echo "using old xtables with xt-internal.h"
80d689d0 132 echo "TC_CONFIG_XT_OLD_H:=y" >>Config
63c7d26f
JHS
133fi
134rm -f /tmp/ipttest.c /tmp/ipttest
f1a0125b
AH
135}
136
137function check_ipt
138{
139 if ! grep TC_CONFIG_XT Config > /dev/null
140 then
141 echo "using iptables"
142 fi
143}
144
145echo "# Generated config based on" $INCLUDE >Config
146
147echo "TC schedulers"
148
149echo -n " ATM "
150check_atm
151
152echo -n " IPT "
153check_xt
154check_xt_old
155check_xt_old_internal_h
156check_ipt
157