diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2013-05-14 16:08:32 +0200 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2013-05-24 14:17:26 +0200 |
commit | 9877109c1f00e20f76a69ac656fc02a439ae318a (patch) | |
tree | 97fe748cf815830dcfdf3b9af4ca60f4cf8dff24 /t/ccnoco-lib.sh | |
parent | ac13ca500648395417e5d9bcf110475b42841bee (diff) | |
download | automake-9877109c1f00e20f76a69ac656fc02a439ae318a.tar.gz |
compile: rewrite AC_PROG_CC with AM_PROG_CC_C_O contents
This is a much simpler rewrite than the one we attempted in the past,
and that was later removed by commit 'v1.13.1d-137-g32eb770' of
2013-05-11 (compile: avoid AC_PROG_CC messy rewrite).
Not only this change simplifies the code a little, but has the welcome
collateral effect of making automatic dependency tracking work better
with compilers that doesn't grasp the '-c' and '-o' options together.
Issues in that setup have been caught by several failures in the target
'check-no-cc-c-o'.
Unfortunately, this change has less welcome collateral effects:
1. AM_PROG_AR must now be called *after* AC_PROG_CC;
2. Autoconf emits extra warnings when used with Automake-generated
aclocal.m4.
These are unacceptable regressions for a release, but since we are
going to fix them soon enough in a follow-up patch (surely to be
applied before Automake 1.14 is released) we don't worry too much.
* m4/init.m4: Redefine AC_PROG_CC early, to automatically invoke
AM_PROG_CC_C_O as well. Accordingly, drop now-unneeded "automagical"
AM_PROG_CC_C_O expansion at later time (which took place thanks to
a AC_CONFIG_COMMANDS_PRE call).
* m4/minuso.m4 (AM_PROG_CC_C_O): Ensure the expansion of the body
of this macro takes place with C as "current Autoconf language" (use
AC_LANG_PUSH/AC_LANG_POP).
* m4/ar-lib.m4 (AM_PROG_AR): Likewise. Also, require this macro to
be expanded *after* AC_PROG_CC (so that any rewrite of $CC, if required,
has already taken place).
* t/add-missing.tap: Adjust to avoid spurious failures.
* t/aclocal-deps.sh: Likewise, by having AM_PROG_AR called *after*
AC_PROG_CC.
* t/subobj-clean-lt-pr10697.sh: Likewise.
* t/alloca.sh: Likewise.
* t/condlib.sh: Likewise.
* t/discover.sh: Likewise.
* t/objc-megademo.sh: Likewise.
* t/ccnoco.sh: Extend a little.
* t/ccnoco-deps.sh: New test.
* t/ccnoco-lib.sh: Likewise.
* t/ccnoco-lt.sh: Likewise.
* t/list-of-tests.mk: Add them.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 't/ccnoco-lib.sh')
-rwxr-xr-x | t/ccnoco-lib.sh | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/t/ccnoco-lib.sh b/t/ccnoco-lib.sh new file mode 100755 index 000000000..0e6a37510 --- /dev/null +++ b/t/ccnoco-lib.sh @@ -0,0 +1,73 @@ +#! /bin/sh +# Copyright (C) 2001-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/>. + +# Test to make sure we can compile when the compiler doesn't +# understand '-c -o'. + +required=gcc # For cc-no-c-o. +. test-init.sh + +cat >> configure.ac << 'END' +AC_PROG_CC +$CC --version || exit 1 +$CC -v || exit 1 +AC_PROG_RANLIB +AM_PROG_AR +AC_OUTPUT +END + +cat > Makefile.am << 'END' +mylibsdir = $(libdir)/my-libs +mylibs_LIBRARIES = libwish.a +libwish_a_SOURCES = a.c +# Make sure we need something strange. +libwish_CFLAGS = -O0 +END + +cat > a.c << 'END' +int wish_granted (void) +{ + return 0; +} +END + +# Make sure the compiler doesn't understand '-c -o' +CC=$am_testaux_builddir/cc-no-c-o; export CC + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --copy --add-missing + +for vpath in : false; do + if $vpath; then + srcdir=.. + mkdir build + cd build + else + srcdir=. + fi + $srcdir/configure >stdout || { cat stdout; exit 1; } + cat stdout + $EGREP 'understands? -c and -o together.* no$' stdout + # No repeated checks please. + test $(grep -c ".*-c['\" ].*-o['\" ]" stdout) -eq 1 + $MAKE + cd $srcdir +done + +$MAKE distcheck + +: |