From: Stefano Lattarini Date: Tue, 9 Aug 2011 15:51:51 +0000 (+0200) Subject: tests: don't let a known Solaris make bug poison too many tests X-Git-Tag: ng-0.5a~140 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f501499a97946794fe2e5f264e2276ffe826ec07;p=thirdparty%2Fautomake.git tests: don't let a known Solaris make bug poison too many tests See automake bug#7670 and bug#7824. * tests/defs (make_can_chain_suffix_rules): New function, tell whether the make implementation in use can chain suffix rules automatically or not. * tests/suffix3.test: Use it to avoid issuing calls to make that are unportable to make implementations that are not smart enough to chain suffix rules automatically. * tests/suffix8.test: Use it to avoid issuing calls to make that * tests/suffix10.test: Use it to avoid issuing calls to make that * tests/suffix11.test: Use it to avoid issuing calls to make that * tests/suffix-chain.test: New test, exposes the limitation that we have papered over in the tests above. --- diff --git a/ChangeLog b/ChangeLog index 2a8ab43e6..5a74f6644 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2011-08-09 Stefano Lattarini + + tests: don't let a known Solaris make bug poison too many tests + See automake bug#7670 and bug#7824. + * tests/defs (make_can_chain_suffix_rules): New function, tell + whether the make implementation in use can chain suffix rules + automatically or not. + * tests/suffix3.test: Use it to avoid issuing calls to make that + are unportable to make implementations that are not smart enough + to chain suffix rules automatically. + * tests/suffix8.test: Use it to avoid issuing calls to make that + * tests/suffix10.test: Use it to avoid issuing calls to make that + * tests/suffix11.test: Use it to avoid issuing calls to make that + * tests/suffix-chain.test: New test, exposes the limitation that + we have papered over in the tests above. + 2011-08-09 Stefano Lattarini gitignore: more use of anchors diff --git a/tests/Makefile.am b/tests/Makefile.am index dd1875e9c..82fb90606 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -960,6 +960,7 @@ suffix10.test \ suffix11.test \ suffix12.test \ suffix13.test \ +suffix-chain.test \ symlink.test \ symlink2.test \ syntax.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 08ac8e89b..d6d418ced 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1233,6 +1233,7 @@ suffix10.test \ suffix11.test \ suffix12.test \ suffix13.test \ +suffix-chain.test \ symlink.test \ symlink2.test \ syntax.test \ diff --git a/tests/defs b/tests/defs index 701668deb..dba01fbf0 100644 --- a/tests/defs +++ b/tests/defs @@ -204,6 +204,41 @@ using_gmake () esac } +# make_can_chain_suffix_rules +# --------------------------- +# Return 0 if $MAKE is a make implementation that can chain suffix rules +# automatically, return 1 otherwise. Caches the result for speed reasons. +make_can_chain_suffix_rules () +{ + if test -z "$am__can_chain_suffix_rules"; then + if using_gmake; then + am__can_chain_suffix_rules=yes + return 0 + else + mkdir am__chain.dir$$ + cd am__chain.dir$$ + unindent > Makefile << 'END' + .u.v: ; cp $< $@ + .v.w: ; cp $< $@ +END + echo make can chain suffix rules > foo.u + if $MAKE foo.w && diff foo.u foo.w; then + am__can_chain_suffix_rules=yes + else + am__can_chain_suffix_rules=no + fi + cd .. + rm -rf am__chain.dir$$ + fi + fi + case $am__can_chain_suffix_rules in + yes) return 0;; + no) return 1;; + *) fatal_ "make_can_chain_suffix_rules: internal error";; + esac +} +am__can_chain_suffix_rules="" # Avoid interferences from the environment. + commented_sed_unindent_prog=' /^$/b # Nothing to do for empty lines. x # Get x into pattern space. diff --git a/tests/suffix-chain.test b/tests/suffix-chain.test new file mode 100755 index 000000000..c461cc933 --- /dev/null +++ b/tests/suffix-chain.test @@ -0,0 +1,57 @@ +#! /bin/sh +# Copyright (C) 2002, 2003, 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 that Automake can emit code that work round the inability of +# some make implementations to automatically chain suffix rules. +# See automake bug#7824 and bug#7670. + +. ./defs || Exit 1 + +cat >> configure.ac <<'END' +AC_PROG_CC +AC_OUTPUT +END + +cat > Makefile.am <<'END' +bin_PROGRAMS = foo +foo_SOURCES = foo.e +.e.d: + (echo 'int main (void)' && echo '{' && cat $<) > $@ +.d.c: + (cat $< && echo '}') > $@ +CLEANFILES = foo.d foo.c +END + +echo 'return 0' > foo.e + +$ACLOCAL +$AUTOMAKE +$AUTOCONF +./configure + +$MAKE +$MAKE distcheck + +$MAKE clean + +cat >> Makefile <<'END' +foo.c: foo.d +foo.d: foo.e +END + +$MAKE + +: diff --git a/tests/suffix10.test b/tests/suffix10.test index 026da2430..091ca9f95 100755 --- a/tests/suffix10.test +++ b/tests/suffix10.test @@ -61,6 +61,8 @@ $AUTOMAKE --add-missing ./configure $MAKE test + +make_can_chain_suffix_rules || skip_ "make doesn't chain suffix rules" $MAKE all : diff --git a/tests/suffix11.test b/tests/suffix11.test index daeba1c2c..8979bbee8 100755 --- a/tests/suffix11.test +++ b/tests/suffix11.test @@ -68,6 +68,9 @@ $AUTOMAKE -a -Wno-portability OBJEXT=foo $MAKE -e test-fake $MAKE test-real + +make_can_chain_suffix_rules || skip_ "make doesn't chain suffix rules" + $MAKE $MAKE distcheck diff --git a/tests/suffix3.test b/tests/suffix3.test index e0c01f618..029e5bdf8 100755 --- a/tests/suffix3.test +++ b/tests/suffix3.test @@ -47,6 +47,8 @@ $FGREP foo.c Makefile.in && Exit 1 # transformed into foo.o, and use this latter file (to link foo). $FGREP 'foo.$(OBJEXT)' Makefile.in +make_can_chain_suffix_rules || skip_ "make doesn't chain suffix rules" + $AUTOCONF ./configure diff --git a/tests/suffix8.test b/tests/suffix8.test index 921c6419e..99582d764 100755 --- a/tests/suffix8.test +++ b/tests/suffix8.test @@ -79,6 +79,7 @@ $AUTOMAKE -a OBJEXT=foo $MAKE -e test0 $MAKE test1 +make_can_chain_suffix_rules || skip_ "make doesn't chain suffix rules" $MAKE test2 $MAKE all $MAKE distcheck