automake: display whether sleep supports fractional seconds as yes/no.
[automake.git] / t / lex-depend-cxx.sh
blob081ffd6c570732ffdc503a96070d271f28c3b2b8
1 #! /bin/sh
2 # Copyright (C) 2011-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 to make sure dependencies work with Lex/C++.
18 # Test synthesized from PR automake/6.
20 required='c++ lex'
21 . test-init.sh
23 cat >> configure.ac << 'END'
24 AC_PROG_CXX
25 AM_PROG_LEX
26 AC_OUTPUT
27 END
29 cat > Makefile.am << 'END'
30 AM_LFLAGS = --never-interactive
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 is_newest joe.$(OBJEXT) my-hdr.hxx
46 is_newest moe.$(OBJEXT) my-hdr.hxx
47 END
49 # For the explanation of the conditionals on using extern "C",
50 # see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45205#13.
51 cat > joe.ll << 'END'
53 #define YY_DECL int yylex (void)
54 #if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
55 extern "C"
56 #endif
57 YY_DECL;
60 "foo" return EOF;
63 #include "my-hdr.hxx"
64 int yywrap (void)
66 return 1;
68 int main (int argc, char **argv)
70 return 0;
72 END
74 cp joe.ll moe.l++
76 cat > my-hdr.hxx <<'END'
77 // This header contains deliberately invalid C (but valid C++).
78 using namespace std;
79 END
81 $ACLOCAL
82 $AUTOMAKE -a
84 $FGREP joe.Po Makefile.in
85 $FGREP moe.Po Makefile.in
87 $AUTOCONF
88 # Try to enable dependency tracking if possible, even if that means
89 # using slow dependency extractors.
90 ./configure --enable-dependency-tracking
92 # For debugging.
93 for f in $(find . -name '*.Po'); do
94 cat $f
95 done
97 $MAKE test-deps-exist
98 $MAKE
100 $sleep
101 touch my-hdr.hxx
102 $MAKE test-obj-updated