test: protect more yacc declarations against C vs. C++ linkage.
[automake.git] / t / lex5.sh
blob93b670665539efc9115e8221745b93402505ef3e
1 #! /bin/sh
2 # Copyright (C) 2002-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 # Test for subdir lexers.
19 required='cc lex'
20 . test-init.sh
22 cat >> configure.ac << 'END'
23 AC_PROG_CC
24 AM_PROG_LEX
25 AC_OUTPUT
26 END
28 cat > Makefile.am << 'END'
29 AUTOMAKE_OPTIONS = subdir-objects
30 LDADD = @LEXLIB@
31 AM_LFLAGS = --never-interactive
33 bin_PROGRAMS = foo/foo
34 foo_foo_SOURCES = foo/foo.l
35 END
37 mkdir foo
39 cat > foo/foo.l << 'END'
41 "END" return EOF;
44 int
45 main ()
47 while (yylex () != EOF)
50 return 0;
52 END
54 $ACLOCAL
55 $AUTOCONF
56 $AUTOMAKE -a
58 # We expect ylwrap to be used and distributed even if there is
59 # only one lexer.
60 test -f ylwrap
62 mkdir sub
63 cd sub
64 ../configure
65 $MAKE foo/foo.o
66 ls -l # For debugging.
68 test -f foo/foo.c
69 test -f foo/foo.o
71 # Now, adds another lexer to test ylwrap.
73 cd ..
74 cp foo/foo.l foo/foo2.l
75 cat >> Makefile.am << 'END'
76 EXTRA_foo_foo_SOURCES = foo/foo2.l
77 END
79 # Make sure Makefile.in has a new time stamp: the rebuild rules are
80 # used below. We do this after updating Makefile.am, that way we can
81 # ensure that automake, even with --no-force, is not confused if the
82 # new Makefile.am has the same time stamp as the older one (since the
83 # output will change, --no-force should have no effect).
84 $sleep
86 $AUTOMAKE -a --no-force
88 cd sub
89 using_gmake || $MAKE Makefile
90 $MAKE foo/foo2.o
91 ls -l # For debugging.
92 test -f foo/foo2.c
93 test -f foo/foo2.o