]>
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 $TMPDIRa; exit $status' EXIT HUP INT QUIT TERM
12 cat >$TMPDIR/atmtest.c
<<EOF
14 int main(int argc, char **argv) {
16 (void) text2qos("aal5,ubr:sdu=9180,rx:none",&qos,0);
20 gcc
-I$INCLUDE -o $TMPDIR/atmtest
$TMPDIR/atmtest.c
-latm >/dev
/null
2>&1
23 echo "TC_CONFIG_ATM:=y" >>Config
28 rm -f $TMPDIR/atmtest.c
$TMPDIR/atmtest
33 #check if we have xtables from iptables >= 1.4.5.
34 cat >$TMPDIR/ipttest.c
<<EOF
36 #include <linux/netfilter.h>
37 static struct xtables_globals test_globals = {
39 .program_name = "tc-ipt",
40 .program_version = XTABLES_VERSION,
46 int main(int argc, char **argv)
48 xtables_init_all(&test_globals, NFPROTO_IPV4);
54 if gcc
-I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL $
(pkg-config xtables
--cflags --libs) -ldl >/dev
/null
2>&1
56 echo "TC_CONFIG_XT:=y" >>Config
59 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
64 # bail if previous XT checks has already succeded.
65 if grep TC_CONFIG_XT Config
> /dev
/null
70 #check if we dont need our internal header ..
71 cat >$TMPDIR/ipttest.c
<<EOF
74 unsigned int global_option_offset = 0;
75 const char *program_version = XTABLES_VERSION;
76 const char *program_name = "tc-ipt";
77 struct afinfo afinfo = {
78 .libprefix = "libxt_",
81 void exit_error(enum exittype status, const char *msg, ...)
85 int main(int argc, char **argv) {
91 gcc
-I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL -ldl >/dev
/null
2>&1
95 echo "TC_CONFIG_XT_OLD:=y" >>Config
96 echo "using old xtables (no need for xt-internal.h)"
98 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
101 check_xt_old_internal_h
()
103 # bail if previous XT checks has already succeded.
104 if grep TC_CONFIG_XT Config
> /dev
/null
109 #check if we need our own internal.h
110 cat >$TMPDIR/ipttest.c
<<EOF
112 #include "xt-internal.h"
114 unsigned int global_option_offset = 0;
115 const char *program_version = XTABLES_VERSION;
116 const char *program_name = "tc-ipt";
117 struct afinfo afinfo = {
118 .libprefix = "libxt_",
121 void exit_error(enum exittype status, const char *msg, ...)
125 int main(int argc, char **argv) {
131 gcc
-I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL -ldl >/dev
/null
2>&1
135 echo "using old xtables with xt-internal.h"
136 echo "TC_CONFIG_XT_OLD_H:=y" >>Config
138 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
143 if ! grep TC_CONFIG_XT Config
> /dev
/null
145 echo "using iptables"
152 for dir
in /lib
/usr
/lib
/usr
/local
/lib
154 for file in $dir/{xtables
,iptables
}/lib
*t_
*so
; do
155 if [ -f $file ]; then
157 echo "IPT_LIB_DIR:=${file%/*}" >> Config
167 cat >$TMPDIR/setnstest.c
<<EOF
169 int main(int argc, char **argv)
175 gcc
-I$INCLUDE -o $TMPDIR/setnstest
$TMPDIR/setnstest.c
>/dev
/null
2>&1
178 echo "IP_CONFIG_SETNS:=y" >>Config
183 rm -f $TMPDIR/setnstest.c
$TMPDIR/setnstest
188 cat >$TMPDIR/ipsettest.c
<<EOF
189 #include <linux/netfilter/ipset/ip_set.h>
190 #ifndef IP_SET_INVALID
191 #define IPSET_DIM_MAX 3
192 typedef unsigned short ip_set_id_t;
194 #include <linux/netfilter/xt_set.h>
196 struct xt_set_info info;
197 #if IPSET_PROTOCOL == 6
200 return IPSET_MAXNAMELEN;
203 #error unknown ipset version
207 if gcc
-I$INCLUDE -o $TMPDIR/ipsettest
$TMPDIR/ipsettest.c
>/dev
/null
2>&1
209 echo "TC_CONFIG_IPSET:=y" >>Config
214 rm -f $TMPDIR/ipsettest.c
$TMPDIR/ipsettest
217 echo "# Generated config based on" $INCLUDE >Config
227 check_xt_old_internal_h
233 echo -n "iptables modules directory: "
236 echo -n "libc has setns: "