doc: typos in test file.
[automake.git] / t / silent-cxx.sh
blob5b70cbc65700f9c4701fc002a54be999c8d9bde0
1 #!/bin/sh
2 # Copyright (C) 2010-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 # Check silent-rules mode for C++, both with and without automatic
18 # dependency tracking.
20 required=c++
21 . test-init.sh
23 mkdir sub
25 cat >>configure.ac <<'EOF'
26 AC_PROG_CXX
27 AC_CONFIG_FILES([sub/Makefile])
28 AC_OUTPUT
29 EOF
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)
37 SUBDIRS = sub
38 EOF
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)
47 EOF
49 cat > foo.cpp <<'EOF'
50 using namespace std; /* C compilers fail on this. */
51 int main (void) { return 0; }
52 EOF
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
60 $ACLOCAL
61 $AUTOMAKE --add-missing
62 $AUTOCONF
64 # Sanity check: make sure the cache variable we force is really used
65 # by configure.
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.
71 for config_args in \
72 --enable-dependency-tracking --disable-dependency-tracking
75 ./configure $config_args --enable-silent-rules
77 run_make -O
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.
92 $MAKE clean
94 run_make -O V=1
96 grep ' -c ' stdout
97 grep ' -o ' stdout
99 $EGREP '(CXX|LD) ' stdout && exit 1
101 # Ensure a clean reconfiguration/rebuild.
102 $MAKE clean
103 $MAKE maintainer-clean
105 done