2 # Copyright (C) 2010-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)
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 # Check silent-rules mode for C++.
18 # This test requires the GNU C++ compiler; keep it in sync with sister
19 # test 'silentcxx.sh', which should work with generic compilers.
26 cat >>configure.ac <<'EOF'
28 AC_CONFIG_FILES([sub/Makefile])
32 cat > Makefile.am <<'EOF'
33 # Need generic and non-generic rules.
34 bin_PROGRAMS = foo1 foo2
35 foo1_SOURCES = foo.cpp baz.cxx quux.cc
36 foo2_SOURCES = $(foo1_SOURCES)
37 foo2_CXXFLAGS = $(AM_CXXFLAGS)
41 cat > sub/Makefile.am <<'EOF'
42 AUTOMAKE_OPTIONS = subdir-objects
43 # Need generic and non-generic rules.
44 bin_PROGRAMS = bar1 bar2
45 bar1_SOURCES = bar.cpp
46 bar2_SOURCES = $(bar1_SOURCES)
47 bar2_CXXFLAGS = $(AM_CXXFLAGS)
51 using namespace std; /* C compilers fail on this. */
52 int main() { return 0; }
55 # Let's try out other extensions too.
56 echo 'class Baz { public: int i; };' > baz.cxx
57 echo 'class Quux { public: bool b; };' > quux.cc
59 cp foo.cpp sub/bar.cpp
62 $AUTOMAKE --add-missing
65 # Sanity check: make sure the cache variable we force is really used
67 $FGREP am_cv_CXX_dependencies_compiler_type configure
69 # Force gcc ("fast") depmode.
70 # This apparently useless "for" loop is here to simplify the syncing
71 # with sister test 'silentcxx.sh'.
73 am_cv_CXX_dependencies_compiler_type=gcc
75 ./configure $config_args --enable-silent-rules
76 $MAKE >stdout || { cat stdout; exit 1; }
79 $EGREP ' (-c|-o)' stdout && exit 1
80 grep 'mv ' stdout && exit 1
82 grep 'CXX .*foo\.' stdout
83 grep 'CXX .*baz\.' stdout
84 grep 'CXX .*quux\.' stdout
85 grep 'CXX .*bar\.' stdout
86 grep 'CXXLD .*foo1' stdout
87 grep 'CXXLD .*bar1' stdout
88 grep 'CXXLD .*foo2' stdout
89 grep 'CXXLD .*bar2' stdout
91 # Ensure a clean rebuild.
94 $MAKE V=1 >stdout || { cat stdout; exit 1; }
100 $EGREP '(CC|CXX|LD) ' stdout && exit 1
102 # Ensure a clean reconfiguration/rebuild.
104 $MAKE maintainer-clean