osdl.net!shemminger | 449bf1f | 2004-06-25 21:14:22 +0000 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | # This is not an autconf generated configure |
| 3 | # |
osdl.net!shemminger | 4b1bbd9 | 2004-08-09 16:35:28 +0000 | [diff] [blame] | 4 | INCLUDE=${1:-"$PWD/include"} |
osdl.net!shemminger | 449bf1f | 2004-06-25 21:14:22 +0000 | [diff] [blame] | 5 | |
Andreas Henriksson | 14743a7 | 2010-01-01 23:20:30 +0100 | [diff] [blame^] | 6 | check_atm() |
Andreas Henriksson | f1a0125 | 2009-12-02 05:12:30 +0000 | [diff] [blame] | 7 | { |
osdl.net!shemminger | c830d77 | 2004-07-02 17:47:53 +0000 | [diff] [blame] | 8 | cat >/tmp/atmtest.c <<EOF |
| 9 | #include <atm.h> |
| 10 | int main(int argc, char **argv) { |
| 11 | struct atm_qos qos; |
| 12 | (void) text2qos("aal5,ubr:sdu=9180,rx:none",&qos,0); |
| 13 | return 0; |
| 14 | } |
| 15 | EOF |
osdl.net!shemminger | 2979d52 | 2004-07-30 20:24:59 +0000 | [diff] [blame] | 16 | gcc -I$INCLUDE -o /tmp/atmtest /tmp/atmtest.c -latm >/dev/null 2>&1 |
osdl.net!shemminger | c830d77 | 2004-07-02 17:47:53 +0000 | [diff] [blame] | 17 | if [ $? -eq 0 ] |
osdl.net!shemminger | 449bf1f | 2004-06-25 21:14:22 +0000 | [diff] [blame] | 18 | then |
osdl.net!shemminger | c830d77 | 2004-07-02 17:47:53 +0000 | [diff] [blame] | 19 | echo "TC_CONFIG_ATM:=y" >>Config |
osdl.net!shemminger | b9cb1c9 | 2004-07-30 22:27:50 +0000 | [diff] [blame] | 20 | echo yes |
osdl.net!shemminger | 449bf1f | 2004-06-25 21:14:22 +0000 | [diff] [blame] | 21 | else |
osdl.net!shemminger | b9cb1c9 | 2004-07-30 22:27:50 +0000 | [diff] [blame] | 22 | echo no |
osdl.net!shemminger | 449bf1f | 2004-06-25 21:14:22 +0000 | [diff] [blame] | 23 | fi |
osdl.net!shemminger | 2979d52 | 2004-07-30 20:24:59 +0000 | [diff] [blame] | 24 | rm -f /tmp/atmtest.c /tmp/atmtest |
Andreas Henriksson | f1a0125 | 2009-12-02 05:12:30 +0000 | [diff] [blame] | 25 | } |
Jamal Hadi Salim | 63c7d26 | 2009-02-07 08:19:20 -0500 | [diff] [blame] | 26 | |
Andreas Henriksson | 14743a7 | 2010-01-01 23:20:30 +0100 | [diff] [blame^] | 27 | check_xt() |
Andreas Henriksson | f1a0125 | 2009-12-02 05:12:30 +0000 | [diff] [blame] | 28 | { |
Andreas Henriksson | a36ceb8 | 2009-12-02 16:11:50 +0100 | [diff] [blame] | 29 | #check if we have xtables from iptables >= 1.4.5. |
| 30 | cat >/tmp/ipttest.c <<EOF |
| 31 | #include <xtables.h> |
| 32 | #include <linux/netfilter.h> |
| 33 | static struct xtables_globals test_globals = { |
| 34 | .option_offset = 0, |
| 35 | .program_name = "tc-ipt", |
| 36 | .program_version = XTABLES_VERSION, |
| 37 | .orig_opts = NULL, |
| 38 | .opts = NULL, |
| 39 | .exit_err = NULL, |
| 40 | }; |
| 41 | |
| 42 | int main(int argc, char **argv) |
| 43 | { |
| 44 | xtables_init_all(&test_globals, NFPROTO_IPV4); |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | EOF |
| 49 | |
| 50 | if gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl -lxtables >/dev/null 2>&1 |
| 51 | then |
| 52 | echo "TC_CONFIG_XT:=y" >>Config |
Andreas Henriksson | f1a0125 | 2009-12-02 05:12:30 +0000 | [diff] [blame] | 53 | echo "using xtables" |
| 54 | fi |
| 55 | rm -f /tmp/ipttest.c /tmp/ipttest |
| 56 | } |
| 57 | |
Andreas Henriksson | 14743a7 | 2010-01-01 23:20:30 +0100 | [diff] [blame^] | 58 | check_xt_old() |
Andreas Henriksson | f1a0125 | 2009-12-02 05:12:30 +0000 | [diff] [blame] | 59 | { |
| 60 | # bail if previous XT checks has already succeded. |
| 61 | if grep TC_CONFIG_XT Config > /dev/null |
| 62 | then |
| 63 | return |
Andreas Henriksson | a36ceb8 | 2009-12-02 16:11:50 +0100 | [diff] [blame] | 64 | fi |
| 65 | |
Jamal Hadi Salim | 63c7d26 | 2009-02-07 08:19:20 -0500 | [diff] [blame] | 66 | #check if we need dont our internal header .. |
| 67 | cat >/tmp/ipttest.c <<EOF |
| 68 | #include <xtables.h> |
| 69 | char *lib_dir; |
| 70 | unsigned int global_option_offset = 0; |
| 71 | const char *program_version = XTABLES_VERSION; |
| 72 | const char *program_name = "tc-ipt"; |
| 73 | struct afinfo afinfo = { |
| 74 | .libprefix = "libxt_", |
| 75 | }; |
| 76 | |
| 77 | void exit_error(enum exittype status, const char *msg, ...) |
| 78 | { |
| 79 | } |
| 80 | |
| 81 | int main(int argc, char **argv) { |
| 82 | |
| 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | EOF |
| 87 | gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl >/dev/null 2>&1 |
| 88 | |
| 89 | if [ $? -eq 0 ] |
| 90 | then |
Andreas Henriksson | 80d689d | 2009-12-02 16:11:21 +0100 | [diff] [blame] | 91 | echo "TC_CONFIG_XT_OLD:=y" >>Config |
Andreas Henriksson | f1a0125 | 2009-12-02 05:12:30 +0000 | [diff] [blame] | 92 | echo "using old xtables (no need for xt-internal.h)" |
| 93 | fi |
| 94 | rm -f /tmp/ipttest.c /tmp/ipttest |
| 95 | } |
| 96 | |
Andreas Henriksson | 14743a7 | 2010-01-01 23:20:30 +0100 | [diff] [blame^] | 97 | check_xt_old_internal_h() |
Andreas Henriksson | f1a0125 | 2009-12-02 05:12:30 +0000 | [diff] [blame] | 98 | { |
| 99 | # bail if previous XT checks has already succeded. |
| 100 | if grep TC_CONFIG_XT Config > /dev/null |
| 101 | then |
| 102 | return |
Jamal Hadi Salim | 63c7d26 | 2009-02-07 08:19:20 -0500 | [diff] [blame] | 103 | fi |
| 104 | |
| 105 | #check if we need our own internal.h |
| 106 | cat >/tmp/ipttest.c <<EOF |
| 107 | #include <xtables.h> |
| 108 | #include "xt-internal.h" |
| 109 | char *lib_dir; |
| 110 | unsigned int global_option_offset = 0; |
| 111 | const char *program_version = XTABLES_VERSION; |
| 112 | const char *program_name = "tc-ipt"; |
| 113 | struct afinfo afinfo = { |
| 114 | .libprefix = "libxt_", |
| 115 | }; |
| 116 | |
| 117 | void exit_error(enum exittype status, const char *msg, ...) |
| 118 | { |
| 119 | } |
| 120 | |
| 121 | int main(int argc, char **argv) { |
| 122 | |
| 123 | return 0; |
| 124 | } |
| 125 | |
| 126 | EOF |
| 127 | gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl >/dev/null 2>&1 |
| 128 | |
| 129 | if [ $? -eq 0 ] |
| 130 | then |
Andreas Henriksson | f1a0125 | 2009-12-02 05:12:30 +0000 | [diff] [blame] | 131 | echo "using old xtables with xt-internal.h" |
Andreas Henriksson | 80d689d | 2009-12-02 16:11:21 +0100 | [diff] [blame] | 132 | echo "TC_CONFIG_XT_OLD_H:=y" >>Config |
Jamal Hadi Salim | 63c7d26 | 2009-02-07 08:19:20 -0500 | [diff] [blame] | 133 | fi |
| 134 | rm -f /tmp/ipttest.c /tmp/ipttest |
Andreas Henriksson | f1a0125 | 2009-12-02 05:12:30 +0000 | [diff] [blame] | 135 | } |
| 136 | |
Andreas Henriksson | 14743a7 | 2010-01-01 23:20:30 +0100 | [diff] [blame^] | 137 | check_ipt() |
Andreas Henriksson | f1a0125 | 2009-12-02 05:12:30 +0000 | [diff] [blame] | 138 | { |
| 139 | if ! grep TC_CONFIG_XT Config > /dev/null |
| 140 | then |
| 141 | echo "using iptables" |
| 142 | fi |
| 143 | } |
| 144 | |
| 145 | echo "# Generated config based on" $INCLUDE >Config |
| 146 | |
| 147 | echo "TC schedulers" |
| 148 | |
| 149 | echo -n " ATM " |
| 150 | check_atm |
| 151 | |
| 152 | echo -n " IPT " |
| 153 | check_xt |
| 154 | check_xt_old |
| 155 | check_xt_old_internal_h |
| 156 | check_ipt |
| 157 | |