]>
git.proxmox.com Git - mirror_iproute2.git/blob - configure
9912114438e908ffd0820876c69968c4db399a59
2 # This is not an autconf generated configure
4 INCLUDE
=${1:-"$PWD/include"}
5 : ${PKG_CONFIG:=pkg-config}
7 echo "PKG_CONFIG:=${PKG_CONFIG}" >>Config
9 # Make a temp directory in build tree.
10 TMPDIR
=$
(mktemp
-d config.XXXXXX
)
11 trap 'status=$?; rm -rf $TMPDIR; exit $status' EXIT HUP INT QUIT TERM
15 cat >$TMPDIR/atmtest.c
<<EOF
17 int main(int argc, char **argv) {
19 (void) text2qos("aal5,ubr:sdu=9180,rx:none",&qos,0);
23 $CC -I$INCLUDE -o $TMPDIR/atmtest
$TMPDIR/atmtest.c
-latm >/dev
/null
2>&1
26 echo "TC_CONFIG_ATM:=y" >>Config
31 rm -f $TMPDIR/atmtest.c
$TMPDIR/atmtest
36 #check if we have xtables from iptables >= 1.4.5.
37 cat >$TMPDIR/ipttest.c
<<EOF
39 #include <linux/netfilter.h>
40 static struct xtables_globals test_globals = {
42 .program_name = "tc-ipt",
43 .program_version = XTABLES_VERSION,
49 int main(int argc, char **argv)
51 xtables_init_all(&test_globals, NFPROTO_IPV4);
57 if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL $
(${PKG_CONFIG} xtables
--cflags --libs) -ldl >/dev
/null
2>&1
59 echo "TC_CONFIG_XT:=y" >>Config
62 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
67 # bail if previous XT checks has already succeded.
68 if grep TC_CONFIG_XT Config
> /dev
/null
73 #check if we dont need our internal header ..
74 cat >$TMPDIR/ipttest.c
<<EOF
77 unsigned int global_option_offset = 0;
78 const char *program_version = XTABLES_VERSION;
79 const char *program_name = "tc-ipt";
80 struct afinfo afinfo = {
81 .libprefix = "libxt_",
84 void exit_error(enum exittype status, const char *msg, ...)
88 int main(int argc, char **argv) {
94 $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL -ldl >/dev
/null
2>&1
98 echo "TC_CONFIG_XT_OLD:=y" >>Config
99 echo "using old xtables (no need for xt-internal.h)"
101 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
104 check_xt_old_internal_h
()
106 # bail if previous XT checks has already succeded.
107 if grep TC_CONFIG_XT Config
> /dev
/null
112 #check if we need our own internal.h
113 cat >$TMPDIR/ipttest.c
<<EOF
115 #include "xt-internal.h"
117 unsigned int global_option_offset = 0;
118 const char *program_version = XTABLES_VERSION;
119 const char *program_name = "tc-ipt";
120 struct afinfo afinfo = {
121 .libprefix = "libxt_",
124 void exit_error(enum exittype status, const char *msg, ...)
128 int main(int argc, char **argv) {
134 $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL -ldl >/dev
/null
2>&1
138 echo "using old xtables with xt-internal.h"
139 echo "TC_CONFIG_XT_OLD_H:=y" >>Config
141 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
146 if ! grep TC_CONFIG_XT Config
> /dev
/null
148 echo "using iptables"
154 IPT_LIB_DIR
=$
(${PKG_CONFIG} --variable=xtlibdir xtables
)
155 if [ -n "$IPT_LIB_DIR" ]; then
157 echo "IPT_LIB_DIR:=$IPT_LIB_DIR" >> Config
161 for dir
in /lib
/usr
/lib
/usr
/local
/lib
163 for file in $dir/{xtables
,iptables
}/lib
*t_
*so
; do
164 if [ -f $file ]; then
166 echo "IPT_LIB_DIR:=${file%/*}" >> Config
176 cat >$TMPDIR/setnstest.c
<<EOF
178 int main(int argc, char **argv)
184 $CC -I$INCLUDE -o $TMPDIR/setnstest
$TMPDIR/setnstest.c
>/dev
/null
2>&1
187 echo "IP_CONFIG_SETNS:=y" >>Config
192 rm -f $TMPDIR/setnstest.c
$TMPDIR/setnstest
197 cat >$TMPDIR/ipsettest.c
<<EOF
198 #include <linux/netfilter/ipset/ip_set.h>
199 #ifndef IP_SET_INVALID
200 #define IPSET_DIM_MAX 3
201 typedef unsigned short ip_set_id_t;
203 #include <linux/netfilter/xt_set.h>
205 struct xt_set_info info;
206 #if IPSET_PROTOCOL == 6
209 return IPSET_MAXNAMELEN;
212 #error unknown ipset version
216 if $CC -I$INCLUDE -o $TMPDIR/ipsettest
$TMPDIR/ipsettest.c
>/dev
/null
2>&1
218 echo "TC_CONFIG_IPSET:=y" >>Config
223 rm -f $TMPDIR/ipsettest.c
$TMPDIR/ipsettest
226 echo "# Generated config based on" $INCLUDE >Config
236 check_xt_old_internal_h
242 echo -n "iptables modules directory: "
245 echo -n "libc has setns: "