tests: fix a spurious typo-related failure
[automake.git] / t / lflags.sh
blob933f89698c22382e9460700c2607a58e2543c465
1 #! /bin/sh
2 # Copyright (C) 2010-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)
7 # any later version.
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 $(LFLAGS) takes precedence over both $(AM_LFLAGS) and
18 # $(foo_LFLAGS).
19 # Please keep this in sync with the sister tests lflags2.sh, yflags.sh
20 # and yflags2.sh.
22 required=cc
23 . ./defs || exit 1
25 cat >fake-lex <<'END'
26 #!/bin/sh
27 echo '/*' "$*" '*/' >lex.yy.c
28 echo 'extern int dummy;' >> lex.yy.c
29 END
30 chmod a+x fake-lex
32 # Remove Lex from the environment, so that it won't interfere
33 # with 'make -e' below.
34 unset LEX || :
36 cat >> configure.ac <<'END'
37 AC_SUBST([CC], [false])
38 # Simulate presence of Lex using our fake-lex script.
39 AC_SUBST([LEX], ['$(abs_top_srcdir)'/fake-lex])
40 AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
41 AC_SUBST([LEXLIB], [''])
42 AC_OUTPUT
43 END
45 cat > Makefile.am <<'END'
46 AUTOMAKE_OPTIONS = no-dependencies
47 bin_PROGRAMS = foo bar
48 foo_SOURCES = main.c foo.l
49 bar_SOURCES = main.c bar.l
50 AM_LFLAGS = __am_flags__
51 bar_LFLAGS = __bar_flags__
52 END
54 $ACLOCAL
55 $AUTOMAKE -a
57 grep '\$(LFLAGS).*\$(bar_LFLAGS)' Makefile.in && exit 1
58 grep '\$(LFLAGS).*\$(AM_LFLAGS)' Makefile.in && exit 1
60 : > foo.l
61 : > bar.l
63 $AUTOCONF
64 ./configure
65 env LFLAGS=__user_flags__ $MAKE -e foo.c bar-bar.c
67 cat foo.c
68 cat bar-bar.c
70 grep '__am_flags__.*__user_flags__' foo.c
71 grep '__bar_flags__.*__user_flags__' bar-bar.c