Merge branch 'yacc-quote-fix'
[automake.git] / tests / lex-depend-cxx.test
blob478a55fb01311c215f1b48716bf46bc06470fac2
1 #! /bin/sh
2 # Copyright (C) 2011-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 # Test to make sure dependencies work with Lex/C++.
18 # Test synthesized from PR automake/6.
20 required=lex
21 . ./defs || Exit 1
23 set -e
25 cat >> configure.in << 'END'
26 AC_PROG_CXX
27 AM_PROG_LEX
28 AC_OUTPUT
29 END
31 cat > Makefile.am << 'END'
32 noinst_PROGRAMS = joe moe
33 joe_SOURCES = joe.ll
34 moe_SOURCES = moe.l++
35 LDADD = $(LEXLIB)
37 .PHONY: test-deps-exist
38 test-deps-exist:
39 ls -l $(DEPDIR) ;: For debugging.
40 test -f $(DEPDIR)/joe.Po
41 test -f $(DEPDIR)/moe.Po
43 .PHONY: test-obj-updated
44 test-obj-updated: joe.$(OBJEXT) moe.$(OBJEXT)
45 stat older my-hdr.hxx joe.$(OBJEXT) moe.$(OBJEXT) || :
46 test `ls -t older joe.$(OBJEXT) | sed 1q` = joe.$(OBJEXT)
47 test `ls -t older moe.$(OBJEXT) | sed 1q` = moe.$(OBJEXT)
48 END
50 cat > joe.ll << 'END'
52 "foo" return EOF;
55 #include "my-hdr.hxx"
56 int yywrap (void)
58 return 1;
60 int main (int argc, char **argv)
62 printf("Hello, World!\n");
63 return 0;
65 END
67 cp joe.ll moe.l++
69 cat > my-hdr.hxx <<'END'
70 // This header contains deliberetly invalid C (but valid C++)
71 #include <cstdio>
72 using namespace std;
73 END
75 $ACLOCAL
76 $AUTOMAKE -a
78 $FGREP joe.Po Makefile.in
79 $FGREP moe.Po Makefile.in
81 $AUTOCONF
82 # Try to enable dependency tracking if possible, even if that means
83 # using slow dependency extractors.
84 ./configure --enable-dependency-tracking
86 $MAKE test-deps-exist
87 $MAKE
89 : > older
90 $sleep
91 touch my-hdr.hxx
92 $MAKE test-obj-updated