]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: don't let a known Solaris make bug poison too many tests
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 9 Aug 2011 15:51:51 +0000 (17:51 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 9 Aug 2011 15:54:44 +0000 (17:54 +0200)
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.

ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/defs
tests/suffix-chain.test [new file with mode: 0755]
tests/suffix10.test
tests/suffix11.test
tests/suffix3.test
tests/suffix8.test

index 2a8ab43e634487b39edcf5ca44ff4e3f7e01209e..5a74f6644944ed03c5c575c70e4743fc499c12dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       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  <stefano.lattarini@gmail.com>
 
        gitignore: more use of anchors
index dd1875e9c987782a826d5ae7b04dcd4d72d456f4..82fb906063125acd1ce512b777d3c62b6b6ae548 100644 (file)
@@ -960,6 +960,7 @@ suffix10.test \
 suffix11.test \
 suffix12.test \
 suffix13.test \
+suffix-chain.test \
 symlink.test \
 symlink2.test \
 syntax.test \
index 08ac8e89b068e87682b76eab1def65a80fa1f9d4..d6d418ced13cfde8deb1d4f599b29ba7608ac356 100644 (file)
@@ -1233,6 +1233,7 @@ suffix10.test \
 suffix11.test \
 suffix12.test \
 suffix13.test \
+suffix-chain.test \
 symlink.test \
 symlink2.test \
 syntax.test \
index 701668deb04eb223b83d8a2e2b3d2bb9e2730eb1..dba01fbf01d93d60c3fc0c67cdf63c571c8ded8f 100644 (file)
@@ -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<indent> into pattern space.
diff --git a/tests/suffix-chain.test b/tests/suffix-chain.test
new file mode 100755 (executable)
index 0000000..c461cc9
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+:
index 026da2430a8f5b5c103b3e8e525e62ce59ead079..091ca9f95a2dad4e675ef3d483d42c625878fc26 100755 (executable)
@@ -61,6 +61,8 @@ $AUTOMAKE --add-missing
 
 ./configure
 $MAKE test
+
+make_can_chain_suffix_rules || skip_ "make doesn't chain suffix rules"
 $MAKE all
 
 :
index daeba1c2c3ddb407cc036130bd9abb1e8c2c8cb6..8979bbee842e8cb21d537b4d43e9a40ffd14f8b1 100755 (executable)
@@ -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
 
index e0c01f618de7333a6a4453f308b60c1b9f9ba591..029e5bdf8fb3f694a9966e7bf408a8917a02306e 100755 (executable)
@@ -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
 
index 921c6419e776d8c79aba9294eddbefa865dabe22..99582d764ea6366bb9a3cfa1298dea234d5fffa0 100755 (executable)
@@ -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