#! /bin/bash # This is not an autconf generated configure # INCLUDE=${1:-"$PWD/include"} echo "# Generated config based on" $INCLUDE >Config echo "TC schedulers" echo -n " ATM " cat >/tmp/atmtest.c < int main(int argc, char **argv) { struct atm_qos qos; (void) text2qos("aal5,ubr:sdu=9180,rx:none",&qos,0); return 0; } EOF gcc -I$INCLUDE -o /tmp/atmtest /tmp/atmtest.c -latm >/dev/null 2>&1 if [ $? -eq 0 ] then echo "TC_CONFIG_ATM:=y" >>Config echo yes else echo no fi rm -f /tmp/atmtest.c /tmp/atmtest echo -n " IPT " #check if we have xtables from iptables >= 1.4.5. cat >/tmp/ipttest.c < #include static struct xtables_globals test_globals = { .option_offset = 0, .program_name = "tc-ipt", .program_version = XTABLES_VERSION, .orig_opts = NULL, .opts = NULL, .exit_err = NULL, }; int main(int argc, char **argv) { xtables_init_all(&test_globals, NFPROTO_IPV4); return 0; } EOF if gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl -lxtables >/dev/null 2>&1 then echo "TC_CONFIG_XT:=y" >>Config echo "using xtables instead of iptables" fi #check if we need dont our internal header .. cat >/tmp/ipttest.c < char *lib_dir; unsigned int global_option_offset = 0; const char *program_version = XTABLES_VERSION; const char *program_name = "tc-ipt"; struct afinfo afinfo = { .libprefix = "libxt_", }; void exit_error(enum exittype status, const char *msg, ...) { } int main(int argc, char **argv) { return 0; } EOF 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" fi #check if we need our own internal.h cat >/tmp/ipttest.c < #include "xt-internal.h" char *lib_dir; unsigned int global_option_offset = 0; const char *program_version = XTABLES_VERSION; const char *program_name = "tc-ipt"; struct afinfo afinfo = { .libprefix = "libxt_", }; void exit_error(enum exittype status, const char *msg, ...) { } int main(int argc, char **argv) { return 0; } EOF 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 "TC_CONFIG_XT_OLD_H:=y" >>Config else echo "failed test 3 using iptables" fi rm -f /tmp/ipttest.c /tmp/ipttest