2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Check that automake complains about *_YFLAGS variables which have
18 # conditional content.
22 cat >> configure.ac
<<'END'
25 # 'YFLAGS' is AC_SUBST'd by AC_PROG_YACC by default, but we
26 # don't want this, since it might confuse our error messages.
27 # Also, AM_SUBST_NOTMAKE seems not to help about this.
28 # So we simply define $(YACC) by hand.
29 AC_SUBST([YACC], [yacc])
31 AM_CONDITIONAL([COND], [:])
36 cat > Makefile.am
<<'END'
37 bin_PROGRAMS = foo zardoz
39 zardoz_SOURCES = zardoz.y
46 cat > Makefile1.am
<<'END'
49 ## This is a dummy comment to keep line count right.
55 cat > Makefile2.am
<<'END'
64 cat > Makefile3.am
<<'END'
67 foo_YFLAGS = foo_yflags
73 cat > Makefile4.am
<<'END'
74 bin_PROGRAMS = foo zardoz
77 zardoz_SOURCES = $(foo_SOURCES)
80 AM_YFLAGS = $(COND_VAR1)
81 zardoz_YFLAGS = $(COND_VAR2:z=r)
92 cat > Makefile5.am
<<'END'
93 bin_PROGRAMS = foo zardoz
95 zardoz_SOURCES = zardoz.y
103 cat > Makefile6.am
<<'END'
115 LC_ALL
=C
; export LC_ALL
; # For grep regexes below.
117 AUTOMAKE_fails
-Wnone -Wunsupported Makefile
118 grep '^Makefile\.am:5:.*AM_YFLAGS.* conditional contents' stderr
119 grep '^Makefile\.am:6:.*zardoz_YFLAGS.* conditional contents' stderr
122 AUTOMAKE_fails
-Wnone -Wunsupported Makefile
$i
123 grep "^Makefile$i\\.am:5:.*[^a-zA-Z0-9_]YFLAGS.* conditional contents" \
127 AUTOMAKE_fails
-Wnone -Wunsupported Makefile4
128 grep '^Makefile4\.am:6:.*[^a-zA-Z0-9_]YFLAGS.* conditional contents' stderr
129 grep '^Makefile4\.am:7:.*AM_YFLAGS.* conditional contents' stderr
130 grep '^Makefile4\.am:8:.*zardoz_YFLAGS.* conditional contents' stderr
132 # Now let's check we avoid false positives.
134 # Disable 'gnu' warnings because we override the user variable 'YFLAGS'.
135 AUTOMAKE_fails
-Wno-gnu Makefile5
136 grep -v '^Makefile5\.am:.*zardoz_YFLAGS' stderr \
137 |
grep -v ': warnings are treated as errors' \
140 # Disable 'gnu' warnings because we override the user variable 'YFLAGS'.
141 $AUTOMAKE -Wno-gnu Makefile6