tests: Let 'ltorder.sh' run successfully with Guix dynamic loader
[automake.git] / t / lex5.sh
blobd41a3b6b0c6a7b8b3685851826483dfdd11afb30
1 #! /bin/sh
2 # Copyright (C) 2002-2018 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@
32 bin_PROGRAMS = foo/foo
33 foo_foo_SOURCES = foo/foo.l
34 END
36 mkdir foo
38 cat > foo/foo.l << 'END'
40 #define YY_NO_UNISTD_H 1
43 "END" return EOF;
46 int
47 main ()
49 while (yylex () != EOF)
52 return 0;
54 END
56 $ACLOCAL
57 $AUTOCONF
58 $AUTOMAKE -a
60 # We expect ylwrap to be used and distributed even if there is
61 # only one lexer.
62 test -f ylwrap
64 mkdir sub
65 cd sub
66 ../configure
67 $MAKE foo/foo.o
68 ls -l # For debugging.
70 test -f foo/foo.c
71 test -f foo/foo.o
73 # Now, adds another lexer to test ylwrap.
75 cd ..
76 cp foo/foo.l foo/foo2.l
77 cat >> Makefile.am << 'END'
78 EXTRA_foo_foo_SOURCES = foo/foo2.l
79 END
81 # Make sure Makefile.in has a new time stamp: the rebuild rules are
82 # used below. We do this after updating Makefile.am, that way we can
83 # ensure that automake, even with --no-force, is not confused if the
84 # new Makefile.am has the same time stamp as the older one (since the
85 # output will change, --no-force should have no effect).
86 $sleep
88 $AUTOMAKE -a --no-force
90 cd sub
91 using_gmake || $MAKE Makefile
92 $MAKE foo/foo2.o
93 ls -l # For debugging.
94 test -f foo/foo2.c
95 test -f foo/foo2.o