test runner: work correctly in VPATH setups
[platform/upstream/automake.git] / syntax-checks.mk
1 # Maintainer checks for Automake.  Requires GNU make.
2
3 # Copyright (C) 2012 Free Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # We also have to take into account VPATH builds (where some generated
19 # tests might be in '$(builddir)' rather than in '$(srcdir)'), TAP-based
20 # tests script (which have a '.tap' extension) and helper scripts used
21 # by other test cases (which have a '.sh' extension).
22 xtests := $(shell \
23   if test $(srcdir) = .; then \
24      dirs=.; \
25    else \
26      dirs='$(srcdir) .'; \
27    fi; \
28    for d in $$dirs; do \
29      for s in tap sh; do \
30        ls $$d/t/*.$$s $$d/t/ax/*.$$s 2>/dev/null; \
31      done; \
32    done | sort)
33
34 xdefs = $(srcdir)/t/ax/test-init.sh $(srcdir)/defs $(srcdir)/defs-static.in
35
36 ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print)
37
38 # Some simple checks, and then ordinary check.  These are only really
39 # guaranteed to work on my machine.
40 syntax_check_rules = \
41 $(sc_tests_plain_check_rules) \
42 sc_test_names \
43 sc_diff_automake_in_automake \
44 sc_diff_aclocal_in_automake \
45 sc_perl_syntax \
46 sc_no_brace_variable_expansions \
47 sc_rm_minus_f \
48 sc_no_for_variable_in_macro \
49 sc_mkinstalldirs \
50 sc_pre_normal_post_install_uninstall \
51 sc_perl_no_undef \
52 sc_perl_no_split_regex_space \
53 sc_cd_in_backquotes \
54 sc_cd_relative_dir \
55 sc_perl_at_uscore_in_scalar_context \
56 sc_perl_local \
57 sc_AMDEP_TRUE_in_automake_in \
58 sc_tests_make_without_am_makeflags \
59 sc_tests_obsolete_variables \
60 sc_tests_here_document_format \
61 sc_tests_command_subst \
62 sc_tests_Exit_not_exit \
63 sc_tests_automake_fails \
64 sc_tests_required_after_defs \
65 sc_tests_overriding_macros_on_cmdline \
66 sc_tests_plain_sleep \
67 sc_tests_ls_t \
68 sc_tests_executable \
69 sc_m4_am_plain_egrep_fgrep \
70 sc_tests_no_configure_in \
71 sc_tests_PATH_SEPARATOR \
72 sc_tests_logs_duplicate_prefixes \
73 sc_tests_makefile_variable_order \
74 sc_perl_at_substs \
75 sc_unquoted_DESTDIR \
76 sc_tabs_in_texi \
77 sc_at_in_texi
78
79 ## Look for test whose names can cause spurious failures when used as
80 ## first argument to AC_INIT (chiefly because they might contain an
81 ## m4/m4sugar builtin or macro name).
82 m4_builtins = \
83   __gnu__ \
84   __unix__ \
85   bpatsubst \
86   bregexp \
87   builtin \
88   changecom \
89   changequote \
90   changeword \
91   debugfile \
92   debugmode \
93   decr \
94   define \
95   defn \
96   divert \
97   divnum \
98   dnl \
99   dumpdef \
100   errprint \
101   esyscmd \
102   eval \
103   format \
104   ifdef \
105   ifelse \
106   include \
107   incr \
108   index \
109   indir \
110   len \
111   m4exit \
112   m4wrap \
113   maketemp \
114   mkstemp \
115   patsubst \
116   popdef \
117   pushdef \
118   regexp \
119   shift \
120   sinclude \
121   substr \
122   symbols \
123   syscmd \
124   sysval \
125   traceoff \
126   traceon \
127   translit \
128   undefine \
129   undivert
130 sc_test_names:
131         @m4_builtin_rx=`echo $(m4_builtins) | sed 's/ /|/g'`; \
132          m4_macro_rx="\\<($$m4_builtin_rx)\\>|\\<_?(A[CUMHS]|m4)_"; \
133          if { \
134            for t in $(xtests); do echo $$t; done \
135              | LC_ALL=C grep -E "$$m4_macro_rx"; \
136          }; then \
137            echo "the names of the tests above can be problematic" 1>&2; \
138            echo "Avoid test names that contain names of m4 macros" 1>&2; \
139            exit 1; \
140          fi
141
142 ## These check avoids accidental configure substitutions in the source.
143 ## There are exactly 9 lines that should be modified from automake.in to
144 ## automake, and 10 lines that should be modified from aclocal.in to
145 ## aclocal; these wors out to 32 and 34 lines of diffs, respectively.
146 sc_diff_automake_in_automake:
147         @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 32; then \
148           echo "found too many diffs between automake.in and automake" 1>&2; \
149           diff -c $(srcdir)/automake.in automake; \
150           exit 1; \
151         fi
152 sc_diff_aclocal_in_aclocal:
153         @if test `diff $(srcdir)/aclocal.in aclocal | wc -l` -ne 34; then \
154           echo "found too many diffs between aclocal.in and aclocal" 1>&2; \
155           diff -c $(srcdir)/aclocal.in aclocal; \
156           exit 1; \
157         fi
158
159 ## Syntax check with default Perl (on my machine, Perl 5).
160 sc_perl_syntax:
161         @perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w automake
162         @perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w aclocal
163
164 ## Expect no instances of '${...}'.  However, $${...} is ok, since that
165 ## is a shell construct, not a Makefile construct.
166 sc_no_brace_variable_expansions:
167         @if grep -v '^ *#' $(ams) | grep -F '$${' | grep -F -v '$$$$'; then \
168           echo "Found too many uses of '\$${' in the lines above." 1>&2; \
169           exit 1;                               \
170         else :; fi
171
172 ## Make sure 'rm' is called with '-f'.
173 sc_rm_minus_f:
174         @if grep -v '^#' $(ams) $(xtests) \
175            | grep -vE '/(spy-rm\.tap|subobj-clean.*-pr10697\.sh):' \
176            | grep -E '\<rm ([^-]|\-[^f ]*\>)'; \
177         then \
178           echo "Suspicious 'rm' invocation." 1>&2; \
179           exit 1;                               \
180         else :; fi
181
182 ## Never use something like "for file in $(FILES)", this doesn't work
183 ## if FILES is empty or if it contains shell meta characters (e.g. $ is
184 ## commonly used in Java filenames).
185 sc_no_for_variable_in_macro:
186         @if grep 'for .* in \$$(' $(ams) | grep -v '/Makefile\.am:'; then \
187           echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
188           exit 1; \
189         else :; fi
190
191 ## Make sure all invocations of mkinstalldirs are correct.
192 sc_mkinstalldirs:
193         @if grep -n 'mkinstalldirs' $(ams) \
194               | grep -F -v '$$(mkinstalldirs)' \
195               | grep -v '^\./Makefile.am:[0-9][0-9]*:  *lib/mkinstalldirs \\$$'; \
196         then \
197           echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
198           exit 1; \
199         else :; fi
200
201 ## Make sure all calls to PRE/NORMAL/POST_INSTALL/UNINSTALL
202 sc_pre_normal_post_install_uninstall:
203         @if grep -E -n '\((PRE|NORMAL|POST)_(|UN)INSTALL\)' $(ams) | \
204               grep -v ':##' | grep -v ':        @\$$('; then \
205           echo "Found incorrect use of PRE/NORMAL/POST_INSTALL/UNINSTALL in the lines above" 1>&2; \
206           exit 1; \
207         else :; fi
208
209 ## We never want to use "undef", only "delete", but for $/.
210 sc_perl_no_undef:
211         @if grep -n -w 'undef ' $(srcdir)/automake.in | \
212               grep -F -v 'undef $$/'; then \
213           echo "Found undef in automake.in; use delete instead" 1>&2; \
214           exit 1; \
215         fi
216
217 ## We never want split (/ /,...), only split (' ', ...).
218 sc_perl_no_split_regex_space:
219         @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
220           echo "Found bad split in the lines above." 1>&2; \
221           exit 1; \
222         fi
223
224 ## Look for cd within backquotes
225 sc_cd_in_backquotes:
226         @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in $(ams); then \
227           echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
228           exit 1; \
229         fi
230
231 ## Look for cd to a relative directory (may be influenced by CDPATH).
232 ## Skip some known directories that are OK.
233 sc_cd_relative_dir:
234         @if grep -n '^[^#]*cd ' $(srcdir)/automake.in $(ams) | \
235               grep -v 'echo.*cd ' | \
236               grep -v 'am__cd =' | \
237               grep -v '^[^#]*cd [./]' | \
238               grep -v '^[^#]*cd \$$(top_builddir)' | \
239               grep -v '^[^#]*cd "\$$\$$am__cwd' | \
240               grep -v '^[^#]*cd \$$(abs' | \
241               grep -v '^[^#]*cd "\$$(DESTDIR)'; then \
242           echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
243           exit 1; \
244         fi
245
246 ## Using @_ in a scalar context is most probably a programming error.
247 sc_perl_at_uscore_in_scalar_context:
248         @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
249           echo "Using @_ in a scalar context in the lines above." 1>&2; \
250           exit 1; \
251         fi
252
253 ## Allow only few variables to be localized in Automake.
254 sc_perl_local:
255         @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' $(srcdir)/automake.in | \
256                 grep '^[ \t]*local [^*]'; then \
257           echo "Please avoid 'local'." 1>&2; \
258           exit 1; \
259         fi
260
261 ## Don't let AMDEP_TRUE substitution appear in automake.in.
262 sc_AMDEP_TRUE_in_automake_in:
263         @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
264           echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
265           exit 1; \
266         fi
267
268 ## Recursive make invocations should always pass $(AM_MAKEFLAGS)
269 ## to $(MAKE), for portability to non-GNU make.
270 sc_tests_make_without_am_makeflags:
271         @if grep '^[^#].*(MAKE) ' $(ams) $(srcdir)/automake.in \
272             | grep -v 'AM_MAKEFLAGS' \
273             | grep -v '/am/header-vars\.am:.*am--echo.*| $$(MAKE) -f *-'; \
274         then \
275           echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
276           exit 1; \
277         fi
278
279 ## Look out for some obsolete variables.
280 sc_tests_obsolete_variables:
281         @vars=" \
282           using_tap \
283           test_prefer_config_shell \
284           original_AUTOMAKE \
285           original_ACLOCAL \
286           parallel_tests \
287           am_parallel_tests \
288         "; \
289         seen=""; \
290         for v in $$vars; do \
291           if grep -E "\b$$v\b" $(xtests) $(xdefs); then \
292             seen="$$seen $$v"; \
293           fi; \
294         done; \
295         if test -n "$$seen"; then \
296           for v in $$seen; do \
297             case $$v in \
298               parallel_tests|am_parallel_tests) v2=am_serial_tests;; \
299               *) v2=am_$$v;; \
300             esac; \
301             echo "Variable '$$v' is obsolete, use '$$v2' instead." 1>&2; \
302           done; \
303           exit 1; \
304         else :; fi
305
306 ## Tests should never call some programs directly, but only through the
307 ## corresponding variable (e.g., '$MAKE', not 'make').  This will allow
308 ## the programs to be overridden at configure time (for less brittleness)
309 ## or by the user at make time (to allow better testsuite coverage).
310 sc_tests_plain_check_rules = \
311   sc_tests_plain_egrep \
312   sc_tests_plain_fgrep \
313   sc_tests_plain_make \
314   sc_tests_plain_perl \
315   sc_tests_plain_automake \
316   sc_tests_plain_aclocal \
317   sc_tests_plain_autoconf \
318   sc_tests_plain_autoupdate \
319   sc_tests_plain_autom4te \
320   sc_tests_plain_autoheader \
321   sc_tests_plain_autoreconf
322
323 toupper = $(shell echo $(1) | LC_ALL=C tr '[a-z]' '[A-Z]')
324
325 $(sc_tests_plain_check_rules): sc_tests_plain_% :
326         @# The leading ':' in the grep below is what is printed by the
327         @# preceding 'grep -v' after the file name.
328         @# It works here as a poor man's substitute for beginning-of-line
329         @# marker.
330         @if grep -v '^[         ]*#' $(xtests) \
331            | $(EGREP) '(:|\bif|\bnot|[;!{\|\(]|&&|\|\|)[        ]*?$*\b'; \
332          then \
333            echo 'Do not run "$*" in the above tests.' \
334                 'Use "$$$(call toupper,$*)" instead.' 1>&2; \
335            exit 1; \
336         fi
337
338 ## Tests should only use END and EOF for here documents
339 ## (so that the next test is effective).
340 sc_tests_here_document_format:
341         @if grep '<<' $(xtests) | grep -Ev '\b(END|EOF)\b|\bcout <<'; then \
342           echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \
343           exit 1; \
344         fi
345
346 ## Our test case should use the $(...) POSIX form for command substitution,
347 ## rather than the older `...` form.
348 ## The point of ignoring text on here-documents is that we want to exempt
349 ## Makefile.am rules, configure.ac code and helper shell script created and
350 ## used by out shell scripts, because Autoconf (as of version 2.69) does not
351 ## yet ensure that $CONFIG_SHELL will be set to a proper POSIX shell.
352 sc_tests_command_subst:
353         @found=false; \
354         scan () { \
355           sed -n -e '/^#/d' \
356                  -e '/<<.*END/,/^END/b' -e '/<<.*EOF/,/^EOF/b' \
357                  -e 's/\\`/\\{backtick}/' \
358                  -e "s/[^\\]'\([^']*\`[^']*\)*'/'{quoted-text}'/g" \
359                  -e '/`/p' $$*; \
360         }; \
361         for file in $(xtests); do \
362           res=`scan $$file`; \
363           if test -n "$$res"; then \
364             echo "$$file:$$res"; \
365             found=true; \
366           fi; \
367         done; \
368         if $$found; then \
369           echo 'Use $$(...), not `...`, for command substitutions.' >&2; \
370           exit 1; \
371         fi
372
373 ## Tests should no more call 'Exit', just 'exit'.  That's because we
374 ## now have in place a better workaround to ensure the exit status is
375 ## transported correctly across the exit trap.
376 sc_tests_Exit_not_exit:
377         @if grep 'Exit' $(xtests) $(xdefs) | grep -Ev '^[^:]+: *#' | grep .; then \
378           echo "Use 'exit', not 'Exit'; it's obsolete now." 1>&2; \
379           exit 1; \
380         fi
381
382 ## Use AUTOMAKE_fails when appropriate
383 sc_tests_automake_fails:
384         @if grep -v '^#' $(xtests) | grep '\$$AUTOMAKE.*&&.*exit'; then \
385           echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2;  \
386           exit 1; \
387         fi
388
389 ## Setting 'required' after sourcing './defs' is a bug.
390 sc_tests_required_after_defs:
391         @for file in $(xtests); do \
392           if out=`sed -n '/defs/,$${/required=/p;}' $$file`; test -n "$$out"; then \
393             echo 'Do not set "required" after sourcing "defs" in '"$$file: $$out" 1>&2; \
394             exit 1; \
395           fi; \
396         done
397
398 ## Overriding a Makefile macro on the command line is not portable when
399 ## recursive targets are used.  Better use an envvar.  SHELL is an
400 ## exception, POSIX says it can't come from the environment.  V, DESTDIR,
401 ## DISTCHECK_CONFIGURE_FLAGS and DISABLE_HARD_ERRORS are exceptions, too,
402 ## as package authors are urged not to initialize them anywhere.
403 ## Finally, 'exp' is used by some ad-hoc checks, where we ensure it's
404 ## ok to override it from the command line.
405 sc_tests_overriding_macros_on_cmdline:
406         @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(xtests); then \
407           echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
408           echo ' in the above lines, it is more portable.' 1>&2; \
409           exit 1; \
410         fi
411 # The first s/// tries to account for usages like "$MAKE || st=$?".
412 # 'DISTCHECK_CONFIGURE_FLAGS' and 'exp' are allowed to contain whitespace in
413 # their definitions, hence the more complex last three substitutions below.
414 # Also, the 'make-dryrun.sh' is whitelisted, since there we need to
415 # override variables from the command line in order to cover the expected
416 # code paths.
417         @tests=`for t in $(xtests); do \
418                   case $$t in */make-dryrun.sh);; *) echo $$t;; esac; \
419                 done`; \
420         if sed -e 's/ || .*//' -e 's/ && .*//' \
421                 -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
422                 -e 's/ V=[^ ]*/ /' -e 's/ DISABLE_HARD_ERRORS=[^ ]*/ /' \
423                 -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
424                 -e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
425                 -e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
426                 -e "s/ exp='[^']*'/ /" \
427                 -e 's/ exp="[^"]*"/ /' \
428                 -e 's/ exp=[^ ]/ /' \
429               $$tests | grep '\$$MAKE .*='; then \
430           echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
431           echo 'it is more portable.' 1>&2; \
432           exit 1; \
433         fi
434         @if grep 'SHELL=.*\$$MAKE' $(xtests); then \
435           echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
436           echo 'the above lines.' 1>&2; \
437           exit 1; \
438         fi
439
440 ## Prefer use of our 'is_newest' auxiliary script over the more hacky
441 ## idiom "test $(ls -1t new old | sed 1q) = new", which is both more
442 ## cumbersome and more fragile.
443 sc_tests_ls_t:
444         @if LC_ALL=C grep -E '\bls(\s+-[a-zA-Z0-9]+)*\s+-[a-zA-Z0-9]*t' \
445             $(xtests); then \
446           echo "Use 'is_newest' rather than hacks based on 'ls -t'" 1>&2; \
447           exit 1; \
448         fi
449
450 ## Test scripts must be executable.
451 sc_tests_executable:
452         @st=0; \
453         for f in $(xtests); do \
454           case $$f in \
455             t/ax/*|./t/ax/*|$(srcdir)/t/ax/*);; \
456             *) test -x $$f || { echo "$$f: not executable" >&2; st=1; }; \
457           esac; \
458         done; \
459         test $$st -eq 0 || echo '$@: some test scripts are not executable' >&2; \
460         exit $$st;
461
462
463 ## Never use 'sleep 1' to create files with different timestamps.
464 ## Use '$sleep' instead.  Some filesystems (e.g., Windows) have only
465 ## a 2sec resolution.
466 sc_tests_plain_sleep:
467         @if grep -E '\bsleep +[12345]\b' $(xtests); then \
468           echo 'Do not use "sleep x" in the above tests.  Use "$$sleep" instead.' 1>&2; \
469           exit 1; \
470         fi
471
472 ## fgrep and egrep are not required by POSIX.
473 sc_m4_am_plain_egrep_fgrep:
474         @if grep -E '\b[ef]grep\b' $(ams) $(srcdir)/m4/*.m4; then \
475           echo 'Do not use egrep or fgrep in the above files,' \
476                'they are not portable.' 1>&2; \
477           exit 1; \
478         fi
479
480 ## Prefer 'configure.ac' over the obsolescent 'configure.in' as the name
481 ## for configure input files in our testsuite.  The latter  has been
482 ## deprecated for several years (at least since autoconf 2.50).
483 sc_tests_no_configure_in:
484         @if grep -E '\bconfigure\\*\.in\b' $(xtests) $(xdefs) \
485               | grep -Ev '/backcompat.*\.(sh|tap):' \
486               | grep -Ev '/autodist-configure-no-subdir\.sh:' \
487               | grep -Ev '/(configure|help)\.sh:' \
488               | grep .; \
489         then \
490           echo "Use 'configure.ac', not 'configure.in', as the name" >&2; \
491           echo "for configure input files in the test cases above." >&2; \
492           exit 1; \
493         fi
494
495 ## Rule to ensure that the testsuite has been run before.  We don't depend
496 ## on 'check' here, because that would be very wasteful in the common case.
497 ## We could run "make check RECHECK_LOGS=" and avoid toplevel races with
498 ## AM_RECURSIVE_TARGETS.  Suggest keeping test directories around for
499 ## greppability of the Makefile.in files.
500 sc_ensure_testsuite_has_run:
501         @if test ! -f '$(TEST_SUITE_LOG)'; then \
502           echo 'Run "env keep_testdirs=yes make check" before' \
503                'running "make maintainer-check"' >&2; \
504           exit 1; \
505         fi
506 .PHONY: sc_ensure_testsuite_has_run
507
508 ## Ensure our warning and error messages do not contain duplicate 'warning:' prefixes.
509 ## This test actually depends on the testsuite having been run before.
510 sc_tests_logs_duplicate_prefixes: sc_ensure_testsuite_has_run
511         @if grep -E '(warning|error):.*(warning|error):' t/*.log; then \
512           echo 'Duplicate warning/error message prefixes seen in above tests.' >&2; \
513           exit 1; \
514         fi
515
516 ## Ensure variables are listed before rules in Makefile.in files we generate.
517 sc_tests_makefile_variable_order: sc_ensure_testsuite_has_run
518         @st=0; \
519         for file in `find t -name Makefile.in -print`; do \
520           latevars=`sed -n \
521             -e :x -e 's/#.*//' \
522             -e '/\\\\$$/{' -e N -e 'b x' -e '}' \
523             -e '# Literal TAB.' \
524             -e '1,/^    /d' \
525             -e '# Allow @ so we match conditionals.' \
526             -e '/^ *[a-zA-Z_@]\{1,\} *=/p' $$file`; \
527           if test -n "$$latevars"; then \
528             echo "Variables are expanded too late in $$file:" >&2; \
529             echo "$$latevars" | sed 's/^/  /' >&2; \
530             st=1; \
531           fi; \
532         done; \
533         test $$st -eq 0 || { \
534           echo 'Ensure variables are expanded before rules' >&2; \
535           exit 1; \
536         }
537
538 ## Using ':' as a PATH separator is not portable.
539 sc_tests_PATH_SEPARATOR:
540         @if grep -E '\bPATH=.*:.*' $(xtests) ; then \
541           echo "Use '\$$PATH_SEPARATOR', not ':', in PATH definitions" \
542                "above." 1>&2; \
543           exit 1; \
544         fi
545
546 ## Try to make sure all @...@ substitutions are covered by our
547 ## substitution rule.
548 sc_perl_at_substs:
549         @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
550           echo "Unresolved @...@ substitution in aclocal" 1>&2; \
551           exit 1; \
552         fi
553         @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
554           echo "Unresolved @...@ substitution in automake" 1>&2; \
555           exit 1; \
556         fi
557
558 sc_unquoted_DESTDIR:
559         @if grep -E "[^\'\"]\\\$$\(DESTDIR" $(ams); then \
560           echo 'Suspicious unquoted DESTDIR uses.' 1>&2 ; \
561           exit 1; \
562         fi
563
564 sc_tabs_in_texi:
565         @if grep '      ' $(srcdir)/doc/automake.texi; then \
566           echo 'Do not use tabs in the manual.' 1>&2; \
567           exit 1; \
568         fi
569
570 sc_at_in_texi:
571         @if grep -E '([^@]|^)@([         ][^@]|$$)' $(srcdir)/doc/automake.texi; \
572         then \
573           echo 'Unescaped @.' 1>&2; \
574           exit 1; \
575         fi
576
577 $(syntax_check_rules): automake aclocal
578 maintainer-check: $(syntax_check_rules)
579 .PHONY: maintainer-check $(syntax_check_rules)
580
581 ## Check that the list of tests given in the Makefile is equal to the
582 ## list of all test scripts in the Automake testsuite.
583 maintainer-check: maintainer-check-list-of-tests