<context for autoconf@ people>

The Autoconf test suite is filter in two different places: once to
avoid testing all the macros, since some of them are already run by
other tests etc., and once to check that the configure scripts do stay
within their name space (it does think by saving the env, and
comparing it later, filtering out the vars that configure is allowed
to change).

In each case, an egrep with multiple `-e' was used (here, in a Makefile):

FILTER_MACROS = egrep -v \
  -e '^AC_ARG_VAR$$' \
  -e '^AC_CHECK_(DECL|FILE|FUNC|HEADER|MEMBER|PROG|SIZEOF|TYPE)S?$$' \
  -e '^AC_CONFIG' \
  -e '^AC_INIT' \
  -e '^AC_LINKER_OPTION$$' \
  -e '^AC_LINK_FILES$$' \
  -e '^AC_LIST_MEMBER_OF$$' \
  -e '^AC_PATH_(TOOL|PROG)S?$$' \
  -e '^AC_PROG_(CC|CXX|F77)_(GNU|WORKS)$$' \
  -e '^AC_REPLACE_FUNCS$$' \
  -e '^AC_SEARCH_LIBS$$' \
  -e '^AC_TRY' \
  -e '_AC_'

but Nicolas reported that IRIX's egrep does not support multiple `-e':
it honors the last one.  So we tried this:

FILTER_MACROS = sed \
-e '/^AC_ARG_VAR$$/d' \
-e '/^AC_CHECK_\(DECL\|FILE\|FUNC\|HEADER\|MEMBER\|PROG\|SIZEOF\|TYPE\)S\?$$/d' \
-e '/^AC_CONFIG/d' \
-e '/^AC_INIT/d' \
-e '/^AC_LINKER_OPTION$$/d' \
-e '/^AC_LINK_FILES$$/d' \
-e '/^AC_LIST_MEMBER_OF$$/d' \
-e '/^AC_PATH_\(TOOL\|PROG\)S\?$$/d' \
-e '/^AC_PROG_\(CC\|CXX\|F77\)_\(GNU\|WORKS\)$$/d' \
-e '/^AC_REPLACE_FUNCS$$/d' \
-e '/^AC_SEARCH_LIBS$$/d' \
-e '/^AC_TRY/d' \
-e '/_AC_/d'

and it turns out that his sed (the very same bloody sed which makes
writing config.status a real challenge) doesn't seem to support the
alternation at all, not to mention the portability problems of `?'.

</context for autoconf@ people>

The question is then, how to write such a filter?  Of course there is
an obvious solution: replace each `-e' with `| egrep -v -e', which
seems a bit excessive.

Of course too, we can factor everything into a single egrep pattern,
but this is soooo maintainer unfriendly!  I'd like to keep a readable
pattern, not a big monster.

How would you solve this?

        Akim

Reply via email to