From: Stefano Lattarini Date: Wed, 4 May 2011 09:48:19 +0000 (+0200) Subject: tests: drop useless requirements of 'g++' X-Git-Tag: ng-0.5a~89^2~246 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2733c3b4bdd553e0fac6ae53dc64ab84cfc908a8;p=thirdparty%2Fautomake.git tests: drop useless requirements of 'g++' * tests/lflags2.test ($required): Remove 'g++', as any working C++ compiler should be enough, and ./configure will cause the test to skip if no working C++ compiler is found. * tests/yflags2.test: Likewise. * tests/subobj9.test: Likewise. * tests/silentcxx.test: Likewise. Also, do not force depmodes that could cause non-GNU C++ compilers to fail. * tests/silentcxx-gcc.test: New test, like `silentcxx.test', but forcing "fast" gcc depmode (and thus requiring the GNU C++ compiler). * tests/specflg10.test: Add proper "fixme" comment telling that we should make this test work with a generic C++ compiler. * tests/Makefile.am (TESTS): Update. --- diff --git a/ChangeLog b/ChangeLog index eda448ecc..6021006fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2011-05-04 Stefano Lattarini + + tests: drop useless requirements of 'g++' + * tests/lflags2.test ($required): Remove 'g++', as any working + C++ compiler should be enough, and ./configure will cause the + test to skip if no working C++ compiler is found. + * tests/yflags2.test: Likewise. + * tests/subobj9.test: Likewise. + * tests/silentcxx.test: Likewise. Also, do not force depmodes + that could cause non-GNU C++ compilers to fail. + * tests/silentcxx-gcc.test: New test, like `silentcxx.test', + but forcing "fast" gcc depmode (and thus requiring the GNU C++ + compiler). + * tests/specflg10.test: Add proper "fixme" comment telling that + we should make this test work with a generic C++ compiler. + * tests/Makefile.am (TESTS): Update. + 2011-05-03 Stefano Lattarini tests defs: one more environment sanitization (corner case) diff --git a/tests/Makefile.am b/tests/Makefile.am index f51fb2c82..20552111d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -864,6 +864,7 @@ silent7.test \ silent8.test \ silent9.test \ silentcxx.test \ +silentcxx-gcc.test \ silentf77.test \ silentf90.test \ silent-many-gcc.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index fd9841514..e672e90ff 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1125,6 +1125,7 @@ silent7.test \ silent8.test \ silent9.test \ silentcxx.test \ +silentcxx-gcc.test \ silentf77.test \ silentf90.test \ silent-many-gcc.test \ diff --git a/tests/lflags2.test b/tests/lflags2.test index 9e339f37c..6c731216a 100755 --- a/tests/lflags2.test +++ b/tests/lflags2.test @@ -19,7 +19,6 @@ # Please keep this in sync with the sister tests lflags.test, yflags.test # and yflags2.test -required=g++ # FIXME: any working C++ compiler should be OK . ./defs || Exit 1 cat >fake-lex <<'END' diff --git a/tests/silentcxx-gcc.test b/tests/silentcxx-gcc.test new file mode 100755 index 000000000..bc8beb917 --- /dev/null +++ b/tests/silentcxx-gcc.test @@ -0,0 +1,108 @@ +#!/bin/sh +# Copyright (C) 2010, 2011 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 . + +# Check silent-rules mode for C++. +# This test requires the GNU C++ compiler; keep it in sync with sister +# test `silentcxx.test', which should work with generic compilers. + +. ./defs || Exit 1 + +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 + +# Sanity check: make sure the cache variable we force is really used +# by configure. +$FGREP am_cv_CXX_dependencies_compiler_type configure + +# Force gcc ("fast") depmode. +# This apparently useless "for" loop is here to simplify the syncing +# with sister test `silentcxx.test'. +for config_args in \ + am_cv_CXX_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) ' stdout && Exit 1 + + # Ensure a clean reconfiguration/rebuild. + $MAKE clean + $MAKE maintainer-clean + +done + +: diff --git a/tests/silentcxx.test b/tests/silentcxx.test index 14d61ca58..b4919c775 100755 --- a/tests/silentcxx.test +++ b/tests/silentcxx.test @@ -15,8 +15,10 @@ # along with this program. If not, see . # Check silent-rules mode for C++. +# This test should work with generic C++ compilers; keep it in sync with +# sister test `silentcxx-gcc.test', which requires the GNU C++ compiler +# and forces the use of gcc depmode. -required='g++' # FIXME: any decent C++ compiler should be OK . ./defs || Exit 1 mkdir sub @@ -47,7 +49,7 @@ bar2_CXXFLAGS = $(AM_CXXFLAGS) EOF cat > foo.cpp <<'EOF' -using namespace std; /* C compilers fail on this */ +using namespace std; /* C compilers fail on this. */ int main() { return 0; } EOF @@ -61,11 +63,15 @@ $ACLOCAL $AUTOMAKE --add-missing $AUTOCONF -# configure once for fastdep, once for non-fastdep, once for nodep +# Sanity check: make sure the cache variable we force is really used +# by configure. +$FGREP am_cv_CXX_dependencies_compiler_type configure + +# Force dependency tracking explicitly, so that slow dependency +# extractors are not rejected. Try also with dependency tracking +# explicitly disabled. for config_args in \ - '' \ - am_cv_CC_dependencies_compiler_type=gcc \ - --disable-dependency-tracking + --enable-dependency-tracking --disable-dependency-tracking do ./configure $config_args --enable-silent-rules $MAKE >stdout || { cat stdout; Exit 1; } diff --git a/tests/specflg10.test b/tests/specflg10.test index 45753b20f..3a057165b 100755 --- a/tests/specflg10.test +++ b/tests/specflg10.test @@ -16,7 +16,7 @@ # AM_DEFAULT_SOURCE_EXT -required=g++ +required=g++ #FIXME: a generic C++ compiler should be enough. . ./defs || Exit 1 cat >> configure.in << 'END' diff --git a/tests/subobj9.test b/tests/subobj9.test index fb81d70cc..f0e900714 100755 --- a/tests/subobj9.test +++ b/tests/subobj9.test @@ -17,7 +17,7 @@ # Test for PR 312. -required='libtoolize g++' +required=libtoolize . ./defs || Exit 1 cat > configure.in << END diff --git a/tests/yflags2.test b/tests/yflags2.test index fe0d4b31f..803cecc28 100755 --- a/tests/yflags2.test +++ b/tests/yflags2.test @@ -19,7 +19,6 @@ # Please keep this in sync with the sister tests yflags.test, lflags.test # and lflags2.test -required=g++ # FIXME: any working C++ compiler should be OK . ./defs || Exit 1 cat >fake-yacc <<'END'