2 # Copyright (C) 2010-2017 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++, both with and without automatic
18 # dependency tracking.
25 cat >>configure.ac
<<'EOF'
27 AC_CONFIG_FILES([sub/Makefile])
31 cat > Makefile.am
<<'EOF'
32 # Need generic and non-generic rules.
33 bin_PROGRAMS = foo1 foo2
34 foo1_SOURCES = foo.cpp baz.cxx quux.cc
35 foo2_SOURCES = $(foo1_SOURCES)
36 foo2_CXXFLAGS = $(AM_CXXFLAGS)
40 cat > sub
/Makefile.am
<<'EOF'
41 AUTOMAKE_OPTIONS = subdir-objects
42 # Need generic and non-generic rules.
43 bin_PROGRAMS = bar1 bar2
44 bar1_SOURCES = bar.cpp
45 bar2_SOURCES = $(bar1_SOURCES)
46 bar2_CXXFLAGS = $(AM_CXXFLAGS)
50 using namespace std; /* C compilers fail on this. */
51 int main (void) { return 0; }
54 # Let's try out other extensions too.
55 echo 'class Baz { public: int i; };' > baz.cxx
56 echo 'class Quux { public: bool b; };' > quux.cc
58 cp foo.cpp sub
/bar.cpp
61 $AUTOMAKE --add-missing
64 # Sanity check: make sure the cache variable we force is really used
66 $FGREP am_cv_CXX_dependencies_compiler_type configure
68 # Force dependency tracking explicitly, so that slow dependency
69 # extractors are not rejected. Try also with dependency tracking
70 # explicitly disabled.
72 --enable-dependency-tracking --disable-dependency-tracking
75 .
/configure
$config_args --enable-silent-rules
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.
99 $EGREP '(CXX|LD) ' stdout
&& exit 1
101 # Ensure a clean reconfiguration/rebuild.
103 $MAKE maintainer-clean