]>
git.proxmox.com Git - mirror_iproute2.git/blob - configure
2 # This is not an autconf generated configure
4 INCLUDE
=${1:-"$PWD/include"}
6 # Make a temp directory in build tree.
7 TMPDIR
=$
(mktemp
-d config.XXXXXX
)
8 trap 'status=$?; rm -rf $TMPDIR; exit $status' EXIT HUP INT QUIT TERM
12 : ${PKG_CONFIG:=pkg-config}
15 echo "AR:=${AR}" >>Config
16 echo "CC:=${CC}" >>Config
17 echo "PKG_CONFIG:=${PKG_CONFIG}" >>Config
22 cat >$TMPDIR/atmtest.c
<<EOF
24 int main(int argc, char **argv) {
26 (void) text2qos("aal5,ubr:sdu=9180,rx:none",&qos,0);
30 $CC -I$INCLUDE -o $TMPDIR/atmtest
$TMPDIR/atmtest.c
-latm >/dev
/null
2>&1
33 echo "TC_CONFIG_ATM:=y" >>Config
38 rm -f $TMPDIR/atmtest.c
$TMPDIR/atmtest
43 #check if we have xtables from iptables >= 1.4.5.
44 cat >$TMPDIR/ipttest.c
<<EOF
46 #include <linux/netfilter.h>
47 static struct xtables_globals test_globals = {
49 .program_name = "tc-ipt",
50 .program_version = XTABLES_VERSION,
56 int main(int argc, char **argv)
58 xtables_init_all(&test_globals, NFPROTO_IPV4);
64 if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL $
(${PKG_CONFIG} xtables
--cflags --libs) -ldl >/dev
/null
2>&1
66 echo "TC_CONFIG_XT:=y" >>Config
69 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
74 # bail if previous XT checks has already succeded.
75 if grep TC_CONFIG_XT Config
> /dev
/null
80 #check if we dont need our internal header ..
81 cat >$TMPDIR/ipttest.c
<<EOF
84 unsigned int global_option_offset = 0;
85 const char *program_version = XTABLES_VERSION;
86 const char *program_name = "tc-ipt";
87 struct afinfo afinfo = {
88 .libprefix = "libxt_",
91 void exit_error(enum exittype status, const char *msg, ...)
95 int main(int argc, char **argv) {
101 $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL -ldl >/dev
/null
2>&1
105 echo "TC_CONFIG_XT_OLD:=y" >>Config
106 echo "using old xtables (no need for xt-internal.h)"
108 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
111 check_xt_old_internal_h
()
113 # bail if previous XT checks has already succeded.
114 if grep TC_CONFIG_XT Config
> /dev
/null
119 #check if we need our own internal.h
120 cat >$TMPDIR/ipttest.c
<<EOF
122 #include "xt-internal.h"
124 unsigned int global_option_offset = 0;
125 const char *program_version = XTABLES_VERSION;
126 const char *program_name = "tc-ipt";
127 struct afinfo afinfo = {
128 .libprefix = "libxt_",
131 void exit_error(enum exittype status, const char *msg, ...)
135 int main(int argc, char **argv) {
141 $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL -ldl >/dev
/null
2>&1
145 echo "using old xtables with xt-internal.h"
146 echo "TC_CONFIG_XT_OLD_H:=y" >>Config
148 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
153 if ! grep TC_CONFIG_XT Config
> /dev
/null
155 echo "using iptables"
161 IPT_LIB_DIR
=$
(${PKG_CONFIG} --variable=xtlibdir xtables
)
162 if [ -n "$IPT_LIB_DIR" ]; then
164 echo "IPT_LIB_DIR:=$IPT_LIB_DIR" >> Config
168 for dir
in /lib
/usr
/lib
/usr
/local
/lib
170 for file in $dir/{xtables
,iptables
}/lib
*t_
*so
; do
171 if [ -f $file ]; then
173 echo "IPT_LIB_DIR:=${file%/*}" >> Config
183 cat >$TMPDIR/setnstest.c
<<EOF
185 int main(int argc, char **argv)
191 $CC -I$INCLUDE -o $TMPDIR/setnstest
$TMPDIR/setnstest.c
>/dev
/null
2>&1
194 echo "IP_CONFIG_SETNS:=y" >>Config
199 rm -f $TMPDIR/setnstest.c
$TMPDIR/setnstest
204 cat >$TMPDIR/ipsettest.c
<<EOF
205 #include <linux/netfilter/ipset/ip_set.h>
206 #ifndef IP_SET_INVALID
207 #define IPSET_DIM_MAX 3
208 typedef unsigned short ip_set_id_t;
210 #include <linux/netfilter/xt_set.h>
212 struct xt_set_info info;
213 #if IPSET_PROTOCOL == 6
216 return IPSET_MAXNAMELEN;
219 #error unknown ipset version
223 if $CC -I$INCLUDE -o $TMPDIR/ipsettest
$TMPDIR/ipsettest.c
>/dev
/null
2>&1
225 echo "TC_CONFIG_IPSET:=y" >>Config
230 rm -f $TMPDIR/ipsettest.c
$TMPDIR/ipsettest
233 echo "# Generated config based on" $INCLUDE >Config
244 check_xt_old_internal_h
250 echo -n "iptables modules directory: "
253 echo -n "libc has setns: "