]>
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
21 cat >$TMPDIR/atmtest.c
<<EOF
23 int main(int argc, char **argv) {
25 (void) text2qos("aal5,ubr:sdu=9180,rx:none",&qos,0);
29 $CC -I$INCLUDE -o $TMPDIR/atmtest
$TMPDIR/atmtest.c
-latm >/dev
/null
2>&1
32 echo "TC_CONFIG_ATM:=y" >>Config
37 rm -f $TMPDIR/atmtest.c
$TMPDIR/atmtest
42 #check if we have xtables from iptables >= 1.4.5.
43 cat >$TMPDIR/ipttest.c
<<EOF
45 #include <linux/netfilter.h>
46 static struct xtables_globals test_globals = {
48 .program_name = "tc-ipt",
49 .program_version = XTABLES_VERSION,
55 int main(int argc, char **argv)
57 xtables_init_all(&test_globals, NFPROTO_IPV4);
63 if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL $
(${PKG_CONFIG} xtables
--cflags --libs) -ldl >/dev
/null
2>&1
65 echo "TC_CONFIG_XT:=y" >>Config
68 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
73 # bail if previous XT checks has already succeded.
74 if grep TC_CONFIG_XT Config
> /dev
/null
79 #check if we dont need our internal header ..
80 cat >$TMPDIR/ipttest.c
<<EOF
83 unsigned int global_option_offset = 0;
84 const char *program_version = XTABLES_VERSION;
85 const char *program_name = "tc-ipt";
86 struct afinfo afinfo = {
87 .libprefix = "libxt_",
90 void exit_error(enum exittype status, const char *msg, ...)
94 int main(int argc, char **argv) {
100 $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL -ldl >/dev
/null
2>&1
104 echo "TC_CONFIG_XT_OLD:=y" >>Config
105 echo "using old xtables (no need for xt-internal.h)"
107 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
110 check_xt_old_internal_h
()
112 # bail if previous XT checks has already succeded.
113 if grep TC_CONFIG_XT Config
> /dev
/null
118 #check if we need our own internal.h
119 cat >$TMPDIR/ipttest.c
<<EOF
121 #include "xt-internal.h"
123 unsigned int global_option_offset = 0;
124 const char *program_version = XTABLES_VERSION;
125 const char *program_name = "tc-ipt";
126 struct afinfo afinfo = {
127 .libprefix = "libxt_",
130 void exit_error(enum exittype status, const char *msg, ...)
134 int main(int argc, char **argv) {
140 $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL -ldl >/dev
/null
2>&1
144 echo "using old xtables with xt-internal.h"
145 echo "TC_CONFIG_XT_OLD_H:=y" >>Config
147 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
152 if ! grep TC_CONFIG_XT Config
> /dev
/null
154 echo "using iptables"
160 IPT_LIB_DIR
=$
(${PKG_CONFIG} --variable=xtlibdir xtables
)
161 if [ -n "$IPT_LIB_DIR" ]; then
163 echo "IPT_LIB_DIR:=$IPT_LIB_DIR" >> Config
167 for dir
in /lib
/usr
/lib
/usr
/local
/lib
169 for file in $dir/{xtables
,iptables
}/lib
*t_
*so
; do
170 if [ -f $file ]; then
172 echo "IPT_LIB_DIR:=${file%/*}" >> Config
182 cat >$TMPDIR/setnstest.c
<<EOF
184 int main(int argc, char **argv)
190 $CC -I$INCLUDE -o $TMPDIR/setnstest
$TMPDIR/setnstest.c
>/dev
/null
2>&1
193 echo "IP_CONFIG_SETNS:=y" >>Config
198 rm -f $TMPDIR/setnstest.c
$TMPDIR/setnstest
203 cat >$TMPDIR/ipsettest.c
<<EOF
204 #include <linux/netfilter/ipset/ip_set.h>
205 #ifndef IP_SET_INVALID
206 #define IPSET_DIM_MAX 3
207 typedef unsigned short ip_set_id_t;
209 #include <linux/netfilter/xt_set.h>
211 struct xt_set_info info;
212 #if IPSET_PROTOCOL == 6
215 return IPSET_MAXNAMELEN;
218 #error unknown ipset version
222 if $CC -I$INCLUDE -o $TMPDIR/ipsettest
$TMPDIR/ipsettest.c
>/dev
/null
2>&1
224 echo "TC_CONFIG_IPSET:=y" >>Config
229 rm -f $TMPDIR/ipsettest.c
$TMPDIR/ipsettest
232 echo "# Generated config based on" $INCLUDE >Config
233 echo "PKG_CONFIG:=${PKG_CONFIG}" >>Config
244 check_xt_old_internal_h
250 echo -n "iptables modules directory: "
253 echo -n "libc has setns: "