tests: avoid a spurious failure on MSYS
[platform/upstream/automake.git] / t / suffix3.tap
1 #! /bin/sh
2 # Copyright (C) 1999-2013 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Test to make sure that suffix rules chain.
18
19 required=c++
20 . test-init.sh
21
22 plan_ 10
23
24 cat >> configure.ac << 'END'
25 AC_PROG_CXX
26 AC_OUTPUT
27 END
28
29 cat > Makefile.am << 'END'
30 SUFFIXES = .zoo
31 .zoo.cc:
32         sed 's/INTEGER/int/g' `test -f '$<' || echo $(srcdir)/`$< >$@
33 bin_PROGRAMS = foo
34 foo_SOURCES = foo.zoo
35 # This is required by "make distcheck".  The useless indirection is
36 # reequired to avoid false positives by the grepping checks below.
37 FOO = foo
38 CLEANFILES = $(FOO).cc
39 END
40
41 command_ok_ "aclocal" $ACLOCAL
42 command_ok_ "automake" $AUTOMAKE
43
44 # The foo.cc intermediate step is implicit, it's a mistake if
45 # Automake requires this file somewhere.  Also, Automake should
46 # not require the file 'foo.c' anywhere.
47 command_ok_ "intermediate files not mentioned" \
48   not $FGREP foo.c Makefile.in
49 # However Automake must figure that foo.zoo is eventually
50 # transformed into foo.o, and use this latter file (to link foo).
51 command_ok_ "final object file figured out" \
52   $FGREP 'foo.$(OBJEXT)' Makefile.in
53
54 command_ok_ "autoconf" $AUTOCONF
55 command_ok_ "configure" ./configure
56
57 # This is deliberately valid C++, but invalid C.
58 cat > foo.zoo <<'END'
59 using namespace std;
60 INTEGER main (void)
61 {
62   return 0;
63 }
64 END
65
66 directive=''; make_can_chain_suffix_rules || directive=TODO
67
68 for target in all distcheck; do
69   command_ok_ "make $target"  \
70               -D "$directive" -r "suffix rules not chained" \
71               $MAKE $target
72 done
73
74 # FIXME: should we check that intermediate file 'foo.cc' has
75 # been removed?  Or is this requiring too much from the make
76 # implementation?
77
78 # Intermediate files should not be distributed.
79 command_ok_ "make distdir" $MAKE distdir
80 command_ok_ "intermediate file not distributed" test ! -e $me-1.0/foo.cc
81
82 :