news: describe recently-fixed bug in vala support
[platform/upstream/automake.git] / tests / subobj9.test
1 #! /bin/sh
2 # Copyright (C) 2002, 2004, 2005, 2010 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 for PR 312.
18
19 required='libtoolize g++'
20 . ./defs || Exit 1
21
22 set -e
23
24 cat > configure.in << END
25 AC_INIT([$me], [1.0])
26 AM_INIT_AUTOMAKE([subdir-objects])
27 AC_PROG_CXX
28 AM_PROG_LIBTOOL
29 AC_CONFIG_FILES([Makefile])
30 AC_OUTPUT
31 END
32
33 cat > Makefile.am << 'END'
34 noinst_LTLIBRARIES = libfoo.la
35 libfoo_la_SOURCES = src/foo.cc .//src/bar.cc  # the `.//' is meant.
36 .PHONY: print
37 print:
38         @echo BEG1: "$(LTCXXCOMPILE)" :1END
39         @echo BEG2: "$(CXXLINK)" :2END
40 END
41
42 mkdir src
43 cat > src/foo.cc << 'END'
44 int doit2 (void);
45 int doit (void)
46 {
47    return doit2();
48 }
49 END
50
51 cat > src/bar.cc << 'END'
52 int doit2 (void)
53 {
54    return 23;
55 }
56 END
57
58
59 libtoolize --force
60 $ACLOCAL
61 $AUTOCONF
62 $AUTOMAKE -a
63
64 # Skip this test on configure errors (e.g., broken C++ compilers).
65 ./configure || Exit 77
66
67 # Ensure './libtool --help' will use the right tool versions.
68 export AUTOCONF AUTOMAKE
69
70 # Opportunistically check that --tag=CXX is used when supported.
71 if ./libtool --help | grep tag=TAG; then
72   $MAKE print >stdout || { cat stdout; Exit 1; }
73   cat stdout
74   grep 'BEG1: .*--tag=CXX.*--mode=compile.* :1END' stdout
75   grep 'BEG2: .*--tag=CXX.*--mode=link.* :2END' stdout
76 fi
77
78 $MAKE
79 $MAKE distcheck >output 2>&1 || { cat output; Exit 1; }
80 cat output
81 # GNU Make used to complain that the Makefile contained two rules
82 # for `src/.dirstamp' and `.//src/.dirstamp'.
83 grep 'overriding commands' output && Exit 1
84
85 :