tests: avoid two spurious failures on FreeBSD
[automake.git] / t / lflags2.sh
blobf657da5509ab894a1ca10bbe904b886e167b7638
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 lflags.sh, yflags.sh
20 # and yflags2.sh.
22 . ./defs || exit 1
24 cat >fake-lex <<'END'
25 #!/bin/sh
26 echo '/*' "$*" '*/' >lex.yy.c
27 echo 'extern int dummy;' >> lex.yy.c
28 END
29 chmod a+x fake-lex
31 # Remove Lex from the environment, so that it won't interfere
32 # with 'make -e' below.
33 unset LEX || :
35 cat >> configure.ac <<'END'
36 AC_SUBST([CXX], [false])
37 # Simulate presence of Lex using our fake-lex script.
38 AC_SUBST([LEX], ['$(abs_top_srcdir)'/fake-lex])
39 AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
40 AC_SUBST([LEXLIB], [''])
41 AC_OUTPUT
42 END
44 cat > Makefile.am <<'END'
45 AUTOMAKE_OPTIONS = no-dependencies
46 bin_PROGRAMS = foo bar
47 foo_SOURCES = main.cc foo.ll
48 bar_SOURCES = main.cc bar.l++
49 AM_LFLAGS = __am_flags__
50 bar_LFLAGS = __bar_flags__
51 END
53 $ACLOCAL
54 $AUTOMAKE -a
56 grep '\$(LFLAGS).*\$(bar_LFLAGS)' Makefile.in && exit 1
57 grep '\$(LFLAGS).*\$(AM_LFLAGS)' Makefile.in && exit 1
59 : > foo.ll
60 : > bar.l++
62 $AUTOCONF
63 ./configure
64 env LFLAGS=__user_flags__ $MAKE -e foo.cc bar-bar.c++
66 cat foo.cc
67 cat bar-bar.c++
69 grep '__am_flags__.*__user_flags__' foo.cc
70 grep '__bar_flags__.*__user_flags__' bar-bar.c++