2 # Copyright (C) 2010, 2011 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 $(YFLAGS) takes precedence over both $(AM_YFLAGS) and
19 # Please keep this in sync with the sister tests yflags.test, lflags.test
22 required=g++ # FIXME: any working C++ compiler should be OK
27 cat >fake-yacc <<'END'
29 echo '/*' "$*" '*/' >y.tab.c
30 echo 'extern int dummy;' >> y.tab.c
34 # Remove Yacc from the environment, so that it won't interfere
35 # with `make -e' below.
38 cat >> configure.in <<'END'
40 # Simulate presence of Yacc using our fake-yacc script.
41 AC_SUBST([YACC], ['$(abs_top_srcdir)'/fake-yacc])
45 cat > Makefile.am <<'END'
46 bin_PROGRAMS = foo bar
47 foo_SOURCES = main.cc foo.yy
48 bar_SOURCES = main.cc bar.y++
49 AM_YFLAGS = __am_flags__
50 bar_YFLAGS = __bar_flags__
56 grep '\$(YFLAGS).*\$(bar_YFLAGS)' Makefile.in && Exit 1
57 grep '\$(YFLAGS).*\$(AM_YFLAGS)' Makefile.in && Exit 1
59 echo 'int main(void) { return 0; }' > main.cc
65 env YFLAGS=__user_flags__ $MAKE -e
70 grep '__am_flags__.*__user_flags__' foo.cc
72 grep '__bar_flags__.*__user_flags__' bar-bar.c++