2 # Copyright (C) 2011-2013 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 the user can force automake to use *_YFLAGS variables
18 # which have conditional content.
22 cat >> configure.ac <<'END'
23 AC_SUBST([CC], [false])
25 AM_CONDITIONAL([COND], [test x"$cond" = x"yes"])
30 cat > bin/fake-yacc <<'END'
32 echo "/* $* */" > y.tab.c
33 echo 'extern int dummy;' >> y.tab.c
35 chmod a+x bin/fake-yacc
36 PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
37 YACC=fake-yacc; export YACC
39 cat > Makefile.am <<'END'
40 AUTOMAKE_OPTIONS = no-dependencies
41 bin_PROGRAMS = foo bar
42 foo_SOURCES = foo.y main.c
43 bar_SOURCES = $(foo_SOURCES)
44 bar_YFLAGS = $(bar_yflags2)
46 AM_YFLAGS = __am_cond_yes__
47 bar_YFLAGS += __bar_cond_yes__
49 AM_YFLAGS = __am_cond_no__
50 bar_yflags2 = __bar_cond_no__
58 $AUTOMAKE -a -Wno-unsupported
60 $EGREP '(YFLAGS|yflags|am__append)' Makefile.in # For debugging.
68 $FGREP ' __am_cond_yes__ ' foo.c
69 $FGREP ' __bar_cond_yes__ ' bar-foo.c
70 $FGREP 'cond_no' foo.c bar-foo.c && exit 1
72 $MAKE maintainer-clean
81 $FGREP ' __am_cond_no__ ' foo.c
82 $FGREP ' __bar_cond_no__ ' bar-foo.c
83 $FGREP 'cond_yes' foo.c bar-foo.c && exit 1