]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
silent-rules tests: fix spurious failures with Sun Studio C++
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 2 Jun 2011 13:35:03 +0000 (15:35 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 2 Jun 2011 13:35:03 +0000 (15:35 +0200)
* tests/silentcxx.test: The C++ compiler from Sun Studio is named
`CC'.  Account for this in our grepping checks on the make output.
Since we are at it, throw in a couple of improvements to comments
and formatting.
* tests/silent-many-generic.test: The C++ compiler from Sun Studio
is named `CC', and this can cause spurious failures in our grepping
of the make output.  Work around this by using a wrapper script
around the C++ compiler (generated on the fly), since filtering the
make output proved to be too fragile.

ChangeLog
tests/silent-many-generic.test
tests/silentcxx.test

index 9ec908313bd7eed77e240d0ccb757aba74aed1f1..df6cb05cd42e24654fb4f485907bcf1ace8651dc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-06-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       silent-rules tests: fix spurious failures with Sun Studio C++
+       * tests/silentcxx.test: The C++ compiler from Sun Studio is named
+       `CC'.  Account for this in our grepping checks on the make output.
+       Since we are at it, throw in a couple of improvements to comments
+       and formatting.
+       * tests/silent-many-generic.test: The C++ compiler from Sun Studio
+       is named `CC', and this can cause spurious failures in our grepping
+       of the make output.  Work around this by using a wrapper script
+       around the C++ compiler (generated on the fly), since filtering the
+       make output proved to be too fragile.
+
 2011-06-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: fix spurious failure in backcompat2.test on NetBSD
index 17dea2cfc92b51ae610119274af43cf7dd7f6d56..b2c7e89fa8500d17cd5b2e0f75d410d0a27291b0 100755 (executable)
@@ -99,11 +99,27 @@ 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_PROG_CXX
+
+# The SunStudio C++ compiler is unfortunately named `CC' (yuck!),
+# and this can cause problems with our grepping checks on the
+# output from make.  Avoid these problems by invoking a wrapper
+# script, as filtering the make output proved too fragile.
+case " $CXX " in
+  *' CC '*|*'/CC '*)
+    AC_MSG_WARN([the C++ compiler '$CXX' seems to be named 'CC'])
+    AC_MSG_WARN([it will be wrapped with the custom script 'am--cxx'])
+    echo '#!/bin/sh' > bin/am--cxx
+    echo 'PATH=$saved_PATH; export PATH' >> bin/am--cxx
+    echo "exec $CXX \${1+"\$@"}" >> bin/am--cxx
+    chmod a+x bin/am--cxx
+    CXX=am--cxx
+esac
+
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
@@ -182,6 +198,10 @@ cp foo3.f sub/baz3.f
 cp foo5.l sub/baz5.l
 cp foo6.y sub/baz6.y
 
+mkdir bin
+saved_PATH=$PATH; export saved_PATH
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+
 $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
index 14825db24c780f000f39b08bb145a8be38b5e0aa..f6eab3da5da000425c40e5d315a0f1b5fa2fe37e 100755 (executable)
@@ -51,10 +51,10 @@ EOF
 
 cat > foo.cpp <<'EOF'
 using namespace std; /* C compilers fail on this. */
-int main() { return 0; }
+int main (void) { return 0; }
 EOF
 
-# let's try out other extensions too
+# Let's try out other extensions too.
 echo 'class Baz  { public: int i;  };' > baz.cxx
 echo 'class Quux { public: bool b; };' > quux.cc
 
@@ -99,7 +99,7 @@ do
   grep ' -c ' stdout
   grep ' -o ' stdout
 
-  $EGREP '(CC|CXX|LD) ' stdout && Exit 1
+  $EGREP '(CXX|LD) ' stdout && Exit 1
 
   # Ensure a clean reconfiguration/rebuild.
   $MAKE clean