]>
git.proxmox.com Git - mirror_iproute2.git/blob - configure
2 # This is not an autconf generated configure
4 INCLUDE
=${1:-"$PWD/include"}
5 : ${PKG_CONFIG:=pkg-config}
6 echo "PKG_CONFIG:=${PKG_CONFIG}" >>Config
8 # Make a temp directory in build tree.
9 TMPDIR
=$
(mktemp
-d config.XXXXXX
)
10 trap 'status=$?; rm -rf $TMPDIR; exit $status' EXIT HUP INT QUIT TERM
14 cat >$TMPDIR/atmtest.c
<<EOF
16 int main(int argc, char **argv) {
18 (void) text2qos("aal5,ubr:sdu=9180,rx:none",&qos,0);
22 gcc
-I$INCLUDE -o $TMPDIR/atmtest
$TMPDIR/atmtest.c
-latm >/dev
/null
2>&1
25 echo "TC_CONFIG_ATM:=y" >>Config
30 rm -f $TMPDIR/atmtest.c
$TMPDIR/atmtest
35 #check if we have xtables from iptables >= 1.4.5.
36 cat >$TMPDIR/ipttest.c
<<EOF
38 #include <linux/netfilter.h>
39 static struct xtables_globals test_globals = {
41 .program_name = "tc-ipt",
42 .program_version = XTABLES_VERSION,
48 int main(int argc, char **argv)
50 xtables_init_all(&test_globals, NFPROTO_IPV4);
56 if gcc
-I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL $
(${PKG_CONFIG} xtables
--cflags --libs) -ldl >/dev
/null
2>&1
58 echo "TC_CONFIG_XT:=y" >>Config
61 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
66 # bail if previous XT checks has already succeded.
67 if grep TC_CONFIG_XT Config
> /dev
/null
72 #check if we dont need our internal header ..
73 cat >$TMPDIR/ipttest.c
<<EOF
76 unsigned int global_option_offset = 0;
77 const char *program_version = XTABLES_VERSION;
78 const char *program_name = "tc-ipt";
79 struct afinfo afinfo = {
80 .libprefix = "libxt_",
83 void exit_error(enum exittype status, const char *msg, ...)
87 int main(int argc, char **argv) {
93 gcc
-I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL -ldl >/dev
/null
2>&1
97 echo "TC_CONFIG_XT_OLD:=y" >>Config
98 echo "using old xtables (no need for xt-internal.h)"
100 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
103 check_xt_old_internal_h
()
105 # bail if previous XT checks has already succeded.
106 if grep TC_CONFIG_XT Config
> /dev
/null
111 #check if we need our own internal.h
112 cat >$TMPDIR/ipttest.c
<<EOF
114 #include "xt-internal.h"
116 unsigned int global_option_offset = 0;
117 const char *program_version = XTABLES_VERSION;
118 const char *program_name = "tc-ipt";
119 struct afinfo afinfo = {
120 .libprefix = "libxt_",
123 void exit_error(enum exittype status, const char *msg, ...)
127 int main(int argc, char **argv) {
133 gcc
-I$INCLUDE $IPTC -o $TMPDIR/ipttest
$TMPDIR/ipttest.c
$IPTL -ldl >/dev
/null
2>&1
137 echo "using old xtables with xt-internal.h"
138 echo "TC_CONFIG_XT_OLD_H:=y" >>Config
140 rm -f $TMPDIR/ipttest.c
$TMPDIR/ipttest
145 if ! grep TC_CONFIG_XT Config
> /dev
/null
147 echo "using iptables"
153 IPT_LIB_DIR
=$
(${PKG_CONFIG} --variable=xtlibdir xtables
)
154 if [ -n "$IPT_LIB_DIR" ]; then
156 echo "IPT_LIB_DIR:=$IPT_LIB_DIR" >> Config
160 for dir
in /lib
/usr
/lib
/usr
/local
/lib
162 for file in $dir/{xtables
,iptables
}/lib
*t_
*so
; do
163 if [ -f $file ]; then
165 echo "IPT_LIB_DIR:=${file%/*}" >> Config
175 cat >$TMPDIR/setnstest.c
<<EOF
177 int main(int argc, char **argv)
183 gcc
-I$INCLUDE -o $TMPDIR/setnstest
$TMPDIR/setnstest.c
>/dev
/null
2>&1
186 echo "IP_CONFIG_SETNS:=y" >>Config
191 rm -f $TMPDIR/setnstest.c
$TMPDIR/setnstest
196 cat >$TMPDIR/ipsettest.c
<<EOF
197 #include <linux/netfilter/ipset/ip_set.h>
198 #ifndef IP_SET_INVALID
199 #define IPSET_DIM_MAX 3
200 typedef unsigned short ip_set_id_t;
202 #include <linux/netfilter/xt_set.h>
204 struct xt_set_info info;
205 #if IPSET_PROTOCOL == 6
208 return IPSET_MAXNAMELEN;
211 #error unknown ipset version
215 if gcc
-I$INCLUDE -o $TMPDIR/ipsettest
$TMPDIR/ipsettest.c
>/dev
/null
2>&1
217 echo "TC_CONFIG_IPSET:=y" >>Config
222 rm -f $TMPDIR/ipsettest.c
$TMPDIR/ipsettest
225 echo "# Generated config based on" $INCLUDE >Config
235 check_xt_old_internal_h
241 echo -n "iptables modules directory: "
244 echo -n "libc has setns: "