tests: avoid a spurious failure on MSYS
[platform/upstream/automake.git] / t / lflags.sh
1 #! /bin/sh
2 # Copyright (C) 2010-2013 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
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.
21
22 required=cc
23 . test-init.sh
24
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
31
32 cat >> configure.ac <<'END'
33 AC_SUBST([CC], [false])
34 # Simulate presence of Lex using our fake-lex script.
35 AC_SUBST([LEX], ['$(abs_top_srcdir)'/fake-lex])
36 AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
37 AC_SUBST([LEXLIB], [''])
38 AC_OUTPUT
39 END
40
41 cat > Makefile.am <<'END'
42 AUTOMAKE_OPTIONS = no-dependencies
43 bin_PROGRAMS = foo bar
44 foo_SOURCES = main.c foo.l
45 bar_SOURCES = main.c bar.l
46 AM_LFLAGS = __am_flags__
47 bar_LFLAGS = __bar_flags__
48 END
49
50 $ACLOCAL
51 $AUTOMAKE -a
52
53 grep '\$(LFLAGS).*\$(bar_LFLAGS)' Makefile.in && exit 1
54 grep '\$(LFLAGS).*\$(AM_LFLAGS)' Makefile.in && exit 1
55
56 : > foo.l
57 : > bar.l
58
59 $AUTOCONF
60 ./configure
61 run_make LFLAGS=__user_flags__ foo.c bar-bar.c
62
63 cat foo.c
64 cat bar-bar.c
65
66 grep '__am_flags__.*__user_flags__' foo.c
67 grep '__bar_flags__.*__user_flags__' bar-bar.c
68
69 :