filtergen-0.12.7/0000755000175000017500000000000012657606274010600 500000000000000filtergen-0.12.7/fg-util.c0000644000175000017500000000246412657605413012233 00000000000000/* utility functions for filter generation * * Copyright (c) 2002 Matthew Kirkwood * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include char *strapp(char *s, const char *n) { size_t l; if (!n) return s; if (!s) return strdup(n); l = strlen(s) + strlen(n) + 1; s = realloc(s, l); return strcat(s, n); } int str_to_int(const char *s, int *i) { long m; char *e; m = strtol(s, &e, 10); if (*e) return -1; *i = m; return 0; } char *int_to_str_dup(int i) { char buf[100]; snprintf(buf, sizeof(buf) - 1, "%d", i); buf[sizeof(buf) - 1] = 0; return strdup(buf); } filtergen-0.12.7/README0000644000175000017500000001223612657466010011374 00000000000000 PACKET FILTER GENERATOR GENERAL This tool is for generating packet filtering rules from a fairly high- level description language. It doesn't support all of the whizz-bang features of the latest and greatest packet filters, but supports a decent subset which is sufficient for me. It currently supports only Linux iptables and ipchains. Cisco IOS has been begun, but is incomplete. Darren Reed's ipfilter may be supported at some stage. It doesn't generate optimal rulesets, and has a few limitations which need to be removed, but is still a useful tool. There's a basic webpage at http://hairy.beasts.org/filter/ WARNING! This package isn't perfect. Nevertheless, I don't believe that the ipchains or iptables drivers leak packets. LICENCE It was written, and is copyrighted by me , and made available you you under the terms of the GNU General Public Licence. WHY? Not many large softare projects are written entirely in assembly language these days. It's not difficult to be, and the results can often be more efficient, but it does take longer to implement and bugfix, and is not portable to other systems. It is also harder for others to understand, update and audit. Similarly, it seems odd that people continue to write packet filters in the equivalent of assembler, or in inflexible macro languages. Hence this package -- my intent is that "filter" will be to iptables and shell what a C compiler (but not a 4GL) is to assembly. USAGE The filter generator is called "filtergen". It can be invoked as: $ filtergen source.file > output.rules or as a filter itself: $ cat source.file | filtergen > output.rules The default output mode is for iptables, but you can override this by giving an extra argument on the command-line: $ filtergen oldbox.filter ipchains > oldbox.rules and using "-" to imply standard input: $ cat oldbox.filter | filtergen - ipchains > oldbox.rules Some of the backends (notably iptables and ipchains) generate a "skeleton" around the rules that they output. This can be disabled with "-n": $ filtergen -n tests/ticmp.filter ipchains The rulesets generated with this option may not be complete, but the flag is useful to allow one to see what sort of output is generated. SYNTAX The syntax looks not entirely unlike that of "fk"s ACL facility ("fk" is another project of mine which lives at http://hairy.beasts.org/fk/), and it might be worth familiarising yourself with that first (not least because it is rather less experimental). An example will probably show most of the basics. Here's a simple one for a single-interface host (perhaps a mail server): # Unfortunately, we don't have time to audit the # communications which go on locally {input lo; output lo} accept; # But we want to be a bit more careful when speaking # to the outside world input eth0 { proto tcp { dport { smtp pop-3 } accept; dport ssh source ournet/24 accept; # We don't answer this, but don't want to # cause timeouts by blocking it dport auth reject; log drop; }; # We don't run any UDP (or other non-TCP) # services log drop; }; output eth0 { proto tcp { dport { smtp auth } accept; log drop; }; # Outbound DNS is OK proto udp dport domain dest { ns0 ns1 } accept; log drop; }; At first sight, this might not look like much more than a shorthand for raw packet filtering rules, and indeed it isn't. However, the abbreviation is better than one might imagine because it also (again, as far as the underlying packet filter allows it) outputs appropriate rules for returning packets on a connection, and applies stateful rules where possible. So a simple rule like: output eth0 proto tcp dport http accept; might generate ipchains rules like: ipchains -A output -i eth0 -p tcp --dport=http -j ACCEPT ipchains -A input -i eth0 -p tcp ! --syn --sport=http -j ACCEPT to give simple "state" matching -- the second rule will block any packets which could initiate a connection. Otherwise, an attacker could connect to any port on your machine merely by binding the attack program to port 80 on his machine. The same rule might generate iptables rule resembling: iptables -A OUTPUT -o eth0 -p tcp -m state --state=NEW,ESTABLISHED \ --dport=http -j ACCEPT iptables -A INPUT -i eth0 -p tcp -m state --state=ESTABLISHED ! --syn \ --sport=http -j ACCEPT Note the explicit state checking here (which, in theory, makes the "! --syn" bit unnecessary, but a bit of defence in depth never hurt). SIGNIFICANT DIFFERENCES FROM ACL SYNTAX There are a number of places where the filter language differs from the ACL language. They are not (well, not all) as gratuitous as one might think at first. * ACL has "allow" and "deny", filter has "accept", "drop" and "reject". * ACL makes no distinction between the actual inbound and outbound connections which make up a proxied logical connection. These are essentially because a packet filter isn't really in a position to permit or refuse a connection -- it acts only on single packets, and is not really able to reason about connections (whatever the blurb claims). It also matches the terminology used by Linux's iptables. $Id: README,v 1.9 2002/08/20 22:54:38 matthew Exp $ filtergen-0.12.7/filter.h0000644000175000017500000001333012657605413012150 00000000000000/* types and functions used throughout filtergen * * Copyright (c) 2002 Matthew Kirkwood * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _FK_FILTER_H #define _FK_FILTER_H #include #include #include #ifdef __GNUC__ #define _PRINTF_ATTR(s, e) __attribute__((__format__(__printf__, (s), (e)))) #else #define _PRINTF_ATTR(s, e) #endif /* * If it doesn't begin with "F_", it's a simple token, not an * filter type */ enum filtertype { YYEOF = 0, F_DIRECTION, F_TARGET, F_SOURCE, F_DEST, F_SPORT, F_DPORT, F_ICMPTYPE, F_PROTO, F_NEG, F_SIBLIST, F_SUBGROUP, F_LOG, F_RTYPE, F_ONEWAY, /* this must be the last real filter type */ F_FILTER_MAX, /* parser use only */ INPUT, OUTPUT, /* lex uses "ACCEPT" and "REJECT" */ T_ACCEPT, DROP, T_REJECT, MASQ, REDIRECT, OPENBRACE, CLOSEBRACE, OPENBRACKET, CLOSEBRACKET, SEMICOLON, STRING, INCLUDE, LOCALONLY, ROUTEDONLY, /* for F_RTYPE */ TEXT, /* for F_LOG */ }; /* Structures which appear in both the parse tree and the output rule */ struct proto_spec { int num; char *name; }; struct addr_spec { sa_family_t family; union { struct { struct in_addr addr, mask; } inet; struct { struct in6_addr addr, mask; } inet6; } u; char *addrstr, *maskstr; }; struct port_spec { int min, max; char *minstr, *maxstr; }; /* This is basically just a parse tree */ struct filter { enum filtertype type; union { struct { enum filtertype direction; char *iface; } ifinfo; enum filtertype target; char *logmsg; enum filtertype rtype; struct addr_spec addrs; struct port_spec ports; char *icmp; struct proto_spec proto; struct filter *neg; struct filter *sib; struct { char *name; struct filter *list; } sub; } u; struct filter *child, *next; /* infernal use only */ int negate; }; struct filtergen_opts { sa_family_t family; }; /* from filter.c */ typedef struct filter *filter_tctor(enum filtertype); filter_tctor new_filter_target, new_filter_rtype; struct filter *new_filter_neg(struct filter *sub); struct filter *new_filter_sibs(struct filter *list); struct filter *new_filter_subgroup(char *name, struct filter *list); typedef struct filter *filter_ctor(enum filtertype, const char *); filter_ctor new_filter_device, new_filter_ports, new_filter_icmp, new_filter_proto, new_filter_log; struct filter *new_filter_host(enum filtertype, const char *, sa_family_t); struct filter *new_filter_oneway(void); /* filter manipulations */ void filter_unroll(struct filter **f); void filter_nogroup(struct filter *f); void filter_noneg(struct filter **f); void filter_apply_flags(struct filter *f, long flags); /* from generated lexer and parer in filterlex.l */ int filter_fopen(const char *filename); struct filter *filter_parse_list(struct filtergen_opts *o); /* from gen.c */ #define ESET(e, f) (e->whats_set & (1 << F_##f)) struct filterent { /* Either direction+iface or groupname must be set */ enum filtertype direction; char *iface; char *groupname; /* One of these must be set */ enum filtertype target; char *subgroup; /* These may or may not be set */ int whats_set : F_FILTER_MAX; int whats_negated : F_FILTER_MAX; struct addr_spec srcaddr, dstaddr; enum filtertype rtype; struct proto_spec proto; char *logmsg; int oneway; /* We need this not to be a union, for error-checking reasons */ struct { struct { struct port_spec src, dst; } ports; char *icmp; } u; }; struct fg_misc { int flags; void *misc; }; typedef int fg_cb_rule(const struct filterent *ent, struct fg_misc *misc); typedef int fg_cb_group(const char *name); typedef struct { fg_cb_rule *rule; fg_cb_group *group; } fg_callback; int filtergen_cprod(struct filter *filter, fg_callback *cb, struct fg_misc *misc); /* fg-util.c */ char *strapp(char *s, const char *n); #define strapp2(s, n1, n2) strapp(strapp(s, n1), n2) int str_to_int(const char *s, int *i); char *int_to_str_dup(int i); /* various drivers */ typedef int filtergen(struct filter *filter, int flags); filtergen fg_iptables, fg_ip6tables, fg_iptrestore, fg_ip6trestore, fg_ipchains, fg_ipfilter, fg_cisco; typedef int filter_flush(enum filtertype policy); filter_flush flush_iptables, flush_ip6tables, flush_iptrestore, flush_ip6trestore, flush_ipchains; /* ("flags" arguments) */ #define FF_NOSKEL (1 << 0) /* omit any "skeleton" rules */ #define FF_LSTATE (1 << 1) /* lightweight state matching */ #define FF_LOCAL (1 << 2) /* assume packets are local only */ #define FF_ROUTE (1 << 3) /* assume packets are forwarded */ #define FF_LOOKUP \ (1 << 4) /* translate host and service names into \ * IP addresses and port numbers */ #define FF_FLUSH (1 << 5) /* just flush the ruleset instead */ /* filtergen.c */ int oputs(const char *s); int oprintf(const char *fmt, ...) _PRINTF_ATTR(1, 2); #endif /* _FK_FILTER_H */ filtergen-0.12.7/rules.filter.in0000644000175000017500000000036712657466011013465 00000000000000# @sysconfdir@/rules.filter # Please read @pkgexdir@/*.filter for # more comprehensive filter examples. # allow all traffic on the loopback interface {input lo; output lo } accept; # allow all traffic on eth0 {input eth0; output eth0 } accept; filtergen-0.12.7/aclocal.m40000644000175000017500000013047712657605415012370 00000000000000# generated automatically by aclocal 1.15 -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.15], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.15])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Copyright (C) 1998-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_LEX # ----------- # Autoconf leaves LEX=: if lex or flex can't be found. Change that to a # "missing" invocation, for better error output. AC_DEFUN([AM_PROG_LEX], [AC_PREREQ([2.50])dnl AC_REQUIRE([AM_MISSING_HAS_RUN])dnl AC_REQUIRE([AC_PROG_LEX])dnl if test "$LEX" = :; then LEX=${am_missing_run}flex fi]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # -*- Autoconf -*- # Obsolete and "removed" macros, that must however still report explicit # error messages when used, to smooth transition. # # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. AC_DEFUN([AM_CONFIG_HEADER], [AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl AC_CONFIG_HEADERS($@)]) AC_DEFUN([AM_PROG_CC_STDC], [AC_PROG_CC am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should simply use the 'AC][_PROG_CC' macro instead. Also, your code should no longer depend upon 'am_cv_prog_cc_stdc', but upon 'ac_cv_prog_cc_stdc'.])]) AC_DEFUN([AM_C_PROTOTYPES], [AC_FATAL([automatic de-ANSI-fication support has been removed])]) AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR filtergen-0.12.7/fg-iptables.c0000644000175000017500000003346712657605413013070 00000000000000/* filter generator, iptables driver * * Copyright (c) 2002 Matthew Kirkwood * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * Description of generated filter * * 1. Policy: * + "filter" chains DROP. * + "nat" chains ACCEPT. * 2. State: * + Non-TCP/UDP rules don't include state. * + Allow rules include state. * + Deny rules don't. * 3. NAT is done in PRE- and POSTROUTING, as required. * However, we also must add rules to INPUT (for * transproxy) and OUTPUT (for masquerading). * 4. Reject rules need to go into FORWARD as well as * INPUT or OUTPUT. * 5. INPUT rules also get added to FORWARD. * 6. If LOCALONLY is set, no FORWARD rules are output. * * The above means that each rulechain can generate up to * three rules -- nat, in and out. */ #include #include #include #include "filter.h" #include "util.h" /* bitfields for features used */ #define REJECT 0x01 #define A_TCP 0x10 #define A_UDP 0x20 /* full path to ip{,6}tables executables */ #define IPTABLES "/sbin/iptables" #define IP6TABLES "/sbin/ip6tables" static char *appip(char *r, const struct addr_spec *h) { APPS(r, h->addrstr); if (h->maskstr) APP2(r, "/", h->maskstr); return r; } #define APPIP(r, h) (r = appip(r, h)) #define APPIP2(f, r, h) (APPS(r, f), APPIP(r, h)) static char *appport(char *r, const struct port_spec *h) { APPS(r, h->minstr); if (h->maxstr) APP2(r, ":", h->maxstr); return r; } #define APPPORT(r, h) (r = appport(r, h)) #define APPPORT2(f, r, h) (APPS(r, f), APPPORT(r, h)) static int cb_iptables_rule_common(const struct filterent *ent, struct fg_misc *misc, sa_family_t family, const char *iptables) { char *rulechain = NULL, *revchain = NULL, *natchain = NULL; char *ruletarget = NULL, *revtarget = NULL, *nattarget = NULL; char *natrule = NULL, *rule = NULL, *rule_r = NULL; char *forchain = NULL, *forrevchain = NULL; char *fortarget = NULL, *forrevtarget = NULL; char *subchain = NULL, *subtarget = NULL; int neednat = 0, needret = 0; int islocal = (ent->rtype != ROUTEDONLY); int isforward = (ent->rtype != LOCALONLY); long *feat = (long *)misc->misc; enum filtertype target = ent->target; int orules = 0; /* nat rule? */ if ((target == MASQ) || (target == REDIRECT)) { neednat = 1; if (family == AF_INET6) { fprintf(stderr, "can't NAT with IPv6\n"); return -1; } if ((target == MASQ) && (ent->direction == INPUT)) { fprintf(stderr, "can't masquerade on input\n"); return -1; } else if ((target == REDIRECT) && (ent->direction == OUTPUT)) { fprintf(stderr, "can't redirect on output\n"); return -1; } } /* sub-stuff? */ if (target == F_SUBGROUP) { subtarget = strapp(strdup(ent->subgroup), "-"); needret = 1; } else subtarget = strdup(""); if (ent->groupname) subchain = strapp(strdup(ent->groupname), "-"); else subchain = strdup(""); switch (ent->direction) { case INPUT: natchain = strdup("PREROUTING"); rulechain = strdup("INPUT"); revchain = strdup("OUTPUT"); forchain = strdup("FORWARD"); forrevchain = strdup("FORW_OUT"); if (ent->iface && strcmp(ent->iface, "*")) { if (NEG(DIRECTION)) { APPS(natrule, "!"); APPS(rule, "!"); APPS(rule_r, "!"); } if (strcmp(ent->iface, "*")) { APPSS2(natrule, "-i", ent->iface); APPSS2(rule, "-i", ent->iface); APPSS2(rule_r, "-o", ent->iface); } } break; case OUTPUT: natchain = strdup("POSTROUTING"); rulechain = strdup("OUTPUT"); revchain = strdup("INPUT"); forchain = strdup("FORW_OUT"); forrevchain = strdup("FORWARD"); if (ent->iface && strcmp(ent->iface, "*")) { if (NEG(DIRECTION)) { APPS(natrule, "!"); APPS(rule, "!"); APPS(rule_r, "!"); } if (strcmp(ent->iface, "*")) { APPSS2(natrule, "-o", ent->iface); APPSS2(rule, "-o", ent->iface); APPSS2(rule_r, "-i", ent->iface); } } break; default: fprintf(stderr, "unknown direction\n"); abort(); } /* state and reverse rules here */ /* FIXME: state established on reverse for every rule, not just * specifically udp and tcp */ if (ent->proto.name) { int needstate = 0; APPSS2(natrule, "-p", ent->proto.name); APPSS2(rule, "-p", ent->proto.name); APPSS2(rule_r, "-p", ent->proto.name); switch (ent->proto.num) { case IPPROTO_TCP: needret++; needstate++; *feat |= A_TCP; APPS(rule_r, "! --syn"); break; case IPPROTO_UDP: needret++; needstate++; *feat |= A_UDP; break; } if (needstate) { APPS(rule, "-m state --state NEW,ESTABLISHED"); APPS(rule_r, "-m state --state ESTABLISHED"); } } if (ent->srcaddr.addrstr) { NEGA(natrule, SOURCE); NEGA(rule, SOURCE); NEGA(rule_r, SOURCE); APPIP2("-s", natrule, &ent->srcaddr); APPIP2("-s", rule, &ent->srcaddr); APPIP2("-d", rule_r, &ent->srcaddr); } if (ent->dstaddr.addrstr) { NEGA(natrule, DEST); NEGA(rule, DEST); NEGA(rule_r, DEST); APPIP2("-d", natrule, &ent->dstaddr); APPIP2("-d", rule, &ent->dstaddr); APPIP2("-s", rule_r, &ent->dstaddr); } switch (ent->proto.num) { case 0: break; case IPPROTO_UDP: case IPPROTO_TCP: if (ent->u.ports.src.minstr) { NEGA(natrule, SPORT); NEGA(rule, SPORT); NEGA(rule_r, SPORT); APPPORT2("--sport", natrule, &ent->u.ports.src); APPPORT2("--sport", rule, &ent->u.ports.src); APPPORT2("--dport", rule_r, &ent->u.ports.src); } if (ent->u.ports.dst.minstr) { NEGA(natrule, DPORT); NEGA(rule, DPORT); NEGA(rule_r, DPORT); APPPORT2("--dport", natrule, &ent->u.ports.dst); APPPORT2("--dport", rule, &ent->u.ports.dst); APPPORT2("--sport", rule_r, &ent->u.ports.dst); } break; case IPPROTO_ICMP: if (ent->u.icmp) { NEGA(natrule, ICMPTYPE); APPSS2(natrule, "--icmp-type", ent->u.icmp); NEGA(rule, ICMPTYPE); APPSS2(rule, "--icmp-type", ent->u.icmp); } break; default: ; } APPS(natrule, "-j"); APPS(rule, "-j"); APPS(rule_r, "-j"); /* The "rule+1" in the printfs below are an ugly hack to * prevent a double-space in the output rule */ /* Yuck, separate rules for logging packets. Be still my * beating lunch. * * Logging and target rules have to be the last bits * before output, or this doesn't work. This will also * fail if any mangling has been done above. */ if (ESET(ent, LOG)) { char *lc, *la, *ls; if (ent->logmsg) { lc = strdup(" --log-prefix="); la = ent->logmsg; ls = strdup("\" \""); } else lc = la = ls = strdup(""); if (islocal) orules++, oprintf("%s -A %s %s LOG%s%s%s\n", iptables, rulechain, rule + 1, lc, la, ls); if (isforward) orules++, oprintf("%s -A %s %s LOG%s%s%s\n", iptables, forchain, rule + 1, lc, la, ls); } /* Do this twice, once for NAT, once for filter */ if (neednat) { switch (target) { case MASQ: nattarget = strdup("MASQUERADE"); break; case REDIRECT: nattarget = strdup("REDIRECT"); break; default: abort(); } } switch (target) { case MASQ: case REDIRECT: case T_ACCEPT: ruletarget = revtarget = fortarget = forrevtarget = strdup("ACCEPT"); switch (ent->direction) { case INPUT: fortarget = strdup("FORW_OUT"); break; case OUTPUT: forrevtarget = strdup("FORW_OUT"); break; default: abort(); } break; case DROP: ruletarget = fortarget = strdup("DROP"); needret = 0; break; case T_REJECT: ruletarget = fortarget = strdup("REJECT"); needret = 0; *feat |= T_REJECT; break; case F_SUBGROUP: switch (ent->direction) { case INPUT: ruletarget = strdup("INPUT"); revtarget = strdup("OUTPUT"); fortarget = strdup("FORWARD"); forrevtarget = strdup("FORW_OUT"); break; case OUTPUT: ruletarget = strdup("OUTPUT"); revtarget = strdup("INPUT"); fortarget = strdup("FORW_OUT"); forrevtarget = strdup("FORWARD"); break; default: abort(); } break; default: abort(); } if ((misc->flags & FF_LSTATE) && (target != T_REJECT)) needret = 0; if (ent->oneway) needret = 0; if (neednat) orules++, oprintf("%s -t nat -A %s%s %s %s%s\n", iptables, subchain, natchain, natrule + 1, subtarget, nattarget); if (islocal) orules++, oprintf("%s -A %s%s %s %s%s\n", iptables, subchain, rulechain, rule + 1, subtarget, ruletarget); if (needret) orules++, oprintf("%s -I %s%s %s %s%s\n", iptables, subchain, revchain, rule_r + 1, subtarget, revtarget); if (isforward) { orules++, oprintf("%s -A %s%s %s %s%s\n", iptables, subchain, forchain, rule + 1, subtarget, fortarget); if (needret) orules++, oprintf("%s -I %s%s %s %s%s\n", iptables, subchain, forrevchain, rule_r + 1, subtarget, forrevtarget); } free(natrule); free(rule); free(rule_r); free(subchain); free(subtarget); return orules; } static int cb_iptables_rule(const struct filterent *ent, struct fg_misc *misc) { return cb_iptables_rule_common(ent, misc, AF_INET, IPTABLES); } static int cb_ip6tables_rule(const struct filterent *ent, struct fg_misc *misc) { return cb_iptables_rule_common(ent, misc, AF_INET6, IP6TABLES); } static int cb_iptables_group_common(const char *name, const char *iptables) { oprintf("for f in INPUT OUTPUT FORWARD FORW_OUT; do %s -N %s-$f; done\n", iptables, name); return 4; } static int cb_iptables_group(const char *name) { return cb_iptables_group_common(name, IPTABLES); } static int cb_ip6tables_group(const char *name) { return cb_iptables_group_common(name, IP6TABLES); } static int fg_iptables_common(struct filter *filter, int flags, sa_family_t family, const char *iptables) { long feat = 0; int r = 0; struct fg_misc misc = {flags, &feat}; fg_callback cb_iptables = { .rule = family == AF_INET ? cb_iptables_rule : cb_ip6tables_rule, .group = family == AF_INET ? cb_iptables_group : cb_ip6tables_group, }; const int nchains = 3; filter_unroll(&filter); filter_apply_flags(filter, flags); if (!(flags & FF_NOSKEL)) { oputs("CHAINS=\"INPUT OUTPUT FORWARD\""); oputs(""); oputs("# Flush/remove rules, set policy"); oprintf("for f in $CHAINS; do %s -P $f DROP; done\n", iptables); oprintf("%s -F; %s -X\n", iptables, iptables); if (family == AF_INET) oprintf("%s -t nat -F; %s -t nat -X\n", iptables, iptables); oputs(""); oputs("# Create FORW_OUT chain"); oprintf("%s -N FORW_OUT\n", iptables); oputs(""); oputs("# Setup INVALID chain"); oprintf("%s -N INVALID\n", iptables); #if 0 oprintf("%s -A INVALID -j LOG --log-prefix \"invalid \"\n", iptables); #endif oprintf("%s -A INVALID -j DROP\n", iptables); oprintf("for f in $CHAINS; do\n" "\t%s -I $f -m state --state INVALID -j INVALID;\n" "done\n", iptables); oputs(""); r += nchains; } if ((r = filtergen_cprod(filter, &cb_iptables, &misc)) < 0) return r; if (!(flags & FF_NOSKEL)) { if ((flags & FF_LSTATE) && (feat & (A_TCP | A_UDP))) { oputs("for f in $CHAINS; do"); if (feat & A_TCP) { r += nchains; oprintf("\t%s -I $f -p tcp ! --syn -m state --state ESTABLISHED -j " "ACCEPT;\n", iptables); } if (feat & A_UDP) { r += nchains; oprintf("\t%s -I $f -p udp -m state --state ESTABLISHED -j ACCEPT;\n", iptables); } oputs("done"); } #if 0 oprintf("for f in $CHAINS; do %s -A $f -j LOG; done\n", iptables); r += nchains; #endif } return r; } int fg_iptables(struct filter *filter, int flags) { return fg_iptables_common(filter, flags, AF_INET, IPTABLES); } int fg_ip6tables(struct filter *filter, int flags) { return fg_iptables_common(filter, flags, AF_INET6, IP6TABLES); } /* Rules which just flush the packet filter */ static int flush_iptables_common(enum filtertype policy, sa_family_t family, const char *iptables) { char *ostr; oputs("CHAINS=\"INPUT OUTPUT FORWARD\""); oputs(""); switch (policy) { case T_ACCEPT: ostr = strdup("ACCEPT"); break; case DROP: ostr = strdup("DROP"); break; case T_REJECT: ostr = strdup("REJECT"); break; default: fprintf(stderr, "invalid filtertype %d\n", policy); abort(); } oprintf("for f in $CHAINS; do %s -P $f %s; done\n", iptables, ostr); oprintf("%s -F; %s -X\n", iptables, iptables); if (family == AF_INET) oprintf("%s -t nat -F; %s -t nat -X\n", iptables, iptables); return 0; } int flush_iptables(enum filtertype policy) { return flush_iptables_common(policy, AF_INET, IPTABLES); } int flush_ip6tables(enum filtertype policy) { return flush_iptables_common(policy, AF_INET, IP6TABLES); } filtergen-0.12.7/rules.filter0000644000175000017500000000042512657605424013056 00000000000000# ${prefix}/etc/rules.filter # Please read /usr/local/share/doc/filtergen/examples/*.filter for # more comprehensive filter examples. # allow all traffic on the loopback interface {input lo; output lo } accept; # allow all traffic on eth0 {input eth0; output eth0 } accept; filtergen-0.12.7/fg-iptrestore.c0000644000175000017500000003273012657605413013455 00000000000000/* filter generator, iptables-restore driver * * Copyright (c) 2002 Matthew Kirkwood * Copyright (c) 2009 Anchor Systems (written by Matt Palmer *) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * Description of generated filter * * 1. Policy: * + "filter" chains DROP. * + "nat" chains ACCEPT. * 2. State: * + Non-TCP/UDP rules don't include state. * + Allow rules include state. * + Deny rules don't. * 3. NAT is done in PRE- and POSTROUTING, as required. * However, we also must add rules to INPUT (for * transproxy) and OUTPUT (for masquerading). * 4. Reject rules need to go into FORWARD as well as * INPUT or OUTPUT. * 5. INPUT rules also get added to FORWARD. * 6. If LOCALONLY is set, no FORWARD rules are output. * * The above means that each rulechain can generate up to * three rules -- nat, in and out. */ #include #include #include #include "filter.h" #include "util.h" /* bitfields for features used */ #define REJECT 0x01 #define A_TCP 0x10 #define A_UDP 0x20 /* full path to ip{,6}tables-restore executables */ #define IPTABLES_RESTORE "/sbin/iptables-restore" #define IP6TABLES_RESTORE "/sbin/ip6tables-restore" static char *appip(char *r, const struct addr_spec *h) { APPS(r, h->addrstr); if (h->maskstr) APP2(r, "/", h->maskstr); return r; } #define APPIP(r, h) (r = appip(r, h)) #define APPIP2(f, r, h) (APPS(r, f), APPIP(r, h)) static char *appport(char *r, const struct port_spec *h) { APPS(r, h->minstr); if (h->maxstr) APP2(r, ":", h->maxstr); return r; } #define APPPORT(r, h) (r = appport(r, h)) #define APPPORT2(f, r, h) (APPS(r, f), APPPORT(r, h)) static int cb_iptrestore_rule_common(const struct filterent *ent, struct fg_misc *misc, sa_family_t family) { char *rulechain = NULL, *revchain = NULL, *natchain = NULL; char *ruletarget = NULL, *revtarget = NULL, *nattarget = NULL; char *natrule = NULL, *rule = NULL, *rule_r = NULL; char *forchain = NULL, *forrevchain = NULL; char *fortarget = NULL, *forrevtarget = NULL; char *subchain = NULL, *subtarget = NULL; int neednat = 0, needret = 0; int islocal = (ent->rtype != ROUTEDONLY); int isforward = (ent->rtype != LOCALONLY); long *feat = (long *)misc->misc; enum filtertype target = ent->target; int orules = 0; /* nat rule? */ if ((target == MASQ) || (target == REDIRECT)) { neednat = 1; if (family == AF_INET6) { fprintf(stderr, "can't NAT with IPv6\n"); return -1; } if ((target == MASQ) && (ent->direction == INPUT)) { fprintf(stderr, "can't masquerade on input\n"); return -1; } else if ((target == REDIRECT) && (ent->direction == OUTPUT)) { fprintf(stderr, "can't redirect on output\n"); return -1; } } /* sub-stuff? */ if (target == F_SUBGROUP) { subtarget = strapp(strdup(ent->subgroup), "-"); needret = 1; } else subtarget = strdup(""); if (ent->groupname) subchain = strapp(strdup(ent->groupname), "-"); else subchain = strdup(""); switch (ent->direction) { case INPUT: natchain = strdup("PREROUTING"); rulechain = strdup("INPUT"); revchain = strdup("OUTPUT"); forchain = strdup("FORWARD"); forrevchain = strdup("FORW_OUT"); if (ent->iface && strcmp(ent->iface, "*")) { if (NEG(DIRECTION)) { APPS(natrule, "!"); APPS(rule, "!"); APPS(rule_r, "!"); } APPSS2(natrule, "-i", ent->iface); APPSS2(rule, "-i", ent->iface); APPSS2(rule_r, "-o", ent->iface); } break; case OUTPUT: natchain = strdup("POSTROUTING"); rulechain = strdup("OUTPUT"); revchain = strdup("INPUT"); forchain = strdup("FORW_OUT"); forrevchain = strdup("FORWARD"); if (ent->iface && strcmp(ent->iface, "*")) { if (NEG(DIRECTION)) { APPS(natrule, "!"); APPS(rule, "!"); APPS(rule_r, "!"); } APPSS2(natrule, "-o", ent->iface); APPSS2(rule, "-o", ent->iface); APPSS2(rule_r, "-i", ent->iface); } break; default: fprintf(stderr, "unknown direction\n"); abort(); } /* state and reverse rules here */ /* FIXME: state established on reverse for every rule, not just * specifically udp and tcp */ if (ent->proto.name) { int needstate = 0; APPSS2(natrule, "-p", ent->proto.name); APPSS2(rule, "-p", ent->proto.name); APPSS2(rule_r, "-p", ent->proto.name); switch (ent->proto.num) { case IPPROTO_TCP: needret++; needstate++; *feat |= A_TCP; APPS(rule_r, "! --syn"); break; case IPPROTO_UDP: needret++; needstate++; *feat |= A_UDP; break; } if (needstate) { APPS(rule, "-m state --state NEW,ESTABLISHED"); APPS(rule_r, "-m state --state ESTABLISHED"); } } if (ent->srcaddr.addrstr) { NEGA(natrule, SOURCE); NEGA(rule, SOURCE); NEGA(rule_r, SOURCE); APPIP2("-s", natrule, &ent->srcaddr); APPIP2("-s", rule, &ent->srcaddr); APPIP2("-d", rule_r, &ent->srcaddr); } if (ent->dstaddr.addrstr) { NEGA(natrule, DEST); NEGA(rule, DEST); NEGA(rule_r, DEST); APPIP2("-d", natrule, &ent->dstaddr); APPIP2("-d", rule, &ent->dstaddr); APPIP2("-s", rule_r, &ent->dstaddr); } switch (ent->proto.num) { case 0: break; case IPPROTO_UDP: case IPPROTO_TCP: if (ent->u.ports.src.minstr) { NEGA(natrule, SPORT); NEGA(rule, SPORT); NEGA(rule_r, SPORT); APPPORT2("--sport", natrule, &ent->u.ports.src); APPPORT2("--sport", rule, &ent->u.ports.src); APPPORT2("--dport", rule_r, &ent->u.ports.src); } if (ent->u.ports.dst.minstr) { NEGA(natrule, DPORT); NEGA(rule, DPORT); NEGA(rule_r, DPORT); APPPORT2("--dport", natrule, &ent->u.ports.dst); APPPORT2("--dport", rule, &ent->u.ports.dst); APPPORT2("--sport", rule_r, &ent->u.ports.dst); } break; case IPPROTO_ICMP: if (ent->u.icmp) { NEGA(natrule, ICMPTYPE); APPSS2(natrule, "--icmp-type", ent->u.icmp); NEGA(rule, ICMPTYPE); APPSS2(rule, "--icmp-type", ent->u.icmp); } break; default: ; } APPS(natrule, "-j"); APPS(rule, "-j"); APPS(rule_r, "-j"); /* The "rule+1" in the printfs below are an ugly hack to * prevent a double-space in the output rule */ /* Yuck, separate rules for logging packets. Be still my * beating lunch. * * Logging and target rules have to be the last bits * before output, or this doesn't work. This will also * fail if any mangling has been done above. */ if (ESET(ent, LOG)) { char *lc, *la, *ls; if (ent->logmsg) { lc = strdup(" --log-prefix \""); la = ent->logmsg; ls = strdup(" \""); } else lc = la = ls = strdup(""); if (islocal) orules++, oprintf("-A %s %s LOG%s%s%s\n", rulechain, rule + 1, lc, la, ls); if (isforward) orules++, oprintf("-A %s %s LOG%s%s%s\n", forchain, rule + 1, lc, la, ls); } /* Do this twice, once for NAT, once for filter */ if (neednat) { switch (target) { case MASQ: nattarget = strdup("MASQUERADE"); break; case REDIRECT: nattarget = strdup("REDIRECT"); break; default: abort(); } } switch (target) { case MASQ: case REDIRECT: case T_ACCEPT: ruletarget = revtarget = fortarget = forrevtarget = strdup("ACCEPT"); switch (ent->direction) { case INPUT: fortarget = strdup("FORW_OUT"); break; case OUTPUT: forrevtarget = strdup("FORW_OUT"); break; default: abort(); } break; case DROP: ruletarget = fortarget = strdup("DROP"); needret = 0; break; case T_REJECT: ruletarget = fortarget = strdup("REJECT"); needret = 0; *feat |= T_REJECT; break; case F_SUBGROUP: switch (ent->direction) { case INPUT: ruletarget = strdup("INPUT"); revtarget = strdup("OUTPUT"); fortarget = strdup("FORWARD"); forrevtarget = strdup("FORW_OUT"); break; case OUTPUT: ruletarget = strdup("OUTPUT"); revtarget = strdup("INPUT"); fortarget = strdup("FORW_OUT"); forrevtarget = strdup("FORWARD"); break; default: abort(); } break; default: abort(); } if ((misc->flags & FF_LSTATE) && (target != T_REJECT)) needret = 0; if (ent->oneway) needret = 0; if (neednat) { orules++; oputs("COMMIT\n"); oprintf("*nat\n"); oprintf("-A %s%s %s %s%s\n", subchain, natchain, natrule + 1, subtarget, nattarget); oputs("COMMIT\n"); oprintf("*filter\n"); } if (islocal) orules++, oprintf("-A %s%s %s %s%s\n", subchain, rulechain, rule + 1, subtarget, ruletarget); if (needret) orules++, oprintf("-I %s%s %s %s%s\n", subchain, revchain, rule_r + 1, subtarget, revtarget); if (isforward) { orules++, oprintf("-A %s%s %s %s%s\n", subchain, forchain, rule + 1, subtarget, fortarget); if (needret) orules++, oprintf("-I %s%s %s %s%s\n", subchain, forrevchain, rule_r + 1, subtarget, forrevtarget); } free(natrule); free(rule); free(rule_r); free(subchain); free(subtarget); return orules; } static int cb_iptrestore_rule(const struct filterent *ent, struct fg_misc *misc) { return cb_iptrestore_rule_common(ent, misc, AF_INET); } static int cb_ip6trestore_rule(const struct filterent *ent, struct fg_misc *misc) { return cb_iptrestore_rule_common(ent, misc, AF_INET6); } static int cb_iptrestore_group_common(const char *name) { oprintf("-N %s-INPUT\n", name); oprintf("-N %s-OUTPUT\n", name); oprintf("-N %s-FORWARD\n", name); oprintf("-N %s-FORW_OUT\n", name); return 4; } static int cb_iptrestore_group(const char *name) { return cb_iptrestore_group_common(name); } static int cb_ip6trestore_group(const char *name) { return cb_iptrestore_group_common(name); } static int fg_iptrestore_common(struct filter *filter, int flags, sa_family_t family, const char *iptables_restore) { long feat = 0; int r = 0; struct fg_misc misc = {flags, &feat}; fg_callback cb_iptrestore = { .rule = family == AF_INET ? cb_iptrestore_rule : cb_ip6trestore_rule, .group = family == AF_INET ? cb_iptrestore_group : cb_ip6trestore_group, }; const int nchains = 3; filter_unroll(&filter); filter_apply_flags(filter, flags); if (!(flags & FF_NOSKEL)) { oprintf("%s < * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "icmpent.h" /* icmp codes from RFC1700 */ struct icmpent_s icmpcodes[] = {{"0", "echo-reply"}, /* 1-2 unassigned */ {"3", "destination-unreachable"}, {"3/0", "network-unreachable"}, {"3/1", "host-unreachable"}, {"3/2", "protocol-unreachable"}, {"3/3", "port-unreachable"}, {"3/4", "fragmentation-needed"}, {"3/5", "source-route-failed"}, {"3/6", "network-unknown"}, {"3/7", "host-unknown"}, {"3/8", "source-host-isolated"}, {"3/9", "network-prohibited"}, {"3/10", "host-prohibited"}, {"3/11", "tos-network-unreachable"}, {"3/12", "tos-host-unreachable"}, /* RFC1812 defines the next three */ {"3/13", "communication-prohibited"}, {"3/14", "host-precedence-violation"}, {"3/15", "precedence-cutoff"}, {"4", "source-quench"}, {"5", "redirect"}, {"5/0", "redirect-network"}, {"5/1", "redirect-host"}, {"5/2", "redirect-tos-network"}, {"5/3", "redirect-tos-host"}, {"6", "alternate-host-address"}, /* 7 unassigned */ {"8", "echo-request"}, {"9", "router-advertisement"}, {"9/0", "router-advertisement-normal"}, /* RFC2002 */ {"9/16", "router-advertisement-uncommon"}, {"10", "router-selection"}, {"11", "time-exceeded"}, {"11/0", "time-exceeded-in-transmit"}, {"11/1", "time-exceeded-fragment-reassembly"}, {"12", "parameter-problem"}, {"12/0", "parameter-problem-pointer"}, /* RFC1108 */ {"12/1", "parameter-problem-missing-option"}, {"12/2", "parameter-problem-bad-length"}, {"13", "timestamp-request"}, {"14", "timestamp-reply"}, {"15", "information-request"}, {"16", "information-reply"}, {"17", "address-mask-request"}, {"18", "address-mask-reply"}, /* 19-29 reserved */ {"30", "traceroute"}, {"31", "datagram-conversion-error"}, {"32", "mobile-host-redirect"}, {"33", "ipv6-where-are-you"}, {"34", "ipv6-i-am-here"}, {"35", "mobile-registration-request"}, {"36", "mobile-registration-reply"}, {"37", "domain-name-request"}, {"38", "domain-name-reply"}, {"39", "skip"}, {"40", "photuris"}, {"40/0", "photuris-bad-spi"}, {"40/1", "photuris-authn-failed"}, {"40/2", "photuris-decompression-failed"}, {"40/3", "photuris-decryption-failed"}, {"40/4", "photuris-need-authn"}, {"40/5", "photuris-need-authz"}, /* 41-255 reserved */ {NULL, NULL}}; /* fake netdb-like function for icmp types */ struct icmpent_s *geticmpbyname(char *name) { struct icmpent_s *icmpent; for (icmpent = icmpcodes; icmpent->i_type != NULL; icmpent++) { if (!strcmp(name, icmpent->name)) break; } if (icmpent->i_type == NULL) icmpent = NULL; return icmpent; } filtergen-0.12.7/icmpent.h0000644000175000017500000000026712657605413012327 00000000000000#ifndef __ICMPENT_H__ #define __ICMPENT_H__ struct icmpent_s { const char *i_type; const char *name; }; struct icmpent_s *geticmpbyname(char *name); #endif /* __ICMPENT_H__ */ filtergen-0.12.7/configure0000755000175000017500000053157012657605417012440 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for filtergen 0.12.7. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and jaq@spacepants.org $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='filtergen' PACKAGE_TARNAME='filtergen' PACKAGE_VERSION='0.12.7' PACKAGE_STRING='filtergen 0.12.7' PACKAGE_BUGREPORT='jaq@spacepants.org' PACKAGE_URL='' ac_unique_file="filtergen.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS pkgexdir pkgdocdir SYSCONFDIR SBINDIR BINDIR GETOPT_LIBS EGREP GREP CPP YFLAGS YACC LEXLIB LEX_OUTPUT_ROOT LEX am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC PROGRAM MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_dependency_tracking enable_debug ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS YACC YFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures filtergen 0.12.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/filtergen] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of filtergen 0.12.7:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-debug enable debugging compiler options Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF filtergen configure 0.12.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## --------------------------------- ## ## Report this to jaq@spacepants.org ## ## --------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by filtergen $as_me 0.12.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in . "$srcdir"/.; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in . \"$srcdir\"/." "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ac_config_headers="$ac_config_headers config.h" am__api_version='1.15' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='filtergen' VERSION='0.12.7' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE filtergen_config_ok=yes ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LEX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 $as_echo "$LEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test "x$LEX" != "x:"; then cat >conftest.l <<_ACEOF %% a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ yyless ((input () != 0)); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% #ifdef YYTEXT_POINTER extern char *yytext; #endif int main (void) { return ! yylex () + ! yywrap (); } _ACEOF { { ac_try="$LEX conftest.l" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$LEX conftest.l") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } if ${ac_cv_prog_lex_root+:} false; then : $as_echo_n "(cached) " >&6 else if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 $as_echo "$ac_cv_prog_lex_root" >&6; } LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } if ${ac_cv_lib_lex+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS=$LIBS ac_cv_lib_lex='none needed' for ac_lib in '' -lfl -ll; do LIBS="$ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lex=$ac_lib fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext test "$ac_cv_lib_lex" != 'none needed' && break done LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 $as_echo "$ac_cv_lib_lex" >&6; } test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } if ${ac_cv_prog_lex_yytext_pointer+:} false; then : $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_prog_lex_yytext_pointer=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 $as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h fi rm -f conftest.l $LEX_OUTPUT_ROOT.c fi if test "$LEX" = :; then LEX=${am_missing_run}flex fi for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_YACC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 $as_echo "$YACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in getopt.h do : ac_fn_c_check_header_mongrel "$LINENO" "getopt.h" "ac_cv_header_getopt_h" "$ac_includes_default" if test "x$ac_cv_header_getopt_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETOPT_H 1 _ACEOF fi done HAVE_GETOPT=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getopt in -lgetopt" >&5 $as_echo_n "checking for getopt in -lgetopt... " >&6; } if ${ac_cv_lib_getopt_getopt+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgetopt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getopt (); int main () { return getopt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_getopt_getopt=yes else ac_cv_lib_getopt_getopt=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_getopt_getopt" >&5 $as_echo "$ac_cv_lib_getopt_getopt" >&6; } if test "x$ac_cv_lib_getopt_getopt" = xyes; then : HAVE_GETOPT=yes HAVE_GETOPT=no fi if test "x$HAVE_GETOPT" = xyes ; then GETOPT_LIBS="-lgetopt" fi if test "x$ac_cv_c_compiler_gnu" = xyes ; then CFLAGS="$CFLAGS -W -Wall -Werror -Waggregate-return" CFLAGS="$CFLAGS -Wcast-align -Wcast-qual -Wnested-externs" CFLAGS="$CFLAGS -Wshadow -Wbad-function-cast -Wwrite-strings" CFLAGS="$CFLAGS -Winit-self -Wformat=2 -Wuninitialized" CFLAGS="$CFLAGS -Wpointer-arith" CFLAGS="$CFLAGS -Wstrict-aliasing -fstrict-aliasing" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable debugging compiler options" >&5 $as_echo_n "checking whether to enable debugging compiler options... " >&6; } # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } tmp_CFLAGS=`echo $CFLAGS | sed 's/O2/O0/g'` CFLAGS="$tmp_CFLAGS" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test "$prefix" = "NONE" && prefix=/usr/local test "$exec_prefix" = "NONE" && exec_prefix=$prefix eval BINDIR="$bindir" eval SBINDIR="$sbindir" eval SYSCONFDIR="$sysconfdir" eval pkgdocdir="$datadir/doc/$PACKAGE" eval pkgexdir="$pkgdocdir/examples" if test "x$filtergen_config_ok" = xno ; then echo "nothing yet" else ac_config_files="$ac_config_files Makefile t/Makefile filtergen.spec fgadm fgadm.conf rules.filter" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by filtergen $as_me 0.12.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ filtergen config.status 0.12.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "t/Makefile") CONFIG_FILES="$CONFIG_FILES t/Makefile" ;; "filtergen.spec") CONFIG_FILES="$CONFIG_FILES filtergen.spec" ;; "fgadm") CONFIG_FILES="$CONFIG_FILES fgadm" ;; "fgadm.conf") CONFIG_FILES="$CONFIG_FILES fgadm.conf" ;; "rules.filter") CONFIG_FILES="$CONFIG_FILES rules.filter" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: filtergen $VERSION: automatic configuration OK. Type 'make' to compile filtergen. Type 'make install' to install filtergen. " >&5 $as_echo " filtergen $VERSION: automatic configuration OK. Type 'make' to compile filtergen. Type 'make install' to install filtergen. " >&6; } fi filtergen-0.12.7/Makefile.am0000644000175000017500000000132612657605413012550 00000000000000SUBDIRS = . t sbin_PROGRAMS = filtergen sbin_SCRIPTS = fgadm filtergen_SOURCES = \ filtergen.c \ gen.c \ filter.c \ fg-util.c \ fg-iptables.c \ fg-iptrestore.c \ fg-ipchains.c \ fg-ipfilter.c \ fg-cisco.c \ parser.y \ scanner.l \ glue.c \ resolver.c \ icmpent.c filtergen_LDADD = @GETOPT_LIBS@ headers = filter.h util.h ast.h resolver.h icmpent.h mans = filter_backends.7 filter_syntax.5 filtergen.8 fgadm.8 man_MANS = $(mans) dist_sysconf_DATA = fgadm.conf rules.filter dist_pkgex_DATA = $(top_srcdir)/examples/*.filter dist_pkgdoc_DATA = $(top_srcdir)/doc/* EXTRA_DIST = HISTORY HONESTY README TODO $(headers) $(mans) filtergen.spec extras/* AM_CFLAGS = -D_GNU_SOURCE AM_LDFLAGS = -g AM_YFLAGS = -d filtergen-0.12.7/fgadm.in0000644000175000017500000000377312657605413012132 00000000000000#!/bin/sh FILTER=@SYSCONFDIR@/rules.filter CONF=@SYSCONFDIR@/filtergen.conf FILTERGEN=@SBINDIR@/filtergen # move to the config directory so relative includes work if ! test -d @SYSCONFDIR@ ; then echo @SYSCONFDIR@ not found exit 1 fi cd @SYSCONFDIR@ # load config options if [ -f $CONF ]; then . $CONF fi # sanity check config values case "$BACKEND" in iptables|ip6tables|iptables-restore|ip6tables-restore|ipchains|ipfilter|cisco) ;; *) BACKEND="iptables" ;; esac # check validity of input file check () { $FILTERGEN $FGOPTS -t $BACKEND $FILTER } reload () { if [ -f $FILTER ]; then echo "Generating $BACKEND packet filter." case "$BACKEND" in iptables|iptables-restore|ip6tables|ip6tables-restore|ipchains) if [ -x /sbin/$BACKEND ]; then if $FILTERGEN $FGOPTS -t $BACKEND $FILTER > /dev/null ; then $FILTERGEN $FGOPTS -t $BACKEND $FILTER | /bin/sh else echo "Errors found in $FILTER. Not reloading." RETVAL=1 fi else echo "/sbin/$BACKEND not found. Not reloading." RETVAL=1 fi ;; *) echo "Operation not supported for $BACKEND backend." ;; esac else echo "$RULES not found. Not reloading." RETVAL=1 fi } stop () { echo "Stopping current packet filter." case "$BACKEND" in iptables|ipchains) if [ -x /sbin/$BACKEND ]; then $FILTERGEN -t $BACKEND -F ACCEPT | /bin/sh else echo "/sbin/$BACKEND not found" RETVAL=1 fi ;; *) echo "Operation not supported for $BACKEND backend." ;; esac } save () { case "$BACKEND" in iptables) if [ -f /etc/redhat-release ]; then /sbin/service iptables save fi ;; ipchains) if [ -f /etc/redhat-release ]; then /sbin/service ipchains save fi ;; *) echo "Operation not supported for $BACKEND backend." ;; esac } usage () { echo < $work/rules < $work/empty < $work/out if test $? -ne 0 ; then fail ; fi cat > $work/good < $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner2.out $work/out if test $? -ne 0 ; then fail ; fi # got this far? pass filtergen-0.12.7/t/t_53_convertproto0000755000175000017500000000065012657575427014315 00000000000000#!/bin/sh -x TEST="that the converter can convert protocols" DATA=converter5 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_37_specifier_list0000755000175000017500000000076112657575427014562 00000000000000#!/bin/sh -x TEST="that the parser reads a specifier_list correctly" DATA=emitter4 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/t_28_routing0000755000175000017500000000042112657575427013236 00000000000000#!/bin/sh -x TEST="that parsing routing specfiers works" DATA=parser13 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_47_subrule_list0000755000175000017500000000075712657575427014300 00000000000000#!/bin/sh -x TEST="that the parser reads subrule lists correctly" DATA=emitter14 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/t_08_networknames0000755000175000017500000000042412657575427014265 00000000000000#!/bin/sh -x TEST="that network addresses and services are scanned correctly" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner8.in > $work/out if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner8.out $work/out # got this far? pass filtergen-0.12.7/t/t_07_names0000755000175000017500000000053612657575427012656 00000000000000#!/bin/sh -x TEST="that non-keyword identifiers are scanned correctly" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner7.in > $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner7.out $work/out if test $? -ne 0 ; then diff -u $testdir/data/scanner7.out $work/out fail fi # got this far? pass filtergen-0.12.7/t/t_33_nestedparse0000755000175000017500000000063412657575427014066 00000000000000#!/bin/sh -x TEST="that the parser can cope with included files" DATA=parser16 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi cat > include.conf < $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_50_convertrulelist0000755000175000017500000000067012657575427015014 00000000000000#!/bin/sh -x TEST="that the converter can convert rule lists to next chains" DATA=converter2 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_39_negated_specifier0000755000175000017500000000075112657575427015217 00000000000000#!/bin/sh -x TEST="that the parser reads negated specifiers" DATA=emitter6 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/t_45_icmptype0000755000175000017500000000075712657575427013414 00000000000000#!/bin/sh -x TEST="that the parser reads icmptypes and arguments" DATA=emitter12 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/Makefile.am0000644000175000017500000000363712657575427013035 00000000000000TESTS = t_01_ccomment \ t_02_hashcomment \ t_03_hashnonewline \ t_04_keywords \ t_05_punct \ t_06_numbers \ t_07_names \ t_08_networknames \ t_09_badcomment \ t_10_goodcomment \ t_11_includeone \ t_12_includeloop \ t_13_includetwo \ t_14_includeinline \ t_15_includenotfound \ t_16_emptyfilter \ t_17_oneemptyrule \ t_18_manyemptyrules \ t_19_simplerule \ t_20_fullrule \ t_21_compoundarg \ t_22_hostnames \ t_23_ports \ t_24_log \ t_25_target \ t_26_negation \ t_27_compoundspecifier \ t_28_routing \ t_29_nocommentend \ t_30_chaingroup \ t_31_chaingroupbad \ t_32_syntaxexamples \ t_33_nestedparse \ t_34_ast \ t_35_rule_list \ t_36_rule \ t_37_specifier_list \ t_38_specifier \ t_39_negated_specifier \ t_40_direction \ t_41_target \ t_42_host \ t_43_port \ t_44_protocol \ t_45_icmptype \ t_46_routing \ t_47_subrule_list \ t_48_chaingroup \ t_49_convertspeclist \ t_50_convertrulelist \ t_51_convertdirection \ t_52_converthost \ t_53_convertproto \ t_54_convertport \ t_55_converticmptype \ t_56_convertrouting \ t_57_convertchains \ t_58_convertcompound \ t_59_convertnested \ t_60_bigugly \ t_61_convertlog \ t_62_convertoptions \ t_63_includedir \ t_64_includedirwfile \ t_65_includedirwdir \ t_66_includedirtwofiles \ t_67_includeemptyfile \ t_68_noop \ t_69_includeemptynoop \ t_70_includesemicolon \ t_71_includeglob check_PROGRAMS = scan parse emit convert factorise scan_SOURCES = scan.c scan_LDADD = ../scanner.o ../parser.o parse_SOURCES = parse.c parse_LDADD = ../scanner.o ../parser.o emit_SOURCES = emit.c emit_LDADD = ../scanner.o ../parser.o convert_SOURCES = convert.c convert_LDADD = ../scanner.o ../parser.o ../glue.o ../filter.o ../fg-util.o factorise_SOURCES = factorise.c factorise_LDADD = ../scanner.o ../parser.o EXTRA_DIST = $(top_srcdir)/t/data/*.in $(top_srcdir)/t/data/*.out \ testlib $(TESTS) AM_CFLAGS = -g -Wall -Werror -I$(top_srcdir) filtergen-0.12.7/t/t_69_includeemptynoop0000755000175000017500000000127712657575427015164 00000000000000#!/bin/sh -x TEST="that empty includes that create noops get parsed correctly" testdir=`dirname $0` . $testdir/testlib cat > $work/rules < $work/empty < $work/out if test $? -ne 0 ; then fail ; fi cat > $work/good < $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_03_hashnonewline0000755000175000017500000000047112657575427014407 00000000000000#!/bin/sh -x TEST="that hash style comments with no newline are scanned and ignored" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner3.in > $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner3.out $work/out if test $? -ne 0 ; then fail ; fi # got this far? pass filtergen-0.12.7/t/t_35_rule_list0000755000175000017500000000075412657575427013560 00000000000000#!/bin/sh -x TEST="that the parser reads a rule list correctly" DATA=emitter2 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/t_36_rule0000755000175000017500000000074712657575427012530 00000000000000#!/bin/sh -x TEST="that the parser reads a rule correctly" DATA=emitter3 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/t_04_keywords0000755000175000017500000000053112657575427013412 00000000000000#!/bin/sh -x TEST="that filtergen keywords are scanned correctly" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner4.in > $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner4.out $work/out if test $? -ne 0 ; then diff -u $testdir/data/scanner4.out $work/out fail fi # got this far? pass filtergen-0.12.7/t/t_21_compoundarg0000755000175000017500000000044312657575427014062 00000000000000#!/bin/sh -x TEST="that parsing a rule with a compound port argument works" DATA=parser6 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_40_direction0000755000175000017500000000075712657575427013535 00000000000000#!/bin/sh -x TEST="that the parser reads directions and arguments" DATA=emitter7 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/t_51_convertdirection0000755000175000017500000000065112657575427015131 00000000000000#!/bin/sh -x TEST="that the converter can convert directions" DATA=converter3 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_57_convertchains0000755000175000017500000000065312657575427014426 00000000000000#!/bin/sh -x TEST="that the converter can convert chain groups" DATA=converter9 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_44_protocol0000755000175000017500000000100112657575427013401 00000000000000#!/bin/sh -x TEST="that the parser reads protocol specifier and protocol arguments" DATA=emitter11 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/factorise.c0000644000175000017500000001013112657605413013074 00000000000000/* factorise test */ #include #include #include "../ast.h" #include "../factoriser.h" int yyparse(void *); int facttrace; int nesting = 0; void nest() { int i; for (i = 0; i < nesting; i++) printf(" "); printf("("); nesting++; } void unnest() { int i; for (i = 0; i < nesting; i++) printf(" "); printf(")\n"); nesting--; } void emit_negated_specifier(struct negated_specifier_s *n); void emit_compound_specifier(struct compound_specifier_s *n) { struct subrule_list_s *s; struct specifier_list_s *t; if (n->list) { int count = 0; for (s = n->list; s; s = s->subrule_list) count++; if (count > 1) { nest(); printf("or\n"); } for (s = n->list; s; s = s->subrule_list) { if (s->specifier_list) { int count0 = 0; for (t = s->specifier_list; t; t = t->list) count0++; if (count0 > 1) { nest(); printf("and\n"); } for (t = s->specifier_list; t; t = t->list) { if (t->spec) emit_negated_specifier(t->spec); } if (count0 > 1) unnest(); } } if (count > 1) unnest(); } } void emit_specifier(struct specifier_s *n) { if (n->direction) { if (n->direction->list) { struct direction_argument_list_s *l; int count = 0; for (l = n->direction->list; l; l = l->list) count++; if (count > 1) { nest(); printf("or\n"); } for (l = n->direction->list; l; l = l->list) { if (l->arg) { nest(); printf("direction %s\n", l->arg->direction); unnest(); } } if (count > 1) unnest(); } } else if (n->target) { nest(); printf("target\n"); unnest(); } else if (n->host) { if (n->host->list) { struct host_argument_list_s *l; int count = 0; for (l = n->host->list; l; l = l->list) count++; if (count > 1) { nest(); printf("or\n"); } for (l = n->host->list; l; l = l->list) { if (l->arg) { nest(); printf("host %s\n", l->arg->host); unnest(); } } if (count > 1) unnest(); } } else if (n->port) { nest(); printf("port\n"); unnest(); } else if (n->protocol) { nest(); printf("protocol\n"); unnest(); } else if (n->icmptype) { nest(); printf("icmptype\n"); unnest(); } else if (n->option) { nest(); printf("option\n"); unnest(); } else if (n->chaingroup) { nest(); printf("chaingroup FIXME\n"); unnest(); } else if (n->compound) { emit_compound_specifier(n->compound); } } void emit_negated_specifier(struct negated_specifier_s *n) { if (n->spec) { if (n->negated) { nest(); printf("not\n"); } emit_specifier(n->spec); if (n->negated) { unnest(); } } } void emit_rule(struct rule_s *n) { struct specifier_list_s *s; if (n->list) { int count = 0; for (s = n->list; s; s = s->list) count++; if (count > 1) { nest(); /* specifiers have implicit AND */ printf("and\n"); } for (s = n->list; s; s = s->list) { if (s->spec) { emit_negated_specifier(s->spec); } } if (count > 1) unnest(); } } void emit_ast(struct ast_s *n) { struct rule_list_s *r; if (n->list) { int count = 0; for (r = n->list; r; r = r->list) count++; if (count > 1) { nest(); /* semicolons are OR */ printf("or\n"); } for (r = n->list; r; r = r->list) { if (r->rule) { emit_rule(r->rule); } } if (count > 1) unnest(); } } int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) { char *FACTTRACE; struct ast_s ast; int r; FACTTRACE = getenv("FACTTRACE"); facttrace = FACTTRACE ? atoi(FACTTRACE) : 0; r = yyparse((void *)&ast); if (r != 0) { printf("yyparse returned %d\n", r); return 1; } /* do magic */ /* factorise(&ast); */ emit_ast(&ast); return 0; } filtergen-0.12.7/t/t_25_target0000755000175000017500000000042212657575427013033 00000000000000#!/bin/sh -x TEST="that parsing the filter targets works" DATA=parser10 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/emit.c0000644000175000017500000001475112657605413012067 00000000000000/* ast emitter * output should be identical (syntactically) to the input */ #include #include #include "../ast.h" #include "../parser.h" int yyparse(void *); int emittrace = 0; #define EMIT(x) void emit_##x(struct x##_s *n) #define eprint(x) \ if (emittrace) \ fprintf(stderr, x) EMIT(specifier_list); EMIT(subrule_list) { if (n->subrule_list) { eprint("emitting subrule_list\n"); emit_subrule_list(n->subrule_list); printf(";\n"); } if (n->specifier_list) { eprint("emitting specifier_list\n"); emit_specifier_list(n->specifier_list); } } EMIT(chaingroup_specifier) { printf("["); if (n->name) { printf(" \"%s\"", n->name); } printf("\n"); eprint("emitting subrule_list\n"); emit_subrule_list(n->list); printf("]"); } EMIT(compound_specifier) { printf("{"); if (n->list) { eprint("emitting subrule_list\n"); emit_subrule_list(n->list); } printf("}"); } EMIT(option_specifier) { switch (n->type) { case TOK_LOCAL: printf("local"); break; case TOK_FORWARD: printf("forward"); break; case TOK_ONEWAY: printf("oneway"); break; case TOK_LOG: if (n->logmsg) { printf("log text \"%s\"", n->logmsg); } else { printf("log"); } break; default: printf("error"); break; } } EMIT(icmptype_argument) { printf("%s", n->icmptype); } EMIT(icmptype_argument_list) { if (n->list) { emit_icmptype_argument_list(n->list); printf(" "); } emit_icmptype_argument(n->arg); } EMIT(icmptype_specifier) { printf("icmptype { "); if (n->list) emit_icmptype_argument_list(n->list); printf(" }"); } EMIT(protocol_argument) { printf("%s", n->proto); } EMIT(protocol_argument_list) { if (n->list) { eprint("emitting protocol_argument_list\n"); emit_protocol_argument_list(n->list); printf(" "); } eprint("emitting protocol_argument\n"); emit_protocol_argument(n->arg); } EMIT(protocol_specifier) { printf("proto { "); if (n->list) { eprint("emitting protocol_argument\n"); emit_protocol_argument_list(n->list); } printf(" }"); } EMIT(port_argument) { if (n->port_min) { printf("%s", n->port_min); } if (n->port_max) { printf(":%s", n->port_max); } } EMIT(port_argument_list) { if (n->list) { eprint("emitting port_argument_list\n"); emit_port_argument_list(n->list); printf(" "); } eprint("emitting port_argument\n"); emit_port_argument(n->arg); } EMIT(port_specifier) { if (n->type == TOK_DPORT) { printf("dport "); } else if (n->type == TOK_SPORT) { printf("sport "); } printf("{ "); if (n->list) emit_port_argument_list(n->list); printf(" }"); } EMIT(host_argument) { if (n->host) { printf("%s", n->host); } if (n->mask) { printf("/%s", n->mask); } } EMIT(host_argument_list) { if (n->list) { emit_host_argument_list(n->list); printf(" "); } emit_host_argument(n->arg); } EMIT(host_specifier) { if (n->type == TOK_SOURCE) { printf("source "); } else if (n->type == TOK_DEST) { printf("dest "); } printf("{ "); if (n->list) emit_host_argument_list(n->list); printf(" }"); } EMIT(target_specifier) { switch (n->type) { case TOK_ACCEPT: printf("accept"); break; case TOK_REJECT: printf("reject"); break; case TOK_DROP: printf("drop"); break; case TOK_REDIRECT: printf("redirect"); break; case TOK_MASQ: printf("masq"); break; break; default: printf("error"); break; } } EMIT(direction_argument) { eprint("emitting direction\n"); if (n->direction) printf("%s", n->direction); else printf("error: n->direction is NULL\n"); } EMIT(direction_argument_list) { if (n->list) { eprint("emitting direction_argument_list\n"); emit_direction_argument_list(n->list); printf(" "); } if (n->arg) { eprint("emitting direction_argument\n"); emit_direction_argument(n->arg); } } EMIT(direction_specifier) { if (n->type == TOK_INPUT) { printf("input "); } else { printf("output "); } printf("{ "); if (n->list) { eprint("emitting direction_argument\n"); emit_direction_argument_list(n->list); } printf(" }"); } EMIT(specifier) { if (n->compound) { eprint("emitting compound_specifier\n"); emit_compound_specifier(n->compound); } else if (n->direction) { eprint("emitting direction_specifier\n"); emit_direction_specifier(n->direction); } else if (n->target) { eprint("emitting target_specifier\n"); emit_target_specifier(n->target); } else if (n->host) { eprint("emitting host_specifier\n"); emit_host_specifier(n->host); } else if (n->port) { eprint("emitting port_specifier\n"); emit_port_specifier(n->port); } else if (n->protocol) { eprint("emitting protocol_specifier\n"); emit_protocol_specifier(n->protocol); } else if (n->icmptype) { eprint("emitting icmptype_specifier\n"); emit_icmptype_specifier(n->icmptype); } else if (n->option) { eprint("emitting routing_specifier\n"); emit_option_specifier(n->option); } else { eprint("emitting chaingroup_specifier\n"); emit_chaingroup_specifier(n->chaingroup); } } EMIT(negated_specifier) { if (n->negated) { printf("! "); } eprint("emitting specifier\n"); emit_specifier(n->spec); } EMIT(specifier_list) { if (n->list) { eprint("emitting specifier_list\n"); emit_specifier_list(n->list); /* specifiers are separated by spaces */ printf(" "); } eprint("emitting negated_specifier\n"); emit_negated_specifier(n->spec); } EMIT(rule) { if (n->list) { eprint("emitting specifier_list\n"); emit_specifier_list(n->list); } /* rules end in a semicolon and newline */ printf(";\n"); } EMIT(rule_list) { if (n->list) { eprint("emitting rule_list\n"); emit_rule_list(n->list); } if (n->rule) { eprint("emitting rule\n"); emit_rule(n->rule); } } EMIT(ast) { if (n->list) { eprint("emitting rule_list\n"); emit_rule_list(n->list); } } int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) { char *EMITTRACE; struct ast_s ast; int res; EMITTRACE = getenv("EMITTRACE"); emittrace = EMITTRACE ? atoi(EMITTRACE) : 0; res = yyparse((void *)&ast); if (res != 0) { printf("yyparse returned %d\n", res); return 1; } eprint("emitting ast\n"); emit_ast(&ast); return 0; } filtergen-0.12.7/t/t_29_nocommentend0000755000175000017500000000042112657575427014236 00000000000000#!/bin/sh -x TEST="that open ended comments are handled" DATA=scanner16 testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/Makefile.in0000644000175000017500000015227212657605417013037 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : check_PROGRAMS = scan$(EXEEXT) parse$(EXEEXT) emit$(EXEEXT) \ convert$(EXEEXT) factorise$(EXEEXT) subdir = t ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_convert_OBJECTS = convert.$(OBJEXT) convert_OBJECTS = $(am_convert_OBJECTS) convert_DEPENDENCIES = ../scanner.o ../parser.o ../glue.o ../filter.o \ ../fg-util.o am_emit_OBJECTS = emit.$(OBJEXT) emit_OBJECTS = $(am_emit_OBJECTS) emit_DEPENDENCIES = ../scanner.o ../parser.o am_factorise_OBJECTS = factorise.$(OBJEXT) factorise_OBJECTS = $(am_factorise_OBJECTS) factorise_DEPENDENCIES = ../scanner.o ../parser.o am_parse_OBJECTS = parse.$(OBJEXT) parse_OBJECTS = $(am_parse_OBJECTS) parse_DEPENDENCIES = ../scanner.o ../parser.o am_scan_OBJECTS = scan.$(OBJEXT) scan_OBJECTS = $(am_scan_OBJECTS) scan_DEPENDENCIES = ../scanner.o ../parser.o AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(convert_SOURCES) $(emit_SOURCES) $(factorise_SOURCES) \ $(parse_SOURCES) $(scan_SOURCES) DIST_SOURCES = $(convert_SOURCES) $(emit_SOURCES) $(factorise_SOURCES) \ $(parse_SOURCES) $(scan_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GETOPT_LIBS = @GETOPT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PROGRAM = @PROGRAM@ SBINDIR = @SBINDIR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSCONFDIR = @SYSCONFDIR@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgdocdir = @pkgdocdir@ pkgexdir = @pkgexdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ TESTS = t_01_ccomment \ t_02_hashcomment \ t_03_hashnonewline \ t_04_keywords \ t_05_punct \ t_06_numbers \ t_07_names \ t_08_networknames \ t_09_badcomment \ t_10_goodcomment \ t_11_includeone \ t_12_includeloop \ t_13_includetwo \ t_14_includeinline \ t_15_includenotfound \ t_16_emptyfilter \ t_17_oneemptyrule \ t_18_manyemptyrules \ t_19_simplerule \ t_20_fullrule \ t_21_compoundarg \ t_22_hostnames \ t_23_ports \ t_24_log \ t_25_target \ t_26_negation \ t_27_compoundspecifier \ t_28_routing \ t_29_nocommentend \ t_30_chaingroup \ t_31_chaingroupbad \ t_32_syntaxexamples \ t_33_nestedparse \ t_34_ast \ t_35_rule_list \ t_36_rule \ t_37_specifier_list \ t_38_specifier \ t_39_negated_specifier \ t_40_direction \ t_41_target \ t_42_host \ t_43_port \ t_44_protocol \ t_45_icmptype \ t_46_routing \ t_47_subrule_list \ t_48_chaingroup \ t_49_convertspeclist \ t_50_convertrulelist \ t_51_convertdirection \ t_52_converthost \ t_53_convertproto \ t_54_convertport \ t_55_converticmptype \ t_56_convertrouting \ t_57_convertchains \ t_58_convertcompound \ t_59_convertnested \ t_60_bigugly \ t_61_convertlog \ t_62_convertoptions \ t_63_includedir \ t_64_includedirwfile \ t_65_includedirwdir \ t_66_includedirtwofiles \ t_67_includeemptyfile \ t_68_noop \ t_69_includeemptynoop \ t_70_includesemicolon \ t_71_includeglob scan_SOURCES = scan.c scan_LDADD = ../scanner.o ../parser.o parse_SOURCES = parse.c parse_LDADD = ../scanner.o ../parser.o emit_SOURCES = emit.c emit_LDADD = ../scanner.o ../parser.o convert_SOURCES = convert.c convert_LDADD = ../scanner.o ../parser.o ../glue.o ../filter.o ../fg-util.o factorise_SOURCES = factorise.c factorise_LDADD = ../scanner.o ../parser.o EXTRA_DIST = $(top_srcdir)/t/data/*.in $(top_srcdir)/t/data/*.out \ testlib $(TESTS) AM_CFLAGS = -g -Wall -Werror -I$(top_srcdir) all: all-am .SUFFIXES: .SUFFIXES: .c .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign t/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign t/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) convert$(EXEEXT): $(convert_OBJECTS) $(convert_DEPENDENCIES) $(EXTRA_convert_DEPENDENCIES) @rm -f convert$(EXEEXT) $(AM_V_CCLD)$(LINK) $(convert_OBJECTS) $(convert_LDADD) $(LIBS) emit$(EXEEXT): $(emit_OBJECTS) $(emit_DEPENDENCIES) $(EXTRA_emit_DEPENDENCIES) @rm -f emit$(EXEEXT) $(AM_V_CCLD)$(LINK) $(emit_OBJECTS) $(emit_LDADD) $(LIBS) factorise$(EXEEXT): $(factorise_OBJECTS) $(factorise_DEPENDENCIES) $(EXTRA_factorise_DEPENDENCIES) @rm -f factorise$(EXEEXT) $(AM_V_CCLD)$(LINK) $(factorise_OBJECTS) $(factorise_LDADD) $(LIBS) parse$(EXEEXT): $(parse_OBJECTS) $(parse_DEPENDENCIES) $(EXTRA_parse_DEPENDENCIES) @rm -f parse$(EXEEXT) $(AM_V_CCLD)$(LINK) $(parse_OBJECTS) $(parse_LDADD) $(LIBS) scan$(EXEEXT): $(scan_OBJECTS) $(scan_DEPENDENCIES) $(EXTRA_scan_DEPENDENCIES) @rm -f scan$(EXEEXT) $(AM_V_CCLD)$(LINK) $(scan_OBJECTS) $(scan_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convert.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/factorise.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? t_01_ccomment.log: t_01_ccomment @p='t_01_ccomment'; \ b='t_01_ccomment'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_02_hashcomment.log: t_02_hashcomment @p='t_02_hashcomment'; \ b='t_02_hashcomment'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_03_hashnonewline.log: t_03_hashnonewline @p='t_03_hashnonewline'; \ b='t_03_hashnonewline'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_04_keywords.log: t_04_keywords @p='t_04_keywords'; \ b='t_04_keywords'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_05_punct.log: t_05_punct @p='t_05_punct'; \ b='t_05_punct'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_06_numbers.log: t_06_numbers @p='t_06_numbers'; \ b='t_06_numbers'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_07_names.log: t_07_names @p='t_07_names'; \ b='t_07_names'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_08_networknames.log: t_08_networknames @p='t_08_networknames'; \ b='t_08_networknames'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_09_badcomment.log: t_09_badcomment @p='t_09_badcomment'; \ b='t_09_badcomment'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_10_goodcomment.log: t_10_goodcomment @p='t_10_goodcomment'; \ b='t_10_goodcomment'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_11_includeone.log: t_11_includeone @p='t_11_includeone'; \ b='t_11_includeone'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_12_includeloop.log: t_12_includeloop @p='t_12_includeloop'; \ b='t_12_includeloop'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_13_includetwo.log: t_13_includetwo @p='t_13_includetwo'; \ b='t_13_includetwo'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_14_includeinline.log: t_14_includeinline @p='t_14_includeinline'; \ b='t_14_includeinline'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_15_includenotfound.log: t_15_includenotfound @p='t_15_includenotfound'; \ b='t_15_includenotfound'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_16_emptyfilter.log: t_16_emptyfilter @p='t_16_emptyfilter'; \ b='t_16_emptyfilter'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_17_oneemptyrule.log: t_17_oneemptyrule @p='t_17_oneemptyrule'; \ b='t_17_oneemptyrule'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_18_manyemptyrules.log: t_18_manyemptyrules @p='t_18_manyemptyrules'; \ b='t_18_manyemptyrules'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_19_simplerule.log: t_19_simplerule @p='t_19_simplerule'; \ b='t_19_simplerule'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_20_fullrule.log: t_20_fullrule @p='t_20_fullrule'; \ b='t_20_fullrule'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_21_compoundarg.log: t_21_compoundarg @p='t_21_compoundarg'; \ b='t_21_compoundarg'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_22_hostnames.log: t_22_hostnames @p='t_22_hostnames'; \ b='t_22_hostnames'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_23_ports.log: t_23_ports @p='t_23_ports'; \ b='t_23_ports'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_24_log.log: t_24_log @p='t_24_log'; \ b='t_24_log'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_25_target.log: t_25_target @p='t_25_target'; \ b='t_25_target'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_26_negation.log: t_26_negation @p='t_26_negation'; \ b='t_26_negation'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_27_compoundspecifier.log: t_27_compoundspecifier @p='t_27_compoundspecifier'; \ b='t_27_compoundspecifier'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_28_routing.log: t_28_routing @p='t_28_routing'; \ b='t_28_routing'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_29_nocommentend.log: t_29_nocommentend @p='t_29_nocommentend'; \ b='t_29_nocommentend'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_30_chaingroup.log: t_30_chaingroup @p='t_30_chaingroup'; \ b='t_30_chaingroup'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_31_chaingroupbad.log: t_31_chaingroupbad @p='t_31_chaingroupbad'; \ b='t_31_chaingroupbad'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_32_syntaxexamples.log: t_32_syntaxexamples @p='t_32_syntaxexamples'; \ b='t_32_syntaxexamples'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_33_nestedparse.log: t_33_nestedparse @p='t_33_nestedparse'; \ b='t_33_nestedparse'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_34_ast.log: t_34_ast @p='t_34_ast'; \ b='t_34_ast'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_35_rule_list.log: t_35_rule_list @p='t_35_rule_list'; \ b='t_35_rule_list'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_36_rule.log: t_36_rule @p='t_36_rule'; \ b='t_36_rule'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_37_specifier_list.log: t_37_specifier_list @p='t_37_specifier_list'; \ b='t_37_specifier_list'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_38_specifier.log: t_38_specifier @p='t_38_specifier'; \ b='t_38_specifier'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_39_negated_specifier.log: t_39_negated_specifier @p='t_39_negated_specifier'; \ b='t_39_negated_specifier'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_40_direction.log: t_40_direction @p='t_40_direction'; \ b='t_40_direction'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_41_target.log: t_41_target @p='t_41_target'; \ b='t_41_target'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_42_host.log: t_42_host @p='t_42_host'; \ b='t_42_host'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_43_port.log: t_43_port @p='t_43_port'; \ b='t_43_port'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_44_protocol.log: t_44_protocol @p='t_44_protocol'; \ b='t_44_protocol'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_45_icmptype.log: t_45_icmptype @p='t_45_icmptype'; \ b='t_45_icmptype'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_46_routing.log: t_46_routing @p='t_46_routing'; \ b='t_46_routing'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_47_subrule_list.log: t_47_subrule_list @p='t_47_subrule_list'; \ b='t_47_subrule_list'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_48_chaingroup.log: t_48_chaingroup @p='t_48_chaingroup'; \ b='t_48_chaingroup'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_49_convertspeclist.log: t_49_convertspeclist @p='t_49_convertspeclist'; \ b='t_49_convertspeclist'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_50_convertrulelist.log: t_50_convertrulelist @p='t_50_convertrulelist'; \ b='t_50_convertrulelist'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_51_convertdirection.log: t_51_convertdirection @p='t_51_convertdirection'; \ b='t_51_convertdirection'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_52_converthost.log: t_52_converthost @p='t_52_converthost'; \ b='t_52_converthost'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_53_convertproto.log: t_53_convertproto @p='t_53_convertproto'; \ b='t_53_convertproto'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_54_convertport.log: t_54_convertport @p='t_54_convertport'; \ b='t_54_convertport'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_55_converticmptype.log: t_55_converticmptype @p='t_55_converticmptype'; \ b='t_55_converticmptype'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_56_convertrouting.log: t_56_convertrouting @p='t_56_convertrouting'; \ b='t_56_convertrouting'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_57_convertchains.log: t_57_convertchains @p='t_57_convertchains'; \ b='t_57_convertchains'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_58_convertcompound.log: t_58_convertcompound @p='t_58_convertcompound'; \ b='t_58_convertcompound'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_59_convertnested.log: t_59_convertnested @p='t_59_convertnested'; \ b='t_59_convertnested'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_60_bigugly.log: t_60_bigugly @p='t_60_bigugly'; \ b='t_60_bigugly'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_61_convertlog.log: t_61_convertlog @p='t_61_convertlog'; \ b='t_61_convertlog'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_62_convertoptions.log: t_62_convertoptions @p='t_62_convertoptions'; \ b='t_62_convertoptions'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_63_includedir.log: t_63_includedir @p='t_63_includedir'; \ b='t_63_includedir'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_64_includedirwfile.log: t_64_includedirwfile @p='t_64_includedirwfile'; \ b='t_64_includedirwfile'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_65_includedirwdir.log: t_65_includedirwdir @p='t_65_includedirwdir'; \ b='t_65_includedirwdir'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_66_includedirtwofiles.log: t_66_includedirtwofiles @p='t_66_includedirtwofiles'; \ b='t_66_includedirtwofiles'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_67_includeemptyfile.log: t_67_includeemptyfile @p='t_67_includeemptyfile'; \ b='t_67_includeemptyfile'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_68_noop.log: t_68_noop @p='t_68_noop'; \ b='t_68_noop'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_69_includeemptynoop.log: t_69_includeemptynoop @p='t_69_includeemptynoop'; \ b='t_69_includeemptynoop'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_70_includesemicolon.log: t_70_includesemicolon @p='t_70_includesemicolon'; \ b='t_70_includesemicolon'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t_71_includeglob.log: t_71_includeglob @p='t_71_includeglob'; \ b='t_71_includeglob'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: filtergen-0.12.7/t/t_01_ccomment0000755000175000017500000000044612657575427013352 00000000000000#!/bin/sh -x TEST="that c style comments are scanned and ignored" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner1.in > $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner1.out $work/out if test $? -ne 0 ; then fail ; fi # got this far? pass filtergen-0.12.7/t/t_10_goodcomment0000755000175000017500000000042712657575427014057 00000000000000#!/bin/sh -x TEST="that c style comments with nested /* are scanned correctly" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner10.in > $work/out if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner10.out $work/out # got this far? pass filtergen-0.12.7/t/t_46_routing0000755000175000017500000000075212657575427013245 00000000000000#!/bin/sh -x TEST="that the parser reads routing specifiers" DATA=emitter13 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/convert.c0000644000175000017500000000742012657605413012604 00000000000000#include #include "stdlib.h" #include "../filter.h" #include "../ast.h" int indent = -2; #ifndef FILTER_EMIT extern int convtrace; int yyparse(void *); struct filter *convert(struct ast_s *, struct filtergen_opts *); #endif void emit_filter(struct filter *f) { int i; indent += 2; for (i = 0; i < indent; i++) { printf(" "); }; printf("( "); if (!f) { printf("error: emit_filter called with NULL\n"); return; } switch (f->type) { case F_DIRECTION: switch (f->u.ifinfo.direction) { case INPUT: printf("input"); break; case OUTPUT: printf("output"); break; default: printf("error: encountered a direction %d\n", (int)f->u.ifinfo.direction); break; } printf(" %s\n", f->u.ifinfo.iface); break; case F_TARGET: switch (f->u.target) { case T_ACCEPT: printf("accept\n"); break; case DROP: printf("drop\n"); break; case T_REJECT: printf("reject\n"); break; case MASQ: printf("masq\n"); break; case REDIRECT: printf("redirect\n"); break; default: printf("error: encountered a target %d\n", (int)f->u.target); break; } break; case F_SOURCE: printf("source %s", f->u.addrs.addrstr); if (f->u.addrs.maskstr) printf("/%s", f->u.addrs.maskstr); printf("\n"); break; case F_DEST: printf("dest %s", f->u.addrs.addrstr); if (f->u.addrs.maskstr) printf("/%s", f->u.addrs.maskstr); printf("\n"); break; case F_SPORT: printf("sport %s", f->u.ports.minstr); if (f->u.ports.maxstr) printf(":%s", f->u.ports.maxstr); printf("\n"); break; case F_DPORT: printf("dport %s", f->u.ports.minstr); if (f->u.ports.maxstr) printf(":%s", f->u.ports.maxstr); printf("\n"); break; case F_ICMPTYPE: printf("icmptype %s\n", f->u.icmp); break; case F_PROTO: printf("proto %s\n", f->u.proto.name); break; case F_NEG: printf("neg\n"); emit_filter(f->u.neg); break; case F_SIBLIST: printf("siblist\n"); emit_filter(f->u.sib); break; case F_SUBGROUP: printf("subgroup \"%s\"\n", f->u.sub.name); emit_filter(f->u.sub.list); break; case F_LOG: if (f->u.logmsg) { printf("log \"%s\"\n", f->u.logmsg); } else { printf("log \"\"\n"); } break; case F_RTYPE: switch (f->u.rtype) { case ROUTEDONLY: printf("forward\n"); break; case LOCALONLY: printf("local\n"); break; case F_ONEWAY: printf("oneway\n"); break; default: printf("error: encountered a rtype %d\n", (int)f->u.rtype); break; } break; default: printf("error: encountered a token %d\n", (int)f->type); break; } if (f->child) { for (i = 0; i < indent; i++) printf(" "); printf(" child\n"); emit_filter(f->child); } if (f->next) { for (i = 0; i < indent; i++) printf(" "); printf(" next\n"); emit_filter(f->next); } /* for (i = 0; i < indent; i++) printf(" "); printf(" negate: %d\n", f->negate); */ for (i = 0; i < indent; i++) printf(" "); printf(" )\n"); indent -= 2; } int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) { struct filter *f = NULL; struct filtergen_opts o = {AF_INET}; #ifndef FILTER_EMIT char *CONVTRACE; struct ast_s ast; int r; CONVTRACE = getenv("CONVTRACE"); convtrace = CONVTRACE ? atoi(CONVTRACE) : 0; r = yyparse((void *)&ast); if (r != 0) { printf("yyparse returned %d\n", r); return 1; } f = convert(&ast, &o); #else filter_fopen(NULL); f = filter_parse_list(); #endif if (!f) { printf("convert returned NULL\n"); return 1; } emit_filter(f); return 0; } filtergen-0.12.7/t/t_54_convertport0000755000175000017500000000064412657575427014142 00000000000000#!/bin/sh -x TEST="that the converter can convert ports" DATA=converter6 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_61_convertlog0000755000175000017500000000065312657575427013735 00000000000000#!/bin/sh -x TEST="that the converter can convert log options" DATA=converter13 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_63_includedir0000755000175000017500000000061212657575427013672 00000000000000#!/bin/sh -x TEST="that directory inclusion works" testdir=`dirname $0` . $testdir/testlib mkdir $work/include.d if test $? -ne 0 ; then no_result; fi cat >$work/in < $work/out 2>&1 if test $? -ne 0 ; then fail ; fi cat >$work/good < $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_68_noop0000755000175000017500000000113412657575427012530 00000000000000#!/bin/sh -x TEST="that empty rules get parsed correctly" testdir=`dirname $0` . $testdir/testlib cat > $work/rules < $work/out if test $? -ne 0 ; then fail ; fi cat > $work/good <$work/in < $work/include.d/foo < $work/include.d/quux.d/bar < $work/out 2>&1 if test $? -ne 0 ; then fail ; fi test "x$srcdir" = "x" && cat $work/out cat >$work/good < $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_66_includedirtwofiles0000755000175000017500000000144612657605413015445 00000000000000#!/bin/sh -x TEST="that directory inclusion works with files" testdir=`dirname $0` . $testdir/testlib mkdir $work/include.d if test $? -ne 0 ; then no_result; fi cat > $work/include.d/foo < $work/include.d/bar <$work/in < $work/out 2>&1 if test $? -ne 0 ; then fail ; fi cat >$work/good < $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner6.out $work/out if test $? -ne 0 ; then diff -u $testdir/data/scanner6.out $work/out fail fi # got this far? pass filtergen-0.12.7/t/t_59_convertnested0000755000175000017500000000066112657575427014444 00000000000000#!/bin/sh -x TEST="that the converter can convert nested specifiers" DATA=converter11 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_62_convertoptions0000755000175000017500000000066012657575427014646 00000000000000#!/bin/sh -x TEST="that the converter can convert multiple options" DATA=converter14 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_27_compoundspecifier0000755000175000017500000000042212657575427015265 00000000000000#!/bin/sh -x TEST="that parsing compound specfiers works" DATA=parser12 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_55_converticmptype0000755000175000017500000000065112657575427015007 00000000000000#!/bin/sh -x TEST="that the converter can convert icmp types" DATA=converter7 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_17_oneemptyrule0000755000175000017500000000042212657575427014276 00000000000000#!/bin/sh -x TEST="that parsing a single empty rule works" DATA=parser2 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_19_simplerule0000755000175000017500000000041412657575427013732 00000000000000#!/bin/sh -x TEST="that parsing a simple rule works" DATA=parser4 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/testlib0000755000175000017500000000203412657602107012345 00000000000000# -*- sh -*- # source this file for a few useful functions that get repeated at the top # of every test here=`pwd` if test $? -ne 0 ; then exit 77 ; fi work=${TMP_DIR-/tmp}/filtergen-test-$$ pass () { set +x cd $here rm -rf $work exit 0 } fail () { set +x cd $here rm -rf $work echo "FAILED testing $TEST" exit 1 } no_result () { set +x cd $here rm -rf $work echo "NO RESULT when testing $TEST" #exit 77 exit 1 } trap no_result 1 2 3 15 # function for comparing files compare () { cmp "$1" "$2" >/dev/null 2>&1 case "$?" in 0) ;; 1) diff -u "$1" "$2" fail ;; *) no_result ;; esac } mkdir $work if test $? -ne 0 ; then no_result ; fi # srcdir gets defined by the automake test caller, assume it's not defined # by the user's environment, so set debug trace on when run manually test "x$srcdir" = "x" && set -x # fix testdir testdir=`pwd`/$testdir if test -d $testdir/t/data ; then echo "testlib error: testdir not in $testdir" fail fi filtergen-0.12.7/t/t_18_manyemptyrules0000755000175000017500000000042412657575427014647 00000000000000#!/bin/sh -x TEST="that parsing a list of empty rules works" DATA=parser3 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_22_hostnames0000755000175000017500000000043612657575427013550 00000000000000#!/bin/sh -x TEST="that parsing hostname and netmask variations works" DATA=parser7 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/scan.c0000644000175000017500000000474012657605413012052 00000000000000#include #include #include #include #include #include "../parser.h" extern char *yytext; int yylex(); long int lineno(); char *filename(); char *tok_map(int c) { char *r; switch (c) { case TOK_ACCEPT: r = strdup("accept"); break; case TOK_DEST: r = strdup("dest"); break; case TOK_DPORT: r = strdup("dport"); break; case TOK_DROP: r = strdup("drop"); break; case TOK_FORWARD: r = strdup("forward"); break; case TOK_ICMPTYPE: r = strdup("icmptype"); break; case TOK_INPUT: r = strdup("input"); break; case TOK_LCURLY: r = strdup("lcurly"); break; case TOK_LOCAL: r = strdup("local"); break; case TOK_LOG: r = strdup("log"); break; case TOK_LSQUARE: r = strdup("lsquare"); break; case TOK_MASQ: r = strdup("masq"); break; case TOK_ONEWAY: r = strdup("oneway"); break; case TOK_OUTPUT: r = strdup("output"); break; case TOK_PROTO: r = strdup("proto"); break; case TOK_PROXY: r = strdup("proxy"); break; case TOK_RCURLY: r = strdup("rcurly"); break; case TOK_REDIRECT: r = strdup("redirect"); break; case TOK_REJECT: r = strdup("reject"); break; case TOK_RSQUARE: r = strdup("rsquare"); break; case TOK_SEMICOLON: r = strdup("semicolon"); break; case TOK_SOURCE: r = strdup("source"); break; case TOK_SPORT: r = strdup("sport"); break; case TOK_TEXT: r = strdup("text"); break; case TOK_IDENTIFIER: r = strdup("identifier"); break; case TOK_DOT: r = strdup("dot"); break; case TOK_SLASH: r = strdup("slash"); break; case TOK_BANG: r = strdup("bang"); break; case TOK_COLON: r = strdup("colon"); break; case TOK_STAR: r = strdup("star"); break; default: r = strdup("UNRECOGNISED"); break; } return r; } int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) { int c; /* if running in make distcheck the cwd isn't the same as the srcdir */ if (getenv("srcdir")) { if (chdir(getenv("srcdir")) < 0) { fprintf(stderr, "error changing to path %s: %s\n", getenv("srcdir"), strerror(errno)); return EXIT_FAILURE; } } while ((c = yylex())) { printf("kind = %s, spelling = \"%s\", file = \"%s\", line = %ld\n", tok_map(c), yytext, filename(), lineno()); } return 0; } filtergen-0.12.7/t/t_23_ports0000755000175000017500000000042412657575427012714 00000000000000#!/bin/sh -x TEST="that parsing ports and port ranges works" DATA=parser8 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_71_includeglob0000755000175000017500000000260112657605413014023 00000000000000#!/bin/sh -x TEST="that glob includes generate the right order" testdir=`dirname $0` . $testdir/testlib cat > $work/rules < $work/d/$i < $work/out if test $? -ne 0 ; then fail ; fi cat > $work/good < $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi cat $work/out compare $testdir/data/scanner12.out $work/out # got this far? pass filtergen-0.12.7/t/t_24_log0000755000175000017500000000042012657575427012323 00000000000000#!/bin/sh -x TEST="that parsing the log directive works" DATA=parser9 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_05_punct0000755000175000017500000000053012657575427012674 00000000000000#!/bin/sh -x TEST="that filtergen punctuation scanned correctly" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner5.in > $work/out if test $? -ne 0 ; then no_result ; fi cmp $testdir/data/scanner5.out $work/out if test $? -ne 0 ; then diff -u $testdir/data/scanner5.out $work/out fail fi # got this far? pass filtergen-0.12.7/t/t_34_ast0000755000175000017500000000074712657575427012346 00000000000000#!/bin/sh -x TEST="that the parser reads an ast correctly" DATA=emitter1 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/t_09_badcomment0000755000175000017500000000041012657575427013655 00000000000000#!/bin/sh -x TEST="that bad comments are scanned and flag errors" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner9.in > $work/out if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner9.out $work/out # got this far? pass filtergen-0.12.7/t/t_13_includetwo0000755000175000017500000000041112657575427013715 00000000000000#!/bin/sh -x TEST="that including more than one file works" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner13.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner13.out $work/out # got this far? pass filtergen-0.12.7/t/t_49_convertspeclist0000755000175000017500000000063012657575427015003 00000000000000#!/bin/sh -x TEST="that the converter works" DATA=converter1 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_16_emptyfilter0000755000175000017500000000040312657575427014110 00000000000000#!/bin/sh -x TEST="that parsing the empty program works" testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/parser1.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/parser1.out $work/out # got this far? pass filtergen-0.12.7/t/t_43_port0000755000175000017500000000076012657575427012536 00000000000000#!/bin/sh -x TEST="that the parser reads ports and port arguments" DATA=emitter10 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/t_52_converthost0000755000175000017500000000064412657575427014131 00000000000000#!/bin/sh -x TEST="that the converter can convert hosts" DATA=converter4 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_11_includeone0000755000175000017500000000041212657575427013664 00000000000000#!/bin/sh -x TEST="that c style comments are scanned and ignored" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner11.in > $work/out if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner11.out $work/out # got this far? pass filtergen-0.12.7/t/t_58_convertcompound0000755000175000017500000000066312657575427015007 00000000000000#!/bin/sh -x TEST="that the converter can convert compound specifiers" DATA=converter10 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_31_chaingroupbad0000755000175000017500000000042012657575427014346 00000000000000#!/bin/sh -x TEST="that parsing bad chain groups fails" DATA=parser15 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_14_includeinline0000755000175000017500000000041112657575427014363 00000000000000#!/bin/sh -x TEST="that including more than one file works" testdir=`dirname $0` . $testdir/testlib ./scan < $testdir/data/scanner14.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner14.out $work/out # got this far? pass filtergen-0.12.7/t/t_67_includeemptyfile0000755000175000017500000000062712657575427015124 00000000000000#!/bin/sh -x TEST="that inclusion of empty files works" testdir=`dirname $0` . $testdir/testlib cat > $work/rules < $work/empty < $work/out if test $? -ne 0 ; then fail ; fi cat > $work/good < $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/t_15_includenotfound0000755000175000017500000000043512657575427014750 00000000000000#!/bin/sh -x TEST="that including a non-existent file is handled correctly" testdir=`dirname $0` . $testdir/testlib $here/scan < $testdir/data/scanner15.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/scanner15.out $work/out # got this far? pass filtergen-0.12.7/t/t_30_chaingroup0000755000175000017500000000043012657575427013677 00000000000000#!/bin/sh -x TEST="that chained subgroups are parsed correctly" DATA=parser14 testdir=`dirname $0` . $testdir/testlib ./parse < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/data/0000755000175000017500000000000012657606274011754 500000000000000filtergen-0.12.7/t/data/emitter10.in0000644000175000017500000000040612455345651014031 00000000000000dport 1; dport foo; dport 1:1024; dport foo:bar; dport 1:bar; dport foo:1024; sport 1; sport foo; sport 1:1024; sport foo:bar; sport 1:bar; sport foo:1024; dport { 1 foo 1:1024 foo:bar 1:bar foo:1024 }; sport { 1 foo 1:1024 foo:bar 1:bar foo:1024 }; filtergen-0.12.7/t/data/converter8.in0000644000175000017500000000020612455345651014314 00000000000000# convert routing specifiers input eth0 dest foo local accept; input eth0 dest foo forward accept; input eth0 dest foo oneway accept; filtergen-0.12.7/t/data/parser15.out0000644000175000017500000000000012657466011014046 00000000000000filtergen-0.12.7/t/data/parser8.out0000644000175000017500000000000012657466011013770 00000000000000filtergen-0.12.7/t/data/scanner15.in0000644000175000017500000000003012657466011014005 00000000000000include nonexistentfile filtergen-0.12.7/t/data/scanner12.out0000644000175000017500000000020212657605413014205 00000000000000data/scanner12.in:1: warning: too many nested includes data/scanner12.in:1: warning: skipping include of file "data/scanner12.in" filtergen-0.12.7/t/data/scanner6.out0000644000175000017500000000033112657466011014132 00000000000000kind = identifier, spelling = "37", file = "(standard input)", line = 2 kind = identifier, spelling = "69", file = "(standard input)", line = 3 kind = identifier, spelling = "255", file = "(standard input)", line = 4 filtergen-0.12.7/t/data/scanner9.in0000644000175000017500000000004012657466011013731 00000000000000/* c comments can't nest */ ***/filtergen-0.12.7/t/data/converter5.out0000644000175000017500000000066712455345651014525 00000000000000( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( accept ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp next ( proto udp ) ) child ( accept ) ) ) ) ) filtergen-0.12.7/t/data/converter5.in0000644000175000017500000000015012455345651014307 00000000000000# convert protocols input eth0 dest foo proto tcp accept; input eth0 dest foo proto { tcp udp } accept; filtergen-0.12.7/t/data/emitter15.in0000644000175000017500000000025212455345651014035 00000000000000# chain groups [ ]; [ proto tcp ]; [ accept; reject; ]; [ "foo" ]; [ "foo" proto tcp; ]; [ "foo" accept; reject; ]; [ foo ]; [ foo proto tcp; ]; [ foo accept; reject; ]; filtergen-0.12.7/t/data/emitter14.out0000644000175000017500000000011312455345651014231 00000000000000{}; {proto { tcp }}; {proto { tcp }; accept; icmptype { echo-request }; }; filtergen-0.12.7/t/data/scanner1.out0000644000175000017500000000000012657466011014116 00000000000000filtergen-0.12.7/t/data/converter12.in0000644000175000017500000000055712455574147014404 00000000000000# big ugly filter input eth0 source foo dest bar [ proto tcp { dport {echo https nntp}; sport 1:1023 dport ssh; } accept; ]; input eth0 source baz dest quux [ proto tcp { dport {1264 1521 1984 8008 8080 26000}; } accept; ]; filtergen-0.12.7/t/data/scanner14.in0000644000175000017500000000021112657466011014005 00000000000000/* test includes that are inline with other directives */ input include data/scanner7.in accept; output include data/scanner7.in accept; filtergen-0.12.7/t/data/scanner16.in0000644000175000017500000000005312657466011014013 00000000000000/* open ended comment just doesn't end. filtergen-0.12.7/t/data/parser2.in0000644000175000017500000000002312657466011013566 00000000000000# one empty rule ; filtergen-0.12.7/t/data/parser16.in0000644000175000017500000000016112657466011013656 00000000000000# parse a file, see how well includes cope with nested sections input eth0 dest { include include.conf } accept; filtergen-0.12.7/t/data/scanner3.in0000644000175000017500000000007612657466011013734 00000000000000# scan and ignore hash style comments -- no newline at the endfiltergen-0.12.7/t/data/emitter10.out0000644000175000017500000000045212455345651014233 00000000000000dport { 1 }; dport { foo }; dport { 1:1024 }; dport { foo:bar }; dport { 1:bar }; dport { foo:1024 }; sport { 1 }; sport { foo }; sport { 1:1024 }; sport { foo:bar }; sport { 1:bar }; sport { foo:1024 }; dport { 1 foo 1:1024 foo:bar 1:bar foo:1024 }; sport { 1 foo 1:1024 foo:bar 1:bar foo:1024 }; filtergen-0.12.7/t/data/parser7.in0000644000175000017500000000046212657605413013603 00000000000000# test hostname variations source foo; source bar/24; source baz/255.255.255.248; source meep/0; source sod/255.0 source 127.0.0.1/32; source 127.0.0.1/255.255.255.255; source mail.example.com; source mail.example.com/24; source ::/128; source 0123:4567:89ab:cdef:0123:4567:89AB:CDEF; source 1:2:3:4::/32; filtergen-0.12.7/t/data/emitter6.out0000644000175000017500000000007612455345651014162 00000000000000dest { foo }; ! dest { foo }; sport { bar }; ! sport { bar }; filtergen-0.12.7/t/data/emitter2.out0000644000175000017500000000000212455345651014143 00000000000000; filtergen-0.12.7/t/data/converter1.out0000644000175000017500000000020312455345651014503 00000000000000( siblist ( input eth0 ) child ( neg ( siblist ( dest foo ) ) child ( reject ) ) ) filtergen-0.12.7/t/data/scanner4.in0000644000175000017500000000017112657466011013731 00000000000000accept dest dport drop forward icmptype input local log masq oneway output proto proxy redirect reject source sport text filtergen-0.12.7/t/data/scanner2.in0000644000175000017500000000004612657466011013730 00000000000000# scan and ignore hash style comments filtergen-0.12.7/t/data/emitter6.in0000644000175000017500000000012212455345651013751 00000000000000# parse and emit negated specifiers dest foo; ! dest foo; sport bar; ! sport bar; filtergen-0.12.7/t/data/scanner15.out0000644000175000017500000000012712657466011014215 00000000000000(standard input):1: warning: stat failed on nonexistentfile: No such file or directory filtergen-0.12.7/t/data/parser3.out0000644000175000017500000000000012657466011013763 00000000000000filtergen-0.12.7/t/data/converter11.in0000644000175000017500000000012612455574147014373 00000000000000# nested sibs input eth0 proto tcp { dport { echo https smtp }; sport 53; } accept; filtergen-0.12.7/t/data/parser4.in0000644000175000017500000000004312657466011013572 00000000000000# parse a very simple rule accept; filtergen-0.12.7/t/data/converter12.out0000644000175000017500000000332512455574147014601 00000000000000( siblist ( input eth0 ) child ( siblist ( source foo ) child ( siblist ( dest bar ) child ( subgroup "chain_0" ( siblist ( proto tcp ) child ( siblist ( siblist ( dport echo next ( dport https next ( dport nntp ) ) ) next ( siblist ( sport 1:1023 ) child ( siblist ( dport ssh ) ) ) ) child ( accept ) ) ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( source baz ) child ( siblist ( dest quux ) child ( subgroup "chain_1" ( siblist ( proto tcp ) child ( siblist ( siblist ( dport 1264 next ( dport 1521 next ( dport 1984 next ( dport 8008 next ( dport 8080 next ( dport 26000 ) ) ) ) ) ) ) child ( accept ) ) ) ) ) ) ) ) filtergen-0.12.7/t/data/parser1.out0000644000175000017500000000000012657466011013761 00000000000000filtergen-0.12.7/t/data/converter3.in0000644000175000017500000000015412455345651014311 00000000000000# check directions input eth0 reject; output eth0 reject; # compound directions input { eth0 eth1 } reject; filtergen-0.12.7/t/data/emitter3.out0000644000175000017500000000001612455345651014151 00000000000000accept; drop; filtergen-0.12.7/t/data/emitter4.in0000644000175000017500000000005712455345651013756 00000000000000# test specifier_list input eth0 accept; drop; filtergen-0.12.7/t/data/scanner13.out0000644000175000017500000000224012657466011014211 00000000000000kind = input, spelling = "input", file = "(standard input)", line = 2 kind = identifier, spelling = "foo", file = "data/scanner7.in", line = 2 kind = identifier, spelling = "bar", file = "data/scanner7.in", line = 3 kind = identifier, spelling = "baz", file = "data/scanner7.in", line = 4 kind = identifier, spelling = "quux", file = "data/scanner7.in", line = 5 kind = identifier, spelling = "mail.example.com", file = "data/scanner7.in", line = 6 kind = accept, spelling = "accept", file = "(standard input)", line = 4 kind = semicolon, spelling = ";", file = "(standard input)", line = 5 kind = output, spelling = "output", file = "(standard input)", line = 6 kind = identifier, spelling = "foo", file = "data/scanner7.in", line = 2 kind = identifier, spelling = "bar", file = "data/scanner7.in", line = 3 kind = identifier, spelling = "baz", file = "data/scanner7.in", line = 4 kind = identifier, spelling = "quux", file = "data/scanner7.in", line = 5 kind = identifier, spelling = "mail.example.com", file = "data/scanner7.in", line = 6 kind = accept, spelling = "accept", file = "(standard input)", line = 8 kind = semicolon, spelling = ";", file = "(standard input)", line = 8 filtergen-0.12.7/t/data/scanner10.in0000644000175000017500000000002612657466011014005 00000000000000/* this /* is okay */ filtergen-0.12.7/t/data/converter11.out0000644000175000017500000000060612455574147014577 00000000000000( siblist ( input eth0 ) child ( siblist ( proto tcp ) child ( siblist ( siblist ( dport echo next ( dport https next ( dport smtp ) ) ) next ( siblist ( sport 53 ) ) ) child ( accept ) ) ) ) filtergen-0.12.7/t/data/parser5.out0000644000175000017500000000000012657466011013765 00000000000000filtergen-0.12.7/t/data/converter6.out0000644000175000017500000000571312455574147014527 00000000000000( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( dport echo ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( sport echo ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( sport 53 ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( dport 53 ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( dport 53:54 ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( sport echo:https ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto tcp ) child ( siblist ( dport 53 next ( dport echo next ( dport smtp next ( dport 3128 ) ) ) ) child ( accept ) ) ) ) ) ) ) ) ) ) ) filtergen-0.12.7/t/data/emitter9.in0000644000175000017500000000140712657605413013762 00000000000000# test hosts and arguments source foo; source foo/32; source foo/255.0; source foo/255.255.0; source foo/255.255.255.0; source 127.0.0.1; source 127.0.0.1/24; source 127.0.0.1/255.255; source 127.0.0.1/255.255.0; source 127.0.0.1/255.255.255.255; source ::1/64; source ::127.0.0.1/64; dest foo; dest foo/32; dest foo/255.0; dest foo/255.255.0; dest foo/255.255.255.0; dest 127.0.0.1; dest 127.0.0.1/24; dest 127.0.0.1/255.255; dest 127.0.0.1/255.255.0; dest 127.0.0.1/255.255.255.255; dest ::1/64; dest ::127.0.0.1/64; dest { foo foo/32 foo/255.0 foo/255.255.255.0 127.0.0.1 127.0.0.1/24 127.0.0.1/255.255.255.0 ::1/64 ::127.0.0.1/64 }; source { foo foo/32 foo/255.0 foo/255.255.255.0 127.0.0.1 127.0.0.1/24 127.0.0.1/255.255.255.0 ::1/64 ::127.0.0.1/64 }; filtergen-0.12.7/t/data/emitter12.in0000644000175000017500000000012112455345651014025 00000000000000icmptype echo-request; icmptype { echo-request port-unreachable }; icmptype {};filtergen-0.12.7/t/data/converter9.out0000644000175000017500000000157112455574147014530 00000000000000( siblist ( input eth0 ) child ( siblist ( source foo ) child ( siblist ( dest bar ) child ( subgroup "chain_0" ( siblist ( proto tcp ) child ( siblist ( dport echo next ( dport https next ( dport nntp ) ) ) child ( accept ) ) next ( siblist ( proto tcp ) child ( siblist ( sport 1:1023 ) child ( siblist ( dport ssh ) child ( accept ) ) ) ) ) ) ) ) ) filtergen-0.12.7/t/data/emitter5.out0000644000175000017500000000027412455345651014161 00000000000000input { eth0 }; output { ppp0 }; dest { foo }; source { bar }; dport { 0 }; sport { 1 }; icmptype { echo-request }; accept; reject; drop; redirect; masq; local; forward; log text "pants"; filtergen-0.12.7/t/data/emitter1.out0000644000175000017500000000000012455345651014140 00000000000000filtergen-0.12.7/t/data/converter2.in0000644000175000017500000000011512455345651014305 00000000000000# check "next" chains input eth0 reject; input eth1 accept; input eth2 drop; filtergen-0.12.7/t/data/scanner14.out0000644000175000017500000000224012657466011014212 00000000000000kind = input, spelling = "input", file = "(standard input)", line = 2 kind = identifier, spelling = "foo", file = "data/scanner7.in", line = 2 kind = identifier, spelling = "bar", file = "data/scanner7.in", line = 3 kind = identifier, spelling = "baz", file = "data/scanner7.in", line = 4 kind = identifier, spelling = "quux", file = "data/scanner7.in", line = 5 kind = identifier, spelling = "mail.example.com", file = "data/scanner7.in", line = 6 kind = accept, spelling = "accept", file = "(standard input)", line = 2 kind = semicolon, spelling = ";", file = "(standard input)", line = 2 kind = output, spelling = "output", file = "(standard input)", line = 3 kind = identifier, spelling = "foo", file = "data/scanner7.in", line = 2 kind = identifier, spelling = "bar", file = "data/scanner7.in", line = 3 kind = identifier, spelling = "baz", file = "data/scanner7.in", line = 4 kind = identifier, spelling = "quux", file = "data/scanner7.in", line = 5 kind = identifier, spelling = "mail.example.com", file = "data/scanner7.in", line = 6 kind = accept, spelling = "accept", file = "(standard input)", line = 3 kind = semicolon, spelling = ";", file = "(standard input)", line = 3 filtergen-0.12.7/t/data/converter14.in0000644000175000017500000000011012455345651014363 00000000000000# check multiple options together input eth0 local log text "foo" drop; filtergen-0.12.7/t/data/emitter15.out0000644000175000017500000000025412455345651014240 00000000000000[ ]; [ proto { tcp }]; [ accept; reject; ]; [ "foo" ]; [ "foo" proto { tcp }; ]; [ "foo" accept; reject; ]; [ "foo" ]; [ "foo" proto { tcp }; ]; [ "foo" accept; reject; ]; filtergen-0.12.7/t/data/parser15.in0000644000175000017500000000014712657466011013661 00000000000000# using an unquoted string as a chain label is okay as long as it's # not a keyword. [ snot accept; ]; filtergen-0.12.7/t/data/converter13.in0000644000175000017500000000011112455345651014363 00000000000000# convert log options input eth0 log drop; input eth0 log text foo drop; filtergen-0.12.7/t/data/scanner5.out0000644000175000017500000000113212657575427014145 00000000000000kind = lcurly, spelling = "{", file = "(standard input)", line = 1 kind = rcurly, spelling = "}", file = "(standard input)", line = 2 kind = lsquare, spelling = "[", file = "(standard input)", line = 3 kind = rsquare, spelling = "]", file = "(standard input)", line = 4 kind = semicolon, spelling = ";", file = "(standard input)", line = 5 kind = slash, spelling = "/", file = "(standard input)", line = 6 kind = colon, spelling = ":", file = "(standard input)", line = 7 kind = bang, spelling = "!", file = "(standard input)", line = 8 kind = star, spelling = "*", file = "(standard input)", line = 9 filtergen-0.12.7/t/data/scanner3.out0000644000175000017500000000000012657466011014120 00000000000000filtergen-0.12.7/t/data/emitter7.in0000644000175000017500000000014312455345651013755 00000000000000# test directions and direction arguments input eth0; output ppp0; input { ppp0 eth0 }; output {}; filtergen-0.12.7/t/data/converter4.in0000644000175000017500000000031412455345651014310 00000000000000# check hosts input eth0 dest foo accept; input eth0 source foo reject; # compound input eth0 dest { foo bar } accept; # with mask input eth0 dest foo/255.255.255.0 accept; input eth0 dest foo/32 accept; filtergen-0.12.7/t/data/parser12.in0000644000175000017500000000102112657466011013646 00000000000000# compound specifiers { dport http; }; { dport http dest www }; dest www { dport http; sport https }; # specifier lists inside subrule group source foo { dport http; dport ssh dest bar; } accept; # big nested one input eth0 { dest foo { dport { ssh http } accept; dport ntp sport ntp proto udp accept; dport bootps drop; }; drop; }; # empty subrules {}; # nested empty { { proto tcp; proto udp } dport domain; }; { { proto tcp } }; # with and without final semicolon { proto foo; proto bar; }; { proto foo; proto bar }; filtergen-0.12.7/t/data/scanner10.out0000644000175000017500000000000012657466011014176 00000000000000filtergen-0.12.7/t/data/parser6.out0000644000175000017500000000000012657466011013766 00000000000000filtergen-0.12.7/t/data/converter14.out0000644000175000017500000000017312455345651014575 00000000000000( siblist ( input eth0 ) child ( local child ( log "foo" child ( drop ) ) ) ) filtergen-0.12.7/t/data/emitter1.in0000644000175000017500000000000012455345651013737 00000000000000filtergen-0.12.7/t/data/parser3.in0000644000175000017500000000004012657466011013566 00000000000000# list of empty rules ;; ; ; ;; filtergen-0.12.7/t/data/emitter13.in0000644000175000017500000000005512455345651014034 00000000000000# routing specifiers local; forward; oneway; filtergen-0.12.7/t/data/emitter13.out0000644000175000017500000000003012455345651014226 00000000000000local; forward; oneway; filtergen-0.12.7/t/data/parser8.in0000644000175000017500000000011412657466011013575 00000000000000dport 80; dport http; dport 37000:38000; dport sod:blerg; dport 1:infinity; filtergen-0.12.7/t/data/converter7.out0000644000175000017500000000117712455345651014524 00000000000000( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto icmp ) child ( siblist ( icmptype echo-request ) child ( accept ) ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( siblist ( proto icmp ) child ( siblist ( icmptype echo-request next ( icmptype echo-reply ) ) child ( accept ) ) ) ) ) ) filtergen-0.12.7/t/data/emitter2.in0000644000175000017500000000000212455345651013742 00000000000000; filtergen-0.12.7/t/data/emitter3.in0000644000175000017500000000001612455345651013750 00000000000000accept; drop; filtergen-0.12.7/t/data/scanner9.out0000644000175000017500000000040512657575427014153 00000000000000kind = star, spelling = "*", file = "(standard input)", line = 1 kind = star, spelling = "*", file = "(standard input)", line = 1 kind = star, spelling = "*", file = "(standard input)", line = 1 kind = slash, spelling = "/", file = "(standard input)", line = 1 filtergen-0.12.7/t/data/converter8.out0000644000175000017500000000104012455345651014512 00000000000000( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( local child ( accept ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( forward child ( accept ) ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( oneway child ( accept ) ) ) ) ) ) filtergen-0.12.7/t/data/parser11.in0000644000175000017500000000022312657466011013650 00000000000000# negation of some specifiers ! source foo; ! dest foo; ! sport 80; ! dport 80; ! proto udp; ! input eth0; ! output eth0; ! icmptype echo-request; filtergen-0.12.7/t/data/converter2.out0000644000175000017500000000034312455345651014511 00000000000000( siblist ( input eth0 ) child ( reject ) next ( siblist ( input eth1 ) child ( accept ) next ( siblist ( input eth2 ) child ( drop ) ) ) ) filtergen-0.12.7/t/data/emitter11.in0000644000175000017500000000011312455345651014025 00000000000000# test protocol and arguments proto tcp; proto { tcp udp icmp }; proto {}; filtergen-0.12.7/t/data/example1.in0000644000175000017500000000561712455345651013744 00000000000000# this file contains all the examples from the filter_syntax.7 manpage # MATCHES input eth0 ! dest 10.0.0.3 reject; # OPTIONS input eth0 source { 10.0.0.0/8 192.168.0.0/16 } log text "private addresses" drop; # GROUPING input eth0 source foo dest bar proto tcp dport http accept; input eth0 source foo dest bar proto tcp dport https accept; input eth0 source foo dest bar proto tcp dport nntp accept; input eth0 source foo dest bar proto tcp sport 1:1023 dport ssh accept; input eth0 source foo dest bar proto tcp { dport http; dport https; dport nntp; sport 1:1023 dport ssh; } accept; input eth0 source foo dest bar proto tcp { dport {http https nntp}; sport 1:1023 dport ssh; } accept; # OUT-OF-LINE GROUPS input eth0 source foo dest bar proto tcp { dport {http https nntp}; sport 1:1023 dport ssh; } accept; input eth0 source baz dest quux proto tcp { dport {1264 1521 1984 8008 8080 26000}; } accept; input eth0 source foo dest bar [ proto tcp { dport {http https nntp}; sport 1:1023 dport ssh; } accept; ]; input eth0 source baz dest quux [ proto tcp { dport {1264 1521 1984 8008 8080 26000}; } accept; ]; # EXAMPLE # # Example filter for (for example) a mail server # # Unfortunately, we don't have time to audit the # communications which go on locally {input lo; output lo} accept; # But we want to be a bit more careful when speaking # to the outside world input eth0 { # Sadly, we share a DMZ with Windows machines. # Don't log their netbios noise proto {tcp udp} source ournet/24 dport 137:139 drop; proto tcp { dport { smtp pop-3 } accept; dport ssh source ournet/24 accept; # We don't answer this, but don't want to # cause timeouts by blocking it dport auth reject; log drop; }; # We don't run any UDP (or other non-TCP) # services log drop; }; output eth0 { proto tcp { dport { smtp auth } accept; log drop; }; # Outbound DNS is OK proto udp dport domain dest { ns0 ns1 } accept; log drop; }; filtergen-0.12.7/t/data/converter4.out0000644000175000017500000000161712455345651014520 00000000000000( siblist ( input eth0 ) child ( siblist ( dest foo ) child ( accept ) ) next ( siblist ( input eth0 ) child ( siblist ( source foo ) child ( reject ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo next ( dest bar ) ) child ( accept ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo/255.255.255.0 ) child ( accept ) ) next ( siblist ( input eth0 ) child ( siblist ( dest foo/255.255.255.255 ) child ( accept ) ) ) ) ) ) ) filtergen-0.12.7/t/data/converter3.out0000644000175000017500000000042312455345651014511 00000000000000( siblist ( input eth0 ) child ( reject ) next ( siblist ( output eth0 ) child ( reject ) next ( siblist ( input eth0 next ( input eth1 ) ) child ( reject ) ) ) ) filtergen-0.12.7/t/data/parser16.out0000644000175000017500000000000012657466011014047 00000000000000filtergen-0.12.7/t/data/parser9.in0000644000175000017500000000012712657466011013602 00000000000000# different forms of the log command log drop; log text "foo" drop; log text foo drop; filtergen-0.12.7/t/data/parser7.out0000644000175000017500000000000012657466011013767 00000000000000filtergen-0.12.7/t/data/scanner4.out0000644000175000017500000000251212657466011014133 00000000000000kind = accept, spelling = "accept", file = "(standard input)", line = 1 kind = dest, spelling = "dest", file = "(standard input)", line = 2 kind = dport, spelling = "dport", file = "(standard input)", line = 3 kind = drop, spelling = "drop", file = "(standard input)", line = 4 kind = forward, spelling = "forward", file = "(standard input)", line = 5 kind = icmptype, spelling = "icmptype", file = "(standard input)", line = 6 kind = input, spelling = "input", file = "(standard input)", line = 7 kind = local, spelling = "local", file = "(standard input)", line = 8 kind = log, spelling = "log", file = "(standard input)", line = 9 kind = masq, spelling = "masq", file = "(standard input)", line = 10 kind = oneway, spelling = "oneway", file = "(standard input)", line = 11 kind = output, spelling = "output", file = "(standard input)", line = 12 kind = proto, spelling = "proto", file = "(standard input)", line = 13 kind = proxy, spelling = "proxy", file = "(standard input)", line = 14 kind = redirect, spelling = "redirect", file = "(standard input)", line = 15 kind = reject, spelling = "reject", file = "(standard input)", line = 16 kind = source, spelling = "source", file = "(standard input)", line = 17 kind = sport, spelling = "sport", file = "(standard input)", line = 18 kind = text, spelling = "text", file = "(standard input)", line = 19 filtergen-0.12.7/t/data/emitter12.out0000644000175000017500000000012612455345651014233 00000000000000icmptype { echo-request }; icmptype { echo-request port-unreachable }; icmptype { }; filtergen-0.12.7/t/data/scanner8.in0000644000175000017500000000034712657605413013743 00000000000000/* test some names and numbers in common networking arrangements */ 0.0.0.0 127.0.0.1/255.255.255.255 http bar/29 bar/255.255.255.248 0123:4567:89ab:cdef:0123:4567:89AB:CDEF 1:2:3:4:: ::5:6:7:8 1:2:3:4::5:6:7:8 ::ffff:127.0.0.1 :: filtergen-0.12.7/t/data/scanner6.in0000644000175000017500000000003612657466011013733 00000000000000/* test numerals */ 37 69 255 filtergen-0.12.7/t/data/parser4.out0000644000175000017500000000000012657466011013764 00000000000000filtergen-0.12.7/t/data/emitter7.out0000644000175000017500000000010312455345651014152 00000000000000input { eth0 }; output { ppp0 }; input { ppp0 eth0 }; output { }; filtergen-0.12.7/t/data/converter6.in0000644000175000017500000000061712455574147014324 00000000000000# convert ports input eth0 dest foo proto tcp dport echo accept; input eth0 dest foo proto tcp sport echo accept; input eth0 dest foo proto tcp sport 53 accept; input eth0 dest foo proto tcp dport 53 accept; # ranges input eth0 dest foo proto tcp dport 53:54 accept; input eth0 dest foo proto tcp sport echo:https accept; # compound input eth0 dest foo proto tcp dport { 53 echo smtp 3128 } accept; filtergen-0.12.7/t/data/emitter14.in0000644000175000017500000000023112455345651014031 00000000000000# test subrule lists {}; # subrule list with a single specifier in it { proto tcp }; # more specifiers { proto tcp; accept; icmptype echo-request; }; filtergen-0.12.7/t/data/parser11.out0000644000175000017500000000000012657466011014042 00000000000000filtergen-0.12.7/t/data/emitter8.in0000644000175000017500000000031112455345651013753 00000000000000# test target specifiers and arguments accept; drop; reject; masq; redirect; log drop; log text "invalid - " drop; log text "accept" accept; log text blurble reject; log text foo; log text "bar"; log; filtergen-0.12.7/t/data/scanner7.in0000644000175000017500000000010112657466011013725 00000000000000/* test identifiers (names) */ foo bar baz quux mail.example.com filtergen-0.12.7/t/data/scanner13.in0000644000175000017500000000020112657466011014003 00000000000000/* test double includes with other directives */ input include data/scanner7.in accept ; output include data/scanner7.in accept; filtergen-0.12.7/t/data/converter13.out0000644000175000017500000000031012455345651014565 00000000000000( siblist ( input eth0 ) child ( log "" child ( drop ) ) next ( siblist ( input eth0 ) child ( log "foo" child ( drop ) ) ) ) filtergen-0.12.7/t/data/converter7.in0000644000175000017500000000023412455345651014314 00000000000000# convert icmptype input eth0 dest foo proto icmp icmptype echo-request accept; input eth0 dest foo proto icmp icmptype { echo-request echo-reply } accept; filtergen-0.12.7/t/data/emitter9.out0000644000175000017500000000147212657605413014165 00000000000000source { foo }; source { foo/32 }; source { foo/255.0 }; source { foo/255.255.0 }; source { foo/255.255.255.0 }; source { 127.0.0.1 }; source { 127.0.0.1/24 }; source { 127.0.0.1/255.255 }; source { 127.0.0.1/255.255.0 }; source { 127.0.0.1/255.255.255.255 }; source { ::1/64 }; source { ::127.0.0.1/64 }; dest { foo }; dest { foo/32 }; dest { foo/255.0 }; dest { foo/255.255.0 }; dest { foo/255.255.255.0 }; dest { 127.0.0.1 }; dest { 127.0.0.1/24 }; dest { 127.0.0.1/255.255 }; dest { 127.0.0.1/255.255.0 }; dest { 127.0.0.1/255.255.255.255 }; dest { ::1/64 }; dest { ::127.0.0.1/64 }; dest { foo foo/32 foo/255.0 foo/255.255.255.0 127.0.0.1 127.0.0.1/24 127.0.0.1/255.255.255.0 ::1/64 ::127.0.0.1/64 }; source { foo foo/32 foo/255.0 foo/255.255.255.0 127.0.0.1 127.0.0.1/24 127.0.0.1/255.255.255.0 ::1/64 ::127.0.0.1/64 }; filtergen-0.12.7/t/data/emitter4.out0000644000175000017500000000003512455345651014153 00000000000000input { eth0 } accept; drop; filtergen-0.12.7/t/data/parser10.out0000644000175000017500000000000012657466011014041 00000000000000filtergen-0.12.7/t/data/converter1.in0000644000175000017500000000006512455345651014310 00000000000000# check "child" chains input eth0 ! dest foo reject; filtergen-0.12.7/t/data/parser1.in0000644000175000017500000000002312657466011013565 00000000000000# the empty filter filtergen-0.12.7/t/data/scanner11.out0000644000175000017500000000057312657466011014216 00000000000000kind = identifier, spelling = "foo", file = "data/scanner7.in", line = 2 kind = identifier, spelling = "bar", file = "data/scanner7.in", line = 3 kind = identifier, spelling = "baz", file = "data/scanner7.in", line = 4 kind = identifier, spelling = "quux", file = "data/scanner7.in", line = 5 kind = identifier, spelling = "mail.example.com", file = "data/scanner7.in", line = 6 filtergen-0.12.7/t/data/converter9.in0000644000175000017500000000022012455574147014315 00000000000000# convert chain groups input eth0 source foo dest bar [ proto tcp dport {echo https nntp} accept; proto tcp sport 1:1023 dport ssh accept; ]; filtergen-0.12.7/t/data/emitter11.out0000644000175000017500000000006312455345651014232 00000000000000proto { tcp }; proto { tcp udp icmp }; proto { }; filtergen-0.12.7/t/data/example1.out0000644000175000017500000000000012455345651014122 00000000000000filtergen-0.12.7/t/data/parser6.in0000644000175000017500000000077312657466011013606 00000000000000# a rule with a compound direction argument input { eth0 eth1 }; output { ppp0 wlan0 }; input { lo }; # a rule with a compound host argument dest { foo bar }; source { baz quux }; source { localhost }; # a rule with a compound port argument dport { ssh http }; sport { https ftp-data }; sport { ntp }; # a rule with a compound protocol argument proto { udp tcp icmp }; proto { all }; # a rule with a compound icmptype argument icmptype { echo-request echo-reply source-quench }; icmptype { time-exceeded }; filtergen-0.12.7/t/data/scanner2.out0000644000175000017500000000000012657466011014117 00000000000000filtergen-0.12.7/t/data/parser13.in0000644000175000017500000000004512657466011013654 00000000000000# routing specifiers local; forward; filtergen-0.12.7/t/data/scanner8.out0000644000175000017500000000246212657605413014144 00000000000000kind = identifier, spelling = "0.0.0.0", file = "(standard input)", line = 2 kind = identifier, spelling = "127.0.0.1", file = "(standard input)", line = 3 kind = slash, spelling = "/", file = "(standard input)", line = 3 kind = identifier, spelling = "255.255.255.255", file = "(standard input)", line = 3 kind = identifier, spelling = "http", file = "(standard input)", line = 4 kind = identifier, spelling = "bar", file = "(standard input)", line = 5 kind = slash, spelling = "/", file = "(standard input)", line = 5 kind = identifier, spelling = "29", file = "(standard input)", line = 5 kind = identifier, spelling = "bar", file = "(standard input)", line = 6 kind = slash, spelling = "/", file = "(standard input)", line = 6 kind = identifier, spelling = "255.255.255.248", file = "(standard input)", line = 6 kind = identifier, spelling = "0123:4567:89ab:cdef:0123:4567:89AB:CDEF", file = "(standard input)", line = 7 kind = identifier, spelling = "1:2:3:4::", file = "(standard input)", line = 8 kind = identifier, spelling = "::5:6:7:8", file = "(standard input)", line = 9 kind = identifier, spelling = "1:2:3:4::5:6:7:8", file = "(standard input)", line = 10 kind = identifier, spelling = "::ffff:127.0.0.1", file = "(standard input)", line = 11 kind = identifier, spelling = "::", file = "(standard input)", line = 12 filtergen-0.12.7/t/data/converter10.in0000644000175000017500000000027412455574147014376 00000000000000# convert compound specifiers { input lo; output lo} accept; # chunky input eth0 source foo dest bar proto tcp { dport echo; dport https; dport nntp; sport 1:1023 dport ssh; } accept; filtergen-0.12.7/t/data/parser10.in0000644000175000017500000000006712657466011013655 00000000000000# filter targets accept; reject; drop; redirect; masq; filtergen-0.12.7/t/data/scanner5.in0000644000175000017500000000002212657575427013741 00000000000000{ } [ ] ; / : ! * filtergen-0.12.7/t/data/emitter8.out0000644000175000017500000000024612455345651014163 00000000000000accept; drop; reject; masq; redirect; log drop; log text "invalid - " drop; log text "accept" accept; log text "blurble" reject; log text "foo"; log text "bar"; log; filtergen-0.12.7/t/data/parser14.out0000644000175000017500000000000012657466011014045 00000000000000filtergen-0.12.7/t/data/parser9.out0000644000175000017500000000000012657466011013771 00000000000000filtergen-0.12.7/t/data/scanner12.in0000644000175000017500000000003212657466011014004 00000000000000include data/scanner12.in filtergen-0.12.7/t/data/scanner11.in0000644000175000017500000000006612657466011014012 00000000000000/* test include directive */ include data/scanner7.in filtergen-0.12.7/t/data/parser13.out0000644000175000017500000000000012657466011014044 00000000000000filtergen-0.12.7/t/data/converter10.out0000644000175000017500000000205012455574147014571 00000000000000( siblist ( siblist ( input lo ) next ( siblist ( output lo ) ) ) child ( accept ) next ( siblist ( input eth0 ) child ( siblist ( source foo ) child ( siblist ( dest bar ) child ( siblist ( proto tcp ) child ( siblist ( siblist ( dport echo ) next ( siblist ( dport https ) next ( siblist ( dport nntp ) next ( siblist ( sport 1:1023 ) child ( siblist ( dport ssh ) ) ) ) ) ) child ( accept ) ) ) ) ) ) ) filtergen-0.12.7/t/data/parser12.out0000644000175000017500000000000012657466011014043 00000000000000filtergen-0.12.7/t/data/parser14.in0000644000175000017500000000124512657466011013660 00000000000000# chained subgroup, named [ "thingy" accept; ]; # unnamed [ accept; ]; # empty [ ]; # named empty [ "blarg" ]; # a big one from tgroup.filter input eth0 source wwwserv dest dbserv [ "web_to_dbserv" proto tcp sport 137:139 reject; accept; ]; # from tgroup2.filter input eth0 source wwwserv dest dbserv [ "web_to_dbserv" proto tcp dport 1521 accept; proto tcp dport appserv1 accept; proto tcp dport appserv2 accept; proto tcp dport appserv3 accept; drop; ]; # from tgroup3.filter input eth0 source wwwserv dest dbserv [ "web_to_dbserv" proto tcp dport { 1521 appserv1 appserv2 appserv3 } accept; drop; ]; # now try with a keyword as the chain label [ "input" accept; ]; filtergen-0.12.7/t/data/emitter5.in0000644000175000017500000000030712455345651013755 00000000000000# test for each of the specifier types input eth0; output ppp0; dest foo; source bar; dport 0; sport 1; icmptype echo-request; accept; reject; drop; redirect; masq; local; forward; log text "pants"; filtergen-0.12.7/t/data/scanner1.in0000644000175000017500000000004612657466011013727 00000000000000/* scan and ignore c-style comments */filtergen-0.12.7/t/data/scanner16.out0000644000175000017500000000006012657466011014212 00000000000000(standard input):3: comment reached end of file filtergen-0.12.7/t/data/scanner7.out0000644000175000017500000000057312657466011014143 00000000000000kind = identifier, spelling = "foo", file = "(standard input)", line = 2 kind = identifier, spelling = "bar", file = "(standard input)", line = 3 kind = identifier, spelling = "baz", file = "(standard input)", line = 4 kind = identifier, spelling = "quux", file = "(standard input)", line = 5 kind = identifier, spelling = "mail.example.com", file = "(standard input)", line = 6 filtergen-0.12.7/t/data/parser2.out0000644000175000017500000000000012657466011013762 00000000000000filtergen-0.12.7/t/data/parser5.in0000644000175000017500000000023112657466011013572 00000000000000# a full rule with all specifiers - doesn't need to make sense input eth0 source foo dest bar proto udp sport 37000 dport 80 icmptype echo-request drop; filtergen-0.12.7/t/parse.c0000644000175000017500000000055312657605413012236 00000000000000#include #include "../ast.h" extern char *yytext; int yyparse(void *); extern int yydebug; int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) { char *YYDEBUGTRACE; struct ast_s ast; YYDEBUGTRACE = getenv("YYDEBUGTRACE"); yydebug = YYDEBUGTRACE ? atoi(YYDEBUGTRACE) : 0; yyparse(&ast); return 0; } filtergen-0.12.7/t/t_64_includedirwfile0000755000175000017500000000113512657575427014723 00000000000000#!/bin/sh -x TEST="that directory inclusion works with files" testdir=`dirname $0` . $testdir/testlib mkdir $work/include.d if test $? -ne 0 ; then no_result; fi cat > $work/include.d/foo <$work/in < $work/out 2>&1 if test $? -ne 0 ; then fail ; fi cat >$work/good < $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_48_chaingroup0000755000175000017500000000075612657575427013723 00000000000000#!/bin/sh -x TEST="that the parser reads chain groups correctly" DATA=emitter15 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/t_56_convertrouting0000755000175000017500000000065412657575427014650 00000000000000#!/bin/sh -x TEST="that the converter can convert routing types" DATA=converter8 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi if ! test -x $here/convert ; then echo "convert program not found" no_result fi $here/convert < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # got this far? pass filtergen-0.12.7/t/t_41_target0000755000175000017500000000075412657575427013041 00000000000000#!/bin/sh -x TEST="that the parser reads targets and arguments" DATA=emitter8 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/t/t_38_specifier0000755000175000017500000000075212657575427013530 00000000000000#!/bin/sh -x TEST="that the parser reads all the specifiers" DATA=emitter5 testdir=`dirname $0` . $testdir/testlib cd $work if test $? -ne 0 ; then no_result ; fi $here/emit < $testdir/data/${DATA}.in > $work/out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $testdir/data/${DATA}.out $work/out # now see if the emitter is now idempotent $here/emit < $work/out > $work/out.out 2>&1 if test $? -ne 0 ; then no_result ; fi compare $work/out $work/out.out # got this far? pass filtergen-0.12.7/glue.c0000644000175000017500000003603612657605413011622 00000000000000/* conversion glue between ast and filter structures * * Copyright (c) 2003,2004 Jamie Wilkinson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "filter.h" #include "ast.h" #include "parser.h" int yyparse(void *); void yyrestart(FILE *); int convtrace = 0; int filter_fopen(const char *filename) { FILE *file; if (filename) { /* XXX - make more effort to find file */ if (!(file = fopen(filename, "r"))) { printf("can't open file \"%s\"", filename); return -1; } } else { file = stdin; } yyrestart(file); return 0; } #define eprint(x) \ if (convtrace) \ fprintf(stderr, x) struct filter *convert_specifier_list(struct specifier_list_s *n, struct filtergen_opts *o); struct filter *convert_subrule_list(struct subrule_list_s *n, struct filtergen_opts *o) { struct filter *res = NULL, *end = NULL; eprint("converting subrule_list\n"); if (n->subrule_list) { res = convert_subrule_list(n->subrule_list, o); if (res) { end = res; while (end->next) { end = end->next; } if (n->specifier_list) { end->next = convert_specifier_list(n->specifier_list, o); } } else { printf("warning: convert_subrule_list returned NULL\n"); } } else if (n->specifier_list) { res = convert_specifier_list(n->specifier_list, o); } else { printf("error: no content in subrule_list\n"); } return res; } struct filter *convert_compound_specifier(struct compound_specifier_s *r, struct filtergen_opts *o) { struct filter *res = NULL; eprint("converting compound_specifier\n"); if (r->list) { res = new_filter_sibs(convert_subrule_list(r->list, o)); } return res; } struct filter *convert_direction_argument(struct direction_argument_s *n, int type) { struct filter *res = NULL; if (n->direction) { res = new_filter_device(type, n->direction); } else { printf("error: no direction argument contents\n"); } return res; } struct filter * convert_direction_argument_list(struct direction_argument_list_s *n, int type) { struct filter *res = NULL, *end = NULL; eprint("converting direction argument list\n"); if (n->list) { res = convert_direction_argument_list(n->list, type); if (res) { end = res; while (end->next) { end = end->next; } if (n->arg) { end->next = convert_direction_argument(n->arg, type); } } else { printf("warning: convert_direction_argument_list returned NULL\n"); } } else { res = convert_direction_argument(n->arg, type); } return res; } struct filter *convert_direction(struct direction_specifier_s *n) { struct filter *res = NULL; int type; eprint("converting direction specifier\n"); switch (n->type) { case TOK_INPUT: type = INPUT; break; case TOK_OUTPUT: type = OUTPUT; break; default: printf("error: incorrect direction type encountered\n"); type = YYEOF; break; } if (n->list) { res = new_filter_sibs(convert_direction_argument_list(n->list, type)); } else { printf("error: no direction argument list\n"); } return res; } struct filter *convert_host_argument(struct host_argument_s *n, int type, struct filtergen_opts *o) { struct filter *res = NULL; char *h; eprint("converting host_argument\n"); if (n->host) { if (n->mask) { if (asprintf(&h, "%s/%s", n->host, n->mask) < 0) { printf("error: asprintf allocation failed when converting host " "argument %s/%s", n->host, n->mask); } } else { h = n->host; } res = new_filter_host(type, h, o->family); } else { printf("error: no host part\n"); } return res; } struct filter *convert_host_argument_list(struct host_argument_list_s *n, int type, struct filtergen_opts *o) { struct filter *res = NULL, *end = NULL; eprint("converting host argument list\n"); if (n->list) { res = convert_host_argument_list(n->list, type, o); if (res) { end = res; while (end->next) { end = end->next; } if (n->arg) { end->next = convert_host_argument(n->arg, type, o); } } else { printf("warning: convert_host_argument_list returned NULL\n"); } } else { res = convert_host_argument(n->arg, type, o); } return res; } struct filter *convert_host_specifier(struct host_specifier_s *n, struct filtergen_opts *o) { struct filter *res = NULL; enum filtertype type; eprint("converting host specifier\n"); switch (n->type) { case TOK_SOURCE: type = F_SOURCE; break; case TOK_DEST: type = F_DEST; break; default: printf("error: incorrect host type encountered\n"); type = YYEOF; break; } if (n->list) { res = new_filter_sibs(convert_host_argument_list(n->list, type, o)); } else { printf("error: no host argument list\n"); } return res; } struct filter *convert_protocol_argument(struct protocol_argument_s *n) { struct filter *res = NULL; eprint("converting protocol argument\n"); if (n->proto) { res = new_filter_proto(F_PROTO, n->proto); } else { printf("error: no protocol argument contents\n"); } return res; } struct filter * convert_protocol_argument_list(struct protocol_argument_list_s *n) { struct filter *res = NULL, *end = NULL; eprint("converting protocol argument list\n"); if (n->list) { res = convert_protocol_argument_list(n->list); if (res) { end = res; while (end->next) { end = end->next; } if (n->arg) { end->next = convert_protocol_argument(n->arg); } } else { printf("warning: convert_protocol_argument_list returned NULL\n"); } } else { res = convert_protocol_argument(n->arg); } return res; } struct filter *convert_protocol_specifier(struct protocol_specifier_s *n) { struct filter *res = NULL; eprint("converting protocol specifier\n"); if (n->list) { res = new_filter_sibs(convert_protocol_argument_list(n->list)); } else { printf("error: no protocol argument list\n"); } return res; } struct filter *convert_port_argument(struct port_argument_s *n, int type) { struct filter *res = NULL; char *p; eprint("converting port argument\n"); if (n->port_min) { if (n->port_max) { if (asprintf(&p, "%s:%s", n->port_min, n->port_max) < 0) { printf("error: asprintf allocation failed when emitting port range " "%s:%s\n", n->port_min, n->port_max); } else { res = new_filter_ports(type, p); } } else { res = new_filter_ports(type, n->port_min); } } else { printf("error: no port argument contents\n"); } return res; } struct filter *convert_port_argument_list(struct port_argument_list_s *n, int type) { struct filter *res = NULL, *end = NULL; eprint("converting port argument list\n"); if (n->list) { res = convert_port_argument_list(n->list, type); if (res) { end = res; while (end->next) { end = end->next; } if (n->arg) { end->next = convert_port_argument(n->arg, type); } } else { printf("warning: convert_port_argument_list returned NULL\n"); } } else { res = convert_port_argument(n->arg, type); } return res; } struct filter *convert_port_specifier(struct port_specifier_s *n) { struct filter *res = NULL; enum filtertype type; eprint("converting port specifier\n"); switch (n->type) { case TOK_SPORT: type = F_SPORT; break; case TOK_DPORT: type = F_DPORT; break; default: printf("error: incorrect port type encountered\n"); type = YYEOF; break; } if (n->list) { res = new_filter_sibs(convert_port_argument_list(n->list, type)); } else { printf("error: no port argument list\n"); } return res; } struct filter *convert_icmptype_argument(struct icmptype_argument_s *n) { struct filter *res = NULL; eprint("converting icmptype_argument\n"); if (n->icmptype) { res = new_filter_icmp(F_ICMPTYPE, n->icmptype); } else { printf("error: no icmptype argument contents\n"); } return res; } struct filter * convert_icmptype_argument_list(struct icmptype_argument_list_s *n) { struct filter *res = NULL, *end = NULL; eprint("converting icmptype argument list\n"); if (n->list) { res = convert_icmptype_argument_list(n->list); if (res) { end = res; while (end->next) { end = end->next; } if (n->arg) { end->next = convert_icmptype_argument(n->arg); } } else { printf("warning: convert_icmptype_argument_list returned NULL\n"); } } else { res = convert_icmptype_argument(n->arg); } return res; } struct filter *convert_icmptype_specifier(struct icmptype_specifier_s *n) { struct filter *res = NULL; eprint("converting icmptype specifier\n"); if (n->list) { res = new_filter_sibs(convert_icmptype_argument_list(n->list)); } else { printf("error: no icmptype argument list\n"); } return res; } struct filter *convert_option_specifier(struct option_specifier_s *n) { struct filter *res = NULL; eprint("converting option specifier\n"); switch (n->type) { case TOK_LOCAL: res = new_filter_rtype(LOCALONLY); break; case TOK_FORWARD: res = new_filter_rtype(ROUTEDONLY); break; case TOK_ONEWAY: res = new_filter_rtype(F_ONEWAY); break; case TOK_LOG: res = new_filter_log(F_LOG, n->logmsg); break; default: printf("error: incorrect option type encountered\n"); break; } return res; } struct filter *convert_chaingroup_specifier(struct chaingroup_specifier_s *n, struct filtergen_opts *o) { struct filter *res = NULL, *sub = NULL; char *name = NULL; if (n->name) { name = n->name; } else { /* Allocate a filter name */ static int ccount = 0; if (asprintf(&name, "chain_%d", ccount++) < 0) { printf("error: asprintf allocation failed when creating a filter name " "for chain %d\n", ccount); } } if (n->list) { sub = convert_subrule_list(n->list, o); res = new_filter_subgroup(name, sub); } else { printf("error: no list in chaingroup\n"); } return res; } struct filter *convert_specifier(struct specifier_s *r, struct filtergen_opts *o) { struct filter *res = NULL; eprint("converting specifier\n"); if (r->compound) { eprint("converting compound specifier\n"); res = convert_compound_specifier(r->compound, o); } else if (r->direction) { res = convert_direction(r->direction); } else if (r->target) { enum filtertype type; eprint("converting target specifier\n"); switch (r->target->type) { case TOK_ACCEPT: type = T_ACCEPT; break; case TOK_REJECT: type = T_REJECT; break; case TOK_DROP: type = DROP; break; case TOK_MASQ: type = MASQ; break; case TOK_PROXY: type = REDIRECT; break; case TOK_REDIRECT: type = REDIRECT; break; default: printf("error: incorrect target type encountered\n"); type = YYEOF; break; } res = new_filter_target(type); } else if (r->host) { res = convert_host_specifier(r->host, o); } else if (r->protocol) { res = convert_protocol_specifier(r->protocol); } else if (r->port) { res = convert_port_specifier(r->port); } else if (r->icmptype) { res = convert_icmptype_specifier(r->icmptype); } else if (r->option) { res = convert_option_specifier(r->option); } else if (r->chaingroup) { res = convert_chaingroup_specifier(r->chaingroup, o); } else printf("error: no specifiers\n"); return res; } struct filter *convert_negated_specifier(struct negated_specifier_s *r, struct filtergen_opts *o) { struct filter *spec = NULL; struct filter *res = NULL; eprint("converting negated specifier\n"); if (r->spec) { spec = convert_specifier(r->spec, o); if (spec && r->negated) { eprint("negating\n"); res = new_filter_neg(spec); } else { res = spec; } } return res; } struct filter *convert_specifier_list(struct specifier_list_s *n, struct filtergen_opts *o) { struct filter *res = NULL, *end = NULL; eprint("converting specifier_list\n"); if (n->list) { res = convert_specifier_list(n->list, o); if (res) { end = res; while (end->child) { end = end->child; } if (n->spec) { end->child = convert_negated_specifier(n->spec, o); } } else { printf("warning: convert_specifier_list returned NULL\n"); } } else { res = convert_negated_specifier(n->spec, o); } return res; } struct filter *convert_rule(struct rule_s *r, struct filtergen_opts *o) { struct filter *res = NULL; eprint("converting rule\n"); if (r->list) res = convert_specifier_list(r->list, o); return res; } struct filter *convert_rule_list(struct rule_list_s *n, struct filtergen_opts *o) { struct filter *res = NULL, *end = NULL; eprint("converting rule_list\n"); if (n->list) { res = convert_rule_list(n->list, o); end = res; while (end->next) { end = end->next; } if (n->rule) { end->next = convert_rule(n->rule, o); } } else { res = convert_rule(n->rule, o); } return res; } struct filter *convert(struct ast_s *ast, struct filtergen_opts *o) { struct filter *res = NULL; eprint("converting ast\n"); if (ast->list) res = convert_rule_list(ast->list, o); return res; } struct filter *filter_parse_list(struct filtergen_opts *o) { struct filter *f = NULL; struct ast_s ast; int r; /* parse the input */ r = yyparse((void *)&ast); if (r != 0) { printf("parser failed: %d\n", r); } /* convert our new style AST into the old style struct */ if (!(f = convert(&ast, o))) { printf("conversion failed!\n"); } return f; } filtergen-0.12.7/HISTORY0000644000175000017500000000766212657606211011606 000000000000000.12.7: Supports iptables-restore output format. Supports IPv6 names. Supports ip6tables and ip6tables-restore output format. Better warnings when services don't resolve. Increases include file recursion depth to 512 from 16. Directory includes now have stable ordering of the files within. Runs tests in parallel so their output is captured, and generate more output. Adds more compiler warnings. Compiles clean under clang. 0.12.6: Support shell globbing in include directives. Allow '*' as a network interface name. Modernise build environment: Fix many compiler warnings. Finish migration to Git as upstream host. 0.12.5: Small fixes to test correctness. 0.12.4: Added directory include support. Fixed relative-path include error in fgadm. Improved tests for include file parsing. 0.12.3: Fix critical resolver bug. 0.12.2: New resolver code removes need for struct casting Altered test suite to be more robust minor cosmetic bugs 0.12.1: fixed some dumb bugs fixed some compile bugs on 64 bit platforms 0.12: converted build system to automake rewrote parser added test suite add "oneway" option fix iptables log message format (append a space) add "fgadm" command multi-homed host support 0.11: fixed non-working example in filter_syntax man page fix 64-bit warning in filter.c netmask calculation add "-F [policy]" flush option better feedback on parse errors 0.10: some cleanups, slight memory usage reduction add log messages: 'log text "foo etc"' fixed iptables and ipchains brace-grouping fix filter_unroll loop-making bug add RPM spec file from Wil Cooley rename package to "filtergen" add init scripts and makefile add samples for router, host and proxy firewall 0.9: fix install target to install section 7 manpages too do protocol lookups properly, support protocol numbers lookup/normalise service names force normalisation of netmasks add "-m" to force service and host names and to be turned into port numbers and IP addresses 0.8: cleanup for iptables and ipchains to save reallocs fix input vs output thing in forwarding support for iptables and ipchains 0.7: add "local" and "forward" syntax to state that packets are only for local or remote consumption (and "-h" option to default rules to the former) begin manpages add "-o" option to specify output file fix "make install" getopt()ify filtergen.c add "-l" option to minimise the number of rules for established connections, implemented for iptables backend add more stuff to the iptables skeleton warning fixups implement "local" and "forward" for iptables backend add "-r" option to mirror "-h" cleanup ipchains driver somewhat implement "local" for ipchains backend ("forward" is not possible) fix bug where accept would get lost from: input eth0 { ! dest bar drop; accept; }; iptables and ipchains add "established packet" rules to head of chain add "proxy" as an alias for "redirect" 0.6: disable negation of conjunctions ("or"s, aka brace-grouping) for now add "no skeleton" option fix a couple of segfaults/aborts where input filter is invalid allow literal +, ", and _ signs in input add sub-groups -- where supported, large sub-sections can be moved out-of-line to improve performance 0.5: that's better much fixing of iptables driver. Now shouldn't leak like the proverbial sieve 0.4: testing begins add transproxy and masquerading support fix syntax problems with iptables and ipchains output simple logging support (logs only initiating packets) rule checking -- ports only allowed with tcp or udp initial icmp support 0.3: add ipfilter backend fix yet another silly bug in main() add warning notice to cisco driver cisco driver supports port ranges now 0.2: Various improvements rewrote iptables driver added ipchains driver added beginnings of Cisco IOS ACL driver (see TODO for why this doesn't work yet) added TODO and HONESTY files 0.1: Initial release iptables driver a few bugs filtergen-0.12.7/parser.y0000644000175000017500000003041612657575427012217 00000000000000/* parser for filtergen * * Copyright (c) 2003 Jamie Wilkinson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ %{ #include #include #include #include "ast.h" void yyerror(void *parse_arg, const char * s); extern int yylex(void); #define YYPRINT(f, t, v) yyprint(f, t, v) %} %debug %parse-param {void *parse_arg} %union { struct rule_list_s * u_rule_list; struct rule_s * u_rule; struct specifier_list_s * u_specifier_list; struct negated_specifier_s * u_negated_specifier; struct specifier_s * u_specifier; struct direction_specifier_s * u_direction_specifier; struct direction_argument_list_s * u_direction_argument_list; struct direction_argument_s * u_direction_argument; struct target_specifier_s * u_target_specifier; struct log_target_specifier_s * u_log_target_specifier; struct host_specifier_s * u_host_specifier; struct host_argument_list_s * u_host_argument_list; struct host_argument_s * u_host_argument; struct port_specifier_s * u_port_specifier; struct port_argument_list_s * u_port_argument_list; struct port_argument_s * u_port_argument; struct protocol_specifier_s * u_protocol_specifier; struct protocol_argument_list_s * u_protocol_argument_list; struct protocol_argument_s * u_protocol_argument; struct icmptype_specifier_s * u_icmptype_specifier; struct icmptype_argument_list_s * u_icmptype_argument_list; struct icmptype_argument_s * u_icmptype_argument; struct option_specifier_s * u_option_specifier; struct compound_specifier_s * u_compound_specifier; struct chaingroup_specifier_s * u_chaingroup_specifier; struct subrule_list_s * u_subrule_list; char * u_str; } %type rule_list %type rule %type specifier_list %type negated_specifier %type specifier %type direction_specifier %type direction_argument_list %type direction_argument_list_ %type direction_argument %type target_specifier %type host_specifier %type host_argument_list %type host_argument_list_ %type host_argument %type port_specifier %type port_argument_list %type port_argument_list_ %type port_argument %type protocol_specifier %type protocol_argument_list %type protocol_argument_list_ %type protocol_argument %type icmptype_specifier %type icmptype_argument_list %type icmptype_argument_list_ %type icmptype_argument %type option_specifier %type compound_specifier %type chaingroup_specifier %type subrule_list %defines %token TOK_ACCEPT %token TOK_DEST %token TOK_DPORT %token TOK_DROP %token TOK_FORWARD %token TOK_ICMPTYPE %token TOK_INPUT %token TOK_LCURLY %token TOK_LOCAL %token TOK_LOG %token TOK_LSQUARE %token TOK_MASQ %token TOK_ONEWAY %token TOK_OUTPUT %token TOK_PROTO %token TOK_PROXY %token TOK_RCURLY %token TOK_REDIRECT %token TOK_REJECT %token TOK_RSQUARE %token TOK_SEMICOLON %token TOK_SOURCE %token TOK_SPORT %token TOK_TEXT %token TOK_IDENTIFIER %token TOK_DOT %token TOK_SLASH %token TOK_ERR %token TOK_BANG %token TOK_COLON %token TOK_STAR %{ int yyprint(FILE * f, int t, YYSTYPE v); %} %start ast %% ast: rule_list { /* we expect parse_arg to be already allocated, and that * it is of type (struct ast_s *) */ ((struct ast_s *) parse_arg)->list = $1; } rule_list: /* empty */ { $$ = NULL; } | rule_list rule { $$ = malloc(sizeof(struct rule_list_s)); $$->list = $1; $$->rule = $2; } ; rule: specifier_list TOK_SEMICOLON { $$ = malloc(sizeof(struct rule_s)); $$->list = $1; } ; specifier_list: /* empty */ { $$ = NULL; } | specifier_list negated_specifier { $$ = malloc(sizeof(struct specifier_list_s)); $$->list = $1; $$->spec = $2; } ; negated_specifier: specifier { $$ = malloc(sizeof(struct negated_specifier_s)); $$->negated = 0; $$->spec = $1; } | TOK_BANG specifier { $$ = malloc(sizeof(struct negated_specifier_s)); $$->negated = 1; $$->spec = $2; } ; specifier: compound_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->compound = $1; } | direction_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->direction = $1; } | target_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->target = $1; } | host_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->host = $1; } | port_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->port = $1; } | protocol_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->protocol = $1; } | icmptype_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->icmptype = $1; } | option_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->option = $1; } | chaingroup_specifier { $$ = malloc(sizeof(struct specifier_s)); memset($$, 0, sizeof(struct specifier_s)); $$->chaingroup = $1; } ; direction_specifier: TOK_INPUT direction_argument_list { $$ = malloc(sizeof(struct direction_specifier_s)); $$->type = TOK_INPUT; $$->list = $2; } | TOK_OUTPUT direction_argument_list { $$ = malloc(sizeof(struct direction_specifier_s)); $$->type = TOK_OUTPUT; $$->list = $2; } ; direction_argument_list: direction_argument_list_ { $$ = $1; } | TOK_LCURLY direction_argument_list_ TOK_RCURLY { $$ = $2; } | TOK_STAR { $$ = malloc(sizeof(struct direction_argument_list_s)); $$->list = NULL; $$->arg = malloc(sizeof(struct direction_argument_s)); $$->arg->direction = strdup("*"); } ; direction_argument_list_: /* empty */ { $$ = NULL; } | direction_argument_list_ direction_argument { $$ = malloc(sizeof(struct direction_argument_list_s)); $$->list = $1; $$->arg = $2; } ; direction_argument: TOK_IDENTIFIER { $$ = malloc(sizeof(struct direction_argument_s)); $$->direction = $1; } ; target_specifier: TOK_ACCEPT { $$ = malloc(sizeof(struct target_specifier_s)); $$->type = TOK_ACCEPT; } | TOK_REJECT { $$ = malloc(sizeof(struct target_specifier_s)); $$->type = TOK_REJECT; } | TOK_DROP { $$ = malloc(sizeof(struct target_specifier_s)); $$->type = TOK_DROP; } | TOK_MASQ { $$ = malloc(sizeof(struct target_specifier_s)); $$->type = TOK_MASQ; } | TOK_PROXY { $$ = malloc(sizeof(struct target_specifier_s)); $$->type = TOK_PROXY; } | TOK_REDIRECT { $$ = malloc(sizeof(struct target_specifier_s)); $$->type = TOK_REDIRECT; } ; host_specifier: TOK_SOURCE host_argument_list { $$ = malloc(sizeof(struct host_specifier_s)); $$->type = TOK_SOURCE; $$->list = $2; } | TOK_DEST host_argument_list { $$ = malloc(sizeof(struct host_specifier_s)); $$->type = TOK_DEST; $$->list = $2; } ; host_argument_list: host_argument_list_ { $$ = $1; } | TOK_LCURLY host_argument_list_ TOK_RCURLY { $$ = $2; } ; host_argument_list_: /* empty */ { $$ = NULL; } | host_argument_list_ host_argument { $$ = malloc(sizeof(struct host_argument_list_s)); $$->list = $1; $$->arg = $2; } ; host_argument: TOK_IDENTIFIER TOK_SLASH TOK_IDENTIFIER { $$ = malloc(sizeof(struct host_argument_s)); $$->host = $1; $$->mask = $3; } | TOK_IDENTIFIER { $$ = malloc(sizeof(struct host_argument_s)); $$->host = $1; $$->mask = 0; } ; port_specifier: TOK_SPORT port_argument_list { $$ = malloc(sizeof(struct port_specifier_s)); $$->type = TOK_SPORT; $$->list = $2; } | TOK_DPORT port_argument_list { $$ = malloc(sizeof(struct port_specifier_s)); $$->type = TOK_DPORT; $$->list = $2; } ; port_argument_list: port_argument_list_ { $$ = $1; } | TOK_LCURLY port_argument_list TOK_RCURLY { $$ = $2; } port_argument_list_: port_argument { $$ = malloc(sizeof(struct port_argument_list_s)); $$->list = NULL; $$->arg = $1; } | port_argument_list_ port_argument { $$ = malloc(sizeof(struct port_argument_list_s)); $$->list = $1; $$->arg = $2; } ; port_argument: TOK_IDENTIFIER TOK_COLON TOK_IDENTIFIER { $$ = malloc(sizeof(struct port_argument_s)); $$->port_min = $1; $$->port_max = $3; } | TOK_IDENTIFIER { $$ = malloc(sizeof(struct port_argument_s)); $$->port_min = $1; $$->port_max = NULL; } ; protocol_specifier: TOK_PROTO protocol_argument_list { $$ = malloc(sizeof(struct protocol_specifier_s)); $$->list = $2; } ; protocol_argument_list: protocol_argument_list_ { $$ = $1; } | TOK_LCURLY protocol_argument_list_ TOK_RCURLY { $$ = $2; } ; protocol_argument_list_: /* empty */ { $$ = NULL; } | protocol_argument_list_ protocol_argument { $$ = malloc(sizeof(struct protocol_argument_list_s)); $$->list = $1; $$->arg = $2; } ; protocol_argument: TOK_IDENTIFIER { $$ = malloc(sizeof(struct protocol_argument_s)); $$->proto = strdup($1); } ; icmptype_specifier: TOK_ICMPTYPE icmptype_argument_list { $$ = malloc(sizeof(struct icmptype_specifier_s)); $$->list = $2; } ; icmptype_argument_list: icmptype_argument_list_ { $$ = $1; } | TOK_LCURLY icmptype_argument_list_ TOK_RCURLY { $$ = $2; } ; icmptype_argument_list_: /* empty */ { $$ = NULL; } | icmptype_argument_list_ icmptype_argument { $$ = malloc(sizeof(struct icmptype_argument_list_s)); $$->list = $1; $$->arg = $2; } ; icmptype_argument: TOK_IDENTIFIER { $$ = malloc(sizeof(struct icmptype_argument_s)); $$->icmptype = $1; } ; option_specifier: TOK_LOCAL { $$ = malloc(sizeof(struct option_specifier_s)); $$->type = TOK_LOCAL; $$->logmsg = 0; } | TOK_FORWARD { $$ = malloc(sizeof(struct option_specifier_s)); $$->type = TOK_FORWARD; $$->logmsg = 0; } | TOK_ONEWAY { $$ = malloc(sizeof(struct option_specifier_s)); $$->type = TOK_ONEWAY; $$->logmsg = 0; } | TOK_LOG TOK_TEXT TOK_IDENTIFIER { $$ = malloc(sizeof(struct option_specifier_s)); $$->type = TOK_LOG; $$->logmsg = $3; } | TOK_LOG { $$ = malloc(sizeof(struct option_specifier_s)); $$->type = TOK_LOG; $$->logmsg = 0; } ; compound_specifier: TOK_LCURLY subrule_list TOK_RCURLY { $$ = malloc(sizeof(struct compound_specifier_s)); $$->list = $2; } ; subrule_list: specifier_list { $$ = malloc(sizeof(struct subrule_list_s)); $$->subrule_list = NULL; $$->specifier_list = $1; } | subrule_list TOK_SEMICOLON specifier_list { $$ = malloc(sizeof(struct subrule_list_s)); $$->subrule_list = $1; $$->specifier_list = $3; } ; chaingroup_specifier: TOK_LSQUARE TOK_IDENTIFIER subrule_list TOK_RSQUARE { $$ = malloc(sizeof(struct chaingroup_specifier_s)); $$->name = $2; $$->list = $3; } | TOK_LSQUARE subrule_list TOK_RSQUARE { $$ = malloc(sizeof(struct chaingroup_specifier_s)); $$->name = NULL; $$->list = $2; } ; %% char * filename(); long int lineno(); extern char * yytext; void yyerror(void * parse_arg __attribute__((unused)), const char * s) { fprintf(stderr, "%s:%ld: %s\n", filename(), lineno(), s); } int yyprint(FILE * f, int type, YYSTYPE v) { fprintf(f, "%d:\"%s\":%p", type, yytext, (void *) &v); return 0; } filtergen-0.12.7/config.h.in0000644000175000017500000000313612657605424012542 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER filtergen-0.12.7/scanner.l0000644000175000017500000001716212657605413012327 00000000000000%option noyywrap %option nounput %x include %{ /* input scanner for filtergen language * * Copyright (c) 2003 Jamie Wilkinson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include "parser.h" /* include file stack */ #define MAXINCLUDES 512 struct inc_stack_s { YY_BUFFER_STATE state; char * filename; long int lineno; }; struct inc_stack_s inc_stack[MAXINCLUDES] = { { .state = 0, .filename = NULL, .lineno = 1 } }; int inc_stackptr = 0; long int lineno(); char * filename(); static void scan_err(const char * fmt, ...) __attribute__((format(printf, 1, 2))); void include_file(const char *); %} string \"[^\n]+\" space [ \t]+ word [[:alnum:]._+-]+ id {word}|({word})?:(({word})?:)+({word})? %% "/*" { /* strip c-style comments */ int c; do { while ((c = input()) != '*' && c != EOF && c != '\n') ; while (c == '*') c = input(); if (c == EOF) scan_err("comment reached end of file"); if (c == '\n') inc_stack[inc_stackptr].lineno++; } while (c != '/' && c != EOF); } #[^\n]* /* strip shell style comments */ {string} { /* we do not store the " characters in the string, so lop * them off. We can "safely" assume that the first and last * characters in this regex are ", otherwise there's a bug * in flex... The result is somethign that is syntactically * identical to an identifier for our purposes. */ yylval.u_str = strndup(yytext + 1, yyleng - 2); return TOK_IDENTIFIER; } {space} /* ignore */ \n inc_stack[inc_stackptr].lineno++; include BEGIN(include); accept return TOK_ACCEPT; dest return TOK_DEST; dport return TOK_DPORT; drop return TOK_DROP; forward return TOK_FORWARD; icmptype return TOK_ICMPTYPE; input return TOK_INPUT; local return TOK_LOCAL; log return TOK_LOG; masq return TOK_MASQ; oneway return TOK_ONEWAY; output return TOK_OUTPUT; proto return TOK_PROTO; proxy return TOK_PROXY; redirect return TOK_REDIRECT; reject return TOK_REJECT; source return TOK_SOURCE; sport return TOK_SPORT; text return TOK_TEXT; "{" return TOK_LCURLY; "}" return TOK_RCURLY; "[" return TOK_LSQUARE; "]" return TOK_RSQUARE; ";" return TOK_SEMICOLON; ":" return TOK_COLON; "!" return TOK_BANG; "*" return TOK_STAR; {id} { yylval.u_str = strndup(yytext, yyleng); return TOK_IDENTIFIER; } "/" return TOK_SLASH; . return TOK_ERR; [ \t]* /* eat whitespace after include */ [^ \t\n;]+ { /* include file name */ char * name = strdup(yytext); include_file(name); free(name); BEGIN(INITIAL); } <> { if (!inc_stackptr) { yyterminate(); } else { if (inc_stack[inc_stackptr].filename) { free(inc_stack[inc_stackptr].filename); inc_stack[inc_stackptr].filename = NULL; } inc_stackptr--; yy_delete_buffer(YY_CURRENT_BUFFER); yy_switch_to_buffer(inc_stack[inc_stackptr].state); } } %% long int lineno(void) { return inc_stack[inc_stackptr].lineno; } /* FIXME: make this return an immutable string */ char *filename(void) { return inc_stack[inc_stackptr].filename ? inc_stack[inc_stackptr].filename : strdup("(standard input)"); } static void scan_err(const char *fmt, ...) { va_list args; va_start(args, fmt); if (inc_stackptr >= 0) fprintf(stderr, "%s:%ld: ", filename(), lineno()); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); } void step_into_include_file(const char *fn) { FILE *f; if (inc_stackptr >= MAXINCLUDES - 1) { scan_err("warning: too many nested includes"); scan_err("warning: skipping include of file \"%s\"", fn); return; } if (!(f = fopen(fn, "r"))) { scan_err("warning: can't open file \"%s\"", fn); } else { inc_stack[inc_stackptr++].state = YY_CURRENT_BUFFER; inc_stack[inc_stackptr].lineno = 1; inc_stack[inc_stackptr].filename = strdup(fn); yyin = f; yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); } } /* include a file or directory */ void include_file(const char *name) { struct stat st; struct dirent **namelist; char *fn; int n; if (stat(name, &st)) { if (errno == ENOENT && (index(name, '*') != NULL || index(name, '?') != NULL || index(name, '[') != NULL)) { /* Globbing fiesta! */ glob_t glob_buf; if (glob(name, 0, NULL, &glob_buf) != 0) { scan_err("warning: failed to glob %s: %s", name, strerror(errno)); } else { /* We go through the list of files backwards, because * step_into_include_file() creates a stack of all the * files processed and then works on them in a LIFO * fashion -- which would make all of our rules files * go backwards. Since I can't wrap my head around * why that is, exactly, I'm hacking it up with * this instead. Fixination appreciated. */ for (n = glob_buf.gl_pathc - 1; n >= 0; n--) { if (stat(glob_buf.gl_pathv[n], &st)) { scan_err("warning: stat failed on globbed %s: %s", glob_buf.gl_pathv[n], strerror(errno)); } else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) { step_into_include_file(glob_buf.gl_pathv[n]); } } } globfree(&glob_buf); } else { scan_err("warning: stat failed on %s: %s", name, strerror(errno)); } } else { if (S_ISDIR(st.st_mode)) { if ((n = scandir(name, &namelist, NULL, alphasort)) < 0) { scan_err("warning: scandir failed on %s: %s", name, strerror(errno)); } else { while (n--) { /* FIXME: assumes d_name */ if (namelist[n]->d_name[0] == '.') { free(namelist[n]); continue; } if (asprintf(&fn, "%s/%s", name, namelist[n]->d_name) < 0) { scan_err("internal error: asprintf failed constructing pathname " "for included file %s", namelist[n]->d_name); free(fn); } else { include_file(fn); free(fn); } free(namelist[n]); } free(namelist); } } else { step_into_include_file(name); } } } filtergen-0.12.7/parser.h0000644000175000017500000001137712657576051012175 00000000000000/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ #ifndef YY_YY_PARSER_H_INCLUDED #define YY_YY_PARSER_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG #define YYDEBUG 1 #endif #if YYDEBUG extern int yydebug; #endif /* Token type. */ #ifndef YYTOKENTYPE #define YYTOKENTYPE enum yytokentype { TOK_ACCEPT = 258, TOK_DEST = 259, TOK_DPORT = 260, TOK_DROP = 261, TOK_FORWARD = 262, TOK_ICMPTYPE = 263, TOK_INPUT = 264, TOK_LCURLY = 265, TOK_LOCAL = 266, TOK_LOG = 267, TOK_LSQUARE = 268, TOK_MASQ = 269, TOK_ONEWAY = 270, TOK_OUTPUT = 271, TOK_PROTO = 272, TOK_PROXY = 273, TOK_RCURLY = 274, TOK_REDIRECT = 275, TOK_REJECT = 276, TOK_RSQUARE = 277, TOK_SEMICOLON = 278, TOK_SOURCE = 279, TOK_SPORT = 280, TOK_TEXT = 281, TOK_IDENTIFIER = 282, TOK_DOT = 283, TOK_SLASH = 284, TOK_ERR = 285, TOK_BANG = 286, TOK_COLON = 287, TOK_STAR = 288 }; #endif /* Tokens. */ #define TOK_ACCEPT 258 #define TOK_DEST 259 #define TOK_DPORT 260 #define TOK_DROP 261 #define TOK_FORWARD 262 #define TOK_ICMPTYPE 263 #define TOK_INPUT 264 #define TOK_LCURLY 265 #define TOK_LOCAL 266 #define TOK_LOG 267 #define TOK_LSQUARE 268 #define TOK_MASQ 269 #define TOK_ONEWAY 270 #define TOK_OUTPUT 271 #define TOK_PROTO 272 #define TOK_PROXY 273 #define TOK_RCURLY 274 #define TOK_REDIRECT 275 #define TOK_REJECT 276 #define TOK_RSQUARE 277 #define TOK_SEMICOLON 278 #define TOK_SOURCE 279 #define TOK_SPORT 280 #define TOK_TEXT 281 #define TOK_IDENTIFIER 282 #define TOK_DOT 283 #define TOK_SLASH 284 #define TOK_ERR 285 #define TOK_BANG 286 #define TOK_COLON 287 #define TOK_STAR 288 /* Value type. */ #if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 34 "parser.y" /* yacc.c:1909 */ struct rule_list_s *u_rule_list; struct rule_s *u_rule; struct specifier_list_s *u_specifier_list; struct negated_specifier_s *u_negated_specifier; struct specifier_s *u_specifier; struct direction_specifier_s *u_direction_specifier; struct direction_argument_list_s *u_direction_argument_list; struct direction_argument_s *u_direction_argument; struct target_specifier_s *u_target_specifier; struct log_target_specifier_s *u_log_target_specifier; struct host_specifier_s *u_host_specifier; struct host_argument_list_s *u_host_argument_list; struct host_argument_s *u_host_argument; struct port_specifier_s *u_port_specifier; struct port_argument_list_s *u_port_argument_list; struct port_argument_s *u_port_argument; struct protocol_specifier_s *u_protocol_specifier; struct protocol_argument_list_s *u_protocol_argument_list; struct protocol_argument_s *u_protocol_argument; struct icmptype_specifier_s *u_icmptype_specifier; struct icmptype_argument_list_s *u_icmptype_argument_list; struct icmptype_argument_s *u_icmptype_argument; struct option_specifier_s *u_option_specifier; struct compound_specifier_s *u_compound_specifier; struct chaingroup_specifier_s *u_chaingroup_specifier; struct subrule_list_s *u_subrule_list; char *u_str; #line 150 "parser.h" /* yacc.c:1909 */ }; typedef union YYSTYPE YYSTYPE; #define YYSTYPE_IS_TRIVIAL 1 #define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE yylval; int yyparse(void *parse_arg); #endif /* !YY_YY_PARSER_H_INCLUDED */ filtergen-0.12.7/fg-ipfilter.c0000644000175000017500000000667512657605413013104 00000000000000/* filter generator, ipfilter driver * * Copyright (c) 2002 Matthew Kirkwood * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* TODO: * - does this need skeleton routines? * - implement grouping */ #include #include #include #include "filter.h" #include "util.h" static char *appip(char *r, const struct addr_spec *h) { if (!h->addrstr) return APPS(r, "any"); APPS(r, h->addrstr); if (h->maskstr) APP2(r, "/", h->maskstr); return r; } static char *appport(char *r, const struct port_spec *p, int neg) { if (!p->minstr) return r; APPS(r, "port"); if (!p->maxstr) return APPSS2(r, neg ? "!=" : "=", p->minstr); APPS(r, p->minstr); APPSS2(r, neg ? "><" : "<>", p->maxstr); return r; } static char *appicmp(char *r, const char *h, int neg) { if (!h) return r; if (neg) APPS(r, "!"); return APPSS2(r, "icmp-type", h); } static int cb_ipfilter_rule(const struct filterent *ent, struct fg_misc *misc __attribute__((unused))) { char *rule = NULL; /* target first */ switch (ent->target) { case T_ACCEPT: APP(rule, "pass"); break; case DROP: APP(rule, "block"); break; case T_REJECT: /* XXX - can this violate the rule about icmp errors * about icmp errors? */ if (ent->proto.num == IPPROTO_TCP) APP(rule, "block return-rst"); else APP(rule, "block return-icmp-as-dest(port-unr)"); break; default: abort(); } /* in or out? */ switch (ent->direction) { case INPUT: APPS(rule, "in"); break; case OUTPUT: APPS(rule, "out"); break; default: fprintf(stderr, "unknown direction\n"); abort(); } if (ESET(ent, LOG)) APPS(rule, "log"); /* XXX - All our rules have to be "quick", but ipfilter * people seem to prefer having defaults at the top. * It would be nice to improve the output readability. */ APPS(rule, "quick"); /* access list name */ if (ent->iface) APPSS2(rule, "on", ent->iface); /* protocol */ if (ent->proto.name) APPSS2(rule, "proto", ent->proto.name); APPS(rule, "from"); rule = appip(rule, &ent->srcaddr); rule = appport(rule, &ent->u.ports.src, NEG(SPORT)); APPS(rule, "to"); rule = appip(rule, &ent->dstaddr); rule = appport(rule, &ent->u.ports.dst, NEG(DPORT)); rule = appicmp(rule, ent->u.icmp, NEG(ICMPTYPE)); if (ent->proto.name && (ent->target == T_ACCEPT) && !ent->oneway) APPS(rule, "keep state"); oputs(rule); free(rule); return 1; } int fg_ipfilter(struct filter *filter, int flags) { struct fg_misc misc = {flags, NULL}; fg_callback cb_ipfilter = {.rule = cb_ipfilter_rule, NULL}; filter_nogroup(filter); filter_unroll(&filter); filter_apply_flags(filter, flags); return filtergen_cprod(filter, &cb_ipfilter, &misc); } filtergen-0.12.7/Makefile.in0000644000175000017500000012456612657605416012600 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : sbin_PROGRAMS = filtergen$(EXEEXT) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(dist_pkgdoc_DATA) $(dist_pkgex_DATA) \ $(dist_sysconf_DATA) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = filtergen.spec fgadm fgadm.conf rules.filter CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(sbindir)" \ "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man7dir)" \ "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(pkgdocdir)" \ "$(DESTDIR)$(pkgexdir)" "$(DESTDIR)$(sysconfdir)" PROGRAMS = $(sbin_PROGRAMS) am_filtergen_OBJECTS = filtergen.$(OBJEXT) gen.$(OBJEXT) \ filter.$(OBJEXT) fg-util.$(OBJEXT) fg-iptables.$(OBJEXT) \ fg-iptrestore.$(OBJEXT) fg-ipchains.$(OBJEXT) \ fg-ipfilter.$(OBJEXT) fg-cisco.$(OBJEXT) parser.$(OBJEXT) \ scanner.$(OBJEXT) glue.$(OBJEXT) resolver.$(OBJEXT) \ icmpent.$(OBJEXT) filtergen_OBJECTS = $(am_filtergen_OBJECTS) filtergen_DEPENDENCIES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } SCRIPTS = $(sbin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = @MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ || LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS) AM_V_LEX = $(am__v_LEX_@AM_V@) am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@) am__v_LEX_0 = @echo " LEX " $@; am__v_LEX_1 = YLWRAP = $(top_srcdir)/ylwrap @MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ || am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \ -e s/c++$$/h++/ -e s/c$$/h/ YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS) AM_V_YACC = $(am__v_YACC_@AM_V@) am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@) am__v_YACC_0 = @echo " YACC " $@; am__v_YACC_1 = SOURCES = $(filtergen_SOURCES) DIST_SOURCES = $(filtergen_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac man5dir = $(mandir)/man5 man7dir = $(mandir)/man7 man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man_MANS) DATA = $(dist_pkgdoc_DATA) $(dist_pkgex_DATA) $(dist_sysconf_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/fgadm.conf.in $(srcdir)/fgadm.in \ $(srcdir)/filtergen.spec.in $(srcdir)/rules.filter.in AUTHORS \ INSTALL README THANKS TODO compile config.guess config.sub \ depcomp install-sh missing parser.c parser.h scanner.c ylwrap DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 GZIP_ENV = --best DIST_TARGETS = dist-bzip2 dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BINDIR = @BINDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GETOPT_LIBS = @GETOPT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PROGRAM = @PROGRAM@ SBINDIR = @SBINDIR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSCONFDIR = @SYSCONFDIR@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgdocdir = @pkgdocdir@ pkgexdir = @pkgexdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = . t sbin_SCRIPTS = fgadm filtergen_SOURCES = \ filtergen.c \ gen.c \ filter.c \ fg-util.c \ fg-iptables.c \ fg-iptrestore.c \ fg-ipchains.c \ fg-ipfilter.c \ fg-cisco.c \ parser.y \ scanner.l \ glue.c \ resolver.c \ icmpent.c filtergen_LDADD = @GETOPT_LIBS@ headers = filter.h util.h ast.h resolver.h icmpent.h mans = filter_backends.7 filter_syntax.5 filtergen.8 fgadm.8 man_MANS = $(mans) dist_sysconf_DATA = fgadm.conf rules.filter dist_pkgex_DATA = $(top_srcdir)/examples/*.filter dist_pkgdoc_DATA = $(top_srcdir)/doc/* EXTRA_DIST = HISTORY HONESTY README TODO $(headers) $(mans) filtergen.spec extras/* AM_CFLAGS = -D_GNU_SOURCE AM_LDFLAGS = -g AM_YFLAGS = -d all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .l .o .obj .y am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 filtergen.spec: $(top_builddir)/config.status $(srcdir)/filtergen.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ fgadm: $(top_builddir)/config.status $(srcdir)/fgadm.in cd $(top_builddir) && $(SHELL) ./config.status $@ fgadm.conf: $(top_builddir)/config.status $(srcdir)/fgadm.conf.in cd $(top_builddir) && $(SHELL) ./config.status $@ rules.filter: $(top_builddir)/config.status $(srcdir)/rules.filter.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) parser.h: parser.c @if test ! -f $@; then rm -f parser.c; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) parser.c; else :; fi filtergen$(EXEEXT): $(filtergen_OBJECTS) $(filtergen_DEPENDENCIES) $(EXTRA_filtergen_DEPENDENCIES) @rm -f filtergen$(EXEEXT) $(AM_V_CCLD)$(LINK) $(filtergen_OBJECTS) $(filtergen_LDADD) $(LIBS) install-sbinSCRIPTS: $(sbin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fg-cisco.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fg-ipchains.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fg-ipfilter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fg-iptables.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fg-iptrestore.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fg-util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filtergen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icmpent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resolver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanner.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .l.c: $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) .y.c: $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE) install-man5: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man5dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.5[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ done; } uninstall-man5: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man5dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.5[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) install-man7: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man7dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man7dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man7dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.7[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^7][0-9a-z]*$$,7,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man7dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man7dir)" || exit $$?; }; \ done; } uninstall-man7: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man7dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.7[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^7][0-9a-z]*$$,7,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man7dir)'; $(am__uninstall_files_from_dir) install-man8: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man8dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.8[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) install-dist_pkgdocDATA: $(dist_pkgdoc_DATA) @$(NORMAL_INSTALL) @list='$(dist_pkgdoc_DATA)'; test -n "$(pkgdocdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgdocdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgdocdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdocdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdocdir)" || exit $$?; \ done uninstall-dist_pkgdocDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pkgdoc_DATA)'; test -n "$(pkgdocdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgdocdir)'; $(am__uninstall_files_from_dir) install-dist_pkgexDATA: $(dist_pkgex_DATA) @$(NORMAL_INSTALL) @list='$(dist_pkgex_DATA)'; test -n "$(pkgexdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgexdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgexdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgexdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgexdir)" || exit $$?; \ done uninstall-dist_pkgexDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pkgex_DATA)'; test -n "$(pkgexdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgexdir)'; $(am__uninstall_files_from_dir) install-dist_sysconfDATA: $(dist_sysconf_DATA) @$(NORMAL_INSTALL) @list='$(dist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sysconfdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sysconfdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(sysconfdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(sysconfdir)" || exit $$?; \ done uninstall-dist_sysconfDATA: @$(NORMAL_UNINSTALL) @list='$(dist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sysconfdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(pkgdocdir)" "$(DESTDIR)$(pkgexdir)" "$(DESTDIR)$(sysconfdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -rm -f parser.c -rm -f parser.h -rm -f scanner.c clean: clean-recursive clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dist_pkgdocDATA install-dist_pkgexDATA \ install-man install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-dist_sysconfDATA install-sbinPROGRAMS \ install-sbinSCRIPTS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man5 install-man7 install-man8 install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-dist_pkgdocDATA uninstall-dist_pkgexDATA \ uninstall-dist_sysconfDATA uninstall-man \ uninstall-sbinPROGRAMS uninstall-sbinSCRIPTS uninstall-man: uninstall-man5 uninstall-man7 uninstall-man8 .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-sbinPROGRAMS cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ dist-xz dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-data install-data-am \ install-dist_pkgdocDATA install-dist_pkgexDATA \ install-dist_sysconfDATA install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-man5 \ install-man7 install-man8 install-pdf install-pdf-am \ install-ps install-ps-am install-sbinPROGRAMS \ install-sbinSCRIPTS install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-dist_pkgdocDATA \ uninstall-dist_pkgexDATA uninstall-dist_sysconfDATA \ uninstall-man uninstall-man5 uninstall-man7 uninstall-man8 \ uninstall-sbinPROGRAMS uninstall-sbinSCRIPTS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: filtergen-0.12.7/doc/0000755000175000017500000000000012657606274011345 500000000000000filtergen-0.12.7/doc/flow0000644000175000017500000000020112657466010012140 00000000000000[parser] | v (AST) | v [translator] | v (IR) <-> [factoriser] | v [generator] | v (TR) <-> [optimiser] | v [emitter] filtergen-0.12.7/doc/notes0000644000175000017500000001021712657466010012331 00000000000000#http://www.securityfocus.com/infocus/1711 #http://coombs.anu.edu.au/ipfilter/examples.html #http://hr.uoregon.edu/davidrl/rc.icmp #http://www.cs.iupui.edu/~ddillow/N301/deMorgan.html #demorgans law: ~(a + b) = ~a . ~b and ~(a . b) = ~a + ~b #input eth0 proto tcp dport http:https accept; #input eth0 proto icmp icmptype { echo-request timestamp-request } accept; #input eth0 dest monitors.anchor.net.au accept; #input eth0 dest localhost accept; #input eth0 proto icmp icmptype host-unreachable accept; #input eth+ { # ! source { a b } proto icmp icmptype echo-request accept; # }; #input eth+ and ( source a or source b ) and proto icmp and icmptype echo-request and target accept; #input eth+ and not ( source a or source b ) and proto icmp and icmptypte er and accept; # demorgans: #input e and not source a and not source b and proto icmp and it er and a; # semicolons = OR # sibs = OR # braces and chains = () # implicit gap between specifier = AND # ! = NOT # specifiers are predicates # targets are actions to perform. actions have side effects, predicates do not # guarded expressions # filtergen: input eth0 source { c d } accept; input eth0 ! source { a b } accept; #|| # lisp-like: #(and (input eth0) (not ((source a) or (source b))) (accept)); # #input eth0 accept; #output eth0 accept; #|| #(or (and (input eth0) (accept)) (and (output eth0) (accept))) # also: #{input eth0; output eth0} accept; #|| #(and (or (input eth0) (output eth0)) (accept)) #which by factorisation of the above: #(or (and input accept) (and output accept)) #|| #(input eth0) * (accept) + (output eth0) * (accept) #|| #(accept) * ((input eth0) + (output eth0)) #|| #(and accept (or input output) # expands to: #input accept #output accept # # # ORDER MATTERS when factoring/expanding, e.g.: # # order of targets matters, actions on same predicates # are not swappable (commutative?) # # input eth0 { # proto icmp accept; # proto tcp dport auth reject; # proto { tcp udp } dport domain accept; #}; #= #(and input (or (and proto accept) (and proto dport reject) (and (or proto proto) dport accept))) #expands to: #input proto accept [1] #input proto dport reject [2] #input proto dport accept [3] #input proto dport accept [4] # where 3,4's target is explicitly after [2] target inthe initial input # # TODO: prove that reordering targets has congruence COMMUTATIVITY OF RULES if two consecutive rules are sufficiently different, i.e. they are non overlapping predicate sets (???) then their order may be swapped # expression reduction: # fold duplicates, e.g.: (list reduction) # (and x x) = x # (or x x) = x # pull out common factors, e.g.: # (or (and x y) (and y z)) = (and y (or x z)) # special case optimisations: # (or (host a) (host b)) = (host a+b) iff a and b are the sole elements of # a CIDR set # (or (port a) (port b)) = (port a:b) iff a and b are consecutive ports # common factor puller outerer # at each binary operator node (i.e. "and" or "or") # if both children are binary operators of the opposite kind (i.e. "or" or "and" respectively # for each item in the first list: # if item in second list # pull out item from both lists # reverse operators # place item in top list # place sublists in new #two list reductions # common factor extraction # (or (and x y) (and y z)) # y (or (and x) (and z)) # (and y (or (and x) (and z))) # (and y (or x z)) # (or (and x y z) (and a y z)) # ^^ ^ ^ # x in (a y z)? no # (or (and x y z) (and a y z)) # ^^ ^ ^ # y in (a y z)? yes # (and y (or (and x z) (and a z))) # ^ ^ ^ ^ # z in (a z)? yes # (and y (or (and x z) (and a z))) # ^ ^ ^ ^ # (and y z (or (and x) (and z) # (and y z (or x z)) # singles reduction #one list reductions # duplicate reduction # (and x x) # (and x) # # (or x y x) # (or x y) # # singles reduction # (and x) # x http://hopper.unco.edu/KARNAUGH/Algorithm.html http://134.193.15.25/vu/course/cs281/lectures/boolean-algebra/boolean-algebra.html http://sunsite.wits.ac.za/math/firewall.htm http://www.cisco.com/univercd/cc/td/doc/product/software/ http://arxiv.org/abs/cs.NI/0008006 filtergen-0.12.7/doc/generator.notes0000644000175000017500000000252212455573643014325 00000000000000DAG for rule generation a { b c d } e { f g } x; h { f g } z; i { b c } y; precompute common subexpressions == separate into chains caution: actions are commutative with subexpressions: { f g } x is not the same as { f g } z visit nodes in a dag: when the end of the path is reached, enter a rule into an assembler-like list of tuples chain | if | src ip | dst ip | proto | src port | dst port | options... | action ports ignored for non tcp/udp (i.e. they're NULL) NULL values are assumed to be any: if they were assumed to be none, then all rules missing a value would be no-ops. leaving a specifier out meaning less specifity seems more intuitive. options inclue icmp type, special flags, iptables modifiers apply peephole optimisations: * redundant rules that are more specific than later rules with the same action potential for shadowing warning * rule reordering with other rules having the same action pattern: "if" expression "then" action; ##factorisation common actions E1 A; = ( E1 | E2 ) A E2 A; sib specifiers S { I1 I2 } = ( P(S I1) | P(S I2) ) chains/braces { E } = ( E ) specifier lists S1 I1 S2 I2 = ( P(S1I1) & P(S2I2) ) negations ! {E} = ! ( E ) negations ! S = ! P(S) S { ! I } = ! P(SI) S { ! I1 I2 } = ( !P(SI1) & P(SI2) ) associativity ( E1 o E2 ) o E3 = E1 o ( E2 o E3 ) comutativity E1 o E2 = E2 o E1 filtergen-0.12.7/examples/0000755000175000017500000000000012657606274012416 500000000000000filtergen-0.12.7/examples/proxy-fw-sample.filter0000644000175000017500000000265412455573643016625 00000000000000## ## Sample filtergen ruleset for a proxy gateway host ## ## $Id: proxy-fw-sample.filter,v 1.1 2002/09/12 09:28:53 matthew Exp $ ## # process with this the "-h" option # everything on lo, ugh input lo accept; output lo accept; # # eth0 is the public interface # # It lives on our class C as 111.222.333.28 (aka gw-ext) # input eth0 { # ignore broadbcast / bootp noise dest {111.222.333.0 111.222.333.255 255.255.255.255} drop; proto icmp icmptype {ping pong destination-unreachable} accept; proto tcp dport ssh accept; # FTP data connections (from PORT sent to server) proto tcp dest gw-ext dport 40000:40400 accept; log drop; }; output eth0 { proto icmp icmptype {ping pong destination-unreachable} accept; proto {udp tcp} dport domain accept; proto tcp dport {ssh smtp http https pop-3 ftp} accept; }; # # eth1 is the internal interface # # It lives on 10.1.2.1/24 (aka gw-int) # output eth1 { proto icmp icmptype {ping pong destination-unreachable} accept; # management connections proto tcp dport ssh accept; log reject; }; input eth1 { proto icmp icmptype {ping pong destination-unreachable} accept; # ignore broadbcast / bootp noise dest {10.1.2.0 10.1.2.255 255.255.255.255} drop; # dns proto {udp tcp} dport domain accept; # transproxy stuff proto tcp dport {ssh smtp http https pop-3 nntp ftp} proxy; # FTP data connections (from PASV sent by client) proto tcp dport 30000:30400 accept; log reject; }; filtergen-0.12.7/examples/host-sample.filter0000644000175000017500000000206712455573643016005 00000000000000## ## Sample filtergen ruleset for a host (DB server, in this case) ## ## $Id: host-sample.filter,v 1.1 2002/09/12 09:28:53 matthew Exp $ ## # Process this with the "-h" option # lo -- we haven't time to audit all local communication input lo accept; output lo accept; # eth0 -- DMZ interface input eth0 { # ignore bootp and broadcast noise proto udp sport bootpc dport bootps drop; dest {111.222.333.0 111.222.333.255 0.0.0.0 255.255.255.255} drop; # We only speak to other hosts on this LAN ... ! source 111.222.333.0/24 log drop; # ... and only on one IP ! dest db0 log drop; # Services we permit proto tcp dport {ssh sqlnet postgres} accept; # Everything else, we refuse log drop; }; output eth0 { # We only speak to other hosts on this LAN... ! dest 111.222.333.0/24 log drop; # ...and only from one IP ! source db0 log drop; # The usual outbound noise proto {tcp udp} dport domain dest {ns0 ns1} accept; proto tcp dport smtp dest {mail0 mail1} accept; # Don't know what else goes out, so for now we permit it, # but also log it log accept; }; filtergen-0.12.7/examples/icmp.filter0000644000175000017500000000451712455345651014477 00000000000000# The following information courtesy of Glen Turner: # David Fisher wrote: # > Would some kind person please try pinging the addresses xx.xx.xx.xx or # > xx.xx.xx.xx and let me know the results, please? # > # > I need to test the ICMP block on my router from external ping traffic. # # Great, another path MTU discovery black hole, another # undiagnosable network. # # Fellas, how about using rate limiting. Linux has marvellous # QoS features, enough to allow a few ICMP ECHOs for fault # diagnosis but to deny a ping flood. # # > Note that its probably not a good idea to block ICMP source quench # > packets. # # Nah, block those suckers. Source Quench is deprecated. # # The list is # # Block # Obsolete # Source Quench # Information Request/Reply # Datagram Conversion # Shouldn't cross network boundary # Address Mask Request/Reply # Redirect # Domain Name # Router Advertisment/Selection # Required for operation (rate limit these to, say, 10% of bandwidth) # Destination Unreachable # Time Exceeded # Security Failure # Parameter Problem # Required for diagnosis (rate limit these to, say, 1% of bandwidth) # Echo Request/Reply # Timestamp Request/Reply # # Regards, # Glen # # -- # Glen Turner Tel: (08) 8303 3936 or +61 8 8303 3936 # Network Engineer Email: glen.turner@aarnet.edu.au # Australian Academic & Research Network www.aarnet.edu.au # -- # linux.conf.au 2004, Adelaide lca2004.linux.org.au # Main conference 14-17 January 2004 Miniconfs from 12 Jan # # -- # SLUG - Sydney Linux User's Group - http://slug.org.au/ # More Info: http://lists.slug.org.au/listinfo/slug proto icmp { # these are obsolete drop icmptype { source-quench information-request information-reply datagram-conversion }; # these shouldn't cross network boundary drop icmptype { address-mask-request address-mask-reply redirect domain-name router-advertisement router-selection }; # required for operation accept icmptype { destination-unreachable time-exceeded security-failure parameter-problem } limit rate 20/s burst 10; # required for diagnosis accept icmptype { echo-request echo-reply timestamp-request timestamp-reply } limit rate 10/s burst 5; # drop anything we missed drop; } filtergen-0.12.7/examples/example.filter0000644000175000017500000000135112455573643015177 00000000000000# # Example filter for (for example) a mail server # $Id: example.filter,v 1.3 2001/10/06 19:07:17 matthew Exp $ # # Unfortunately, we don't have time to audit the # communications which go on locally {input lo; output lo} accept; # But we want to be a bit more careful when speaking # to the outside world input eth0 { proto tcp { dport { smtp pop-3 } accept; dport ssh source ournet/24 accept; # We don't answer this, but don't want to # cause timeouts by blocking it dport auth reject; log drop; }; # We don't run any UDP (or other non-TCP) # services log drop; }; output eth0 { proto tcp { dport { smtp auth } accept; log drop; }; # Outbound DNS is OK proto udp dport domain dest { ns0 ns1 } accept; log drop; }; filtergen-0.12.7/examples/router-sample.filter0000644000175000017500000000410312455573643016341 00000000000000## ## Sample filtergen script for a filtering router ## ## $Id: router-sample.filter,v 1.1 2002/09/12 09:28:53 matthew Exp $ ## # The router has: # * a public interface (eth0) on 444.555.666.777 # * DMZ interface (eth1) on 111.222.333.254, behind which is a class C # eth0 is the public interface # # On this interface, we do martian filtering and not a lot else input eth0 forward { dest 111.222.333.0/24 accept; log drop; }; output eth0 forward { source 111.222.333.0/24 accept; log drop; }; input eth0 local { proto icmp accept; # Emergency management connection from outside proto tcp dport ssh source fw0-othersite accept; log drop; }; output eth0 local { proto icmp accept; log drop; }; # eth1 is the DMZ interface # # Here's where the real filtering happens. We split this # subnet into 4 logical groups of 64 IPs each to make this # easier output eth1 forward { # First quarter is infrastructure stuff -- nameservers, # mail, gateway, etc. All traffic is permitted, for now. dest 111.222.333.0/26 accept; # Deny everything to top 64 IPs -- DB servers, etc dest 111.222.333.186/26 log drop; # Web servers (real _and_ virtual) dest 111.222.333.128/26 { proto icmp accept; proto tcp dport { http https } accept; log text "to-web" accept; }; # FIXME: For now, we allow everything else, but log it. # Hopefully we can find time to restrict this log text "unmatched-inbound" accept; # log reject; }; # TODO: Filter outbound traffic, too input eth1 forward accept; # Inbound management connections, etc input eth1 local { # ignore broadcast dest {255.255.255.255 195.157.147.255} drop; # SSH and SNMP from management host source mgmt0 { proto tcp dport ssh accept; proto udp dport snmp accept; }; proto icmp accept; log reject; }; # Outbound stuff. Nothing interesting here: output eth1 local { proto icmp accept; # DNS and mail via ns0, ns1 dest {ns0 ns1} { proto {udp tcp} dport domain accept; proto tcp dport smtp accept; }; # Emergency ssh to gateway host proto tcp { dest gateway0 dport ssh; } accept; log text "from-dmz" reject; }; filtergen-0.12.7/util.h0000644000175000017500000000226412657605413011644 00000000000000/* utility functions for filter output * * Copyright (c) 2001 Matthew Kirkwood * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _FILTER_UTIL_H #define _FILTER_UTIL_H 1 #define APP(l, s) (l = strapp(l, s)) #define APP2(l, s1, s2) (l = strapp2(l, s1, s2)) #define APPS(l, s) APP2(l, " ", s) #define APPS2(l, s1, s2) (APPS(l, s1), APP(l, s2)) #define APPSS2(l, s1, s2) (APPS(l, s1), APPS(l, s2)) #define NEG(t) (ent->whats_negated & (1 << F_##t)) #define NEGA(l, t) (NEG(t) ? APPS(l, "!") : l) #endif /* _FILTER_UTIL_H */ filtergen-0.12.7/resolver.h0000644000175000017500000000172412657605413012530 00000000000000/* argument name resolver * * Copyright (c) 2004 Jamie Wilkinson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __RESOLVER_H__ #define __RESOLVER_H__ #include "ast.h" #include "filter.h" void resolve(struct ast_s *n, struct filtergen_opts *o); #endif /* __RESOLVER_H__ */ filtergen-0.12.7/filtergen.c0000644000175000017500000001627612657605413012651 00000000000000/* packet filter compiler * * Copyright (c) 2002 Matthew Kirkwood * Copyright (c) 2003,2004 Jamie Wilkinson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #ifdef HAVE_GETOPT_H #include #endif #include "filter.h" #include "ast.h" #include "resolver.h" int yyparse(void *); void yyrestart(FILE *); extern struct filter *convert(struct ast_s *n, struct filtergen_opts *o); static FILE *outfile; void usage(char *prog) { fprintf(stderr, "Usage: %s [-chV] [-t backend] [-o output] input\n", prog); fprintf(stderr, " %s [-chV] [-t backend] [-o output] -F policy\n\n", prog); fprintf(stderr, "Options:\n"); #ifdef HAVE_GETOPT_H fprintf(stderr, " --compile/-c compile only, no generate\n"); #else fprintf(stderr, " -c compile only, no generate\n"); #endif #ifdef HAVE_GETOPT_H fprintf( stderr, " --target/-t target generate for target (default: iptables)\n"); #else fprintf( stderr, " -t target generate for target (default: iptables)\n"); #endif #ifdef HAVE_GETOPT_H fprintf( stderr, " --flush/-F policy don't process input, generate flush rules\n"); #else fprintf( stderr, " -F policy don't process input, generate flush rules\n"); #endif #ifdef HAVE_GETOPT_H fprintf(stderr, " --output/-o filename write the generated packet " "filter to filename\n"); #else fprintf(stderr, " -o filename write the generated packet " "filter to filename\n"); #endif #ifdef HAVE_GETOPT_H fprintf(stderr, " --help/-h show this help\n"); #else fprintf(stderr, " -h show this help\n"); #endif #ifdef HAVE_GETOPT_H fprintf(stderr, " --version/-V show program version\n"); #else fprintf(stderr, " -V show program version\n"); #endif } int oputs(const char *s) { int r = 0; if (s) { r = fputs(s, outfile); if (r > 0) { fputc('\n', outfile); r++; } } return r; } int oprintf(const char *fmt, ...) { va_list args; va_start(args, fmt); return vfprintf(outfile, fmt, args); } struct filtyp { const char *name; sa_family_t family; filtergen *compiler; filter_flush *flusher; } filter_types[] = { {"iptables", AF_INET, fg_iptables, flush_iptables}, {"ip6tables", AF_INET6, fg_ip6tables, flush_ip6tables}, {"iptables-restore", AF_INET, fg_iptrestore, flush_iptrestore}, {"ip6tables-restore", AF_INET6, fg_ip6trestore, flush_ip6trestore}, {"ipchains", AF_INET, fg_ipchains, flush_ipchains}, {"ipfilter", AF_INET, fg_ipfilter, NULL}, {"cisco", AF_INET, fg_cisco, NULL}, {NULL, 0, NULL, NULL}, }; #ifdef HAVE_GETOPT_H static struct option long_options[] = {{"help", no_argument, 0, 'h'}, {"compile", no_argument, 0, 'c'}, {"target", required_argument, 0, 't'}, {"output", required_argument, 0, 'o'}, {"flush", required_argument, 0, 'F'}, {"version", no_argument, 0, 'V'}, {0, 0, 0, 0}}; #define GETOPT(x, y, z) getopt_long(x, y, z, long_options, NULL) #else #define GETOPT(x, y, z) getopt(x, y, z) #endif int main(int argc, char **argv) { struct filter *f; int l; time_t t; char buf[100]; char *filename = NULL, *ftn = NULL, *ofn = NULL; struct filtyp *ft = NULL; int flags = 0; char *progname; int arg; enum filtertype flushpol = T_ACCEPT; progname = argv[0]; while ((arg = GETOPT(argc, argv, "hco:t:F:V")) > 0) { switch (arg) { case ':': usage(progname); exit(1); break; case 'h': usage(progname); exit(0); break; case 'c': flags |= FF_NOSKEL; break; case 'o': ofn = strdup(optarg); break; case 't': ftn = strdup(optarg); break; case 'F': flags |= FF_FLUSH; if (!strcasecmp(optarg, "accept")) { flushpol = T_ACCEPT; } else if (!strcasecmp(optarg, "drop")) { flushpol = DROP; } else if (!strcasecmp(optarg, "reject")) { flushpol = T_REJECT; } else { fprintf(stderr, "%s: flush policy unrecofgnised: %s\n", progname, optarg); usage(progname); exit(1); } break; case 'V': printf(PACKAGE " " VERSION "\n"); exit(0); break; default: break; } } if (!(flags & FF_FLUSH)) { if (optind >= argc) { usage(progname); exit(1); } else filename = argv[optind++]; } if (ofn) { /* XXX - open a different tempfile, and rename on success */ outfile = fopen(ofn, "w"); if (!outfile) { fprintf(stderr, "%s: can't open output file \"%s\"\n", progname, ofn); return 1; } } else outfile = stdout; if (!ftn || !*ftn) ftn = strdup("iptables"); for (ft = filter_types; ft->name; ft++) if (!strcmp(ftn, ft->name)) break; if (!ft->name) { fprintf(stderr, "%s: target filter unrecognised: %s\n", progname, ftn); usage(progname); exit(1); } /* What to do, then? */ if (flags & FF_FLUSH) { /* Just flush it */ l = ft->flusher(flushpol); } else { /* Compile from a file */ if (filename && !strcmp(filename, "-")) filename = NULL; if (filter_fopen(filename)) return 1; { struct ast_s ast; if (yyparse(&ast) == 0) { struct filtergen_opts o; memset(&o, 0, sizeof o); o.family = ft->family; resolve(&ast, &o); f = convert(&ast, &o); if (!f) { fprintf(stderr, "couldn't convert file\n"); return 1; } } else { fprintf(stderr, "couldn't parse file\n"); return 1; } } strftime(buf, sizeof(buf) - 1, "%a %b %e %H:%M:%S %Z %Y", localtime((time(&t), &t))); oprintf("# filter generated from %s via %s backend at %s\n", filename ? filename : "standard input", ft->name, buf); l = ft->compiler(f, flags); } if (ofn) fclose(outfile); if (l < 0) { fprintf( stderr, "an error occurred: most likely the filters defined make no sense\n"); if (ofn) unlink(ofn); return 1; } fprintf(stderr, "generated %d rules\n", l); return 0; } filtergen-0.12.7/test-driver0000755000175000017500000001104012657562003012701 00000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2013-07-13.22; # UTC # Copyright (C) 2011-2014 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>$log_file # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: filtergen-0.12.7/fgadm.conf0000644000175000017500000000051412657605423012440 00000000000000# /usr/local/etc/fgadm.conf # Set BACKEND to one of `iptables', `ipchains', `ipfilter', or `cisco', for # your particular packet filter target. The default is `iptables'. BACKEND=iptables # Set any other options you want to give to filtergen when it runs from the # initscript here. See filtergen(8) for more details. FGOPTS="" filtergen-0.12.7/filtergen.80000644000175000017500000000524412657605413012567 00000000000000.\" -*- nroff -*- .TH FILTERGEN 8 "January 7, 2004" .SH NAME filtergen \- packet filter compiler .SH SYNOPSIS \fBfiltergen\fR [ \fB-h\fR | \fB--help\fR ] [ \fB-V\fR | \fB--version\fR ] [ \fB-c\fR | \fB--compile\fR ] [ \fB-t \fItarget\fB\fR | \fB--target=\fItarget\fB\fR ] [ \fB-o \fIoutfile\fB\fR | \fB--output=\fIoutfile\fB\fR ] \fIinfile\fR \fBfiltergen\fR [ \fB-h\fR | \fB--help\fR ] [ \fB-V\fR | \fB--version\fR ] [ \fB-c\fR | \fB--compile\fR ] [ \fB-t \fItarget\fB\fR | \fB--target=\fItarget\fB\fR ] [ \fB-o \fIoutfile\fB\fR | \fB--output=\fIoutfile\fB\fR ] [ \fB-F \fIpolicy\fB\fR | \fB--flush=\fIpolicy\fB\fR ] .SH DESCRIPTION \fBfiltergen\fR compiles a high-level filtering description language into a variety of target formats. .SH USAGE \fBfiltergen\fR reads the ruleset from the \fIinfile\fR specified on the command line (or standard input if \fIinfile\fR is "\-") and outputs to standard output (or \fIoutfile\fR) via an optionally specified backend. .PP Both short and GNU-style long option options are accepted: .TP \fB-c, --compile\fR Only try to "compile" the input, and do not generate any output. This may be useful to check that an input file has no syntax errors in it before one attempts to use the result on a live server. .TP \fB-t \fItarget-filter\fB, --target=\fItarget-filter\fB\fR If specified, \fItarget-filter\fR will be used to select an output filter type, otherwise the default of \fBiptables\fR will be used. Supported backends are \fBiptables\fR, \fBip6tables\fR, \fBiptables-restore\fR, \fBip6tables-restore\fR, \fBipchains\fR, \fBipfilter\fR and \fBcisco\fR (for Cisco IOS access-lists). .TP \fB-F \fIpolicy\fB, --flush=\fIpolicy\fB\fR Flush mode. Generate a set of rules for clearing all rules from the packet filter. Useful for firewall scripts that need to `shutdown' the firewall. You can supply a \fIpolicy\fR argument in place of the usual filename, to specify whether the flushed filter should default to \fBaccept\fR, \fBreject\fR, or \fBdrop\fR. It defaults to \fBaccept\fR, equivalent to having no filter loaded at all. It is not necessary to specify an \fIinfile\fR when using flush mode. .TP \fB-o \fIoutfile\fB, --output=\fIoutfile\fB\fR Write output to \fIoutfile\fR instead of standard output. .TP \fB-h, --help\fR Show command help. .TP \fB-V, --version\fR Show program version. .SH BUGS Not all backends implement all features. The packet filter is not optimised. .SH SEE ALSO \fBfgadm\fR(8), \fBfilter_syntax\fR(5), \fBfilter_backends\fR(7) .SH AUTHOR \fBfiltergen\fR was originally written by Matthew Kirkwood. Jamie Wilkinson then rewrote a lot of the internals, added some features, and took on maintenance of the project. filtergen-0.12.7/install-sh0000755000175000017500000003546312657562003012526 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2014-09-12.12; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) # $RANDOM is not portable (e.g. dash); use it when possible to # lower collision chance tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # As "mkdir -p" follows symlinks and we work in /tmp possibly; so # create the $tmpdir first (and fail if unsuccessful) to make sure # that nobody tries to guess the $tmpdir name. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: filtergen-0.12.7/AUTHORS0000644000175000017500000000053712455345651011570 00000000000000filtergen AUTHORS ================= The following people are the primary authors of filtergen. See also the file THANKS for a list of all contributors. Discussion of development occurs on the fk@hairy.beasts.org mailing list (also an easy way to reach the authors). Jamie Wilkinson Matthew Kirkwood filtergen-0.12.7/filter.c0000644000175000017500000002577012657605413012156 00000000000000/* data structure building routines * * Copyright (c) 2002,2003 Matthew Kirkwood * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "filter.h" #include #include #include #include #include #include static struct filter *__new_filter(enum filtertype type) { struct filter *f; if ((f = calloc(1, sizeof(*f)))) { f->type = type; } return f; } struct filter *new_filter_oneway(void) { return __new_filter(F_ONEWAY); } struct filter *new_filter_target(enum filtertype target) { struct filter *f; if ((f = __new_filter(F_TARGET))) { f->u.target = target; } return f; } struct filter *new_filter_log(enum filtertype type, const char *text) { struct filter *f; if ((f = __new_filter(type))) { f->u.logmsg = text ? strdup(text) : NULL; } return f; } struct filter *new_filter_rtype(enum filtertype rtype) { struct filter *f; if ((f = __new_filter(F_RTYPE))) { f->u.rtype = rtype; } return f; } struct filter *new_filter_neg(struct filter *sub) { struct filter *f; if ((f = __new_filter(F_NEG))) { f->u.neg = sub; } return f; } struct filter *new_filter_sibs(struct filter *list) { struct filter *f; if ((f = __new_filter(F_SIBLIST))) { f->u.sib = list; } return f; } struct filter *new_filter_subgroup(char *name, struct filter *list) { struct filter *f; if ((f = __new_filter(F_SUBGROUP))) { f->u.sub.name = name; f->u.sub.list = list; } return f; } struct filter *new_filter_proto(enum filtertype type, const char *name) { struct filter *f; struct protoent *e; int pn; if (!str_to_int(name, &pn)) e = getprotobynumber(pn); else e = getprotobyname(name); if (!e) { fprintf(stderr, "don't know protocol \"%s\"\n", name); return NULL; } if ((f = __new_filter(type))) { f->u.proto.num = e->p_proto; f->u.proto.name = strdup(e->p_name); } return f; } struct filter *new_filter_device(enum filtertype type, const char *iface) { struct filter *f; if ((f = __new_filter(F_DIRECTION))) { f->u.ifinfo.direction = type; f->u.ifinfo.iface = strdup(iface); } return f; } struct filter *new_filter_host(enum filtertype type, const char *matchstr, sa_family_t family) { struct filter *f; char *mask; int i; if (!(f = __new_filter(type))) return f; f->u.addrs.family = family; f->u.addrs.addrstr = strdup(matchstr); if ((mask = strchr(f->u.addrs.addrstr, '/'))) { *mask++ = 0; switch (family) { case AF_INET: if (!str_to_int(mask, &i)) { /* Netmask like foo/24 */ uint32_t l = 0xffffffff; if (i < 0 || i > 32) { fprintf(stderr, "can't parse netmask \"%s\"\n", mask); return NULL; } if (!i) l = 0; else { i = 32 - i; l >>= i; l <<= i; } f->u.addrs.u.inet.mask.s_addr = htonl(l); } else { /* Better be a /255.255.255.0 mask */ if (!inet_aton(mask, &f->u.addrs.u.inet.mask)) { fprintf(stderr, "can't parse netmask \"%s\"\n", mask); return NULL; } } f->u.addrs.maskstr = strdup(inet_ntoa(f->u.addrs.u.inet.mask)); break; case AF_INET6: if (!str_to_int(mask, &i)) { /* Netmask like foo/128 */ unsigned char l[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; unsigned char *p = l + 15; int o; if (i < 0 || i > 128) { fprintf(stderr, "can't parse netmask \"%s\"\n", mask); return NULL; } if (i != 0) { o = 128 - i; while (o > 8) { *p = 0x00; o -= 8; } if (!i) *p = 0x00; else { *p >>= o; *p <<= o; } } memcpy(f->u.addrs.u.inet6.mask.s6_addr, l, sizeof l); f->u.addrs.maskstr = int_to_str_dup(i); } else { fprintf(stderr, "can't parse netmask \"%s\"\n", mask); return NULL; } break; default: fprintf(stderr, "can't parse netmask \"%s\" for unknown address family\n", mask); return NULL; } } return f; } struct filter *new_filter_ports(enum filtertype type, const char *matchstr) { struct filter *f; struct servent *s; char *min, *max; int imin, imax; min = strdup(matchstr); if ((max = strchr(min, ':'))) { *max++ = 0; max = strdup(max); } if (str_to_int(min, &imin)) { if (!(s = getservbyname(min, NULL))) imin = -1; else { free(min); min = strdup(s->s_name); imin = ntohs(s->s_port); } } if (max) { if (str_to_int(max, &imax)) { if (!(s = getservbyname(max, NULL))) imax = -1; else { free(max); max = strdup(s->s_name); imax = ntohs(s->s_port); } } } else imax = imin; if ((f = __new_filter(type))) { f->u.ports.min = imin; f->u.ports.max = imax; f->u.ports.minstr = min; f->u.ports.maxstr = max; } return f; } struct filter *new_filter_icmp(enum filtertype type, const char *matchstr) { struct filter *f; if ((f = __new_filter(type))) { f->u.icmp = strdup(matchstr); } return f; } /* * These functions DAGify the parsed filter structure. * This means that we can walk all paths down the DAG * merely by following ->child and ->next. */ static void filter_append(struct filter *f, struct filter *x) { if (!f) abort(); if (!x) return; /* We have to be paranoid about making loops here */ while ((f->type != F_SIBLIST) && f->child) { if (f == x) return; f = f->child; } if (f == x) return; if (f->type == F_SIBLIST) { if (f->child) abort(); for (f = f->u.sib; f; f = f->next) filter_append(f, x); } else f->child = x; } /* * The easy bit of a cross-product. Basically we ensure that no * filter node has more than one path out. * 1. We push sibling->child down to the end of the component * sub-lists, and * 2. Ensure that negated entries have only a single component * hanging off them. */ void __filter_unroll(struct filter *f) { struct filter *c, *s; if (!f) return; /* depth first */ __filter_unroll(c = f->child); /* check this node */ switch (f->type) { case F_SIBLIST: for (s = f->u.sib; s; s = s->next) { __filter_unroll(s); filter_append(s, c); } f->child = NULL; break; case F_SUBGROUP: __filter_unroll(f->u.sub.list); break; case F_NEG: abort(); default: break; } /* lastly, go sideways */ __filter_unroll(f->next); } void __filter_neg_expand(struct filter **f, int neg) { if (!*f) return; __filter_neg_expand(&(*f)->child, neg); __filter_neg_expand(&(*f)->next, neg); switch ((*f)->type) { case F_SIBLIST: if (neg && (*f)->u.sib && (*f)->u.sib->next) { fprintf(stderr, "error: can't negate conjunctions\n"); exit(1); } __filter_neg_expand(&(*f)->u.sib, neg); break; case F_SUBGROUP: if (neg) { fprintf(stderr, "error: can't negate subgroups\n"); exit(1); } __filter_neg_expand(&(*f)->u.sub.list, neg); break; case F_NEG: { struct filter *c = (*f)->child, *n = (*f)->next; *f = (*f)->u.neg; neg = !neg; __filter_neg_expand(f, neg); if (c) filter_append(*f, c); (*f)->next = n; break; } default: break; } (*f)->negate = neg; } /* Move targets to end of each list */ void __filter_targets_to_end(struct filter **f) { if (!*f) return; if (((*f)->type == F_TARGET) && (*f)->child) { struct filter *c = (*f)->child; /* Unlink this one */ (*f)->child = NULL; /* Append ourselves */ filter_append(c, (*f)); /* Tell them upstairs */ *f = c; } else { __filter_targets_to_end(&(*f)->child); __filter_targets_to_end(&(*f)->next); } } void filter_unroll(struct filter **f) { __filter_neg_expand(f, 0); __filter_targets_to_end(f); __filter_unroll(*f); } void filter_nogroup(struct filter *f) { if (!f) return; switch (f->type) { case F_SUBGROUP: f->u.sib = f->u.sub.list; f->type = F_SIBLIST; /* fall through */ case F_SIBLIST: filter_nogroup(f->u.sib); break; default: ; } filter_nogroup(f->child); filter_nogroup(f->next); } /* Remove negations by reordering tree: * NEG(ent)->child,next * becomes * ent->next,child,next */ void filter_noneg(struct filter **f) { if (f) { }; return; } /* * Apply flags to the tree */ void filter_apply_flags(struct filter *f, long flags) { struct filter *s; if (!f) return; switch (f->type) { /* Structural things */ case F_SIBLIST: for (s = f->u.sib; s; s = s->next) filter_apply_flags(s, flags); break; case F_SUBGROUP: filter_apply_flags(f->u.sub.list, flags); break; case F_NEG: filter_apply_flags(f->u.neg, flags); break; /* Real things */ case F_SPORT: case F_DPORT: if (flags & FF_LOOKUP) { struct port_spec *p = &f->u.ports; if (p->min == -1) { fprintf(stderr, "warning: couldn't lookup service \"%s\"\n", p->minstr); break; } free(p->minstr); p->minstr = int_to_str_dup(p->min); if (p->maxstr) { if (p->max == -1) { fprintf(stderr, "warning: couldn't lookup service \"%s\"\n", p->minstr); break; } free(p->maxstr); p->maxstr = int_to_str_dup(p->max); } } break; case F_SOURCE: case F_DEST: if (flags & FF_LOOKUP) { struct addr_spec *a = &f->u.addrs; struct addrinfo hints; struct addrinfo *info = NULL; memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = a->family; if (getaddrinfo(a->addrstr, NULL, &hints, &info) == 0) { free(a->addrstr); a->addrstr = malloc(NI_MAXHOST + 1); if (getnameinfo(info->ai_addr, info->ai_addrlen, a->addrstr, NI_MAXHOST, NULL, 0, NI_NUMERICHOST)) { fprintf(stderr, "warning: can't stringify IP: %s\n", strerror(errno)); } freeaddrinfo(info); } else { fprintf(stderr, "warning: can't lookup name \"%s\"\n", a->addrstr); } } break; default: break; } filter_apply_flags(f->child, flags); filter_apply_flags(f->next, flags); } filtergen-0.12.7/filtergen.spec0000644000175000017500000000336212657605423013352 00000000000000Summary: packet filter generator for various firewall systems Name: filtergen Version: 0.12.7 Release: 1 License: GPL Group: Applications/System URL: http://spacepants.org/src/filtergen Packager: Jamie Wilkinson Source: http://spacepants.org/src/filtergen/download/%name-%version.tar.gz Buildroot: %{_tmppath}/%{name}-root BuildPrereq: rpm-build gcc flex make %description filtergen is a packet filter generator. It compiles a fairly high-level description language into iptables, ipchains, or ipfilter rules (and has bits of support for Cisco IOS access lists). %prep %setup -q ./configure %build make CFLAGS="${RPM_OPT_FLAGS}" %install rm -rf $RPM_BUILD_ROOT make PREFIX=${RPM_BUILD_ROOT}/usr BINDIR=${RPM_BUILD_ROOT}/sbin install %post /sbin/chkconfig --add filtergen /sbin/chkconfig filtergen off %preun /sbin/service filtergen accept /sbin/chkconfig --del filtergen %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) /sbin/filtergen /etc/init.d/filtergen /etc/filter/ %{_mandir}/* %doc HISTORY HONESTY README TODO tests/*.filter %changelog * Wed Aug 18 2004 Jamie Wilkinsin - 0.12.4-1 - New upstream release. * Tue Jun 22 2004 Jamie Wilkinson - 0.12.3-1 - New upstream release. * Thu Jun 10 2004 Jamie Wilkinson - 0.12.2-1 - New upstream release. * Wed Mar 10 2004 Jamie Wilkinson - 0.12-1 - New upstream release. * Wed Nov 13 2002 Matthew Kirkwood 0.11-1 - Release 0.11, rename init script from "filter" to "filtergen" * Mon Sep 2 2002 Matthew Kirkwood 0.10-1 - Add new sample and documentation stuff * Sun Aug 18 2002 Wil Cooley 0.8-1 - Initial RPM creation filtergen-0.12.7/fg-cisco.c0000644000175000017500000000733312657605413012356 00000000000000/* filter generator, Cisco IOS driver * * Copyright (c) 2002 Matthew Kirkwood * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* XXX - does this need skeleton rules? */ #include #include #include #include "filter.h" #include "util.h" static char *appip(char *r, const struct addr_spec *h) { if (!h->addrstr) return APPS(r, "any"); if (!h->maskstr) return APPS2(r, "host ", h->addrstr); return APPSS2(r, h->addrstr, h->maskstr); } static char *appport(char *r, const struct port_spec *p, int neg) { if (!p->minstr) return APPS(r, "any"); if (!p->maxstr) return APPS2(r, neg ? "ne " : "eq ", p->minstr); if (neg) abort(); APPS(r, "range"); APPSS2(r, p->minstr, p->maxstr); return r; } static int cb_cisco_rule(const struct filterent *ent, struct fg_misc *misc __attribute__((unused))) { char *rule = NULL, *rule_r = NULL; int needret = 0, needports = 1; APP(rule, "access-list "); APP(rule_r, "access-list "); /* access list name */ if (ent->iface) { APP2(rule, ent->iface, "-"); APP2(rule_r, ent->iface, "-"); } switch (ent->direction) { case INPUT: APP(rule, "IN"); APP(rule_r, "OUT"); break; case OUTPUT: APP(rule, "OUT"); APP(rule_r, "IN"); break; default: fprintf(stderr, "unknown direction\n"); abort(); } /* target */ switch (ent->target) { case T_ACCEPT: APPS(rule, "permit"); APPS(rule_r, "permit"); break; case DROP: APPS(rule, "deny"); APPS(rule_r, "deny"); break; case T_REJECT: fprintf(stderr, "warning: Cisco IOS does not support REJECT\n"); APPS(rule, "deny"); APPS(rule_r, "deny"); break; default: abort(); } /* protocol */ if (ent->proto.name) { APPS(rule, ent->proto.name); APPS(rule_r, ent->proto.name); switch (ent->proto.num) { case IPPROTO_TCP: case IPPROTO_UDP: needret++; break; default: needports = 0; } } else { APPS(rule, "ip"); APPS(rule_r, "ip"); } rule = appip(rule, &ent->srcaddr); rule = appip(rule, &ent->dstaddr); rule_r = appip(rule_r, &ent->dstaddr); rule_r = appip(rule_r, &ent->srcaddr); if (needports) { rule = appport(rule, &ent->u.ports.src, NEG(SPORT)); rule = appport(rule, &ent->u.ports.dst, NEG(DPORT)); rule_r = appport(rule_r, &ent->u.ports.dst, NEG(DPORT)); rule_r = appport(rule_r, &ent->u.ports.src, NEG(SPORT)); } if (ent->proto.num == IPPROTO_TCP) APPS(rule_r, "established"); if (ESET(ent, LOG)) APPS(rule, "log"); if (ent->oneway) needret = 0; oputs(rule); if (needret) oputs(rule_r); free(rule); free(rule_r); return 1 + !!needret; } int fg_cisco(struct filter *filter, int flags) { struct fg_misc misc = {flags, NULL}; fg_callback cb_cisco = {.rule = cb_cisco_rule, NULL}; oputs("# Warning: This backend is not complete and " "can generate broken rulesets."); filter_nogroup(filter); filter_unroll(&filter); filter_apply_flags(filter, flags); return filtergen_cprod(filter, &cb_cisco, &misc); } filtergen-0.12.7/fgadm.conf.in0000644000175000017500000000051212657466011013041 00000000000000# @SYSCONFDIR@/fgadm.conf # Set BACKEND to one of `iptables', `ipchains', `ipfilter', or `cisco', for # your particular packet filter target. The default is `iptables'. BACKEND=iptables # Set any other options you want to give to filtergen when it runs from the # initscript here. See filtergen(8) for more details. FGOPTS="" filtergen-0.12.7/fg-ipchains.c0000644000175000017500000001766112657605413013061 00000000000000/* filter generator, ipchains driver * * Copyright (c) 2002 Matthew Kirkwood * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * XXX - maybe some of this could be shared with the iptables one? */ #include #include #include #include "filter.h" #include "util.h" /* full path to ipchains executable */ #define IPCHAINS "/sbin/ipchains" static char *appip(char *r, const struct addr_spec *h) { APPS(r, h->addrstr); if (h->maskstr) APP2(r, "/", h->maskstr); return r; } #define APPIP(r, h) (r = appip(r, h)) #define APPIP2(f, r, h) (APPS(r, f), APPIP(r, h)) static char *appport(char *r, const struct port_spec *h) { APPS(r, h->minstr); if (h->maxstr) APP2(r, ":", h->maxstr); return r; } #define APPPORT(r, h) (r = appport(r, h)) #define APPPORT2(f, r, h) (APPS(r, f), APPPORT(r, h)) static int cb_ipchains_rule(const struct filterent *ent, struct fg_misc *misc __attribute__((unused))) { char *rule = NULL, *rule_r = NULL; char *rulechain = NULL, *revchain = NULL; char *ruletarget = NULL, *revtarget = NULL; char *forchain = NULL, *forrevchain = NULL; char *fortarget = NULL, *forrevtarget = NULL; char *subchain = NULL, *subtarget = NULL; int needret = 0; int isforward = (ent->rtype != LOCALONLY); int orules = 0; /* nat rule */ if ((ent->target == MASQ) || (ent->target == REDIRECT)) { if ((ent->target == MASQ) && (ent->direction == INPUT)) { fprintf(stderr, "can't masquerade on input\n"); return -1; } else if ((ent->target == REDIRECT) && (ent->direction == OUTPUT)) { fprintf(stderr, "can't redirect on output\n"); return -1; } } /* sub-stuff? */ if (ent->target == F_SUBGROUP) { subtarget = strapp(strdup(ent->subgroup), "-"); needret = 1; } else subtarget = strdup(""); if (ent->groupname) subchain = strapp(strdup(ent->groupname), "-"); else subchain = strdup(""); if (ent->rtype == ROUTEDONLY) { fprintf(stderr, "ipchains can't do forward-only rules\n"); return -1; } switch (ent->direction) { case INPUT: rulechain = strdup("input"); revchain = strdup("output"); forchain = strdup("forward"); forrevchain = strdup("forw_out"); break; case OUTPUT: rulechain = (ent->target == MASQ) ? strdup("forw_out") : strdup("output"); revchain = strdup("input"); forchain = strdup("forw_out"); forrevchain = strdup("forward"); break; default: fprintf(stderr, "unknown direction\n"); abort(); } if (ent->iface && strcmp(ent->iface, "*")) { if (NEG(DIRECTION)) { APPS(rule, "!"); APPS(rule_r, "!"); } APPSS2(rule, "-i", ent->iface); APPSS2(rule_r, "-i", ent->iface); } /* state and reverse rules here */ if (ent->proto.name) { APPSS2(rule, "-p", ent->proto.name); APPSS2(rule_r, "-p", ent->proto.name); switch (ent->proto.num) { case IPPROTO_TCP: APPS(rule_r, "! --syn"); /* fall through */ case IPPROTO_UDP: needret++; } } if (ent->srcaddr.addrstr) { NEGA(rule, SOURCE); NEGA(rule_r, SOURCE); APPIP2("-s", rule, &ent->srcaddr); APPIP2("-d", rule_r, &ent->srcaddr); } if (ent->dstaddr.addrstr) { NEGA(rule, DEST); NEGA(rule_r, DEST); APPIP2("-d", rule, &ent->dstaddr); APPIP2("-s", rule_r, &ent->dstaddr); } switch (ent->proto.num) { case 0: break; case IPPROTO_UDP: case IPPROTO_TCP: if (ent->u.ports.src.minstr) { NEGA(rule, SPORT); NEGA(rule_r, SPORT); APPPORT2("--sport", rule, &ent->u.ports.src); APPPORT2("--dport", rule_r, &ent->u.ports.src); } if (ent->u.ports.dst.minstr) { NEGA(rule, DPORT); NEGA(rule_r, DPORT); APPPORT2("--dport", rule, &ent->u.ports.dst); APPPORT2("--sport", rule_r, &ent->u.ports.dst); } break; case IPPROTO_ICMP: if (ent->u.icmp) { NEGA(rule, ICMPTYPE); APPSS2(rule, "--icmp-type", ent->u.icmp); } break; default: ; } if (ESET(ent, LOG)) APPS(rule, "-l"); APPS(rule, "-j"); APPS(rule_r, "-j"); switch (ent->target) { case T_ACCEPT: ruletarget = revtarget = fortarget = forrevtarget = strdup("ACCEPT"); switch (ent->direction) { case INPUT: fortarget = strdup("forw_out"); break; case OUTPUT: forrevtarget = strdup("forw_out"); break; default: abort(); } break; case DROP: ruletarget = fortarget = strdup("DENY"); needret = 0; break; case T_REJECT: ruletarget = fortarget = strdup("REJECT"); needret = 0; break; case MASQ: ruletarget = strdup("MASQ"); revtarget = strdup("ACCEPT"); break; case REDIRECT: ruletarget = strdup("REDIRECT"); revtarget = strdup("ACCEPT"); break; case F_SUBGROUP: switch (ent->direction) { case INPUT: ruletarget = strdup("input"); revtarget = strdup("output"); fortarget = strdup("forward"); forrevtarget = strdup("forw_out"); break; case OUTPUT: ruletarget = strdup("output"); revtarget = strdup("input"); fortarget = strdup("forw_out"); forrevtarget = strdup("forward"); break; default: abort(); } break; default: abort(); } if (ent->oneway) needret = 0; orules++, oprintf(IPCHAINS " -A %s%s %s %s%s\n", subchain, rulechain, rule + 1, subtarget, ruletarget); if (needret) orules++, oprintf(IPCHAINS " -I %s%s %s %s%s\n", subchain, revchain, rule_r + 1, subtarget, revtarget); if (isforward) { orules++, oprintf(IPCHAINS " -A %s%s %s %s%s\n", subchain, forchain, rule + 1, subtarget, fortarget); if (needret) orules++, oprintf(IPCHAINS " -I %s%s %s %s%s\n", subchain, forrevchain, rule_r + 1, subtarget, forrevtarget); } free(rule); free(rule_r); free(subchain); free(subtarget); return orules; } static int cb_ipchains_group(const char *name) { oprintf("for f in input output forward forw_out; do " IPCHAINS " -N %s-${f}; done\n", name); return 1; } int fg_ipchains(struct filter *filter, int flags) { int r; struct fg_misc misc = {flags, NULL}; fg_callback cb_ipchains = { .rule = cb_ipchains_rule, .group = cb_ipchains_group, }; filter_unroll(&filter); filter_apply_flags(filter, flags); if (!(flags & FF_NOSKEL)) { oputs("for f in INPUT OUTPUT FORWARD; do " IPCHAINS " -P $f DENY; done"); oputs(IPCHAINS " -F; " IPCHAINS " -X"); oputs(IPCHAINS " -N forw_out"); } if ((r = filtergen_cprod(filter, &cb_ipchains, &misc)) < 0) return r; #if 0 if(!(flags & FF_NOSKEL)) { oputs("for f in INPUT OUTPUT FORWARD forw_out; do "IPCHAINS" -A $f -l -j DENY; done"); r += 3; } #endif return r; } /* Rules which just flush the packet filter */ int flush_ipchains(enum filtertype policy) { char *ostr; oputs("CHAINS=\"INPUT OUTPUT FORWARD\""); oputs(""); switch (policy) { case T_ACCEPT: ostr = strdup("ACCEPT"); break; case DROP: ostr = strdup("DENY"); break; case T_REJECT: ostr = strdup("REJECT"); break; default: fprintf(stderr, "invalid filtertype %d\n", policy); abort(); } oprintf("for f in $CHAINS; do " IPCHAINS " -P $f %s; done\n", ostr); oputs(IPCHAINS " -F; " IPCHAINS " -X"); return 0; } filtergen-0.12.7/gen.c0000644000175000017500000001427312657605413011436 00000000000000/* filter compilation routines * * Copyright (c) 2002 Matthew Kirkwood * Copyright (c) 2003,2004 Jamie Wilkinson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "filter.h" void applydefaults(struct filterent *e, long flags) { if (!e->rtype) { if (flags & FF_LOCAL) e->rtype = LOCALONLY; else if (flags & FF_ROUTE) e->rtype = ROUTEDONLY; } } int checkmatch(const struct filterent *e) { int r = 0; #define MUST(t) \ do \ if (!(e->t)) { \ fprintf(stderr, "%s missing from filter\n", #t); \ r++; \ } \ while (0) if (!e->subgroup) MUST(target); if (!e->groupname) { MUST(direction); MUST(iface); } #undef MUST if ((e->u.ports.src.minstr || e->u.ports.dst.minstr) && (e->proto.num != IPPROTO_TCP) && (e->proto.num != IPPROTO_UDP)) { fprintf(stderr, "can only use ports with tcp or udp\n"); r++; } if (e->u.icmp && (e->proto.num != IPPROTO_ICMP)) { fprintf(stderr, "icmptype can only be used with icmp\n"); r++; } if ((e->rtype == LOCALONLY) && (e->target == MASQ)) { fprintf(stderr, "\"local\" and masquerading are incompatible\n"); r++; } return r; } int __fg_apply(struct filterent *e, const struct filter *f, fg_callback *cb, struct fg_misc *misc); int __fg_applylist(struct filterent *e, const struct filter *f, fg_callback *cb, struct fg_misc *misc) { /* This is the interesting one. The filters are * unrolled by now, so there's only one way to * follow it */ int c = 0; for (; f; f = f->next) { int _c = __fg_apply(e, f, cb, misc); if (_c < 0) return _c; c += _c; } return c; } int __fg_applyone(struct filterent *e, const struct filter *f, fg_callback *cb, struct fg_misc *misc) { #define _NA(t, f) \ if (f) { \ fprintf(stderr, "filter has already defined a %s\n", t); \ return -1; \ } #define NA(t) _NA(#t, e->t) #define NC(type, str) \ case F_##type: \ _NA(str, ESET(e, type)); \ e->whats_set |= (1 << F_##type); switch (f->type) { NC(TARGET, "target") e->target = f->u.target; break; NC(SUBGROUP, "subgroup") { struct filterent fe; int r; if (e->subgroup) { fprintf(stderr, "cannot compose subgroups\n"); return -1; } if (!cb->group) { fprintf( stderr, "backend doesn't support grouping, but hasn't removed groups\n"); abort(); } e->target = f->type; e->subgroup = f->u.sub.name; memset(&fe, 0, sizeof(fe)); fe.groupname = f->u.sub.name; /* direction is special -- we need to save it */ fe.direction = e->direction; cb->group(fe.groupname); if ((r = __fg_applylist(&fe, f->u.sub.list, cb, misc)) < 0) return r; break; } NC(DIRECTION, "direction and interface") NA(iface); e->direction = f->u.ifinfo.direction; e->iface = f->u.ifinfo.iface; break; case F_LOG: e->whats_set |= (1 << F_LOG); e->logmsg = f->u.logmsg; break; #define _DV(tag, str, test, targ, source) \ case F_##tag: \ _NA(str, e->test); \ e->targ = f->u.source; \ break #define DV(tag, targ, source) _DV(tag, #targ, targ, targ, source) _DV(PROTO, "protocol", proto.name, proto, proto); _DV(SOURCE, "source address", srcaddr.addrstr, srcaddr, addrs); _DV(DEST, "destination address", dstaddr.addrstr, dstaddr, addrs); _DV(SPORT, "source port", u.ports.src.minstr, u.ports.src, ports); _DV(DPORT, "destination port", u.ports.src.maxstr, u.ports.dst, ports); DV(ICMPTYPE, u.icmp, icmp); DV(RTYPE, rtype, rtype); case F_ONEWAY: e->oneway = 1; break; case F_SIBLIST: return __fg_applylist(e, f->u.sib, cb, misc); default: abort(); } if (f->negate) e->whats_negated |= (1 << f->type); return 0; } int __fg_apply(struct filterent *_e, const struct filter *f, fg_callback *cb, struct fg_misc *misc) { struct filterent e = *_e; /* Looks like we're all done */ if (!f) { applydefaults(&e, misc->flags); if (checkmatch(&e)) { fprintf(stderr, "filter definition incomplete\n"); return -1; } return cb->rule(&e, misc); } return __fg_applyone(&e, f, cb, misc) ? __fg_applyone(&e, f, cb, misc) : __fg_apply(&e, f->child, cb, misc); } int filtergen_cprod(struct filter *filter, fg_callback *cb, struct fg_misc *misc) { struct filterent e; memset(&e, 0, sizeof(e)); return __fg_applylist(&e, filter, cb, misc); } filtergen-0.12.7/config.guess0000755000175000017500000012475312657411231013037 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2015 Free Software Foundation, Inc. timestamp='2015-08-20' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ /sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || \ echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` machine=${arch}${endian}-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "${UNAME_MACHINE_ARCH}" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; *:Sortix:*:*) echo ${UNAME_MACHINE}-unknown-sortix exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; e2k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: filtergen-0.12.7/config.sub0000755000175000017500000010646012657411231012475 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2015 Free Software Foundation, Inc. timestamp='2015-08-20' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: filtergen-0.12.7/resolver.c0000644000175000017500000002436112657605413012525 00000000000000/* argument name resolver * * Copyright (c) 2004 Jamie Wilkinson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include #include #include #include "resolver.h" #include "ast.h" #include "icmpent.h" void resolve_option_specifier(struct option_specifier_s *n __attribute__((unused))) {} void resolve_icmptype_argument(struct icmptype_argument_s *n) { struct icmpent_s *i; if (n->icmptype) { if ((i = geticmpbyname(n->icmptype))) { free(n->icmptype); if (asprintf(&n->icmptype, "%s", i->i_type) < 0) { n->icmptype = NULL; fprintf( stderr, "error: asprintf allocation failed when converting icmptype %s\n", i->i_type); } } else { /* check that the icmptype is a number if we can't resolve it */ long m; char *e; m = strtol(n->icmptype, &e, 10); if (*e || m == LONG_MIN || m == LONG_MAX) { fprintf(stderr, "warning: suspicious icmp type encountered: %s\n", n->icmptype); } } } } void resolve_icmptype_argument_list(struct icmptype_argument_list_s *n) { if (n->list) { resolve_icmptype_argument_list(n->list); } if (n->arg) { resolve_icmptype_argument(n->arg); } } void resolve_icmptype_specifier(struct icmptype_specifier_s *n) { if (n->list) { resolve_icmptype_argument_list(n->list); } } void resolve_port_argument(struct port_argument_s *n) { struct servent *s; if (n->port_min) { /* try to resolve the port name */ if ((s = getservbyname(n->port_min, NULL))) { free(n->port_min); if (asprintf(&n->port_min, "%d", ntohs(s->s_port)) < 0) { n->port_min = NULL; fprintf(stderr, "error: asprintf allocation failed when resolving port %d\n", ntohs(s->s_port)); } } else { /* check that the port is a number if we can't resolve it */ long m; char *e; m = strtol(n->port_min, &e, 10); if (*e || m == LONG_MIN || m == LONG_MAX) { fprintf(stderr, "warning: suspicious port name encountered: %s\n", n->port_min); } } } if (n->port_max) { /* try to resolve the port name */ if ((s = getservbyname(n->port_max, NULL))) { free(n->port_max); if (asprintf(&n->port_max, "%d", ntohs(s->s_port)) < 0) { n->port_max = NULL; fprintf(stderr, "error: asprintf allocation failed when resolving port %d\n", ntohs(s->s_port)); } } else { /* check that the port is a number if we can't resolve it */ long m; char *e; m = strtol(n->port_max, &e, 10); if (*e || m == LONG_MIN || m == LONG_MAX) { fprintf(stderr, "warning: suspicious port name encountered: %s\n", n->port_max); } } } } void resolve_port_argument_list(struct port_argument_list_s *n) { if (n->list) { resolve_port_argument_list(n->list); } if (n->arg) { resolve_port_argument(n->arg); } } void resolve_port_specifier(struct port_specifier_s *n) { if (n->list) { resolve_port_argument_list(n->list); } } void resolve_protocol_argument(struct protocol_argument_s *n) { struct protoent *p; if (n->proto) { if ((p = getprotobyname(n->proto))) { free(n->proto); if (asprintf(&n->proto, "%d", p->p_proto) < 0) { n->proto = NULL; fprintf( stderr, "error: asprintf allocation failed when converting protocol %d\n", p->p_proto); } } else { /* check that the proto is a number if we can't resolve it */ long m; char *e; m = strtol(n->proto, &e, 10); if (*e || m == LONG_MIN || m == LONG_MAX) { fprintf(stderr, "warning: suspicious protocol name encountered: %s\n", n->proto); } } } } void resolve_protocol_argument_list(struct protocol_argument_list_s *n) { if (n->list) { resolve_protocol_argument_list(n->list); } if (n->arg) { resolve_protocol_argument(n->arg); } } void resolve_protocol_specifier(struct protocol_specifier_s *n) { if (n->list) { resolve_protocol_argument_list(n->list); } } void resolve_host_argument(struct host_argument_s *n __attribute__((unused))) {} void resolve_host_argument_list(struct host_argument_list_s *n, struct filtergen_opts *o) { struct addrinfo *a = NULL, *i; struct addrinfo hints; int r; struct host_argument_list_s *list = NULL; struct host_argument_s *host = NULL; if (n->list) { resolve_host_argument_list(n->list, o); } if (n->arg) { memset(&hints, 0, sizeof(struct addrinfo)); /* use our chosen address family */ hints.ai_family = o->family; /* return hostname, though we don't use it, for debugging */ hints.ai_flags = AI_CANONNAME; /* limit so duplicate hosts aren't returned for each socktype */ hints.ai_socktype = SOCK_STREAM; if (n->arg->host) { r = getaddrinfo(n->arg->host, NULL, &hints, &a); switch (r) { case 0: /* replace the hostname with the IP */ free(n->arg->host); /* getnameinfo does no allocation. */ n->arg->host = malloc(NI_MAXHOST + 1); if (getnameinfo(a->ai_addr, a->ai_addrlen, n->arg->host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) == 0) { /* if there's more, create some more hosts */ for (i = a->ai_next; i; i = i->ai_next) { list = malloc(sizeof(struct host_argument_list_s)); host = malloc(sizeof(struct host_argument_s)); host->host = malloc(NI_MAXHOST + 1); if (getnameinfo(i->ai_addr, i->ai_addrlen, host->host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) == 0) { if (n->arg->mask) { host->mask = strdup(n->arg->mask); } /* insert the new node */ list->arg = host; list->list = n->list; n->list = list; } else { fprintf(stderr, "warning: %s\n", strerror(errno)); } } } else { fprintf(stderr, "warning: %s\n", strerror(errno)); } freeaddrinfo(a); break; default: fprintf(stderr, "warning: %s: %s\n", gai_strerror(r), n->arg->host); break; } } } } void resolve_host_specifier(struct host_specifier_s *n, struct filtergen_opts *o) { if (n->list) { resolve_host_argument_list(n->list, o); } } void resolve_target_specifier(struct target_specifier_s *n __attribute__((unused))) {} void resolve_direction_argument(struct direction_argument_s *n __attribute__((unused))) {} void resolve_direction_argument_list(struct direction_argument_list_s *n) { if (n->list) { resolve_direction_argument_list(n->list); } if (n->arg) { resolve_direction_argument(n->arg); } } void resolve_direction_specifier(struct direction_specifier_s *n) { if (n->list) { resolve_direction_argument_list(n->list); } } void resolve_specifier_list(struct specifier_list_s *n, struct filtergen_opts *o); void resolve_subrule_list(struct subrule_list_s *n, struct filtergen_opts *o) { if (n->subrule_list) { resolve_subrule_list(n->subrule_list, o); } if (n->specifier_list) { resolve_specifier_list(n->specifier_list, o); } } void resolve_chaingroup_specifier(struct chaingroup_specifier_s *n, struct filtergen_opts *o) { if (n->list) { resolve_subrule_list(n->list, o); } } void resolve_compound_specifier(struct compound_specifier_s *n, struct filtergen_opts *o) { if (n->list) { resolve_subrule_list(n->list, o); } } void resolve_specifier(struct specifier_s *n, struct filtergen_opts *o) { if (n->compound) { resolve_compound_specifier(n->compound, o); } else if (n->direction) { resolve_direction_specifier(n->direction); } else if (n->target) { resolve_target_specifier(n->target); } else if (n->host) { resolve_host_specifier(n->host, o); } else if (n->port) { resolve_port_specifier(n->port); } else if (n->protocol) { resolve_protocol_specifier(n->protocol); } else if (n->icmptype) { resolve_icmptype_specifier(n->icmptype); } else if (n->option) { resolve_option_specifier(n->option); } else if (n->chaingroup) { resolve_chaingroup_specifier(n->chaingroup, o); } } void resolve_negated_specifier(struct negated_specifier_s *n, struct filtergen_opts *o) { if (n->spec) { resolve_specifier(n->spec, o); } } void resolve_specifier_list(struct specifier_list_s *n, struct filtergen_opts *o) { if (n->list) { resolve_specifier_list(n->list, o); } if (n->spec) { resolve_negated_specifier(n->spec, o); } } void resolve_rule(struct rule_s *n, struct filtergen_opts *o) { if (n->list) { resolve_specifier_list(n->list, o); } } void resolve_rule_list(struct rule_list_s *n, struct filtergen_opts *o) { if (n->list) { resolve_rule_list(n->list, o); } if (n->rule) { resolve_rule(n->rule, o); } } void resolve_ast(struct ast_s *n, struct filtergen_opts *o) { if (n->list) { resolve_rule_list(n->list, o); } } void resolve(struct ast_s *n, struct filtergen_opts *o) { if (n) { resolve_ast(n, o); } } filtergen-0.12.7/ast.h0000644000175000017500000000622712657605413011461 00000000000000/* syntax tree data structure definitions * * Copyright (c) 2003,2004 Jamie Wilkinson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __AST_H__ #define __AST_H__ struct specifier_list_s; struct subrule_list_s { struct subrule_list_s *subrule_list; struct specifier_list_s *specifier_list; }; struct chaingroup_specifier_s { char *name; struct subrule_list_s *list; }; struct compound_specifier_s { struct subrule_list_s *list; }; struct option_specifier_s { int type; char *logmsg; }; struct icmptype_argument_s { char *icmptype; }; struct icmptype_argument_list_s { struct icmptype_argument_list_s *list; struct icmptype_argument_s *arg; }; struct icmptype_specifier_s { struct icmptype_argument_list_s *list; }; struct protocol_argument_s { char *proto; }; struct protocol_argument_list_s { struct protocol_argument_list_s *list; struct protocol_argument_s *arg; }; struct protocol_specifier_s { struct protocol_argument_list_s *list; }; struct port_argument_s { char *port_min; char *port_max; }; struct port_argument_list_s { struct port_argument_list_s *list; struct port_argument_s *arg; }; struct port_specifier_s { int type; struct port_argument_list_s *list; }; struct host_argument_s { char *host; char *mask; }; struct host_argument_list_s { struct host_argument_list_s *list; struct host_argument_s *arg; }; struct host_specifier_s { int type; struct host_argument_list_s *list; }; struct target_specifier_s { int type; }; struct direction_argument_s { char *direction; }; struct direction_argument_list_s { struct direction_argument_list_s *list; struct direction_argument_s *arg; }; struct direction_specifier_s { int type; struct direction_argument_list_s *list; }; struct specifier_s { struct compound_specifier_s *compound; struct direction_specifier_s *direction; struct target_specifier_s *target; struct host_specifier_s *host; struct port_specifier_s *port; struct protocol_specifier_s *protocol; struct icmptype_specifier_s *icmptype; struct option_specifier_s *option; struct chaingroup_specifier_s *chaingroup; }; struct negated_specifier_s { int negated; struct specifier_s *spec; }; struct specifier_list_s { struct specifier_list_s *list; struct negated_specifier_s *spec; }; struct rule_s { struct specifier_list_s *list; }; struct rule_list_s { struct rule_list_s *list; struct rule_s *rule; }; struct ast_s { struct rule_list_s *list; }; #endif /* __AST_H__ */ filtergen-0.12.7/HONESTY0000644000175000017500000000215312455112734011562 00000000000000 FULL-DISCLOSURE (or HONESTY) WHAT'S THIS? Here, I explain the status of the package in non-salesman mode. It might help you to decide whether this package is currently useful to you (though shouldn't put you off contributing). STATUS The language is likely to evolve as more features are implemented. Specifically, I'd like it to express fundamental networking and filtering concepts, rather than being an iptables macro language. The transparent proxying, masquerading and logging support is not as flexible as I'd like it to be. "Grouping" (sub-chain) support is a fairly recent addition and, even in backends which support it (iptables, ipchains), isn't quite right yet. I have been using it on my home gateway for around a year now, and have a dozen or so production servers, and a production router using it too (all via the iptables backend). It has all worked very well. But "working well" does not imply security, and I have not expended a great deal of effort in auditing. See the filter_backends(7) man page for more details on backend- specific issues. $Id: HONESTY,v 1.9 2002/07/21 13:32:23 matthew Exp $ filtergen-0.12.7/depcomp0000755000175000017500000005601612657562003012074 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: filtergen-0.12.7/TODO0000644000175000017500000000432612657466010011205 00000000000000TODO for filtergen ================== * Better documentation. o [jaq] Support scripts, documentation * Better logging options. * Translate icmp names (at least for ipfilter and cisco) o [jaq] ICMP codes (--icmp-type x/y syntax for iptables) * "Loose" option to allow not-quite-correct rulesets to run, eg., using forward-only with ipchains * New backend: FreeBSD ipfw o [jaq] {iptables,ipchains}-restore target format o [jaq] handle resolver errors in resolve.c o [jaq] extra iptables-like commands: user, related state have them carry through to the generator and then have the generator discard rulesets it doesn't like (but be aware of them) * Fixup and maintain the cisco and ipfilter backends - Cisco needs testing, negation fixes and options for reflexive ACLs - ipfilter needs testing and masq, transproxy and grouping support * support sysctl tuning in iptables/ipchains (i.e. linux) targets o [jaq] "limit" rate limiting support * iproute2 "ip rule" backend * Testing and auditing of generated rulesets. o [jaq] Optimiser (de-pessimiser :-) for intermediate step, and also generated rulesets (the latter could be done with a peephole optimiser, I think). - equation factoriser should be simpler and quite good. factorising should be trivial, boolean factorisation never involves polynomials. must watch out for rules with side effects though. order matters. - optimise orthogonal rules by branch counts - future optimise orthogonal rules based on hit frequency * state ESTABLISHED on iptables rules for all rules * no conntrack (i.e. designed for large fast filters) option for iptables o [jaq] Implement a negation unroller for filters which can't negate a match. (For example, Ciscos can't say "match all but this host".) This gives us negation of {}-groups, too. * reject-with for reject target in iptables * ipac-friendly filters * New backend: iptables-save format * New frontend: iptables-save format * unit tests for recursive include * unit tests for all code paths in include directive * " characters in identifiers, do they need to exist? * forward/local specifiers in filtergen language removed. add them back? * generate icmp filters completely filtergen-0.12.7/filter_backends.70000644000175000017500000000375712657605413013735 00000000000000.\" -*- nroff -*- .TH "FILTER BACKENDS" 7 "January 7, 2004" .SH NAME filter_backends \- output drivers for the filtergen packet filter compiler .SH INTRODUCTION This document describes the status and feature-set of the currently available \fBfiltergen\fR backends. .SH IPTABLES, IP6TABLES Most development is done first against the iptables driver. It supports reject, masquerading, transparent proxying, logging (with text) and sub-groups, all of which should work fine (though the latter has only recently been fixed). The ip6tables driver is the IPv6 equivalent of the iptables driver. .SH IPTABLES-RESTORE, IP6TABLES-RESTORE The iptables-restore driver supports all of the features of the iptables driver. It emits a ruleset that is loaded atomically into Netfilter using iptables-restore. The ip6tables-restore driver is the IPv6 equivalent of the iptables-restore driver. .SH IPCHAINS The ipchains driver supports all of the above features, too. Its state model is much weaker though, of course. The forwarding support should work OK, though it is not possible to support "local"-only packets. .SH IPFILTER The ipfilter backend is incomplete. It supports accept, drop, reject and logging, but not masq, transproxy or sub-groups. It should be easy for someone with knowledge of ipfilter to add support for the other features. Options for OpenBSD "pf" features and syntax would be nice, too. It has received no testing; I don't even know if the generated filters are syntactically correct. .SH CISCO The cisco driver is in roughly the same sort of state as the ipfilter one. Additionally, because of the limitations of IOS ACLs, it supports only a limited set of features. It cannot support reject or transparent proxying, and may not be able to support masquerading either. An option for reflexive (stateful) ACLs would be very useful. I understand that Cisco PIX firewalls use a variant of this syntax -- it would be very nice to support them too. .SH SEE ALSO \fBfiltergen\fR(8), \fBfilter_syntax\fR(5) filtergen-0.12.7/filter_syntax.50000644000175000017500000002173612657575427013517 00000000000000.\" -*- nroff -*- .TH "FILTER SYNTAX" 5 "January 7, 2004" .SH NAME rules.filter \- Input format for filtergen packet filter compiler .SH INTRO This file describes the input syntax accepted by \fBfiltergen\fR(8). .SH BASICS In general form, a filter rule is described by a \fIdirection\fR, an \fIinterface\fR, a \fItarget\fR and (possibly empty) sets of \fImatches\fR and \fIoptions\fR. .PP Simple rules will look like: .I direction interface match0 .. matchN target; for example: \"XXX .I input eth0 source host1 dest host2 proto tcp dport http accept; Note that the elements of the rule can be placed in any order, with the exception that the \fIinterface\fR must \fIimmediately\fR follow the direction. Thus, this rule is equivalent to the above (though perhaps less readable): .I proto tcp source host1 dport http accept dest host2 input eth0; The semicolon separates rules. It is optional before a closing brace or the end of a file. Whitespace is not significant. Anything after a hash ("\fI#\fR") on a line is ignored. .SS DIRECTION A direction merely specifies whether to match packets being sent or received. The only two directions available are "input" and "output". Forwarded packets will pass through both, .SS INTERFACE This specifies which real or virtual network device to filter. As far as filtergen is concerned, this is just a text string. It must be the same as the device name on the target system. Common names on Linux are "eth0", "eth1", ..., "ppp0", etc. Other systems will have different naming rules. If you want to match all interfaces, you can specify "*" (without the quotes). .SS TARGET A \fItarget\fR notes what we do with a matching packet. Universal options are \fIaccept\fR and \fIdrop\fR which, respectively, state that the packet should be allowed as normal, or thrown away. Some backends support \fIreject\fR to throw away a packet, but send notification to the sender that it was denied, \fImasq\fR (on \fIoutput\fR rules only) to "masquerade" a packet - alter it so that it appears to come from the address of the sending interface - and \fIproxy\fR (and its deprecated alias \fIredirect\fR) to divert a connection via the local system. .SS MATCHES The \fImatches\fR are the meat of the rule. They apply a set of tests to a packet and decide if this rule will be used to process it. Available matches are: .I source addr-range .I dest addr-range .I proto {tcp|udp|icmp|...} .I sport port-range .I dport port-range .I icmptype icmp-type Matches can be negated by prefixing them with a "!": .nf input eth0 ! dest 10.0.0.3 reject; .fi (note than not all backends can support this). .SS OPTIONS \fIOptions\fR affect the behaviour of the matcher or the target. Currently implemented are \fIlog\fR, which logs packets, \fIlocal\fR, which means only to check packets to or from this interface, \fIforward\fR which means the opposite of \fIlocal\fR, and \fIoneway\fR which causes the backend to omit rules which permit return packets. The \fIlog\fR option can optionally specify a message to log matching packets with, where the backend supports it: .nf input eth0 source { 10.0.0.0/8 192.168.0.0/16 } log text "private addresses" drop; .fi Note that the \fIoneway\fR option make have no effect when used with the \fB-l\fR command-line flag on backends which support it. .SH GROUPING Because it can get tedious to type: .nf input eth0 source foo dest bar proto tcp dport http accept; input eth0 source foo dest bar proto tcp dport https accept; input eth0 source foo dest bar proto tcp dport nntp accept; input eth0 source foo dest bar proto tcp sport 1:1023 dport ssh accept; \... .fi filter allows you to group rules with a set syntax: .nf input eth0 source foo dest bar proto tcp { dport http; dport https; dport nntp; sport 1:1023 dport ssh; } accept; .fi Matches which accept arguments can also be grouped: .nf input eth0 source foo dest bar proto tcp { dport {http https nntp}; sport 1:1023 dport ssh; } accept; .fi .SH "OUT-OF-LINE GROUPS" It is commonly the case that both hosts and routers have long lists of similar looking rules to allow traffic between groups of hosts, as above. What if we had another pair of hosts which needed a variety of services? We could simply put the rule groups one after the other: .nf input eth0 source foo dest bar proto tcp { dport {http https nntp}; sport 1:1023 dport ssh; } accept; input eth0 source baz dest quux proto tcp { dport {1264 1521 1984 8008 8080 26000}; } accept; .fi The above generates 11 rules, and every additional port adds another rule through which packets will pass (well, ones which don't match any of the above). The first four output rules have the same source and destination hosts and protocol, and we know that if it doesn't match those on the first rule, it won't on the next three, either. Out-of-line groups use this fact to streamline things somewhat: .nf input eth0 source foo dest bar [ proto tcp { dport {http https nntp}; sport 1:1023 dport ssh; } accept; ]; input eth0 source baz dest quux [ proto tcp { dport {1264 1521 1984 8008 8080 26000}; } accept; ]; .fi Where the underlying system supports it, everything inside the square brackets is moved into a separate "chain" (in ipchains and iptables-speak) or "group" (in ipfilter-speak). Thus, any packet not matching "source foo dest bar" or "source baz dest quux" above will be checked against only two rules, not eleven. Note that matches which must appear together, like "proto tcp" and "sport 12345" need to be either both in the group, or both out of it. .SH INCLUDING OTHER FILES You can, if necessary, include other files containing filtergen statements in your filter files, with the \fIinclude\fR directive. This is legal anywhere in the file, and acts as if you literally read the included file into the position where the \fIinclude\fR is placed. This allows you to, for example, specify a common set of addresses (say, your monitoring system) and reference them in multiple locations: .nf input eth0 { proto tcp dport ssh source { include monitoring-hosts.acl } accept; ... # NRPE proto tcp dport 5666 source { include monitoring-hosts.acl } accept; } output eth0 { proto tcp sport ssh dest { include monitoring-hosts.acl } accept; ... # NRPE proto tcp sport 5666 source { include monitoring-hosts.acl } accept; } .fi Whilst you could improve this particular example without an \fIinclude\fR by grouping your ssh and NRPE ports together, you'd still have two places to edit when you changed your set of monitoring hosts. Using include, you can have a single place to change when you change your monitoring hosts. You can also include a glob of files, rather than a single file, by using one of the shell globbing metacharacters '\fI*\fR', '\fI?\fR', or '\fI[\fR'. This will cause filtergen to expand that glob and parse the files as if you had included them one-by-one, in your locale's sorted order. This is very handy if you configure your systems with an automated system, because you can dump a series of files into a directory depending on what classes are defined, and filtergen will pick them all up. The sorting is to ensure that your rules appear in the order you want them, rather than some higgledy-piggledy mess. Note that any directories that match your glob will not be recursively included in this mode. Finally, you can just provide a directory name, and filtergen will include all the files and directories under there, recursively (excluding hidden files, starting with a '.'). \fBThis method of including files is strongly deprecated\fR. There is no defined sort order, and if your editor leaves backup or temporary files around, or your configuration management system puts it's backups in the same directory as the original file (cfengine, I'm looking at \fIyou\fR), you can find yourself including files you really didn't intend -- hence why it is a bad idea. Instead, use a glob (above) with an explicit extension (we like \fI*.fg\fR) to perform your directory inclusions with minimal chance of accidents. .SH EXAMPLE Here's a fairly complete example, for a single-interface machine: .nf # # Example filter for (for example) a mail server # # Unfortunately, we don't have time to audit the # communications which go on locally {input lo; output lo} accept; # But we want to be a bit more careful when speaking # to the outside world input eth0 { # Sadly, we share a DMZ with Windows machines. # Don't log their netbios noise proto {tcp udp} source ournet/24 dport 137:139 drop; proto tcp { dport { smtp pop-3 } accept; dport ssh source ournet/24 accept; # We don't answer this, but don't want to # cause timeouts by blocking it dport auth reject; log drop; }; # We don't run any UDP (or other non-TCP) # services log drop; }; output eth0 { proto tcp { dport { smtp auth } accept; log drop; }; # Outbound DNS is OK proto udp dport domain dest { ns0 ns1 } accept; log drop; }; .fi .SH SEE ALSO \fBfiltergen\fR(8), \fBfilter_backends\fR(7) filtergen-0.12.7/fgadm.80000644000175000017500000000454412455573643011675 00000000000000.\" -*- nroff -*- .TH FGADM 8 "June 7, 2004" .SH NAME fgadm \- filtergen command program .SH SYNOPSIS \fBfgadm\fR [ \fBcheck\fR | \fBreload\fR | \fBsave\fR | \fBstop\fR ] .SH DESCRIPTION \fBfgadm\fR is a simple command interface for managing \fBfiltergen\fR(8) based packet filters. .SH USAGE \fBfgadm\fR can be used to stop existing filters (thus turning them off), reload new packet filters, save currently running filters for longevity, and to check filter scripts for errors before reloading. .PP The following commands are accepted by \fBfgadm\fR: .TP \fBcheck\fR Check the filter script \fI/etc/filtergen/rules.filter\fR for errors. The generated filter will be printed on standard output, and errors printed to standard error. .TP \fBreload\fR Replace the current live packet filter with the one in \fI/etc/filtergen/rules.filter\fR. The script will be tested for errors before reloading. .TP \fBsave\fR The current live packet filter will be saved in a distribution-friendly way. On Red Hat systems, this will save the iptables or ipchains firewall that is currently loaded into the kernel to load at boot with the \fIiptables\fR or \fIipchains\fR initscript. .TP \fBstop\fR This command will flush the current live packet filter out and put it in a default accept mode, thus no firewalling will be in place. This is useful to abort firewalls in an emergency. .SH EXAMPLES One may find the following sequence of commands useful for making firewall changes on live servers: .br # \fBat now + 2 min\fR .br warning: commands will be executed using (in order) a) $SHELL b) login shell c) /bin/sh .br at> \fBfgadm stop\fR .br at> \fB^D\fR .br job 53 at 2004-06-07 17:25 .br # \fBfgadm check\fR .br # \fBfgadm reload\fR .br # \fBatq\fR .br 53 .br # \fBatrm 53\fR .br # \fBfgadm save\fR .SH FILES .SS /etc/filtergen/rules.filter Packet filter descriptions are read from this file when \fBfgadm\fR is used. .SS /etc/filtergen/fgadm.conf This file alters the behaviour of \fBfiltergen\fR as called from \fBfgadm\fR. .SH BUGS \fBfgadm save\fR does not work on Debian systems with iptables due to a lack of common sense in the iptables package. .SH SEE ALSO \fBfiltergen\fR(8), \fBfilter_syntax\fR(5), \fBfilter_backends\fR(5) .SH AUTHOR \fBfgadm\fR was written by Jamie Wilkinson for the filtergen package, to ease maintenance of filtergen-based firewalls. filtergen-0.12.7/extras/0000755000175000017500000000000012657606274012106 500000000000000filtergen-0.12.7/extras/etc-filter-Makefile0000644000175000017500000000106212656736250015516 00000000000000# slightly configurable things # XXX - autodetect format RULEBASE=example FILTERFLAGS= FILTERGEN=/sbin/filtergen FORMAT=iptables all: $(RULEBASE).$(FORMAT).out %.$(FORMAT).out: %.filter $(FILTERGEN) $(FILTERFLAGS) -t $(FORMAT) $< > $@.new if [ -f $@ ]; then mv $@ $@.old; fi mv $@.new $@ install: all PATH=$$PATH:/sbin:/usr/sbin sh $(RULEBASE).out $(FORMAT).accept: $(FILTERGEN) $(FILTERFLAGS) -t $(FORMAT) -F accept > $@.new if [ -f $@ ]; then mv $@ $@.old; fi mv $@.new $@ accept: $(FORMAT).accept PATH=$$PATH:/sbin:/usr/sbin sh $(FORMAT).accept filtergen-0.12.7/extras/filter.init0000644000175000017500000000127712656736250014204 00000000000000#!/bin/bash # # filter Apply packet filtering rules # # chkconfig: 2345 5 95 # description: Apply / remove packet filtering rules # # probe: true # Source function library. . /etc/init.d/functions if [ ! -f /etc/sysconfig/network ]; then exit 0 fi . /etc/sysconfig/network # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 case "$1" in start|restart|reload) action $"Loading packet filter rules" make -C /etc/filter install ;; stop) action $"Not removing packet filter rules" true ;; accept) action $"Flushing firewall rules, default accept" make -C /etc/filter accept ;; *) echo $"Usage: $0 {start|stop|restart|reload|accept}" exit 1 esac exit 0 filtergen-0.12.7/THANKS0000644000175000017500000000061012657605413011422 00000000000000filtergen THANKS ================ Many people further contributed to filtergen by reporting problems, suggesting various improvements or submitting actual code. Here is a list of these people, alphabetically by surname. Help me keep it complete and exempt of errors. Michael Chapman Matt Palmer Glen Turner filtergen-0.12.7/configure.ac0000644000175000017500000000536312657605413013007 00000000000000AC_PREREQ(2.50) AC_INIT(filtergen, 0.12.7, jaq@spacepants.org) AC_CONFIG_AUX_DIR(.) AC_CONFIG_SRCDIR(filtergen.c) AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE([foreign dist-bzip2 parallel-tests color-tests]) AM_MAINTAINER_MODE AC_SUBST(PROGRAM) AC_SUBST(VERSION) dnl -------------------------- dnl configuration success flag dnl -------------------------- filtergen_config_ok=yes dnl ------------------- dnl checks for programs dnl ------------------- AC_PROG_CC AM_PROG_LEX AC_PROG_YACC dnl ------------------- dnl check for libraries dnl ------------------- AC_CHECK_HEADERS([getopt.h]) HAVE_GETOPT=no AC_CHECK_LIB(getopt, getopt, HAVE_GETOPT=yes HAVE_GETOPT=no ) if test "x$HAVE_GETOPT" = xyes ; then GETOPT_LIBS="-lgetopt" AC_SUBST(GETOPT_LIBS) fi dnl ----------------- dnl set warning level dnl ----------------- if test "x$ac_cv_c_compiler_gnu" = xyes ; then CFLAGS="$CFLAGS -W -Wall -Werror -Waggregate-return" CFLAGS="$CFLAGS -Wcast-align -Wcast-qual -Wnested-externs" CFLAGS="$CFLAGS -Wshadow -Wbad-function-cast -Wwrite-strings" CFLAGS="$CFLAGS -Winit-self -Wformat=2 -Wuninitialized" CFLAGS="$CFLAGS -Wpointer-arith" CFLAGS="$CFLAGS -Wstrict-aliasing -fstrict-aliasing" fi dnl --------------- dnl set debug level dnl --------------- AC_MSG_CHECKING([whether to enable debugging compiler options]) AC_ARG_ENABLE(debug, [ --enable-debug enable debugging compiler options], AC_MSG_RESULT(yes) tmp_CFLAGS=`echo $CFLAGS | sed 's/O2/O0/g'` CFLAGS="$tmp_CFLAGS", AC_MSG_RESULT(no) ) dnl ------------------------------ dnl fill in path variable expandos dnl ------------------------------ dnl $libdir usually gets set to ${exec_prefix}/lib, dnl $prefix and $exec_prefix is likely to be "NONE" dnl Autoconf usually sets pkglibdir correctly in the Makefile, but not in dnl the configure script :( test "$prefix" = "NONE" && prefix=/usr/local test "$exec_prefix" = "NONE" && exec_prefix=$prefix dnl Executable files eval BINDIR="$bindir" AC_SUBST(BINDIR) eval SBINDIR="$sbindir" AC_SUBST(SBINDIR) dnl Configuration files eval SYSCONFDIR="$sysconfdir" AC_SUBST(SYSCONFDIR) dnl Documentation eval pkgdocdir="$datadir/doc/$PACKAGE" AC_SUBST(pkgdocdir) dnl Example scripts eval pkgexdir="$pkgdocdir/examples" AC_SUBST(pkgexdir) dnl ---------------------------------------------------------- dnl configuration tests complete, provide a summary of results dnl ---------------------------------------------------------- if test "x$filtergen_config_ok" = xno ; then echo "nothing yet" else dnl Dump it out AC_CONFIG_FILES([ Makefile t/Makefile filtergen.spec fgadm fgadm.conf rules.filter ]) AC_OUTPUT AC_MSG_RESULT([ filtergen $VERSION: automatic configuration OK. Type 'make' to compile filtergen. Type 'make install' to install filtergen. ]) fi filtergen-0.12.7/INSTALL0000644000175000017500000000215112657466010011540 00000000000000INSTALLING filtergen ============== Installing filtergen is easy. If you're on a Red Hat-like RPM-based system, you should be able just to run "rpm -ta" on the tarball. Otherwise, just ensure that you have gcc and flex installed, type "make", then "make install". AT-BOOT ------- There are two files in the extras/ directory which make life easier in Red Hat-like systems. My usual installation makes an /etc/filter/ directory and puts the ruleset and a Makefile in there. The latter knows how to turn the filter script into an appropriate output file ("make" does this), and how to load the ruleset ("make install"). filter.init is a SysV init script which invokes make at boot to do these things. Run "/etc/init.d/filter help" to see what it can do. It supports chkconfig. Note that if you intend to load filters at boot, you should install filtergen in /sbin/, in case not all filesystems are mounted at that point. The RPM does all of these things. It does _not_ configure the init script to run at boot, though. You can do that with "chkconfig filter on". $Id: INSTALL,v 1.1 2002/09/12 09:56:25 matthew Exp $ filtergen-0.12.7/parser.c0000644000175000017500000021235312657576066012173 00000000000000/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Copy the first part of user declarations. */ #line 20 "parser.y" /* yacc.c:339 */ #include #include #include #include "ast.h" void yyerror(void *parse_arg, const char *s); extern int yylex(void); #define YYPRINT(f, t, v) yyprint(f, t, v) #line 78 "parser.c" /* yacc.c:339 */ #ifndef YY_NULLPTR #if defined __cplusplus && 201103L <= __cplusplus #define YY_NULLPTR nullptr #else #define YY_NULLPTR 0 #endif #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE #undef YYERROR_VERBOSE #define YYERROR_VERBOSE 1 #else #define YYERROR_VERBOSE 0 #endif /* In a future release of Bison, this section will be replaced by #include "y.tab.h". */ #ifndef YY_YY_PARSER_H_INCLUDED #define YY_YY_PARSER_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG #define YYDEBUG 1 #endif #if YYDEBUG extern int yydebug; #endif /* Token type. */ #ifndef YYTOKENTYPE #define YYTOKENTYPE enum yytokentype { TOK_ACCEPT = 258, TOK_DEST = 259, TOK_DPORT = 260, TOK_DROP = 261, TOK_FORWARD = 262, TOK_ICMPTYPE = 263, TOK_INPUT = 264, TOK_LCURLY = 265, TOK_LOCAL = 266, TOK_LOG = 267, TOK_LSQUARE = 268, TOK_MASQ = 269, TOK_ONEWAY = 270, TOK_OUTPUT = 271, TOK_PROTO = 272, TOK_PROXY = 273, TOK_RCURLY = 274, TOK_REDIRECT = 275, TOK_REJECT = 276, TOK_RSQUARE = 277, TOK_SEMICOLON = 278, TOK_SOURCE = 279, TOK_SPORT = 280, TOK_TEXT = 281, TOK_IDENTIFIER = 282, TOK_DOT = 283, TOK_SLASH = 284, TOK_ERR = 285, TOK_BANG = 286, TOK_COLON = 287, TOK_STAR = 288 }; #endif /* Tokens. */ #define TOK_ACCEPT 258 #define TOK_DEST 259 #define TOK_DPORT 260 #define TOK_DROP 261 #define TOK_FORWARD 262 #define TOK_ICMPTYPE 263 #define TOK_INPUT 264 #define TOK_LCURLY 265 #define TOK_LOCAL 266 #define TOK_LOG 267 #define TOK_LSQUARE 268 #define TOK_MASQ 269 #define TOK_ONEWAY 270 #define TOK_OUTPUT 271 #define TOK_PROTO 272 #define TOK_PROXY 273 #define TOK_RCURLY 274 #define TOK_REDIRECT 275 #define TOK_REJECT 276 #define TOK_RSQUARE 277 #define TOK_SEMICOLON 278 #define TOK_SOURCE 279 #define TOK_SPORT 280 #define TOK_TEXT 281 #define TOK_IDENTIFIER 282 #define TOK_DOT 283 #define TOK_SLASH 284 #define TOK_ERR 285 #define TOK_BANG 286 #define TOK_COLON 287 #define TOK_STAR 288 /* Value type. */ #if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 34 "parser.y" /* yacc.c:355 */ struct rule_list_s *u_rule_list; struct rule_s *u_rule; struct specifier_list_s *u_specifier_list; struct negated_specifier_s *u_negated_specifier; struct specifier_s *u_specifier; struct direction_specifier_s *u_direction_specifier; struct direction_argument_list_s *u_direction_argument_list; struct direction_argument_s *u_direction_argument; struct target_specifier_s *u_target_specifier; struct log_target_specifier_s *u_log_target_specifier; struct host_specifier_s *u_host_specifier; struct host_argument_list_s *u_host_argument_list; struct host_argument_s *u_host_argument; struct port_specifier_s *u_port_specifier; struct port_argument_list_s *u_port_argument_list; struct port_argument_s *u_port_argument; struct protocol_specifier_s *u_protocol_specifier; struct protocol_argument_list_s *u_protocol_argument_list; struct protocol_argument_s *u_protocol_argument; struct icmptype_specifier_s *u_icmptype_specifier; struct icmptype_argument_list_s *u_icmptype_argument_list; struct icmptype_argument_s *u_icmptype_argument; struct option_specifier_s *u_option_specifier; struct compound_specifier_s *u_compound_specifier; struct chaingroup_specifier_s *u_chaingroup_specifier; struct subrule_list_s *u_subrule_list; char *u_str; #line 214 "parser.c" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; #define YYSTYPE_IS_TRIVIAL 1 #define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE yylval; int yyparse(void *parse_arg); #endif /* !YY_YY_PARSER_H_INCLUDED */ /* Copy the second part of user declarations. */ #line 126 "parser.y" /* yacc.c:358 */ int yyprint(FILE *f, int t, YYSTYPE v); #line 234 "parser.c" /* yacc.c:358 */ #ifdef short #undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T #ifdef __SIZE_TYPE__ #define YYSIZE_T __SIZE_TYPE__ #elif defined size_t #define YYSIZE_T size_t #elif !defined YYSIZE_T #include /* INFRINGES ON USER NAME SPACE */ #define YYSIZE_T size_t #else #define YYSIZE_T unsigned int #endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T)-1) #ifndef YY_ #if defined YYENABLE_NLS && YYENABLE_NLS #if ENABLE_NLS #include /* INFRINGES ON USER NAME SPACE */ #define YY_(Msgid) dgettext("bison-runtime", Msgid) #endif #endif #ifndef YY_ #define YY_(Msgid) Msgid #endif #endif #ifndef YY_ATTRIBUTE #if (defined __GNUC__ && \ (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) || \ defined __SUNPRO_C && 0x5110 <= __SUNPRO_C #define YY_ATTRIBUTE(Spec) __attribute__(Spec) #else #define YY_ATTRIBUTE(Spec) /* empty */ #endif #endif #ifndef YY_ATTRIBUTE_PURE #define YY_ATTRIBUTE_PURE YY_ATTRIBUTE((__pure__)) #endif #ifndef YY_ATTRIBUTE_UNUSED #define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE((__unused__)) #endif #if !defined _Noreturn && \ (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) #if defined _MSC_VER && 1200 <= _MSC_VER #define _Noreturn __declspec(noreturn) #else #define _Noreturn YY_ATTRIBUTE((__noreturn__)) #endif #endif /* Suppress unused-variable warnings by "using" E. */ #if !defined lint || defined __GNUC__ #define YYUSE(E) ((void)(E)) #else #define YYUSE(E) /* empty */ #endif #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ #define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") #define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop") #else #define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN #define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN #define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE #define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if !defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ #ifdef YYSTACK_USE_ALLOCA #if YYSTACK_USE_ALLOCA #ifdef __GNUC__ #define YYSTACK_ALLOC __builtin_alloca #elif defined __BUILTIN_VA_ARG_INCR #include /* INFRINGES ON USER NAME SPACE */ #elif defined _AIX #define YYSTACK_ALLOC __alloca #elif defined _MSC_VER #include /* INFRINGES ON USER NAME SPACE */ #define alloca _alloca #else #define YYSTACK_ALLOC alloca #if !defined _ALLOCA_H && !defined EXIT_SUCCESS #include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 #endif #endif #endif #endif #endif #ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ #define YYSTACK_FREE(Ptr) \ do {/* empty */ \ ; \ } while (0) #ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ #define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ #endif #else #define YYSTACK_ALLOC YYMALLOC #define YYSTACK_FREE YYFREE #ifndef YYSTACK_ALLOC_MAXIMUM #define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM #endif #if (defined __cplusplus && !defined EXIT_SUCCESS && \ !((defined YYMALLOC || defined malloc) && \ (defined YYFREE || defined free))) #include /* INFRINGES ON USER NAME SPACE */ #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 #endif #endif #ifndef YYMALLOC #define YYMALLOC malloc #if !defined malloc && !defined EXIT_SUCCESS void *malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ #endif #endif #ifndef YYFREE #define YYFREE free #if !defined free && !defined EXIT_SUCCESS void free(void *); /* INFRINGES ON USER NAME SPACE */ #endif #endif #endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (!defined yyoverflow && \ (!defined __cplusplus || \ (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ #define YYSTACK_GAP_MAXIMUM (sizeof(union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ #define YYSTACK_BYTES(N) \ ((N) * (sizeof(yytype_int16) + sizeof(YYSTYPE)) + YYSTACK_GAP_MAXIMUM) #define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ #define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do { \ YYSIZE_T yynewbytes; \ YYCOPY(&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof(*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof(*yyptr); \ } while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ #ifndef YYCOPY #if defined __GNUC__ && 1 < __GNUC__ #define YYCOPY(Dst, Src, Count) \ __builtin_memcpy(Dst, Src, (Count) * sizeof(*(Src))) #else #define YYCOPY(Dst, Src, Count) \ do { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } while (0) #endif #endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 113 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 34 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 32 /* YYNRULES -- Number of rules. */ #define YYNRULES 70 /* YYNSTATES -- Number of states. */ #define YYNSTATES 96 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 288 #define YYTRANSLATE(YYX) \ ((unsigned int)(YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33}; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 131, 131, 139, 142, 150, 158, 161, 169, 175, 183, 189, 195, 201, 207, 213, 219, 225, 231, 239, 245, 253, 257, 261, 271, 274, 282, 289, 294, 299, 304, 309, 314, 321, 327, 335, 339, 346, 349, 357, 363, 371, 377, 385, 389, 394, 400, 408, 414, 422, 429, 433, 440, 443, 451, 458, 465, 469, 476, 479, 487, 494, 500, 506, 512, 518, 526, 533, 539, 547, 553}; #endif #if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "TOK_ACCEPT", "TOK_DEST", "TOK_DPORT", "TOK_DROP", "TOK_FORWARD", "TOK_ICMPTYPE", "TOK_INPUT", "TOK_LCURLY", "TOK_LOCAL", "TOK_LOG", "TOK_LSQUARE", "TOK_MASQ", "TOK_ONEWAY", "TOK_OUTPUT", "TOK_PROTO", "TOK_PROXY", "TOK_RCURLY", "TOK_REDIRECT", "TOK_REJECT", "TOK_RSQUARE", "TOK_SEMICOLON", "TOK_SOURCE", "TOK_SPORT", "TOK_TEXT", "TOK_IDENTIFIER", "TOK_DOT", "TOK_SLASH", "TOK_ERR", "TOK_BANG", "TOK_COLON", "TOK_STAR", "$accept", "ast", "rule_list", "rule", "specifier_list", "negated_specifier", "specifier", "direction_specifier", "direction_argument_list", "direction_argument_list_", "direction_argument", "target_specifier", "host_specifier", "host_argument_list", "host_argument_list_", "host_argument", "port_specifier", "port_argument_list", "port_argument_list_", "port_argument", "protocol_specifier", "protocol_argument_list", "protocol_argument_list_", "protocol_argument", "icmptype_specifier", "icmptype_argument_list", "icmptype_argument_list_", "icmptype_argument", "option_specifier", "compound_specifier", "subrule_list", "chaingroup_specifier", YY_NULLPTR}; #endif #ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288}; #endif #define YYPACT_NINF -16 #define yypact_value_is_default(Yystate) (!!((Yystate) == (-16))) #define YYTABLE_NINF -3 #define yytable_value_is_error(Yytable_value) 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int8 yypact[] = { -16, 27, 32, -16, -16, -1, -16, 52, 11, -16, -16, 53, 8, -16, -16, 42, 43, -16, -16, 8, 59, -16, -16, -16, -16, 52, 11, 75, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, 45, 11, 41, -16, 47, -16, -16, -16, 49, -16, -16, -16, 67, 40, 12, 70, -16, 17, -16, -16, -16, 71, -16, -16, -16, 6, 72, -16, 83, 76, -16, 7, -16, -16, 9, -16, -16, -16, -16, -16, 44, -16, 10, -16, -16, -16, 77, -16, -16, -16, -16, 40, -16, -16, -16}; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 3, 0, 6, 1, 4, 0, 27, 37, 0, 29, 62, 58, 24, 6, 61, 65, 6, 30, 63, 24, 52, 31, 32, 28, 5, 37, 0, 0, 7, 8, 11, 12, 13, 14, 15, 16, 17, 10, 18, 37, 34, 35, 0, 48, 42, 43, 45, 58, 55, 56, 24, 23, 19, 21, 67, 0, 0, 6, 0, 20, 52, 49, 50, 33, 41, 9, 0, 40, 38, 0, 0, 46, 0, 60, 59, 0, 26, 25, 66, 6, 64, 0, 70, 0, 54, 53, 36, 0, 44, 47, 57, 22, 68, 69, 51, 39}; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = {-16, -16, -16, -16, -2, -16, 78, -16, 87, 57, -16, -16, -16, 84, 69, -16, -16, 33, -16, 65, -16, -16, 51, -16, -16, -16, 66, -16, -16, -16, -15, -16}; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 1, 2, 4, 54, 28, 29, 30, 52, 53, 77, 31, 32, 40, 41, 68, 33, 44, 45, 46, 34, 61, 62, 85, 35, 48, 49, 74, 36, 37, 55, 38}; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int8 yytable[] = { 5, 58, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 50, 22, 23, 42, 24, 25, 26, 86, 90, 3, 91, 94, 27, 78, -2, 67, 73, 79, 76, 84, 43, 82, 79, 51, 81, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 64, 22, 23, 39, 47, 25, 26, 93, 79, 56, 60, 57, 27, 67, 70, 43, 69, 73, 92, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 76, 22, 23, 80, 84, 25, 26, 87, 88, 89, 95, 65, 59, 75, 66, 63, 71, 83, 0, 72}; static const yytype_int8 yycheck[] = { 2, 16, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 10, 20, 21, 10, 23, 24, 25, 19, 19, 0, 19, 19, 31, 19, 0, 27, 27, 23, 27, 27, 27, 22, 23, 33, 57, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 26, 20, 21, 10, 10, 24, 25, 22, 23, 26, 10, 27, 31, 27, 32, 27, 42, 27, 79, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 27, 20, 21, 27, 27, 24, 25, 29, 19, 27, 27, 27, 19, 50, 39, 25, 45, 60, -1, 47}; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 35, 36, 0, 37, 38, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 23, 24, 25, 31, 39, 40, 41, 45, 46, 50, 54, 58, 62, 63, 65, 10, 47, 48, 10, 27, 51, 52, 53, 10, 59, 60, 10, 33, 42, 43, 38, 64, 26, 27, 64, 42, 10, 55, 56, 47, 51, 40, 48, 27, 49, 51, 32, 53, 60, 27, 61, 43, 27, 44, 19, 23, 27, 64, 22, 56, 27, 57, 19, 29, 19, 27, 19, 19, 38, 22, 19, 27}; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 34, 35, 36, 36, 37, 38, 38, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, 42, 42, 42, 43, 43, 44, 45, 45, 45, 45, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 56, 57, 58, 59, 59, 60, 60, 61, 62, 62, 62, 62, 62, 63, 64, 64, 65, 65}; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 0, 2, 2, 0, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 3, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 3, 0, 2, 3, 1, 2, 2, 1, 3, 1, 2, 3, 1, 2, 1, 3, 0, 2, 1, 2, 1, 3, 0, 2, 1, 1, 1, 1, 3, 1, 3, 1, 3, 4, 3}; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK(yylen); \ yystate = *yyssp; \ goto yybackup; \ } else { \ yyerror(parse_arg, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 /* Enable debugging if requested. */ #if YYDEBUG #ifndef YYFPRINTF #include /* INFRINGES ON USER NAME SPACE */ #define YYFPRINTF fprintf #endif #define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT #define YY_LOCATION_PRINT(File, Loc) ((void)0) #endif #define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) { \ YYFPRINTF(stderr, "%s ", Title); \ yy_symbol_print(stderr, Type, Value, parse_arg); \ YYFPRINTF(stderr, "\n"); \ } \ } while (0) /*----------------------------------------. | Print this symbol's value on YYOUTPUT. | `----------------------------------------*/ static void yy_symbol_value_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep, void *parse_arg) { FILE *yyo = yyoutput; YYUSE(yyo); YYUSE(parse_arg); if (!yyvaluep) return; #ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT(yyoutput, yytoknum[yytype], *yyvaluep); #endif YYUSE(yytype); } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ static void yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep, void *parse_arg) { YYFPRINTF(yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print(yyoutput, yytype, yyvaluep, parse_arg); YYFPRINTF(yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print(yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF(stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF(stderr, " %d", yybot); } YYFPRINTF(stderr, "\n"); } #define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print(yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, void *parse_arg) { unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF(stderr, " $%d = ", yyi + 1); yy_symbol_print(stderr, yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]), parse_arg); YYFPRINTF(stderr, "\n"); } } #define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print(yyssp, yyvsp, Rule, parse_arg); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ #define YYDPRINTF(Args) #define YY_SYMBOL_PRINT(Title, Type, Value, Location) #define YY_STACK_PRINT(Bottom, Top) #define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE #ifndef yystrlen #if defined __GLIBC__ && defined _STRING_H #define yystrlen strlen #else /* Return the length of YYSTR. */ static YYSIZE_T yystrlen(const char *yystr) { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } #endif #endif #ifndef yystpcpy #if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE #define yystpcpy stpcpy #else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char *yystpcpy(char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } #endif #endif #ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr(char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (!yyres) return yystrlen(yystr); return yystpcpy(yyres, yystr) - yyres; } #endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error(YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr(YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default(yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error(yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr(YY_NULLPTR, yytname[yyx]); if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { #define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_( 5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); #undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen(yyformat); if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (!(yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr(yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *parse_arg) { YYUSE(yyvaluep); YYUSE(parse_arg); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE(yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END } /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ int yyparse(void *parse_arg) { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: 'yyss': related to states. 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow(YY_("memory exhausted"), &yyss1, yysize * sizeof(*yyssp), &yyvs1, yysize * sizeof(*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ #ifndef YYSTACK_RELOCATE goto yyexhaustedlab; #else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *)YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize)); if (!yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE(yyss_alloc, yyss); YYSTACK_RELOCATE(yyvs_alloc, yyvs); #undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE(yyss1); } #endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF((stderr, "Stack size increased to %lu\n", (unsigned long int)yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default(yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF((stderr, "Reading a token: ")); yychar = yylex(); } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE(yychar); YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error(yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1 - yylen]; YY_REDUCE_PRINT(yyn); switch (yyn) { case 2: #line 132 "parser.y" /* yacc.c:1646 */ { /* we expect parse_arg to be already allocated, and that * it is of type (struct ast_s *) */ ((struct ast_s *)parse_arg)->list = (yyvsp[0].u_rule_list); } #line 1402 "parser.c" /* yacc.c:1646 */ break; case 3: #line 139 "parser.y" /* yacc.c:1646 */ { (yyval.u_rule_list) = NULL; } #line 1410 "parser.c" /* yacc.c:1646 */ break; case 4: #line 143 "parser.y" /* yacc.c:1646 */ { (yyval.u_rule_list) = malloc(sizeof(struct rule_list_s)); (yyval.u_rule_list)->list = (yyvsp[-1].u_rule_list); (yyval.u_rule_list)->rule = (yyvsp[0].u_rule); } #line 1420 "parser.c" /* yacc.c:1646 */ break; case 5: #line 151 "parser.y" /* yacc.c:1646 */ { (yyval.u_rule) = malloc(sizeof(struct rule_s)); (yyval.u_rule)->list = (yyvsp[-1].u_specifier_list); } #line 1429 "parser.c" /* yacc.c:1646 */ break; case 6: #line 158 "parser.y" /* yacc.c:1646 */ { (yyval.u_specifier_list) = NULL; } #line 1437 "parser.c" /* yacc.c:1646 */ break; case 7: #line 162 "parser.y" /* yacc.c:1646 */ { (yyval.u_specifier_list) = malloc(sizeof(struct specifier_list_s)); (yyval.u_specifier_list)->list = (yyvsp[-1].u_specifier_list); (yyval.u_specifier_list)->spec = (yyvsp[0].u_negated_specifier); } #line 1447 "parser.c" /* yacc.c:1646 */ break; case 8: #line 170 "parser.y" /* yacc.c:1646 */ { (yyval.u_negated_specifier) = malloc(sizeof(struct negated_specifier_s)); (yyval.u_negated_specifier)->negated = 0; (yyval.u_negated_specifier)->spec = (yyvsp[0].u_specifier); } #line 1457 "parser.c" /* yacc.c:1646 */ break; case 9: #line 176 "parser.y" /* yacc.c:1646 */ { (yyval.u_negated_specifier) = malloc(sizeof(struct negated_specifier_s)); (yyval.u_negated_specifier)->negated = 1; (yyval.u_negated_specifier)->spec = (yyvsp[0].u_specifier); } #line 1467 "parser.c" /* yacc.c:1646 */ break; case 10: #line 184 "parser.y" /* yacc.c:1646 */ { (yyval.u_specifier) = malloc(sizeof(struct specifier_s)); memset((yyval.u_specifier), 0, sizeof(struct specifier_s)); (yyval.u_specifier)->compound = (yyvsp[0].u_compound_specifier); } #line 1477 "parser.c" /* yacc.c:1646 */ break; case 11: #line 190 "parser.y" /* yacc.c:1646 */ { (yyval.u_specifier) = malloc(sizeof(struct specifier_s)); memset((yyval.u_specifier), 0, sizeof(struct specifier_s)); (yyval.u_specifier)->direction = (yyvsp[0].u_direction_specifier); } #line 1487 "parser.c" /* yacc.c:1646 */ break; case 12: #line 196 "parser.y" /* yacc.c:1646 */ { (yyval.u_specifier) = malloc(sizeof(struct specifier_s)); memset((yyval.u_specifier), 0, sizeof(struct specifier_s)); (yyval.u_specifier)->target = (yyvsp[0].u_target_specifier); } #line 1497 "parser.c" /* yacc.c:1646 */ break; case 13: #line 202 "parser.y" /* yacc.c:1646 */ { (yyval.u_specifier) = malloc(sizeof(struct specifier_s)); memset((yyval.u_specifier), 0, sizeof(struct specifier_s)); (yyval.u_specifier)->host = (yyvsp[0].u_host_specifier); } #line 1507 "parser.c" /* yacc.c:1646 */ break; case 14: #line 208 "parser.y" /* yacc.c:1646 */ { (yyval.u_specifier) = malloc(sizeof(struct specifier_s)); memset((yyval.u_specifier), 0, sizeof(struct specifier_s)); (yyval.u_specifier)->port = (yyvsp[0].u_port_specifier); } #line 1517 "parser.c" /* yacc.c:1646 */ break; case 15: #line 214 "parser.y" /* yacc.c:1646 */ { (yyval.u_specifier) = malloc(sizeof(struct specifier_s)); memset((yyval.u_specifier), 0, sizeof(struct specifier_s)); (yyval.u_specifier)->protocol = (yyvsp[0].u_protocol_specifier); } #line 1527 "parser.c" /* yacc.c:1646 */ break; case 16: #line 220 "parser.y" /* yacc.c:1646 */ { (yyval.u_specifier) = malloc(sizeof(struct specifier_s)); memset((yyval.u_specifier), 0, sizeof(struct specifier_s)); (yyval.u_specifier)->icmptype = (yyvsp[0].u_icmptype_specifier); } #line 1537 "parser.c" /* yacc.c:1646 */ break; case 17: #line 226 "parser.y" /* yacc.c:1646 */ { (yyval.u_specifier) = malloc(sizeof(struct specifier_s)); memset((yyval.u_specifier), 0, sizeof(struct specifier_s)); (yyval.u_specifier)->option = (yyvsp[0].u_option_specifier); } #line 1547 "parser.c" /* yacc.c:1646 */ break; case 18: #line 232 "parser.y" /* yacc.c:1646 */ { (yyval.u_specifier) = malloc(sizeof(struct specifier_s)); memset((yyval.u_specifier), 0, sizeof(struct specifier_s)); (yyval.u_specifier)->chaingroup = (yyvsp[0].u_chaingroup_specifier); } #line 1557 "parser.c" /* yacc.c:1646 */ break; case 19: #line 240 "parser.y" /* yacc.c:1646 */ { (yyval.u_direction_specifier) = malloc(sizeof(struct direction_specifier_s)); (yyval.u_direction_specifier)->type = TOK_INPUT; (yyval.u_direction_specifier)->list = (yyvsp[0].u_direction_argument_list); } #line 1567 "parser.c" /* yacc.c:1646 */ break; case 20: #line 246 "parser.y" /* yacc.c:1646 */ { (yyval.u_direction_specifier) = malloc(sizeof(struct direction_specifier_s)); (yyval.u_direction_specifier)->type = TOK_OUTPUT; (yyval.u_direction_specifier)->list = (yyvsp[0].u_direction_argument_list); } #line 1577 "parser.c" /* yacc.c:1646 */ break; case 21: #line 254 "parser.y" /* yacc.c:1646 */ { (yyval.u_direction_argument_list) = (yyvsp[0].u_direction_argument_list); } #line 1585 "parser.c" /* yacc.c:1646 */ break; case 22: #line 258 "parser.y" /* yacc.c:1646 */ { (yyval.u_direction_argument_list) = (yyvsp[-1].u_direction_argument_list); } #line 1593 "parser.c" /* yacc.c:1646 */ break; case 23: #line 262 "parser.y" /* yacc.c:1646 */ { (yyval.u_direction_argument_list) = malloc(sizeof(struct direction_argument_list_s)); (yyval.u_direction_argument_list)->list = NULL; (yyval.u_direction_argument_list)->arg = malloc(sizeof(struct direction_argument_s)); (yyval.u_direction_argument_list)->arg->direction = strdup("*"); } #line 1604 "parser.c" /* yacc.c:1646 */ break; case 24: #line 271 "parser.y" /* yacc.c:1646 */ { (yyval.u_direction_argument_list) = NULL; } #line 1612 "parser.c" /* yacc.c:1646 */ break; case 25: #line 275 "parser.y" /* yacc.c:1646 */ { (yyval.u_direction_argument_list) = malloc(sizeof(struct direction_argument_list_s)); (yyval.u_direction_argument_list)->list = (yyvsp[-1].u_direction_argument_list); (yyval.u_direction_argument_list)->arg = (yyvsp[0].u_direction_argument); } #line 1622 "parser.c" /* yacc.c:1646 */ break; case 26: #line 283 "parser.y" /* yacc.c:1646 */ { (yyval.u_direction_argument) = malloc(sizeof(struct direction_argument_s)); (yyval.u_direction_argument)->direction = (yyvsp[0].u_str); } #line 1631 "parser.c" /* yacc.c:1646 */ break; case 27: #line 290 "parser.y" /* yacc.c:1646 */ { (yyval.u_target_specifier) = malloc(sizeof(struct target_specifier_s)); (yyval.u_target_specifier)->type = TOK_ACCEPT; } #line 1640 "parser.c" /* yacc.c:1646 */ break; case 28: #line 295 "parser.y" /* yacc.c:1646 */ { (yyval.u_target_specifier) = malloc(sizeof(struct target_specifier_s)); (yyval.u_target_specifier)->type = TOK_REJECT; } #line 1649 "parser.c" /* yacc.c:1646 */ break; case 29: #line 300 "parser.y" /* yacc.c:1646 */ { (yyval.u_target_specifier) = malloc(sizeof(struct target_specifier_s)); (yyval.u_target_specifier)->type = TOK_DROP; } #line 1658 "parser.c" /* yacc.c:1646 */ break; case 30: #line 305 "parser.y" /* yacc.c:1646 */ { (yyval.u_target_specifier) = malloc(sizeof(struct target_specifier_s)); (yyval.u_target_specifier)->type = TOK_MASQ; } #line 1667 "parser.c" /* yacc.c:1646 */ break; case 31: #line 310 "parser.y" /* yacc.c:1646 */ { (yyval.u_target_specifier) = malloc(sizeof(struct target_specifier_s)); (yyval.u_target_specifier)->type = TOK_PROXY; } #line 1676 "parser.c" /* yacc.c:1646 */ break; case 32: #line 315 "parser.y" /* yacc.c:1646 */ { (yyval.u_target_specifier) = malloc(sizeof(struct target_specifier_s)); (yyval.u_target_specifier)->type = TOK_REDIRECT; } #line 1685 "parser.c" /* yacc.c:1646 */ break; case 33: #line 322 "parser.y" /* yacc.c:1646 */ { (yyval.u_host_specifier) = malloc(sizeof(struct host_specifier_s)); (yyval.u_host_specifier)->type = TOK_SOURCE; (yyval.u_host_specifier)->list = (yyvsp[0].u_host_argument_list); } #line 1695 "parser.c" /* yacc.c:1646 */ break; case 34: #line 328 "parser.y" /* yacc.c:1646 */ { (yyval.u_host_specifier) = malloc(sizeof(struct host_specifier_s)); (yyval.u_host_specifier)->type = TOK_DEST; (yyval.u_host_specifier)->list = (yyvsp[0].u_host_argument_list); } #line 1705 "parser.c" /* yacc.c:1646 */ break; case 35: #line 336 "parser.y" /* yacc.c:1646 */ { (yyval.u_host_argument_list) = (yyvsp[0].u_host_argument_list); } #line 1713 "parser.c" /* yacc.c:1646 */ break; case 36: #line 340 "parser.y" /* yacc.c:1646 */ { (yyval.u_host_argument_list) = (yyvsp[-1].u_host_argument_list); } #line 1721 "parser.c" /* yacc.c:1646 */ break; case 37: #line 346 "parser.y" /* yacc.c:1646 */ { (yyval.u_host_argument_list) = NULL; } #line 1729 "parser.c" /* yacc.c:1646 */ break; case 38: #line 350 "parser.y" /* yacc.c:1646 */ { (yyval.u_host_argument_list) = malloc(sizeof(struct host_argument_list_s)); (yyval.u_host_argument_list)->list = (yyvsp[-1].u_host_argument_list); (yyval.u_host_argument_list)->arg = (yyvsp[0].u_host_argument); } #line 1739 "parser.c" /* yacc.c:1646 */ break; case 39: #line 358 "parser.y" /* yacc.c:1646 */ { (yyval.u_host_argument) = malloc(sizeof(struct host_argument_s)); (yyval.u_host_argument)->host = (yyvsp[-2].u_str); (yyval.u_host_argument)->mask = (yyvsp[0].u_str); } #line 1749 "parser.c" /* yacc.c:1646 */ break; case 40: #line 364 "parser.y" /* yacc.c:1646 */ { (yyval.u_host_argument) = malloc(sizeof(struct host_argument_s)); (yyval.u_host_argument)->host = (yyvsp[0].u_str); (yyval.u_host_argument)->mask = 0; } #line 1759 "parser.c" /* yacc.c:1646 */ break; case 41: #line 372 "parser.y" /* yacc.c:1646 */ { (yyval.u_port_specifier) = malloc(sizeof(struct port_specifier_s)); (yyval.u_port_specifier)->type = TOK_SPORT; (yyval.u_port_specifier)->list = (yyvsp[0].u_port_argument_list); } #line 1769 "parser.c" /* yacc.c:1646 */ break; case 42: #line 378 "parser.y" /* yacc.c:1646 */ { (yyval.u_port_specifier) = malloc(sizeof(struct port_specifier_s)); (yyval.u_port_specifier)->type = TOK_DPORT; (yyval.u_port_specifier)->list = (yyvsp[0].u_port_argument_list); } #line 1779 "parser.c" /* yacc.c:1646 */ break; case 43: #line 386 "parser.y" /* yacc.c:1646 */ { (yyval.u_port_argument_list) = (yyvsp[0].u_port_argument_list); } #line 1787 "parser.c" /* yacc.c:1646 */ break; case 44: #line 390 "parser.y" /* yacc.c:1646 */ { (yyval.u_port_argument_list) = (yyvsp[-1].u_port_argument_list); } #line 1795 "parser.c" /* yacc.c:1646 */ break; case 45: #line 395 "parser.y" /* yacc.c:1646 */ { (yyval.u_port_argument_list) = malloc(sizeof(struct port_argument_list_s)); (yyval.u_port_argument_list)->list = NULL; (yyval.u_port_argument_list)->arg = (yyvsp[0].u_port_argument); } #line 1805 "parser.c" /* yacc.c:1646 */ break; case 46: #line 401 "parser.y" /* yacc.c:1646 */ { (yyval.u_port_argument_list) = malloc(sizeof(struct port_argument_list_s)); (yyval.u_port_argument_list)->list = (yyvsp[-1].u_port_argument_list); (yyval.u_port_argument_list)->arg = (yyvsp[0].u_port_argument); } #line 1815 "parser.c" /* yacc.c:1646 */ break; case 47: #line 409 "parser.y" /* yacc.c:1646 */ { (yyval.u_port_argument) = malloc(sizeof(struct port_argument_s)); (yyval.u_port_argument)->port_min = (yyvsp[-2].u_str); (yyval.u_port_argument)->port_max = (yyvsp[0].u_str); } #line 1825 "parser.c" /* yacc.c:1646 */ break; case 48: #line 415 "parser.y" /* yacc.c:1646 */ { (yyval.u_port_argument) = malloc(sizeof(struct port_argument_s)); (yyval.u_port_argument)->port_min = (yyvsp[0].u_str); (yyval.u_port_argument)->port_max = NULL; } #line 1835 "parser.c" /* yacc.c:1646 */ break; case 49: #line 423 "parser.y" /* yacc.c:1646 */ { (yyval.u_protocol_specifier) = malloc(sizeof(struct protocol_specifier_s)); (yyval.u_protocol_specifier)->list = (yyvsp[0].u_protocol_argument_list); } #line 1844 "parser.c" /* yacc.c:1646 */ break; case 50: #line 430 "parser.y" /* yacc.c:1646 */ { (yyval.u_protocol_argument_list) = (yyvsp[0].u_protocol_argument_list); } #line 1852 "parser.c" /* yacc.c:1646 */ break; case 51: #line 434 "parser.y" /* yacc.c:1646 */ { (yyval.u_protocol_argument_list) = (yyvsp[-1].u_protocol_argument_list); } #line 1860 "parser.c" /* yacc.c:1646 */ break; case 52: #line 440 "parser.y" /* yacc.c:1646 */ { (yyval.u_protocol_argument_list) = NULL; } #line 1868 "parser.c" /* yacc.c:1646 */ break; case 53: #line 444 "parser.y" /* yacc.c:1646 */ { (yyval.u_protocol_argument_list) = malloc(sizeof(struct protocol_argument_list_s)); (yyval.u_protocol_argument_list)->list = (yyvsp[-1].u_protocol_argument_list); (yyval.u_protocol_argument_list)->arg = (yyvsp[0].u_protocol_argument); } #line 1878 "parser.c" /* yacc.c:1646 */ break; case 54: #line 452 "parser.y" /* yacc.c:1646 */ { (yyval.u_protocol_argument) = malloc(sizeof(struct protocol_argument_s)); (yyval.u_protocol_argument)->proto = strdup((yyvsp[0].u_str)); } #line 1887 "parser.c" /* yacc.c:1646 */ break; case 55: #line 459 "parser.y" /* yacc.c:1646 */ { (yyval.u_icmptype_specifier) = malloc(sizeof(struct icmptype_specifier_s)); (yyval.u_icmptype_specifier)->list = (yyvsp[0].u_icmptype_argument_list); } #line 1896 "parser.c" /* yacc.c:1646 */ break; case 56: #line 466 "parser.y" /* yacc.c:1646 */ { (yyval.u_icmptype_argument_list) = (yyvsp[0].u_icmptype_argument_list); } #line 1904 "parser.c" /* yacc.c:1646 */ break; case 57: #line 470 "parser.y" /* yacc.c:1646 */ { (yyval.u_icmptype_argument_list) = (yyvsp[-1].u_icmptype_argument_list); } #line 1912 "parser.c" /* yacc.c:1646 */ break; case 58: #line 476 "parser.y" /* yacc.c:1646 */ { (yyval.u_icmptype_argument_list) = NULL; } #line 1920 "parser.c" /* yacc.c:1646 */ break; case 59: #line 480 "parser.y" /* yacc.c:1646 */ { (yyval.u_icmptype_argument_list) = malloc(sizeof(struct icmptype_argument_list_s)); (yyval.u_icmptype_argument_list)->list = (yyvsp[-1].u_icmptype_argument_list); (yyval.u_icmptype_argument_list)->arg = (yyvsp[0].u_icmptype_argument); } #line 1930 "parser.c" /* yacc.c:1646 */ break; case 60: #line 488 "parser.y" /* yacc.c:1646 */ { (yyval.u_icmptype_argument) = malloc(sizeof(struct icmptype_argument_s)); (yyval.u_icmptype_argument)->icmptype = (yyvsp[0].u_str); } #line 1939 "parser.c" /* yacc.c:1646 */ break; case 61: #line 495 "parser.y" /* yacc.c:1646 */ { (yyval.u_option_specifier) = malloc(sizeof(struct option_specifier_s)); (yyval.u_option_specifier)->type = TOK_LOCAL; (yyval.u_option_specifier)->logmsg = 0; } #line 1949 "parser.c" /* yacc.c:1646 */ break; case 62: #line 501 "parser.y" /* yacc.c:1646 */ { (yyval.u_option_specifier) = malloc(sizeof(struct option_specifier_s)); (yyval.u_option_specifier)->type = TOK_FORWARD; (yyval.u_option_specifier)->logmsg = 0; } #line 1959 "parser.c" /* yacc.c:1646 */ break; case 63: #line 507 "parser.y" /* yacc.c:1646 */ { (yyval.u_option_specifier) = malloc(sizeof(struct option_specifier_s)); (yyval.u_option_specifier)->type = TOK_ONEWAY; (yyval.u_option_specifier)->logmsg = 0; } #line 1969 "parser.c" /* yacc.c:1646 */ break; case 64: #line 513 "parser.y" /* yacc.c:1646 */ { (yyval.u_option_specifier) = malloc(sizeof(struct option_specifier_s)); (yyval.u_option_specifier)->type = TOK_LOG; (yyval.u_option_specifier)->logmsg = (yyvsp[0].u_str); } #line 1979 "parser.c" /* yacc.c:1646 */ break; case 65: #line 519 "parser.y" /* yacc.c:1646 */ { (yyval.u_option_specifier) = malloc(sizeof(struct option_specifier_s)); (yyval.u_option_specifier)->type = TOK_LOG; (yyval.u_option_specifier)->logmsg = 0; } #line 1989 "parser.c" /* yacc.c:1646 */ break; case 66: #line 527 "parser.y" /* yacc.c:1646 */ { (yyval.u_compound_specifier) = malloc(sizeof(struct compound_specifier_s)); (yyval.u_compound_specifier)->list = (yyvsp[-1].u_subrule_list); } #line 1998 "parser.c" /* yacc.c:1646 */ break; case 67: #line 534 "parser.y" /* yacc.c:1646 */ { (yyval.u_subrule_list) = malloc(sizeof(struct subrule_list_s)); (yyval.u_subrule_list)->subrule_list = NULL; (yyval.u_subrule_list)->specifier_list = (yyvsp[0].u_specifier_list); } #line 2008 "parser.c" /* yacc.c:1646 */ break; case 68: #line 540 "parser.y" /* yacc.c:1646 */ { (yyval.u_subrule_list) = malloc(sizeof(struct subrule_list_s)); (yyval.u_subrule_list)->subrule_list = (yyvsp[-2].u_subrule_list); (yyval.u_subrule_list)->specifier_list = (yyvsp[0].u_specifier_list); } #line 2018 "parser.c" /* yacc.c:1646 */ break; case 69: #line 548 "parser.y" /* yacc.c:1646 */ { (yyval.u_chaingroup_specifier) = malloc(sizeof(struct chaingroup_specifier_s)); (yyval.u_chaingroup_specifier)->name = (yyvsp[-2].u_str); (yyval.u_chaingroup_specifier)->list = (yyvsp[-1].u_subrule_list); } #line 2028 "parser.c" /* yacc.c:1646 */ break; case 70: #line 554 "parser.y" /* yacc.c:1646 */ { (yyval.u_chaingroup_specifier) = malloc(sizeof(struct chaingroup_specifier_s)); (yyval.u_chaingroup_specifier)->name = NULL; (yyval.u_chaingroup_specifier)->list = (yyvsp[-1].u_subrule_list); } #line 2038 "parser.c" /* yacc.c:1646 */ break; #line 2042 "parser.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK(yylen); yylen = 0; YY_STACK_PRINT(yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE(yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if !YYERROR_VERBOSE yyerror(parse_arg, YY_("syntax error")); #else #define YYSYNTAX_ERROR yysyntax_error(&yymsg_alloc, &yymsg, yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE(yymsg); yymsg = (char *)YYSTACK_ALLOC(yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror(parse_arg, yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } #undef YYSYNTAX_ERROR #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct("Error: discarding", yytoken, &yylval, parse_arg); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK(yylen); yylen = 0; YY_STACK_PRINT(yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default(yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct("Error: popping", yystos[yystate], yyvsp, parse_arg); YYPOPSTACK(1); yystate = *yyssp; YY_STACK_PRINT(yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ YY_SYMBOL_PRINT("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror(parse_arg, YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE(yychar); yydestruct("Cleanup: discarding lookahead", yytoken, &yylval, parse_arg); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK(yylen); YY_STACK_PRINT(yyss, yyssp); while (yyssp != yyss) { yydestruct("Cleanup: popping", yystos[*yyssp], yyvsp, parse_arg); YYPOPSTACK(1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE(yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE(yymsg); #endif return yyresult; } #line 561 "parser.y" /* yacc.c:1906 */ char *filename(); long int lineno(); extern char *yytext; void yyerror(void *parse_arg __attribute__((unused)), const char *s) { fprintf(stderr, "%s:%ld: %s\n", filename(), lineno(), s); } int yyprint(FILE *f, int type, YYSTYPE v) { fprintf(f, "%d:\"%s\":%p", type, yytext, (void *)&v); return 0; } filtergen-0.12.7/missing0000755000175000017500000001533012657562003012110 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: filtergen-0.12.7/ylwrap0000755000175000017500000001531212657562003011755 00000000000000#! /bin/sh # ylwrap - wrapper for lex/yacc invocations. scriptversion=2013-01-12.17; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . get_dirname () { case $1 in */*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';; # Otherwise, we want the empty string (not "."). esac } # guard FILE # ---------- # The CPP macro used to guard inclusion of FILE. guard () { printf '%s\n' "$1" \ | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' \ -e 's/__*/_/g' } # quote_for_sed [STRING] # ---------------------- # Return STRING (or stdin) quoted to be used as a sed pattern. quote_for_sed () { case $# in 0) cat;; 1) printf '%s\n' "$1";; esac \ | sed -e 's|[][\\.*]|\\&|g' } case "$1" in '') echo "$0: No files given. Try '$0 --help' for more information." 1>&2 exit 1 ;; --basedir) basedir=$2 shift 2 ;; -h|--h*) cat <<\EOF Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... Wrapper for lex/yacc invocations, renaming files as desired. INPUT is the input file OUTPUT is one file PROG generates DESIRED is the file we actually want instead of OUTPUT PROGRAM is program to run ARGS are passed to PROG Any number of OUTPUT,DESIRED pairs may be used. Report bugs to . EOF exit $? ;; -v|--v*) echo "ylwrap $scriptversion" exit $? ;; esac # The input. input=$1 shift # We'll later need for a correct munging of "#line" directives. input_sub_rx=`get_dirname "$input" | quote_for_sed` case $input in [\\/]* | ?:[\\/]*) # Absolute path; do nothing. ;; *) # Relative path. Make it absolute. input=`pwd`/$input ;; esac input_rx=`get_dirname "$input" | quote_for_sed` # Since DOS filename conventions don't allow two dots, # the DOS version of Bison writes out y_tab.c instead of y.tab.c # and y_tab.h instead of y.tab.h. Test to see if this is the case. y_tab_nodot=false if test -f y_tab.c || test -f y_tab.h; then y_tab_nodot=true fi # The parser itself, the first file, is the destination of the .y.c # rule in the Makefile. parser=$1 # A sed program to s/FROM/TO/g for all the FROM/TO so that, for # instance, we rename #include "y.tab.h" into #include "parse.h" # during the conversion from y.tab.c to parse.c. sed_fix_filenames= # Also rename header guards, as Bison 2.7 for instance uses its header # guard in its implementation file. sed_fix_header_guards= while test $# -ne 0; do if test x"$1" = x"--"; then shift break fi from=$1 # Handle y_tab.c and y_tab.h output by DOS if $y_tab_nodot; then case $from in "y.tab.c") from=y_tab.c;; "y.tab.h") from=y_tab.h;; esac fi shift to=$1 shift sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;" sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;" done # The program to run. prog=$1 shift # Make any relative path in $prog absolute. case $prog in [\\/]* | ?:[\\/]*) ;; *[\\/]*) prog=`pwd`/$prog ;; esac dirname=ylwrap$$ do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 mkdir $dirname || exit 1 cd $dirname case $# in 0) "$prog" "$input" ;; *) "$prog" "$@" "$input" ;; esac ret=$? if test $ret -eq 0; then for from in * do to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"` if test -f "$from"; then # If $2 is an absolute path name, then just use that, # otherwise prepend '../'. case $to in [\\/]* | ?:[\\/]*) target=$to;; *) target=../$to;; esac # Do not overwrite unchanged header files to avoid useless # recompilations. Always update the parser itself: it is the # destination of the .y.c rule in the Makefile. Divert the # output of all other files to a temporary file so we can # compare them to existing versions. if test $from != $parser; then realtarget=$target target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'` fi # Munge "#line" or "#" directives. Don't let the resulting # debug information point at an absolute srcdir. Use the real # output file name, not yy.lex.c for instance. Adjust the # include guards too. sed -e "/^#/!b" \ -e "s|$input_rx|$input_sub_rx|" \ -e "$sed_fix_filenames" \ -e "$sed_fix_header_guards" \ "$from" >"$target" || ret=$? # Check whether files must be updated. if test "$from" != "$parser"; then if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then echo "$to is unchanged" rm -f "$target" else echo "updating $to" mv -f "$target" "$realtarget" fi fi else # A missing file is only an error for the parser. This is a # blatant hack to let us support using "yacc -d". If -d is not # specified, don't fail when the header file is "missing". if test "$from" = "$parser"; then ret=1 fi fi done fi # Remove the directory. cd .. rm -rf $dirname exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: filtergen-0.12.7/filtergen.spec.in0000644000175000017500000000336512657575427013774 00000000000000Summary: packet filter generator for various firewall systems Name: @PACKAGE@ Version: @VERSION@ Release: 1 License: GPL Group: Applications/System URL: http://spacepants.org/src/filtergen Packager: Jamie Wilkinson Source: http://spacepants.org/src/filtergen/download/%name-%version.tar.gz Buildroot: %{_tmppath}/%{name}-root BuildPrereq: rpm-build gcc flex make %description filtergen is a packet filter generator. It compiles a fairly high-level description language into iptables, ipchains, or ipfilter rules (and has bits of support for Cisco IOS access lists). %prep %setup -q ./configure %build make CFLAGS="${RPM_OPT_FLAGS}" %install rm -rf $RPM_BUILD_ROOT make PREFIX=${RPM_BUILD_ROOT}/usr BINDIR=${RPM_BUILD_ROOT}/sbin install %post /sbin/chkconfig --add filtergen /sbin/chkconfig filtergen off %preun /sbin/service filtergen accept /sbin/chkconfig --del filtergen %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) /sbin/filtergen /etc/init.d/filtergen /etc/filter/ %{_mandir}/* %doc HISTORY HONESTY README TODO tests/*.filter %changelog * Wed Aug 18 2004 Jamie Wilkinsin - 0.12.4-1 - New upstream release. * Tue Jun 22 2004 Jamie Wilkinson - 0.12.3-1 - New upstream release. * Thu Jun 10 2004 Jamie Wilkinson - 0.12.2-1 - New upstream release. * Wed Mar 10 2004 Jamie Wilkinson - 0.12-1 - New upstream release. * Wed Nov 13 2002 Matthew Kirkwood 0.11-1 - Release 0.11, rename init script from "filter" to "filtergen" * Mon Sep 2 2002 Matthew Kirkwood 0.10-1 - Add new sample and documentation stuff * Sun Aug 18 2002 Wil Cooley 0.8-1 - Initial RPM creation filtergen-0.12.7/compile0000755000175000017500000001624512657562003012075 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: filtergen-0.12.7/scanner.c0000644000175000017500000016241712657605430012321 00000000000000 #line 3 "scanner.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 39 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern yy_size_t yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart (FILE *input_file ); void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); void yy_delete_buffer (YY_BUFFER_STATE b ); void yy_flush_buffer (YY_BUFFER_STATE b ); void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); void yypop_buffer_state (void ); static void yyensure_buffer_stack (void ); static void yy_load_buffer_state (void ); static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define yywrap() 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern int yylineno; int yylineno = 1; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 39 #define YY_END_OF_BUFFER 40 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[132] = { 0, 0, 0, 37, 37, 40, 36, 4, 5, 32, 36, 2, 33, 34, 35, 31, 30, 28, 29, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 26, 27, 38, 37, 39, 4, 0, 2, 34, 0, 1, 0, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 38, 37, 3, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 15, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 8, 34, 10, 34, 34, 34, 34, 34, 16, 34, 34, 34, 34, 34, 34, 34, 34, 25, 34, 9, 34, 34, 34, 13, 14, 34, 34, 19, 20, 34, 34, 34, 24, 7, 34, 34, 34, 17, 18, 34, 22, 23, 11, 34, 6, 34, 12, 21, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 1, 1, 1, 1, 1, 1, 7, 8, 1, 8, 8, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 11, 1, 1, 1, 1, 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 1, 13, 1, 8, 1, 14, 8, 15, 16, 17, 18, 19, 8, 20, 21, 8, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 8, 32, 33, 34, 8, 35, 1, 36, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[37] = { 0, 1, 2, 3, 1, 1, 1, 1, 4, 1, 4, 2, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1 } ; static yyconst flex_int16_t yy_base[139] = { 0, 0, 0, 35, 37, 251, 252, 248, 252, 252, 0, 0, 252, 239, 241, 237, 252, 252, 252, 32, 33, 31, 34, 35, 41, 42, 43, 47, 44, 55, 252, 252, 0, 244, 252, 243, 239, 0, 233, 232, 252, 231, 230, 52, 53, 58, 64, 65, 67, 66, 69, 68, 70, 75, 76, 86, 81, 84, 85, 0, 237, 233, 227, 89, 90, 88, 93, 94, 98, 100, 101, 103, 226, 104, 105, 113, 111, 115, 117, 118, 119, 120, 123, 225, 126, 224, 128, 130, 133, 135, 141, 223, 138, 143, 144, 145, 147, 151, 152, 148, 222, 158, 221, 149, 160, 166, 220, 219, 161, 162, 218, 217, 163, 171, 173, 216, 215, 175, 174, 176, 214, 212, 187, 211, 208, 204, 179, 196, 177, 195, 194, 252, 207, 211, 215, 199, 195, 219, 194 } ; static yyconst flex_int16_t yy_def[139] = { 0, 131, 1, 132, 132, 131, 131, 131, 131, 131, 133, 134, 131, 135, 131, 136, 131, 131, 131, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 131, 131, 137, 131, 131, 131, 133, 134, 135, 136, 131, 136, 138, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 137, 131, 133, 138, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 0, 131, 131, 131, 131, 131, 131, 131 } ; static yyconst flex_int16_t yy_nxt[289] = { 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 13, 20, 13, 21, 13, 22, 13, 23, 24, 13, 25, 26, 13, 27, 28, 29, 13, 13, 13, 13, 30, 31, 33, 34, 33, 34, 39, 39, 39, 39, 39, 34, 43, 34, 48, 44, 39, 39, 39, 39, 51, 47, 39, 49, 45, 50, 46, 39, 39, 55, 39, 52, 63, 39, 56, 57, 54, 58, 53, 39, 39, 39, 39, 39, 39, 39, 69, 64, 65, 71, 39, 39, 74, 72, 66, 68, 39, 70, 67, 39, 39, 39, 73, 39, 39, 39, 76, 77, 39, 39, 75, 82, 78, 39, 80, 39, 39, 79, 39, 39, 39, 84, 90, 81, 85, 83, 39, 88, 39, 87, 39, 86, 39, 39, 39, 39, 91, 89, 39, 97, 96, 39, 92, 39, 93, 39, 94, 103, 39, 95, 39, 98, 99, 39, 101, 100, 39, 108, 39, 39, 39, 102, 39, 39, 39, 104, 39, 39, 107, 105, 106, 113, 114, 39, 110, 39, 39, 39, 39, 109, 112, 39, 117, 115, 111, 122, 39, 119, 39, 39, 39, 39, 39, 116, 39, 124, 125, 121, 127, 118, 120, 129, 39, 62, 41, 126, 123, 128, 38, 39, 39, 39, 130, 32, 32, 32, 32, 36, 36, 39, 36, 37, 37, 39, 37, 59, 39, 39, 59, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 42, 61, 60, 42, 42, 42, 39, 61, 35, 60, 42, 40, 39, 35, 131, 5, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131 } ; static yyconst flex_int16_t yy_chk[289] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 4, 4, 21, 19, 20, 22, 23, 3, 19, 4, 22, 20, 24, 25, 26, 28, 24, 21, 27, 22, 20, 23, 20, 43, 44, 27, 29, 25, 43, 45, 28, 28, 26, 29, 25, 46, 47, 49, 48, 51, 50, 52, 49, 44, 45, 50, 53, 54, 52, 50, 46, 48, 56, 49, 47, 57, 58, 55, 51, 65, 63, 64, 54, 55, 66, 67, 53, 63, 55, 68, 57, 69, 70, 56, 71, 73, 74, 65, 71, 58, 66, 64, 76, 69, 75, 68, 77, 67, 78, 79, 80, 81, 73, 70, 82, 78, 77, 84, 74, 86, 75, 87, 76, 86, 88, 76, 89, 79, 80, 92, 82, 81, 90, 92, 93, 94, 95, 84, 96, 99, 103, 87, 97, 98, 90, 88, 89, 97, 98, 101, 94, 104, 108, 109, 112, 93, 96, 105, 103, 99, 95, 112, 113, 105, 114, 118, 117, 119, 128, 101, 126, 114, 117, 109, 119, 104, 108, 126, 122, 138, 136, 118, 113, 122, 135, 130, 129, 127, 128, 132, 132, 132, 132, 133, 133, 125, 133, 134, 134, 124, 134, 137, 123, 121, 137, 120, 116, 115, 111, 110, 107, 106, 102, 100, 91, 85, 83, 72, 62, 61, 60, 42, 41, 39, 38, 36, 35, 33, 15, 14, 13, 7, 5, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "scanner.l" #line 5 "scanner.l" /* input scanner for filtergen language * * Copyright (c) 2003 Jamie Wilkinson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include "parser.h" /* include file stack */ #define MAXINCLUDES 512 struct inc_stack_s { YY_BUFFER_STATE state; char * filename; long int lineno; }; struct inc_stack_s inc_stack[MAXINCLUDES] = { { .state = 0, .filename = NULL, .lineno = 1 } }; int inc_stackptr = 0; long int lineno(); char * filename(); static void scan_err(const char * fmt, ...) __attribute__((format(printf, 1, 2))); void include_file(const char *); #line 612 "scanner.c" #define INITIAL 0 #define include 1 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy (void ); int yyget_debug (void ); void yyset_debug (int debug_flag ); YY_EXTRA_TYPE yyget_extra (void ); void yyset_extra (YY_EXTRA_TYPE user_defined ); FILE *yyget_in (void ); void yyset_in (FILE * in_str ); FILE *yyget_out (void ); void yyset_out (FILE * out_str ); yy_size_t yyget_leng (void ); char *yyget_text (void ); int yyget_lineno (void ); void yyset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap (void ); #else extern int yywrap (void ); #endif #endif #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex (void); #define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_load_buffer_state( ); } { #line 55 "scanner.l" #line 828 "scanner.c" while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 132 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 252 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 57 "scanner.l" { /* strip c-style comments */ int c; do { while ((c = input()) != '*' && c != EOF && c != '\n') ; while (c == '*') c = input(); if (c == EOF) scan_err("comment reached end of file"); if (c == '\n') inc_stack[inc_stackptr].lineno++; } while (c != '/' && c != EOF); } YY_BREAK case 2: YY_RULE_SETUP #line 71 "scanner.l" /* strip shell style comments */ YY_BREAK case 3: YY_RULE_SETUP #line 73 "scanner.l" { /* we do not store the " characters in the string, so lop * them off. We can "safely" assume that the first and last * characters in this regex are ", otherwise there's a bug * in flex... The result is somethign that is syntactically * identical to an identifier for our purposes. */ yylval.u_str = strndup(yytext + 1, yyleng - 2); return TOK_IDENTIFIER; } YY_BREAK case 4: YY_RULE_SETUP #line 83 "scanner.l" /* ignore */ YY_BREAK case 5: /* rule 5 can match eol */ YY_RULE_SETUP #line 85 "scanner.l" inc_stack[inc_stackptr].lineno++; YY_BREAK case 6: YY_RULE_SETUP #line 87 "scanner.l" BEGIN(include); YY_BREAK case 7: YY_RULE_SETUP #line 89 "scanner.l" return TOK_ACCEPT; YY_BREAK case 8: YY_RULE_SETUP #line 90 "scanner.l" return TOK_DEST; YY_BREAK case 9: YY_RULE_SETUP #line 91 "scanner.l" return TOK_DPORT; YY_BREAK case 10: YY_RULE_SETUP #line 92 "scanner.l" return TOK_DROP; YY_BREAK case 11: YY_RULE_SETUP #line 93 "scanner.l" return TOK_FORWARD; YY_BREAK case 12: YY_RULE_SETUP #line 94 "scanner.l" return TOK_ICMPTYPE; YY_BREAK case 13: YY_RULE_SETUP #line 95 "scanner.l" return TOK_INPUT; YY_BREAK case 14: YY_RULE_SETUP #line 96 "scanner.l" return TOK_LOCAL; YY_BREAK case 15: YY_RULE_SETUP #line 97 "scanner.l" return TOK_LOG; YY_BREAK case 16: YY_RULE_SETUP #line 98 "scanner.l" return TOK_MASQ; YY_BREAK case 17: YY_RULE_SETUP #line 99 "scanner.l" return TOK_ONEWAY; YY_BREAK case 18: YY_RULE_SETUP #line 100 "scanner.l" return TOK_OUTPUT; YY_BREAK case 19: YY_RULE_SETUP #line 101 "scanner.l" return TOK_PROTO; YY_BREAK case 20: YY_RULE_SETUP #line 102 "scanner.l" return TOK_PROXY; YY_BREAK case 21: YY_RULE_SETUP #line 103 "scanner.l" return TOK_REDIRECT; YY_BREAK case 22: YY_RULE_SETUP #line 104 "scanner.l" return TOK_REJECT; YY_BREAK case 23: YY_RULE_SETUP #line 105 "scanner.l" return TOK_SOURCE; YY_BREAK case 24: YY_RULE_SETUP #line 106 "scanner.l" return TOK_SPORT; YY_BREAK case 25: YY_RULE_SETUP #line 107 "scanner.l" return TOK_TEXT; YY_BREAK case 26: YY_RULE_SETUP #line 109 "scanner.l" return TOK_LCURLY; YY_BREAK case 27: YY_RULE_SETUP #line 110 "scanner.l" return TOK_RCURLY; YY_BREAK case 28: YY_RULE_SETUP #line 111 "scanner.l" return TOK_LSQUARE; YY_BREAK case 29: YY_RULE_SETUP #line 112 "scanner.l" return TOK_RSQUARE; YY_BREAK case 30: YY_RULE_SETUP #line 113 "scanner.l" return TOK_SEMICOLON; YY_BREAK case 31: YY_RULE_SETUP #line 114 "scanner.l" return TOK_COLON; YY_BREAK case 32: YY_RULE_SETUP #line 115 "scanner.l" return TOK_BANG; YY_BREAK case 33: YY_RULE_SETUP #line 116 "scanner.l" return TOK_STAR; YY_BREAK case 34: YY_RULE_SETUP #line 118 "scanner.l" { yylval.u_str = strndup(yytext, yyleng); return TOK_IDENTIFIER; } YY_BREAK case 35: YY_RULE_SETUP #line 123 "scanner.l" return TOK_SLASH; YY_BREAK case 36: YY_RULE_SETUP #line 125 "scanner.l" return TOK_ERR; YY_BREAK case 37: YY_RULE_SETUP #line 127 "scanner.l" /* eat whitespace after include */ YY_BREAK case 38: YY_RULE_SETUP #line 128 "scanner.l" { /* include file name */ char * name = strdup(yytext); include_file(name); free(name); BEGIN(INITIAL); } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(include): #line 135 "scanner.l" { if (!inc_stackptr) { yyterminate(); } else { if (inc_stack[inc_stackptr].filename) { free(inc_stack[inc_stackptr].filename); inc_stack[inc_stackptr].filename = NULL; } inc_stackptr--; yy_delete_buffer(YY_CURRENT_BUFFER); yy_switch_to_buffer(inc_stack[inc_stackptr].state); } } YY_BREAK case 39: YY_RULE_SETUP #line 148 "scanner.l" ECHO; YY_BREAK #line 1126 "scanner.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 132 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 132 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 131); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart(yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_init_buffer(YY_CURRENT_BUFFER,input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree((void *) b->yy_ch_buf ); yyfree((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { return yy_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int yyget_lineno (void) { return yylineno; } /** Get the input stream. * */ FILE *yyget_in (void) { return yyin; } /** Get the output stream. * */ FILE *yyget_out (void) { return yyout; } /** Get the length of the current token. * */ yy_size_t yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param line_number * */ void yyset_lineno (int line_number ) { yylineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see yy_switch_to_buffer */ void yyset_in (FILE * in_str ) { yyin = in_str ; } void yyset_out (FILE * out_str ) { yyout = out_str ; } int yyget_debug (void) { return yy_flex_debug; } void yyset_debug (int bdebug ) { yy_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = (FILE *) 0; yyout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *yyalloc (yy_size_t size ) { return (void *) malloc( size ); } void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void yyfree (void * ptr ) { free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 147 "scanner.l" long int lineno(void) { return inc_stack[inc_stackptr].lineno; } /* FIXME: make this return an immutable string */ char *filename(void) { return inc_stack[inc_stackptr].filename ? inc_stack[inc_stackptr].filename : strdup("(standard input)"); } static void scan_err(const char *fmt, ...) { va_list args; va_start(args, fmt); if (inc_stackptr >= 0) fprintf(stderr, "%s:%ld: ", filename(), lineno()); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); } void step_into_include_file(const char *fn) { FILE *f; if (inc_stackptr >= MAXINCLUDES - 1) { scan_err("warning: too many nested includes"); scan_err("warning: skipping include of file \"%s\"", fn); return; } if (!(f = fopen(fn, "r"))) { scan_err("warning: can't open file \"%s\"", fn); } else { inc_stack[inc_stackptr++].state = YY_CURRENT_BUFFER; inc_stack[inc_stackptr].lineno = 1; inc_stack[inc_stackptr].filename = strdup(fn); yyin = f; yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); } } /* include a file or directory */ void include_file(const char *name) { struct stat st; struct dirent **namelist; char *fn; int n; if (stat(name, &st)) { if (errno == ENOENT && (index(name, '*') != NULL || index(name, '?') != NULL || index(name, '[') != NULL)) { /* Globbing fiesta! */ glob_t glob_buf; if (glob(name, 0, NULL, &glob_buf) != 0) { scan_err("warning: failed to glob %s: %s", name, strerror(errno)); } else { /* We go through the list of files backwards, because * step_into_include_file() creates a stack of all the * files processed and then works on them in a LIFO * fashion -- which would make all of our rules files * go backwards. Since I can't wrap my head around * why that is, exactly, I'm hacking it up with * this instead. Fixination appreciated. */ for (n = glob_buf.gl_pathc - 1; n >= 0; n--) { if (stat(glob_buf.gl_pathv[n], &st)) { scan_err("warning: stat failed on globbed %s: %s", glob_buf.gl_pathv[n], strerror(errno)); } else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) { step_into_include_file(glob_buf.gl_pathv[n]); } } } globfree(&glob_buf); } else { scan_err("warning: stat failed on %s: %s", name, strerror(errno)); } } else { if (S_ISDIR(st.st_mode)) { if ((n = scandir(name, &namelist, NULL, alphasort)) < 0) { scan_err("warning: scandir failed on %s: %s", name, strerror(errno)); } else { while (n--) { /* FIXME: assumes d_name */ if (namelist[n]->d_name[0] == '.') { free(namelist[n]); continue; } if (asprintf(&fn, "%s/%s", name, namelist[n]->d_name) < 0) { scan_err("internal error: asprintf failed constructing pathname " "for included file %s", namelist[n]->d_name); free(fn); } else { include_file(fn); free(fn); } free(namelist[n]); } free(namelist); } } else { step_into_include_file(name); } } }