]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/blobdiff - configure
gred: support TCA_GRED_MAX_P attribute
[lisovros/iproute2_canprio.git] / configure
index 4fda7cba8f3fb38c5378b3a8a4a1de2a281769f2..09a6987600fb2b8fa9749e146a6a3a67f4ad67a3 100755 (executable)
--- a/configure
+++ b/configure
@@ -3,11 +3,8 @@
 #
 INCLUDE=${1:-"$PWD/include"}
 
-echo "# Generated config based on" $INCLUDE >Config
-
-echo "TC schedulers"
-
-echo -n " ATM  "
+check_atm()
+{
 cat >/tmp/atmtest.c <<EOF
 #include <atm.h>
 int main(int argc, char **argv) {
@@ -25,9 +22,10 @@ else
     echo no
 fi
 rm -f /tmp/atmtest.c /tmp/atmtest
+}
 
-echo -n " IPT  "
-
+check_xt()
+{
 #check if we have xtables from iptables >= 1.4.5.
 cat >/tmp/ipttest.c <<EOF
 #include <xtables.h>
@@ -49,13 +47,23 @@ int main(int argc, char **argv)
 
 EOF
 
-if gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl -lxtables >/dev/null 2>&1
+if gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL $(pkg-config xtables --cflags --libs) -ldl >/dev/null 2>&1
 then
        echo "TC_CONFIG_XT:=y" >>Config
-       echo "using xtables instead of iptables"
+       echo "using xtables"
+fi
+rm -f /tmp/ipttest.c /tmp/ipttest
+}
+
+check_xt_old()
+{
+# bail if previous XT checks has already succeded.
+if grep TC_CONFIG_XT Config > /dev/null
+then
+       return
 fi
 
-#check if we need dont our internal header ..
+#check if we dont need our internal header ..
 cat >/tmp/ipttest.c <<EOF
 #include <xtables.h>
 char *lib_dir;
@@ -81,9 +89,17 @@ gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl >/dev/null 2>&1
 if [ $? -eq 0 ]
 then
        echo "TC_CONFIG_XT_OLD:=y" >>Config
-       echo "using xtables seems no need for internal.h"
-else
-       echo "failed test 2"
+       echo "using old xtables (no need for xt-internal.h)"
+fi
+rm -f /tmp/ipttest.c /tmp/ipttest
+}
+
+check_xt_old_internal_h()
+{
+# bail if previous XT checks has already succeded.
+if grep TC_CONFIG_XT Config > /dev/null
+then
+       return
 fi
 
 #check if we need our own internal.h
@@ -112,10 +128,72 @@ gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl >/dev/null 2>&1
 
 if [ $? -eq 0 ]
 then
-       echo "using xtables instead of iptables (need for internal.h)"
+       echo "using old xtables with xt-internal.h"
        echo "TC_CONFIG_XT_OLD_H:=y" >>Config
+fi
+rm -f /tmp/ipttest.c /tmp/ipttest
+}
 
+check_ipt()
+{
+       if ! grep TC_CONFIG_XT Config > /dev/null
+       then
+               echo "using iptables"
+       fi
+}
+
+check_ipt_lib_dir()
+{
+       IPT_LIB_DIR=""
+       for dir in /lib /usr/lib /usr/local/lib
+       do
+               for file in $dir/{xtables,iptables}/lib*t_*so ; do
+                       if [ -f $file ]; then
+                               echo ${file%/*}
+                               echo "IPT_LIB_DIR:=${file%/*}" >> Config
+                               return
+                       fi
+               done
+       done
+       echo "not found!"
+}
+
+check_setns()
+{
+cat >/tmp/setnstest.c <<EOF
+#include <sched.h>
+int main(int argc, char **argv) 
+{
+       (void)setns(0,0);
+       return 0;
+}
+EOF
+gcc -I$INCLUDE -o /tmp/setnstest /tmp/setnstest.c >/dev/null 2>&1
+if [ $? -eq 0 ]
+then
+       echo "IP_CONFIG_SETNS:=y" >>Config
+       echo "yes"
 else
-       echo "failed test 3 using iptables"
+       echo "no"
 fi
-rm -f /tmp/ipttest.c /tmp/ipttest
+rm -f /tmp/setnstest.c /tmp/setnstest
+}
+
+echo "# Generated config based on" $INCLUDE >Config
+
+echo "TC schedulers"
+
+echo -n " ATM  "
+check_atm
+
+echo -n " IPT  "
+check_xt
+check_xt_old
+check_xt_old_internal_h
+check_ipt
+
+echo -n "iptables modules directory: "
+check_ipt_lib_dir
+
+echo -n "libc has setns: "
+check_setns