summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/add-missing.tap6
-rw-r--r--t/am-prog-cc-c-o.sh65
-rw-r--r--t/ax/am-test-lib.sh5
-rwxr-xr-xt/ccnoco-deps.sh82
-rwxr-xr-xt/ccnoco-lib.sh73
-rwxr-xr-xt/ccnoco-lt.sh76
-rw-r--r--t/ccnoco.sh15
-rw-r--r--t/discover.sh2
-rw-r--r--t/link_cond.sh4
-rw-r--r--t/list-of-tests.mk3
-rw-r--r--t/subobj10.sh2
-rw-r--r--t/subpkg.sh2
12 files changed, 307 insertions, 28 deletions
diff --git a/t/add-missing.tap b/t/add-missing.tap
index 053b9a111..e0a628b15 100644
--- a/t/add-missing.tap
+++ b/t/add-missing.tap
@@ -248,6 +248,7 @@ check_ <<'END'
depcomp/C
== Files ==
depcomp
+compile
== configure.ac ==
AC_PROG_CC
== Makefile.am ==
@@ -272,10 +273,9 @@ compile
== Files ==
compile
== configure.ac ==
-# Using AC_PROG_CC and AC_OUTPUT in configure.ac should be enough.
+# Using AC_PROG_CC in configure.ac should be enough.
# No need to also define, say, xxx_PROGRAMS in Makefile.am.
AC_PROG_CC
-AC_OUTPUT
END
# For config.guess and config.sub.
@@ -297,6 +297,7 @@ check_ <<'END'
ylwrap/Lex
== Files ==
ylwrap
+compile
== configure.ac ==
AC_PROG_CC
AC_PROG_LEX
@@ -311,6 +312,7 @@ check_ <<'END'
ylwrap/Yacc
== Files ==
ylwrap
+compile
== configure.ac ==
AC_PROG_CC
AC_PROG_YACC
diff --git a/t/am-prog-cc-c-o.sh b/t/am-prog-cc-c-o.sh
index 920a0dc93..08522a472 100644
--- a/t/am-prog-cc-c-o.sh
+++ b/t/am-prog-cc-c-o.sh
@@ -29,25 +29,28 @@ echo 'int main (void) { return 0; }' > foo.c
cp configure.ac configure.bak
-cat >> configure.ac << 'END'
-# Since AM_PROG_CC_C_O rewrites $CC, it's an error to call AC_PROG_CC
-# after it.
-AM_PROG_CC_C_O
-AC_PROG_CC
+cat > acinclude.m4 <<'END'
+AC_DEFUN([AM_TWEAKED_OUTPUT], [
+# For debugging.
+printf "CC = '%s'\\n" "$CC"
+# Make sure that $CC can be used after AM_PROG_CC_C_O.
+$CC --version || exit 1
+$CC -v || exit 1
+# $CC rewrite should only take place on time.
+case " $CC " in
+ *" compile"*" compile"*) AC_MSG_ERROR([CC rewritten twice]);;
+esac
+AC_OUTPUT
+])
END
-$ACLOCAL -Wnone 2>stderr && { cat stderr >&2; exit 1; }
-cat stderr >&2
-grep '^configure\.ac:7:.* AC_PROG_CC .*called after AM_PROG_CC_C_O' stderr
+# ---
cat configure.bak - > configure.ac << 'END'
dnl It's OK to call AM_PROG_CC_C_O after AC_PROG_CC.
AC_PROG_CC
AM_PROG_CC_C_O
-# Make sure that $CC can be used after AM_PROG_CC_C_O.
-$CC --version || exit 1
-$CC -v || exit 1
-AC_OUTPUT
+AM_TWEAKED_OUTPUT
END
$ACLOCAL
@@ -61,21 +64,49 @@ if test "$AM_TESTSUITE_SIMULATING_NO_CC_C_O" != no; then
else
$EGREP 'understands? -c and -o together.* yes$' stdout
fi
+
# No repeated checks please.
test $(grep -c ".*-c['\" ].*-o['\" ]" stdout) -eq 1
-$MAKE
+$MAKE
$MAKE maintainer-clean
+rm -rf autom4te*.cache
+
+# ---
+
+cat configure.bak - > configure.ac << 'END'
+dnl It's also OK to call AM_PROG_CC_C_O *before* AC_PROG_CC.
+AM_PROG_CC_C_O
+AC_PROG_CC
+AM_TWEAKED_OUTPUT
+END
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure >stdout || { cat stdout; exit 1; }
+cat stdout
+if test "$AM_TESTSUITE_SIMULATING_NO_CC_C_O" != no; then
+ $EGREP 'understands? -c and -o together.* no$' stdout
+else
+ $EGREP 'understands? -c and -o together.* yes$' stdout
+fi
+
+# Repeated checks are OK in this case, but should be cached.
+test $(grep ".*-c['\" ].*-o['\" ]" stdout \
+ | $FGREP -v ' (cached) ' | wc -l) -eq 1
+
+$MAKE
+$MAKE maintainer-clean
rm -rf autom4te*.cache
+# ---
+
cat configure.bak - > configure.ac << 'END'
dnl It's also OK to call AM_PROG_CC_C_O *without* AC_PROG_CC.
AM_PROG_CC_C_O
-# Make sure that $CC can be used after AM_PROG_CC_C_O.
-$CC --version || exit 1
-$CC -v || exit 1
-AC_OUTPUT
+AM_TWEAKED_OUTPUT
END
$ACLOCAL
diff --git a/t/ax/am-test-lib.sh b/t/ax/am-test-lib.sh
index 8fee84f60..1fbc73138 100644
--- a/t/ax/am-test-lib.sh
+++ b/t/ax/am-test-lib.sh
@@ -765,6 +765,11 @@ require_tool ()
case $1 in
cc|c++|fortran|fortran77)
require_compiler_ $1;;
+ -c-o)
+ if test x"$AM_TESTSUITE_SIMULATING_NO_CC_C_O" = x"yes"; then
+ skip_all_ "need a C compiler that grasps -c and -o together"
+ fi
+ ;;
xsi-lib-shell)
if test x"$am_test_prefer_config_shell" = x"yes"; then
require_xsi "$SHELL"
diff --git a/t/ccnoco-deps.sh b/t/ccnoco-deps.sh
new file mode 100755
index 000000000..d4931d54a
--- /dev/null
+++ b/t/ccnoco-deps.sh
@@ -0,0 +1,82 @@
+#! /bin/sh
+# Copyright (C) 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 dependency tracking can also work with compilers that
+# doesn't understand '-c -o', even if the AM_PROG_CC_C_O macro is not
+# explicitly called.
+
+required=gcc # For 'cc-no-c-o'.
+. test-init.sh
+
+echo '#define myStr "Hello"' > foobar.h
+
+cat > foo.c << 'END'
+#include <stdio.h>
+#include "foobar.h"
+int main (void)
+{
+ printf ("%s\n", myStr);
+ return 0;
+}
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c foobar.h
+check-deps: all
+ test -n '$(DEPDIR)' && test -d '$(DEPDIR)'
+ ls -l $(DEPDIR)
+ grep 'stdio\.h' $(DEPDIR)/foo.Po
+ grep 'foobar\.h' $(DEPDIR)/foo.Po
+check-updated: all
+ is_newest foo foobar.h
+END
+
+# We deliberately don't invoke AM_PROG_CC_C_O here.
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+# Make sure the compiler doesn't understand '-c -o'.
+CC=$am_testaux_builddir/cc-no-c-o; export CC
+
+./configure >stdout || { cat stdout; exit 1; }
+cat stdout
+$EGREP 'understands? -c and -o together.* no$' stdout
+grep '^checking dependency style .*\.\.\. gcc' stdout
+
+$MAKE check-deps
+
+if ! cross_compiling; then
+ ./foo
+ test "$(./foo)" = Hello
+fi
+
+$sleep
+echo '#define myStr "Howdy"' > foobar.h
+$MAKE check-updated
+
+if ! cross_compiling; then
+ ./foo
+ test "$(./foo)" = Howdy
+fi
+
+:
diff --git a/t/ccnoco-lib.sh b/t/ccnoco-lib.sh
new file mode 100755
index 000000000..a6464ec98
--- /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 -Wall -Werror
+$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
+
+:
diff --git a/t/ccnoco-lt.sh b/t/ccnoco-lt.sh
new file mode 100755
index 000000000..793987bf0
--- /dev/null
+++ b/t/ccnoco-lt.sh
@@ -0,0 +1,76 @@
+#! /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 libtool libraries when the compiler
+# doesn't understand '-c -o'.
+
+required='gcc libtoolize' # For cc-no-c-o.
+. test-init.sh
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AM_PROG_AR
+LT_INIT
+$CC --version
+$CC -v
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+lib_LTLIBRARIES = libwish.la
+END
+
+cat > libwish.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
+
+libtoolize --verbose --install
+$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['\" ].*-o['\" ]" stdout \
+ | $FGREP -v ' -c -o file.o' | wc -l) -eq 1
+ # Once we have rewritten $CC to use our 'compile' wrapper script,
+ # libtool should pick it up correctly, and not mess with the
+ # redefinition.
+ grep '^checking if .*/compile .*supports -c -o file\.o\.\.\. yes' stdout
+ # And of course, we should be able to build our package.
+ $MAKE
+ cd $srcdir
+done
+
+$MAKE distcheck
+
+:
diff --git a/t/ccnoco.sh b/t/ccnoco.sh
index be9be375e..d00b6f93d 100644
--- a/t/ccnoco.sh
+++ b/t/ccnoco.sh
@@ -22,7 +22,8 @@ required=gcc # For cc-no-c-o.
cat >> configure.ac << 'END'
AC_PROG_CC
-$CC --version; $CC -v; # For debugging.
+$CC --version || exit 1
+$CC -v || exit 1
AC_OUTPUT
END
@@ -42,11 +43,11 @@ int main ()
}
END
-# Make sure the compiler doesn't understand '-c -o'
+# Make sure the compiler doesn't understand '-c -o'.
CC=$am_testaux_builddir/cc-no-c-o; export CC
$ACLOCAL
-$AUTOCONF
+$AUTOCONF -Wall -Werror
$AUTOMAKE --copy --add-missing
for vpath in : false; do
@@ -57,9 +58,15 @@ for vpath in : false; do
else
srcdir=.
fi
- $srcdir/configure
+ $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
+
:
diff --git a/t/discover.sh b/t/discover.sh
index f841c5ba3..5d564b5d9 100644
--- a/t/discover.sh
+++ b/t/discover.sh
@@ -19,9 +19,9 @@
. test-init.sh
cat >> configure.ac << 'END'
+AC_PROG_CC
AC_PROG_RANLIB
AM_PROG_AR
-AC_PROG_CC
AC_LIBOBJ([fsusage])
AC_OUTPUT
END
diff --git a/t/link_cond.sh b/t/link_cond.sh
index 98b523bc3..85be517b2 100644
--- a/t/link_cond.sh
+++ b/t/link_cond.sh
@@ -64,7 +64,7 @@ run_make CXX=false
# Sanity check.
rm -f foo foo.exe
-run_make CC=false && exit 99
+run_make CC=false && fatal_ '"make CC=false" succeeded unexpectedly'
$MAKE distclean
@@ -83,6 +83,6 @@ run_make CC=false
# Sanity check.
rm -f foo foo.exe
-run_make CXX=false && exit 99
+run_make CXX=false && fatal_ '"make CXX=false" succeeded unexpectedly'
:
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index ce3639cb1..7f77227dc 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -208,8 +208,11 @@ t/canon7.sh \
t/canon8.sh \
t/canon-name.sh \
t/ccnoco.sh \
+t/ccnoco-lib.sh \
+t/ccnoco-lt.sh \
t/ccnoco3.sh \
t/ccnoco4.sh \
+t/ccnoco-deps.sh \
t/check.sh \
t/check2.sh \
t/check4.sh \
diff --git a/t/subobj10.sh b/t/subobj10.sh
index 1be42a95a..f3181d173 100644
--- a/t/subobj10.sh
+++ b/t/subobj10.sh
@@ -16,7 +16,7 @@
# PR 492: Test asm subdir-objects.
-required=gcc
+required='gcc -c-o'
. test-init.sh
cat > configure.ac << END
diff --git a/t/subpkg.sh b/t/subpkg.sh
index f9cdc74e2..2b3d163a0 100644
--- a/t/subpkg.sh
+++ b/t/subpkg.sh
@@ -91,7 +91,7 @@ int lib (void)
EOF
$ACLOCAL
-$AUTOCONF
+$AUTOCONF -Werror -Wall
$AUTOMAKE -Wno-override
cd lib