doc: typos in test file.
[automake.git] / t / lflags-cxx.sh
blobe3b66bc8db88862b9cb9b2c0a770da738eca0ad4
1 #! /bin/sh
2 # Copyright (C) 2010-2024 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 <https://www.gnu.org/licenses/>.
17 # Check that $(LFLAGS) takes precedence over both $(AM_LFLAGS) and
18 # $(foo_LFLAGS). This is the C++ case.
19 # Please keep this in sync with the sister tests:
20 # - lflags.sh
21 # - yflags.sh
22 # - yflags-cxx.sh
24 . test-init.sh
26 cat >fake-lex <<'END'
27 #!/bin/sh
28 echo '/*' "$*" '*/' >lex.yy.c
29 echo 'extern int dummy;' >> lex.yy.c
30 END
31 chmod a+x fake-lex
33 cat >> configure.ac <<'END'
34 AC_SUBST([CXX], [false])
35 # Simulate presence of Lex using our fake-lex script.
36 AC_SUBST([LEX], ['$(abs_top_srcdir)'/fake-lex])
37 AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
38 AC_SUBST([LEXLIB], [''])
39 AC_OUTPUT
40 END
42 cat > Makefile.am <<'END'
43 AUTOMAKE_OPTIONS = no-dependencies
44 bin_PROGRAMS = foo bar
45 foo_SOURCES = main.cc foo.ll
46 bar_SOURCES = main.cc bar.l++
47 AM_LFLAGS = __am_flags__
48 bar_LFLAGS = __bar_flags__
49 END
51 $ACLOCAL
52 $AUTOMAKE -a
54 grep '\$(LFLAGS).*\$(bar_LFLAGS)' Makefile.in && exit 1
55 grep '\$(LFLAGS).*\$(AM_LFLAGS)' Makefile.in && exit 1
57 : > foo.ll
58 : > bar.l++
60 $AUTOCONF
61 ./configure
62 run_make LFLAGS=__user_flags__ foo.cc bar-bar.c++
64 cat foo.cc
65 cat bar-bar.c++
67 grep '__am_flags__.*__user_flags__' foo.cc
68 grep '__bar_flags__.*__user_flags__' bar-bar.c++