automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 07/14] Make sure silent*.test work with non-GNU C compilers.


From: Stefano Lattarini
Subject: [PATCH 07/14] Make sure silent*.test work with non-GNU C compilers.
Date: Fri, 2 Jul 2010 14:18:04 +0200
User-agent: KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; )

And here is the ther fix for spurious failures in tests `silent*.test' 
when run with non-GNU compilers.

Regards,
     Stefano

-*-*-*-

Make sure silent*.test work with non-GNU C compilers.

* tests/silent2.test: Do not force configure to assume gcc-style
depmode, instead try to force use of slow depmode if nothing
better is available.  Accordingly, the test does not have to
require gcc anymore.
* tests/silent4.test: Likewise.
* tests/silent5.test: Likewise.
* tests/silentlex.test: Likewise.
* tests/silentyacc.test: Likewise.
* tests/silentcxx.test: Likewise (but with g++ instead of gcc).
* tests/silent2b.test: New test, sister test of silent2.test,
but require use of GNU C/C++ compilers and try only gcc-style
fast depmode.
* tests/silent4b.test: Likewise, but sister of silent4.test.
* tests/silent5b.test: Likewise, but sister of silent5.test.
* tests/silentcxx2.test: Likewise, but sister of silentcxx.test.
* tests/silent.test: Updated comments about sister tests.
* tests/silent3.test: Likewise.
* tests/silent9.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
From 48c1e6b061b13b7ff3cd19fa13f6c5daf92e9a38 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 2 Jul 2010 12:41:30 +0200
Subject: [PATCH 07/14] Make sure silent*.test work with non-GNU C compilers.

* tests/silent2.test: Do not force configure to assume gcc-style
depmode, instead try to force use of slow depmode if nothing
better is available.  Accordingly, the test does not have to
require gcc anymore.
* tests/silent4.test: Likewise.
* tests/silent5.test: Likewise.
* tests/silentlex.test: Likewise.
* tests/silentyacc.test: Likewise.
* tests/silentcxx.test: Likewise (but with g++ instead of gcc).
* tests/silent2b.test: New test, sister test of silent2.test,
but require use of GNU C/C++ compilers and try only gcc-style
fast depmode.
* tests/silent4b.test: Likewise, but sister of silent4.test.
* tests/silent5b.test: Likewise, but sister of silent5.test.
* tests/silentcxx2.test: Likewise, but sister of silentcxx.test.
* tests/silent.test: Updated comments about sister tests.
* tests/silent3.test: Likewise.
* tests/silent9.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog             |   21 +++++
 tests/Makefile.am     |    4 +
 tests/Makefile.in     |    4 +
 tests/silent.test     |    2 +-
 tests/silent2.test    |   10 +--
 tests/silent2b.test   |   85 +++++++++++++++++++
 tests/silent3.test    |    2 +-
 tests/silent4.test    |    7 +-
 tests/silent4b.test   |   91 ++++++++++++++++++++
 tests/silent5.test    |    3 +-
 tests/silent5b.test   |  223 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/silent9.test    |    2 +-
 tests/silentcxx.test  |    3 +-
 tests/silentcxx2.test |  109 ++++++++++++++++++++++++
 tests/silentlex.test  |    2 +-
 tests/silentyacc.test |    2 +-
 16 files changed, 553 insertions(+), 17 deletions(-)
 create mode 100755 tests/silent2b.test
 create mode 100755 tests/silent4b.test
 create mode 100755 tests/silent5b.test
 create mode 100755 tests/silentcxx2.test

diff --git a/ChangeLog b/ChangeLog
index 29d0159..7be360e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
 2010-07-02  Stefano Lattarini  <address@hidden>
 
+       Make sure tests `silent*.test' work with non-GNU C compilers.
+       * tests/silent2.test: Do not force configure to assume gcc-style
+       depmode, instead try to force use of slow depmode if nothing
+       better is available.  Accordingly, the test does not have to
+       require gcc anymore.
+       * tests/silent4.test: Likewise.
+       * tests/silent5.test: Likewise.
+       * tests/silentlex.test: Likewise.
+       * tests/silentyacc.test: Likewise.
+       * tests/silentcxx.test: Likewise (but with g++ instead of gcc).
+       * tests/silent2b.test: New test, sister test of silent2.test,
+       but require use of GNU C/C++ compilers and try only gcc-style
+       fast depmode.
+       * tests/silent4b.test: Likewise, but sister of silent4.test.
+       * tests/silent5b.test: Likewise, but sister of silent5.test.
+       * tests/silentcxx2.test: Likewise, but sister of silentcxx.test.
+       * tests/silent.test: Updated comments about sister tests.
+       * tests/silent3.test: Likewise.
+       * tests/silent9.test: Likewise.
+       * tests/Makefile.am (TESTS): Updated.
+
        Fix `silent*.test' for C++ compilers with "weird" names.
        * tests/silentcxx.test: Do not fail if the string `CC ' is found
        in make output when in verbose mode, since there could be
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a2f56af..7344522 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -638,14 +638,18 @@ scripts.test \
 seenc.test \
 silent.test \
 silent2.test \
+silent2b.test \
 silent3.test \
 silent4.test \
+silent4b.test \
 silent5.test \
+silent5b.test \
 silent6.test \
 silent7.test \
 silent8.test \
 silent9.test \
 silentcxx.test \
+silentcxx2.test \
 silentf77.test \
 silentf90.test \
 silentlex.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index fc65280..2cc46ca 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -849,14 +849,18 @@ scripts.test \
 seenc.test \
 silent.test \
 silent2.test \
+silent2b.test \
 silent3.test \
 silent4.test \
+silent4b.test \
 silent5.test \
+silent5b.test \
 silent6.test \
 silent7.test \
 silent8.test \
 silent9.test \
 silentcxx.test \
+silentcxx2.test \
 silentf77.test \
 silentf90.test \
 silentlex.test \
diff --git a/tests/silent.test b/tests/silent.test
index db7919e..881e2d1 100755
--- a/tests/silent.test
+++ b/tests/silent.test
@@ -16,7 +16,7 @@
 
 # Check silent-rules mode, without libtool, standard depmode case.
 
-# Please keep this file in sync with silent2.test.
+# Please keep this file in sync with silent2.test and silent2b.test.
 
 required=cc
 . ./defs || Exit 1
diff --git a/tests/silent2.test b/tests/silent2.test
index da22718..8b7f56e 100755
--- a/tests/silent2.test
+++ b/tests/silent2.test
@@ -14,12 +14,10 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check silent-rules mode, without libtool, non-fastdep case
-# (so that, with GCC, we also cover the other code paths in depend2).
+# Check silent-rules mode, without libtool, non-fastdep case.
+# Please keep this file in sync with silent.test and silent2b.test.
 
-# Please keep this file in sync with silent.test.
-
-required=gcc
+required=cc
 . ./defs
 
 set -e
@@ -62,7 +60,7 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules
+./configure --enable-dependency-tracking --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 $EGREP ' (-c|-o)' stdout && Exit 1
diff --git a/tests/silent2b.test b/tests/silent2b.test
new file mode 100755
index 0000000..d5430c9
--- /dev/null
+++ b/tests/silent2b.test
@@ -0,0 +1,85 @@
+#!/bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check silent-rules mode, without libtool, non-fastdep case
+# (so that, with GCC, we also cover the other code paths in depend2).
+# Please keep this file in sync with silent.test ans silent2.test.
+
+required=gcc
+. ./defs
+
+set -e
+
+mkdir sub
+
+cat >>configure.in <<'EOF'
+AM_SILENT_RULES
+AC_CONFIG_FILES([sub/Makefile])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+# Need generic and non-generic rules.
+bin_PROGRAMS = foo bar
+bar_CFLAGS = $(AM_CFLAGS)
+SUBDIRS = sub
+EOF
+
+cat > sub/Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = subdir-objects
+# Need generic and non-generic rules.
+bin_PROGRAMS = baz bla
+bla_CFLAGS = $(AM_CFLAGS)
+EOF
+
+cat > foo.c <<'EOF'
+int main ()
+{
+  return 0;
+}
+EOF
+cp foo.c bar.c
+cp foo.c sub/baz.c
+cp foo.c sub/bla.c
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+$EGREP ' (-c|-o)' stdout && Exit 1
+grep 'mv ' stdout && Exit 1
+grep 'CC .*foo\.' stdout
+grep 'CC .*bar\.' stdout
+grep 'CC .*baz\.' stdout
+grep 'CC .*bla\.' stdout
+grep 'CCLD .*foo' stdout
+grep 'CCLD .*bar' stdout
+grep 'CCLD .*baz' stdout
+grep 'CCLD .*bla' stdout
+
+$MAKE clean
+$MAKE V=1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep ' -c' stdout
+grep ' -o foo' stdout
+$EGREP '(CC|LD) ' stdout && Exit 1
+
+:
diff --git a/tests/silent3.test b/tests/silent3.test
index 4a2f9af..c7d2832 100755
--- a/tests/silent3.test
+++ b/tests/silent3.test
@@ -16,7 +16,7 @@
 
 # Check silent-rules mode, with libtool, standard depmode case.
 
-# Please keep this file in sync with silent4.test and silent9.test.
+# Please keep this file in sync with sister tests silent{4,4b,9}.test.
 
 required='cc libtoolize'
 . ./defs
diff --git a/tests/silent4.test b/tests/silent4.test
index c6c1298..bd08943 100755
--- a/tests/silent4.test
+++ b/tests/silent4.test
@@ -15,11 +15,10 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check silent-rules mode, with libtool, non-fastdep case
-# (so that, with GCC, we also cover the other code paths in depend2).
 
-# Please keep this file in sync with silent3.test and silent9.test.
+# Please keep this file in sync with siste tests silent{3,4b,9}.test.
 
-required="libtoolize gcc"
+required="libtoolize cc"
 . ./defs
 
 set -e
@@ -64,7 +63,7 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules
+./configure --enable-dependency-tracking --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 $EGREP ' (-c|-o)' stdout && Exit 1
diff --git a/tests/silent4b.test b/tests/silent4b.test
new file mode 100755
index 0000000..f7b4e3b
--- /dev/null
+++ b/tests/silent4b.test
@@ -0,0 +1,91 @@
+#!/bin/sh
+# Copyright (C) 2010  Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check silent-rules mode, with libtool, non-fastdep case
+# (so that, with GCC, we also cover the other code paths in depend2).
+
+# Please keep this file in sync with sister tests silent{3,4,9}.test.
+
+required="libtoolize gcc"
+. ./defs
+
+set -e
+
+mkdir sub
+
+cat >>configure.in <<'EOF'
+AM_SILENT_RULES
+AC_CONFIG_FILES([sub/Makefile])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_LIBTOOL
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+# Need generic and non-generic rules.
+lib_LTLIBRARIES = libfoo.la libbar.la
+libbar_la_CFLAGS = $(AM_CFLAGS)
+SUBDIRS = sub
+EOF
+
+cat > sub/Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = subdir-objects
+# Need generic and non-generic rules.
+lib_LTLIBRARIES = libbaz.la libbla.la
+libbla_la_CFLAGS = $(AM_CFLAGS)
+EOF
+
+cat > libfoo.c <<'EOF'
+int main ()
+{
+  return 0;
+}
+EOF
+cp libfoo.c libbar.c
+cp libfoo.c sub/libbaz.c
+cp libfoo.c sub/libbla.c
+
+libtoolize
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+$EGREP ' (-c|-o)' stdout && Exit 1
+grep 'mv ' stdout && Exit 1
+grep ' CC .*foo\.' stdout
+grep ' CC .*bar\.' stdout
+grep ' CC .*baz\.' stdout
+grep ' CC .*bla\.' stdout
+grep ' CCLD .*foo' stdout
+grep ' CCLD .*bar' stdout
+grep ' CCLD .*baz' stdout
+grep ' CCLD .*bla' stdout
+
+$MAKE clean
+$MAKE V=1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep ' -c' stdout
+grep ' -o libfoo' stdout
+# The libtool command line can contain e.g. a `--tag=CC' option.
+sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && Exit 1
+
+$MAKE distclean
+
+:
diff --git a/tests/silent5.test b/tests/silent5.test
index ff3015a..94f6fd5 100755
--- a/tests/silent5.test
+++ b/tests/silent5.test
@@ -18,6 +18,7 @@
 # This test partly overlaps with other silent*.test, but it serves as
 # a stress test by using many different languages at once -- so don't
 # remove this test script.
+# Please keep this file in sync with sister test silent5b.test.
 
 # FIXME: a generic Fortran compiler should suffice here
 required='cc c++ gfortran flex bison'
@@ -185,7 +186,7 @@ $AUTOCONF
 # configure once for fastdep, once for non-fastdep, once for nodep
 for config_args in \
   '' \
-  am_cv_CC_dependencies_compiler_type=gcc \
+  --enable-dependency-tracking \
   --disable-dependency-tracking
 do
 
diff --git a/tests/silent5b.test b/tests/silent5b.test
new file mode 100755
index 0000000..e974e18
--- /dev/null
+++ b/tests/silent5b.test
@@ -0,0 +1,223 @@
+#!/bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check silent-rules mode, languages other than C, using GNU compilers
+# and gcc-syle fast depmode.
+# This test partly overlaps with other silent*.test, but it serves as
+# a stress test by using many different languages at once -- so don't
+# remove this test script.
+# Please keep this file in sync with sister test silent5.test.
+
+# We deliberatly force the use of GNU compilers.
+required='gcc g++ gfortran flex bison'
+. ./defs
+
+set -e
+
+tab='  '
+
+# Avoids too much code duplication.
+do_and_check_silent_build ()
+{
+  case $1 in
+    --rebuild) rebuild=true;;
+            *) rebuild=false;;
+  esac
+
+  $MAKE >stdout || { cat stdout; Exit 1; }
+  cat stdout
+
+  $EGREP ' (-c|-o)' stdout && Exit 1
+  $EGREP '(mv|ylwrap) ' stdout && Exit 1
+
+  grep 'CXX .*foo1\.' stdout
+  grep 'CXX .*baz1\.' stdout
+  grep 'FC .*foo2\.'  stdout
+  grep 'FC .*baz2\.'  stdout
+  grep 'F77 .*foo3\.' stdout
+  grep 'F77 .*baz3\.' stdout
+  grep ' CC .*foo5\.' stdout
+  grep ' CC .*baz5\.' stdout
+  grep ' CC .*foo6\.' stdout
+  grep ' CC .*baz6\.' stdout
+
+  grep 'CXXLD .*foo' stdout
+  grep 'CCLD .*bar'  stdout
+  grep 'CXXLD .*baz' stdout
+  grep 'CCLD .*bla'  stdout
+
+  if $rebuild; then :; else
+    grep 'YACC .*foo6\.' stdout
+    grep 'YACC .*baz6\.' stdout
+    grep 'LEX .*foo5\.'  stdout
+    grep 'LEX .*baz5\.'  stdout
+  fi
+
+  unset rebuild
+}
+
+# Avoids too much code duplication.
+do_and_check_verbose_build ()
+{
+
+  case $1 in
+    --rebuild) rebuild=true;;
+            *) rebuild=false;;
+  esac
+
+  $MAKE V=1 >stdout || { cat stdout; Exit 1; }
+  cat stdout
+
+  grep ' -c ' stdout
+  grep ' -o ' stdout
+
+  # The complex regexp is needed to cater for (C++) compilers with a
+  # "weird" name, such as Sun Stdio's "sunCC" compiler.
+  # And yes, they have already caused spurious failures in practice.
+  $EGREP "(^| |$tab)(CC|CXX|FC|F77LD)($| |$tab)" stdout && Exit 1
+
+  if $rebuild; then :; else
+    grep 'ylwrap ' stdout
+    $EGREP '(LEX|YACC) ' stdout && Exit 1
+  fi
+
+  unset rebuild
+}
+
+mkdir sub
+
+cat >>configure.in <<'EOF'
+AM_SILENT_RULES
+AM_PROG_CC_C_O
+AC_PROG_CXX
+AC_PROG_F77
+AC_PROG_FC
+AC_PROG_LEX
+AC_PROG_YACC
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+# Need generic and non-generic rules.
+bin_PROGRAMS = foo bar fo2
+bar_CFLAGS = $(AM_CFLAGS)
+foo_SOURCES = foo1.cpp foo2.f90 foo3.f foo5.l foo6.y
+fo2_SOURCES = $(foo_SOURCES)
+fo2_CPPFLAGS = $(AM_CPPFLAGS)
+fo2_FFLAGS = $(AM_FFLAGS)
+fo2_FCFLAGS = $(AM_FCFLAGS)
+SUBDIRS = sub
+AM_YFLAGS = -d
+LDADD = $(LEXLIB)
+BUILT_SOURCES = foo6.h
+EOF
+
+cat > sub/Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = subdir-objects
+# Need generic and non-generic rules.
+bin_PROGRAMS = baz bla ba2
+bla_CFLAGS = $(AM_CFLAGS)
+baz_SOURCES = baz1.cpp baz2.f90 baz3.f baz5.l baz6.y
+ba2_SOURCES = $(baz_SOURCES)
+ba2_CPPFLAGS = $(AM_CPPFLAGS)
+ba2_FFLAGS = $(AM_FFLAGS)
+ba2_FCFLAGS = $(AM_FCFLAGS)
+AM_YFLAGS = -d
+LDADD = $(LEXLIB)
+BUILT_SOURCES = baz6.h
+EOF
+
+cat > foo1.cpp <<'EOF'
+int main ()
+{
+  return 0;
+}
+EOF
+cat > foo2.f90 <<'EOF'
+      subroutine foo2
+      return
+      end
+EOF
+cat > foo3.f <<'EOF'
+      subroutine foo3
+      return
+      end
+EOF
+cat > foo5.l <<'EOF'
+%%
+"END"   return EOF;
+.
+%%
+EOF
+cat > foo6.y <<'EOF'
+%{
+void yyerror (char *s) {}
+%}
+%token EOF
+%%
+fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
+EOF
+cp foo1.cpp bar.c
+cp foo1.cpp sub/baz.c
+cp foo1.cpp sub/bla.c
+cp foo1.cpp sub/baz1.cpp
+cp foo2.f90 sub/baz2.f90
+cp foo3.f sub/baz3.f
+cp foo5.l sub/baz5.l
+cp foo6.y sub/baz6.y
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+# Force gcc-style depmode fastdep.  Do not remove this apparently
+# useless loop, to avoid introducing spurious diffs with sister
+# tests.  Also, do not remove the apparently useless single quoting,
+# or Solaris /bin/sh won't execute the body of the loop.
+for config_args in \
+  'am_cv_CC_dependencies_compiler_type=gcc'
+do
+
+  ./configure $config_args --enable-silent-rules
+
+  do_and_check_silent_build
+  # Cleaning and then rebuilding with the same V flag (and without
+  # removing the generated sources in between) shouldn't trigger a
+  # different set of rules.
+  $MAKE clean
+  do_and_check_silent_build --rebuild
+
+  # Ensure a clean rebuild.
+  $MAKE clean
+  # This is required, since these files are not removed by `make clean'
+  # (as dictated by the GNU Coding Standards).
+  rm -f foo5.c foo6.[ch] sub/baz5.c sub/baz6.[ch]
+
+  do_and_check_verbose_build
+  # Cleaning and then rebuilding with the same V flag (and without
+  # removing the generated sources in between) shouldn't trigger a
+  # different set of rules.
+  $MAKE clean
+  do_and_check_verbose_build --rebuild
+
+  # Ensure a clean reconfiguration/rebuild.
+  $MAKE clean
+  $MAKE maintainer-clean
+
+done
+
+:
diff --git a/tests/silent9.test b/tests/silent9.test
index 27fb492..1ce89a8 100755
--- a/tests/silent9.test
+++ b/tests/silent9.test
@@ -16,7 +16,7 @@
 
 # Check silent-rules mode, with libtool, nodep case.
 
-# Please keep this file in sync with silent3.test and silent4.test.
+# Please keep this file in sync with sister tests silent{3,4,4b}.test.
 
 required='cc libtoolize'
 . ./defs
diff --git a/tests/silentcxx.test b/tests/silentcxx.test
index 8dc5c94..2b1af8f 100755
--- a/tests/silentcxx.test
+++ b/tests/silentcxx.test
@@ -15,6 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check silent-rules mode for C++.
+# Keep this in sync with sister test silentcxx2.test.
 
 required='c++'
 . ./defs
@@ -68,7 +69,7 @@ $AUTOCONF
 # configure once for fastdep, once for non-fastdep, once for nodep
 for config_args in \
   '' \
-  am_cv_CC_dependencies_compiler_type=gcc \
+  --enable-dependency-tracking \
   --disable-dependency-tracking
 do
   ./configure $config_args --enable-silent-rules
diff --git a/tests/silentcxx2.test b/tests/silentcxx2.test
new file mode 100755
index 0000000..0c21e63
--- /dev/null
+++ b/tests/silentcxx2.test
@@ -0,0 +1,109 @@
+#!/bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check silent-rules mode for C++, also forcing gcc-style fast depmode.
+# Keep this in sync with sister test silentcxx.test.
+
+required='g++'
+. ./defs
+
+set -e
+
+tab='  '
+
+mkdir sub
+
+cat >>configure.in <<'EOF'
+AM_SILENT_RULES
+AC_PROG_CXX
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+# Need generic and non-generic rules.
+bin_PROGRAMS = foo1 foo2
+foo1_SOURCES = foo.cpp baz.cxx quux.cc
+foo2_SOURCES = $(foo1_SOURCES)
+foo2_CXXFLAGS = $(AM_CXXFLAGS)
+SUBDIRS = sub
+EOF
+
+cat > sub/Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = subdir-objects
+# Need generic and non-generic rules.
+bin_PROGRAMS = bar1 bar2
+bar1_SOURCES = bar.cpp
+bar2_SOURCES = $(bar1_SOURCES)
+bar2_CXXFLAGS = $(AM_CXXFLAGS)
+EOF
+
+cat > foo.cpp <<'EOF'
+using namespace std; /* C compilers fail on this */
+int main() { return 0; }
+EOF
+
+# let's try out other extensions too
+echo 'class Baz  { public: int i;  };' > baz.cxx
+echo 'class Quux { public: bool b; };' > quux.cc
+
+cp foo.cpp sub/bar.cpp
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+# Force gcc-style depmode fastdep.  Do not remove this apparently
+# useless loop, to avoid introducing spurious diffs with sister
+# tests.  Also, do not remove the apparently useless single quoting,
+# or Solaris /bin/sh won't execute the body of the loop.
+for config_args in \
+  'am_cv_CC_dependencies_compiler_type=gcc'
+do
+  ./configure $config_args --enable-silent-rules
+  $MAKE >stdout || { cat stdout; Exit 1; }
+  cat stdout
+
+  $EGREP ' (-c|-o)' stdout && Exit 1
+  grep 'mv ' stdout && Exit 1
+
+  grep 'CXX .*foo\.'  stdout
+  grep 'CXX .*baz\.'  stdout
+  grep 'CXX .*quux\.' stdout
+  grep 'CXX .*bar\.'  stdout
+  grep 'CXXLD .*foo1' stdout
+  grep 'CXXLD .*bar1' stdout
+  grep 'CXXLD .*foo2' stdout
+  grep 'CXXLD .*bar2' stdout
+
+  # Ensure a clean rebuild.
+  $MAKE clean
+
+  $MAKE V=1 >stdout || { cat stdout; Exit 1; }
+  cat stdout
+
+  grep ' -c ' stdout
+  grep ' -o ' stdout
+
+  $EGREP "(CC|CXX|LD)($| |$tab)" stdout && Exit 1
+
+  # Ensure a clean reconfiguration/rebuild.
+  $MAKE clean
+  $MAKE maintainer-clean
+
+done
+
+:
diff --git a/tests/silentlex.test b/tests/silentlex.test
index 57936f4..6ee2b9a 100755
--- a/tests/silentlex.test
+++ b/tests/silentlex.test
@@ -66,7 +66,7 @@ $AUTOCONF
 # configure once for fastdep, once for non-fastdep, once for nodep
 for config_args in \
   '' \
-  am_cv_CC_dependencies_compiler_type=gcc \
+  --enable-dependency-tracking \
   --disable-dependency-tracking
 do
   ./configure $config_args --enable-silent-rules
diff --git a/tests/silentyacc.test b/tests/silentyacc.test
index 336707d..e831440 100755
--- a/tests/silentyacc.test
+++ b/tests/silentyacc.test
@@ -68,7 +68,7 @@ $AUTOCONF
 # configure once for fastdep, once for non-fastdep, once for nodep
 for config_args in \
   '' \
-  am_cv_CC_dependencies_compiler_type=gcc \
+  --enable-dependency-tracking \
   --disable-dependency-tracking
 do
   ./configure $config_args --enable-silent-rules
-- 
1.6.5


reply via email to

[Prev in Thread] Current Thread [Next in Thread]