lint: recipes of syntax check require GNU grep; ensure it is used
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 25 May 2013 20:18:45 +0000 (22:18 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 25 May 2013 20:20:04 +0000 (22:20 +0200)
* syntax-checks.mk (sc_sanity_gnu_grep): New.
($(syntax_check_rules)): Depend on it.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
syntax-checks.mk

index 3922896..4dacc5a 100644 (file)
@@ -79,6 +79,18 @@ sc_unquoted_DESTDIR \
 sc_tabs_in_texi \
 sc_at_in_texi
 
+# The recipes of syntax checks require a modern GNU grep.
+sc_sanity_gnu_grep:
+       $(AM_V_GEN)grep --version | grep 'GNU grep' >/dev/null 2>&1 \
+         && ab=$$(printf 'a\nb') \
+         && test "$$(printf 'xa\nb\nc' | grep -Pzo 'a\nb')" = "$$ab" \
+         || { \
+           echo "Syntax checks recipes require a modern GNU grep" >&2; \
+           exit 1; \
+         }
+.PHONY: sc_sanity_gnu_grep
+$(syntax_check_rules): sc_sanity_gnu_grep
+
 ## These check avoids accidental configure substitutions in the source.
 ## There are exactly 8 lines that should be modified from automake.in to
 ## automake, and 9 lines that should be modified from aclocal.in to