summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am22
-rw-r--r--t/ax/cc-no-c-o.in29
-rwxr-xr-xt/ccnoco.sh21
-rwxr-xr-xt/ccnoco3.sh21
-rwxr-xr-xt/ccnoco4.sh23
-rw-r--r--t/list-of-tests.mk1
-rwxr-xr-xt/self-check-cc-no-c-o.sh35
8 files changed, 95 insertions, 58 deletions
diff --git a/.gitignore b/.gitignore
index a32310e70..dd55add5f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,6 +42,7 @@
/t/wrap/automake-1.*
/t/ax/test-defs.sh
/t/ax/shell-no-trail-bslash
+/t/ax/cc-no-c-o
/t/testsuite-part.am
/t/*-w.tap
/t/*-w.sh
diff --git a/Makefile.am b/Makefile.am
index ab98df708..64e9d4869 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -446,6 +446,17 @@ EXTRA_DIST += t/ax/shell-no-trail-bslash.in
CLEANFILES += t/ax/shell-no-trail-bslash
noinst_SCRIPTS += t/ax/shell-no-trail-bslash
+t/ax/cc-no-c-o: t/ax/cc-no-c-o.in Makefile
+ $(AM_V_at)rm -f $@ $@-t
+ $(AM_V_GEN)in=t/ax/cc-no-c-o.in \
+ && $(MKDIR_P) t/ax \
+ && $(do_subst) <$(srcdir)/$$in >$@-t \
+ && chmod a+x $@-t
+ $(generated_file_finalize)
+EXTRA_DIST += t/ax/cc-no-c-o.in
+CLEANFILES += t/ax/cc-no-c-o
+noinst_SCRIPTS += t/ax/cc-no-c-o
+
runtest: t/ax/runtest.in Makefile
$(AM_V_at)rm -f $@ $@-t
$(AM_V_GEN)in=t/ax/runtest.in \
@@ -518,6 +529,17 @@ check-no-trailing-backslash-in-recipes:
CONFIG_SHELL='$(abs_top_builddir)/t/ax/shell-no-trail-bslash'
.PHONY: check-no-trailing-backslash-in-recipes
+# Some compilers out there (hello, MSVC) still choke on "-c -o" being
+# passed together on the command line. Run the whole testsuite faking
+# the presence of such a compiler, to help catch regressions that would
+# otherwise only present themselves later "in the wild". See also the
+# long discussion about automake bug#13378.
+check-cc-no-c-o:
+ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
+ CC='$(abs_top_builddir)/t/ax/cc-no-c-o' \
+ GNU_CC='$(abs_top_builddir)/t/ax/cc-no-c-o'
+.PHONY: check-cc-no-c-o
+
## Checking the list of tests.
test_subdirs = t t/pm contrib/t
include $(srcdir)/t/CheckListOfTests.am
diff --git a/t/ax/cc-no-c-o.in b/t/ax/cc-no-c-o.in
new file mode 100644
index 000000000..c18f9b975
--- /dev/null
+++ b/t/ax/cc-no-c-o.in
@@ -0,0 +1,29 @@
+#! @AM_TEST_RUNNER_SHELL@
+# Copyright (C) 2012-2013 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/>.
+
+# A "C compiler" that chokes when the '-c' and '-o' options are passed
+# together to it on the command line. See also automake bug#13378.
+
+am_CC=${AM_TESTSUITE_GNU_CC-'@GNU_CC@'}
+
+case " $* " in
+ *\ -c*\ -o* | *\ -o*\ -c*)
+ echo "$0: both '-o' and '-c' seen on the command line" >&2
+ exit 2
+ ;;
+esac
+
+exec $am_CC "$@"
diff --git a/t/ccnoco.sh b/t/ccnoco.sh
index cffabd7d1..c6af79775 100755
--- a/t/ccnoco.sh
+++ b/t/ccnoco.sh
@@ -17,7 +17,7 @@
# Test to make sure we can compile when the compiler doesn't
# understand '-c -o'.
-required=gcc
+required=gcc # For cc-no-c-o.
. test-init.sh
cat >> configure.ac << 'END'
@@ -44,25 +44,8 @@ int main ()
}
END
-cat > Mycomp << END
-#!/bin/sh
-
-case " \$* " in
- *\ -c*\ -o* | *\ -o*\ -c*)
- exit 1
- ;;
-esac
-
-# Use '$CC', not 'gcc', to honour the compiler chosen
-# by the testsuite setup.
-exec $CC "\$@"
-END
-
-chmod +x Mycomp
-
# Make sure the compiler doesn't understand '-c -o'
-CC=$(pwd)/Mycomp
-export CC
+CC=$am_testaux_builddir/cc-no-c-o; export CC
$ACLOCAL
$AUTOCONF
diff --git a/t/ccnoco3.sh b/t/ccnoco3.sh
index 7ad5b3bc5..b8dd77c2b 100755
--- a/t/ccnoco3.sh
+++ b/t/ccnoco3.sh
@@ -16,7 +16,7 @@
# Test to make sure 'compile' doesn't call 'mv SRC SRC'.
-required=gcc
+required=gcc # For cc-no-c-o.
. test-init.sh
cat >> configure.ac << 'END'
@@ -43,25 +43,8 @@ int main ()
}
END
-cat > Mycomp << END
-#!/bin/sh
-
-case " \$* " in
- *\ -c*\ -o* | *\ -o*\ -c*)
- exit 1
- ;;
-esac
-
-# Use '$CC', not 'gcc', to honour the compiler chosen
-# by the testsuite setup.
-exec $CC "\$@"
-END
-
-chmod +x Mycomp
-
# Make sure the compiler doesn't understand '-c -o'
-CC=$(pwd)/Mycomp
-export CC
+CC=$am_testaux_builddir/cc-no-c-o; export CC
$ACLOCAL
$AUTOCONF
diff --git a/t/ccnoco4.sh b/t/ccnoco4.sh
index 73dce9f68..b317fb5b8 100755
--- a/t/ccnoco4.sh
+++ b/t/ccnoco4.sh
@@ -22,7 +22,7 @@
# <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13378#35>
# <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13378#44>
-required=gcc
+required=gcc # For cc-no-c-o.
. test-init.sh
# We deliberately do not call AM_PROG_CC_C_O here.
@@ -40,25 +40,8 @@ END
echo 'int main (void) { return 0; }' > foo.c
-cat > Mycomp << END
-#!/bin/sh
-
-case " \$* " in
- *\ -c*\ -o* | *\ -o*\ -c*)
- exit 1
- ;;
-esac
-
-# Use '$CC', not 'gcc', to honour the compiler chosen
-# by the testsuite setup.
-exec $CC "\$@"
-END
-
-chmod +x Mycomp
-
-# Make sure the compiler doesn't understand '-c -o'.
-CC=$(pwd)/Mycomp
-export CC
+# Make sure the compiler doesn't understand '-c -o'
+CC=$am_testaux_builddir/cc-no-c-o; export CC
$ACLOCAL
$AUTOCONF
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 63e098d25..2052bd8ee 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -954,6 +954,7 @@ t/remake-timing-bug-pr8365.sh \
t/reqd2.sh \
t/repeated-options.sh \
t/rulepat.sh \
+t/self-check-cc-no-c-o.sh \
t/self-check-configure-help.sh \
t/self-check-dir.tap \
t/self-check-exit.tap \
diff --git a/t/self-check-cc-no-c-o.sh b/t/self-check-cc-no-c-o.sh
new file mode 100755
index 000000000..69809b77f
--- /dev/null
+++ b/t/self-check-cc-no-c-o.sh
@@ -0,0 +1,35 @@
+#! /bin/sh
+# Copyright (C) 2012-2013 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 our fake "C compiler" that doesn't grasp the '-c' and
+# '-o' command-line options passed together, used to enhance testsuite
+# coverage.
+
+required=gcc # Our fake compiler uses gcc.
+am_create_testdir=empty
+. test-init.sh
+
+CC=$am_testaux_builddir/cc-no-c-o; export CC
+
+echo 'int main (void) { return 0; }' > foo.c
+$CC -c foo.c
+test -f foo.o || test -f foo.obj
+$CC -c -o bar.o foo.c 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+grep "both '-o' and '-c' seen on the command line" stderr
+test ! -e bar.o && test ! -e bar.obj
+
+: