diff options
Diffstat (limited to 't')
123 files changed, 1953 insertions, 342 deletions
diff --git a/t/Makefile.inc b/t/Makefile.inc new file mode 100644 index 000000000..f979c66dc --- /dev/null +++ b/t/Makefile.inc @@ -0,0 +1,274 @@ +## Included by top-level Makefile for Automake. + +## Copyright (C) 1995-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/>. + +## ------------ ## +## Testsuite. ## +## ------------ ## + +# Run the tests with a proper shell detected at configure time. +LOG_COMPILER = $(AM_TEST_RUNNER_SHELL) + +TEST_EXTENSIONS = .pl .sh .tap +SH_LOG_COMPILER = $(LOG_COMPILER) +TAP_LOG_COMPILER = $(LOG_COMPILER) +PL_LOG_COMPILER = $(PERL) +AM_PL_LOG_FLAGS = -Mstrict -I $(builddir)/lib -I $(srcdir)/lib -w + +TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(srcdir)/lib/tap-driver.sh + +AM_TAP_LOG_DRIVER_FLAGS = --merge + +EXTRA_DIST += %D%/README %D%/ax/is %D%/ax/is_newest + +## Will be updated later. +TESTS = + +# Some testsuite-influential variables should be overridable from the +# test scripts, but not from the environment. +# Keep this in sync with the similar list in ax/runtest.in. +AM_TESTS_ENVIRONMENT = \ + for v in \ + required \ + am_test_protocol \ + am_serial_tests \ + am_test_prefer_config_shell \ + am_original_AUTOMAKE \ + am_original_ACLOCAL \ + am_test_lib_sourced \ + test_lib_sourced \ + ; do \ + eval test x"\$${$$v}" = x || unset $$v; \ + done; +# We want warning messages and explanations for skipped tests to go to +# the console if possible, so set up 'stderr_fileno_' properly. +AM_TESTS_FD_REDIRECT = 9>&2 +AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_; + +# For sourcing of extra "shell libraries" by our test scripts. As per +# POSIX, sourcing a file with '.' will cause it to be looked up in $PATH +# in case it is given with a relative name containing no slashes. +AM_TESTS_ENVIRONMENT += \ + if test $(srcdir) != .; then \ + PATH='$(abs_srcdir)/%D%/ax'$(PATH_SEPARATOR)$$PATH; \ + fi; \ + PATH='$(abs_builddir)/%D%/ax'$(PATH_SEPARATOR)$$PATH; \ + export PATH; + +# Hand-written tests. + +include $(srcdir)/%D%/list-of-tests.mk + +TESTS += $(handwritten_TESTS) +EXTRA_DIST += $(handwritten_TESTS) + +# Automatically-generated tests wrapping hand-written ones. +# Also, automatically-computed dependencies for tests. + +include $(srcdir)/%D%/testsuite-part.am + +TESTS += $(generated_TESTS) +EXTRA_DIST += $(generated_TESTS) + +$(srcdir)/%D%/testsuite-part.am: + $(AM_V_at)rm -f %D%/testsuite-part.tmp $@ + $(AM_V_GEN)$(PERL) $(srcdir)/gen-testsuite-part \ + --srcdir $(srcdir) > %D%/testsuite-part.tmp + $(AM_V_at)chmod a-w %D%/testsuite-part.tmp + $(AM_V_at)mv -f %D%/testsuite-part.tmp $@ +EXTRA_DIST += gen-testsuite-part + +# The dependecies declared here are not truly complete, but such +# completeness would cause more issues than it would solve. See +# automake bug#11347. +$(generated_TESTS): $(srcdir)/gen-testsuite-part +$(srcdir)/%D%/testsuite-part.am: $(srcdir)/gen-testsuite-part +$(srcdir)/%D%/testsuite-part.am: Makefile.am + +# Hand-written tests for stuff in 'contrib/'. +include $(srcdir)/contrib/%D%/Makefile.inc +TESTS += $(contrib_TESTS) +EXTRA_DIST += $(contrib_TESTS) + +# Static dependencies valid for each test case (also further +# extended later). Note that use 'noinst_' rather than 'check_' +# as the prefix, because we really want them to be built by +# "make all". This makes it easier to run the test cases by +# hand after having simply configured and built the package. + +nodist_noinst_SCRIPTS += \ + %D%/wrap/aclocal-$(APIVERSION) \ + %D%/wrap/automake-$(APIVERSION) + +dist_noinst_DATA += \ + %D%/ax/test-init.sh \ + %D%/ax/test-lib.sh \ + %D%/ax/am-test-lib.sh \ + %D%/ax/tap-functions.sh + +# Few more static dependencies. +%D%/distcheck-missing-m4.log: %D%/ax/distcheck-hook-m4.am +%D%/distcheck-outdated-m4.log: %D%/ax/distcheck-hook-m4.am +EXTRA_DIST += %D%/ax/distcheck-hook-m4.am + +%D%/ax/test-defs.sh: %D%/ax/test-defs.in Makefile + $(AM_V_at)rm -f $@ $@-t + $(AM_V_at)$(MKDIR_P) %D%/ax + $(AM_V_GEN)in=%D%/ax/test-defs.in \ + && $(do_subst) <$(srcdir)/$$in >$@-t + $(generated_file_finalize) +EXTRA_DIST += %D%/ax/test-defs.in +CLEANFILES += %D%/ax/test-defs.sh +nodist_noinst_DATA += %D%/ax/test-defs.sh + +%D%/ax/shell-no-trail-bslash: %D%/ax/shell-no-trail-bslash.in Makefile + $(AM_V_at)rm -f $@ $@-t + $(AM_V_GEN)in=%D%/ax/shell-no-trail-bslash.in \ + && $(MKDIR_P) %D%/ax \ + && $(do_subst) <$(srcdir)/$$in >$@-t \ + && chmod a+x $@-t + $(generated_file_finalize) +EXTRA_DIST += %D%/ax/shell-no-trail-bslash.in +CLEANFILES += %D%/ax/shell-no-trail-bslash +nodist_noinst_SCRIPTS += %D%/ax/shell-no-trail-bslash + +%D%/ax/cc-no-c-o: %D%/ax/cc-no-c-o.in Makefile + $(AM_V_at)rm -f $@ $@-t + $(AM_V_GEN)in=%D%/ax/cc-no-c-o.in \ + && $(MKDIR_P) %D%/ax \ + && $(do_subst) <$(srcdir)/$$in >$@-t \ + && chmod a+x $@-t + $(generated_file_finalize) +EXTRA_DIST += %D%/ax/cc-no-c-o.in +CLEANFILES += %D%/ax/cc-no-c-o +nodist_noinst_SCRIPTS += %D%/ax/cc-no-c-o + +runtest: %D%/ax/runtest.in Makefile + $(AM_V_at)rm -f $@ $@-t + $(AM_V_GEN)in=%D%/ax/runtest.in \ + && $(MKDIR_P) %D%/ax \ + && $(do_subst) <$(srcdir)/$$in >$@-t \ + && chmod a+x $@-t + $(generated_file_finalize) +EXTRA_DIST += %D%/ax/runtest.in +CLEANFILES += runtest +nodist_noinst_SCRIPTS += runtest + +# If two test scripts have the same basename, they will end up sharing +# the same log file, leading to all sort of undefined and undesired +# behaviours. +check-no-repeated-test-name: + @LC_ALL=C; export LC_ALL; \ + lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \ + | sort | uniq -c | awk '($$1 > 1) { print }' \ + | sed 's/\.log$$//' | grep . >&2 \ + && { \ + echo $@: test names listed above are duplicated >&2; \ + exit 1; \ + }; : +check-local: check-no-repeated-test-name +.PHONY: check-no-repeated-test-name + +# Check that our test cases are syntactically correct. +# See automake bug#11898. +check-tests-syntax: + @st=0; \ + err () { echo "$@: $$*" >&2; st=1; }; \ +## The user might do something like "make check TESTS=t/foo" or +## "make check TESTS_LOGS=t/foo.log" and expect (say) the test +## 't/foo.sh' to be run; this has worked well until today, and +## we want to continue supporting this use case. + bases=`for log in : $(TEST_LOGS); do echo $$log; done \ + | sed -e '/^:$$/d' -e 's/\.log$$//'`; \ + for bas in $$bases; do \ + for suf in sh tap pl; do \ + tst=$$bas.$$suf; \ +## Emulate VPATH search. + if test -f $$tst; then \ + break; \ + elif test -f $(srcdir)/$$tst; then \ + tst=$(srcdir)/$$tst; \ + break; \ + else \ + tst=''; \ + fi; \ + done; \ + test -n "$$tst" || err "couldn't find test '$$bas'"; \ +## Don't check that perl tests are valid shell scripts! + test $$suf = pl && continue; \ + $(AM_V_P) && echo " $(AM_TEST_RUNNER_SHELL) -n $$tst"; \ + $(AM_TEST_RUNNER_SHELL) -n "$$tst" \ + || err "test '$$tst' syntactically invalid"; \ + done; \ + exit $$st +check-local: check-tests-syntax +.PHONY: check-tests-syntax + +# Recipes with a trailing backslash character (possibly followed by +# blank characters only) can cause spurious syntax errors with at +# least older bash versions (e.g., bash 2.05b), and can be potentially +# be unportable to other weaker shells. Run the testsuite in a way +# that helps catching such problems in Automake-generated recipes. +# See automake bug#10436. +check-no-trailing-backslash-in-recipes: + $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \ + CONFIG_SHELL='$(abs_top_builddir)/%D%/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_GEN)$(MAKE) $(AM_MAKEFLAGS) check \ + AM_TESTSUITE_SIMULATING_NO_CC_C_O=yes +.PHONY: check-cc-no-c-o + +## Checking the list of tests. +test_subdirs = %D% %D%/pm contrib/%D% +include %D%/CheckListOfTests.am + +# Run the testsuite with the installed aclocal and automake. +installcheck-local: installcheck-testsuite +installcheck-testsuite: + $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \ + am_running_installcheck=yes + +# Performance tests. +.PHONY: perf +perf: all + $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \ + TEST_SUITE_LOG='$(PERF_TEST_SUITE_LOG)' TESTS='$(perf_TESTS)' +PERF_TEST_SUITE_LOG = %D%/perf/test-suite.log +CLEANFILES += $(PERF_TEST_SUITE_LOG) +EXTRA_DIST += $(perf_TESTS) + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: +## Directories candidate to be test directories match this wildcard. + @globs='%D%/*.dir %D%/*/*.dir */%D%/*.dir */%D%/*/*.dir'; \ +## The 'nullglob' bash option is not portable, so use perl. + dirs=`$(PERL) -e "print join(' ', glob('$$globs'));"` || exit 1; \ + if test -n "$$dirs"; then \ +## Errors in find are acceptable, errors in rm are not. + find $$dirs -type d ! -perm -700 -exec chmod u+rwx {} ';'; \ + echo " rm -rf $$dirs"; \ + rm -rf $$dirs || exit 1; \ + fi + +# vim: ft=automake noet diff --git a/t/acloca10.sh b/t/aclocal-I-and-install.sh index 632e816b6..7c1b0d403 100644 --- a/t/acloca10.sh +++ b/t/aclocal-I-and-install.sh @@ -15,7 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Make sure aclocal define macros in the same order as -I's. -# This is the same as aclocal-I-order-1.sh, with the macro calls +# This is the similar to aclocal-I-order-1.sh, with the macro calls # reversed (it did make a difference). # # Also check for --install. @@ -28,8 +28,8 @@ am_create_testdir=empty cat > configure.ac << 'END' AC_INIT -MACRO1 MACRO2 +MACRO1 MACRO3 END diff --git a/t/aclocal-I-order-2.sh b/t/aclocal-I-order-2.sh index fd58b4efc..c3fe00a95 100644 --- a/t/aclocal-I-order-2.sh +++ b/t/aclocal-I-order-2.sh @@ -16,7 +16,7 @@ # Make sure that when two files define the same macro in the same # directory, the macro from the lexically greatest file is used. -# See also sister test 'aclocal-I-ordering-2.sh'. +# See also sister test 'aclocal-I-order-3.sh'. am_create_testdir=empty . test-init.sh diff --git a/t/aclocal-I-order-3.sh b/t/aclocal-I-order-3.sh index d2077fe92..4fcbf4c99 100644 --- a/t/aclocal-I-order-3.sh +++ b/t/aclocal-I-order-3.sh @@ -16,7 +16,7 @@ # Make sure that when two files define the same macro in the same # directory, the macro from the lexically greatest file is used. -# Same as acloca-I-ordering.sh, but without calling MACRO2. +# Same as aclocal-I-order-2.sh, but without calling MACRO2. am_create_testdir=empty . test-init.sh diff --git a/t/aclocal-pr450.sh b/t/aclocal-pr450.sh index 7f4796f53..184cc335c 100644 --- a/t/aclocal-pr450.sh +++ b/t/aclocal-pr450.sh @@ -20,8 +20,8 @@ . test-init.sh -cat >configure.ac <<'END' -AC_INIT([acloca19], [1.0]) +cat >configure.ac <<END +AC_INIT([$me], [1.0]) m4_include([aconfig.ac]) FOO AC_OUTPUT diff --git a/t/acsubst2.sh b/t/acsubst2.sh index 2428dc2a8..fc7c9ad17 100644 --- a/t/acsubst2.sh +++ b/t/acsubst2.sh @@ -18,7 +18,6 @@ cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_SUBST([FOOBAR_CFLAGS],[blablabla]) END diff --git a/t/add-missing.tap b/t/add-missing.tap index f74c2fd93..053b9a111 100644 --- a/t/add-missing.tap +++ b/t/add-missing.tap @@ -62,6 +62,7 @@ AC_CANONICAL_TARGET AC_CANONICAL_SYSTEM AM_PATH_LISPDIR AM_PATH_PYTHON +AC_OUTPUT END $ACLOCAL || framework_failure_ "cannot pre-compute aclocal.m4" @@ -271,9 +272,10 @@ compile == Files == compile == configure.ac == -# Using AM_PROG_CC_C_O in configure.ac should be enough. No need to -# use AC_PROG_CC too, nor to define xxx_PROGRAMS in Makefile.am. -AM_PROG_CC_C_O +# Using AC_PROG_CC and AC_OUTPUT 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. diff --git a/t/am-prog-cc-c-o.sh b/t/am-prog-cc-c-o.sh new file mode 100755 index 000000000..920a0dc93 --- /dev/null +++ b/t/am-prog-cc-c-o.sh @@ -0,0 +1,95 @@ +#! /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 uses of the obsolescent AM_PROG_CC_C_O macro doesn't +# cause spurious warnings or errors. Suggested by Eric Blake. + +# We need gcc for for two reasons: +# 1. to ensure our C compiler grasps "-c -o" together. +# 2. to be able to later fake a dumb compiler not grasping that +# (done with 'cc-no-c-o' script below, which required gcc). +required=gcc +. test-init.sh + +echo bin_PROGRAMS = foo > Makefile.am +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 +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 +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 +# No repeated checks please. +test $(grep -c ".*-c['\" ].*-o['\" ]" stdout) -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 +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 +# No repeated checks please. +test $(grep -c ".*-c['\" ].*-o['\" ]" stdout) -eq 1 +$MAKE + +: diff --git a/t/ax/am-test-lib.sh b/t/ax/am-test-lib.sh index e14f96fab..91a18ccc4 100644 --- a/t/ax/am-test-lib.sh +++ b/t/ax/am-test-lib.sh @@ -831,7 +831,7 @@ am_setup_testdir () || framework_failure_ "cannot chdir into test subdirectory" if test x"$am_create_testdir" != x"empty"; then cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \ - "$am_scriptdir"/depcomp . \ + "$am_scriptdir"/compile "$am_scriptdir"/depcomp . \ || framework_failure_ "fetching common files from $am_scriptdir" # Build appropriate environment in test directory. E.g., create # configure.ac, touch all necessary files, etc. Don't use AC_OUTPUT, 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/ax/depcomp.sh b/t/ax/depcomp.sh index cdeaae5d6..1534d5f8e 100644 --- a/t/ax/depcomp.sh +++ b/t/ax/depcomp.sh @@ -130,9 +130,8 @@ check_distclean () cat > configure.ac <<END AC_INIT([$me], [1.0]) AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([subdir-objects]) AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_AR $(if test $depcomp_with_libtool = yes; then echo AC_PROG_LIBTOOL @@ -200,18 +199,17 @@ ${normalized_target}_${LINKADD} = src/libbaz.$a grep-test: ## For debugging. cat \$(DEPDIR)/foo.$po || : - cat \$(DEPDIR)/subfoo.$po || : + cat sub/\$(DEPDIR)/subfoo.$po || : cat src/\$(DEPDIR)/baz.$po || : cat src/sub2/\$(DEPDIR)/sub2foo.$po || : -## Checks done here. +## Checks are done here. grep '^foo.$objext.*:' \$(DEPDIR)/foo.$po - grep '^subfoo\.$objext.*:' \$(DEPDIR)/subfoo.$po + grep '^sub/subfoo\.$objext.*:' sub/\$(DEPDIR)/subfoo.$po grep '^baz\.$objext.*:' src/\$(DEPDIR)/baz.$po grep '^sub2/sub2foo\.$objext.*:' src/sub2/\$(DEPDIR)/sub2foo.$po END cat > src/Makefile.am <<END -AUTOMAKE_OPTIONS = subdir-objects noinst_${LIBPRIMARY} = libbaz.$a # We include sub2foo only to be sure that the munging in depcomp # doesn't remove too much from the object file name. diff --git a/t/ax/runtest.in b/t/ax/runtest.in new file mode 100644 index 000000000..57ce889c1 --- /dev/null +++ b/t/ax/runtest.in @@ -0,0 +1,130 @@ +#!@AM_TEST_RUNNER_SHELL@ +# @configure_input@ +# +# 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/>. + +# Run an Automake test from the command line. + +set -e; set -u + +: ${AM_TEST_RUNNER_SHELL='@AM_TEST_RUNNER_SHELL@'} +: ${AM_PROVE_CMD='prove'} +: ${AM_PROVEFLAGS='--merge --verbose'} +: ${srcdir='@srcdir@'} +: ${abs_srcdir='@abs_srcdir@'} +: ${abs_builddir='@abs_builddir@'} +: ${PATH_SEPARATOR='@PATH_SEPARATOR@'} + +# For sourcing of extra "shell libraries" by our test scripts. As per +# POSIX, sourcing a file with '.' will cause it to be looked up in $PATH +# in case it is given with a relative name containing no slashes. +if test "$srcdir" != .; then + PATH=$abs_srcdir/t/ax$PATH_SEPARATOR$PATH +fi +PATH=$abs_builddir/t/ax$PATH_SEPARATOR$PATH +export PATH + +# For use by the testsuite framework. The Automake test harness +# define this, so we better do the same. +export srcdir + +# Some testsuite-influential variables should be overridable from the +# test scripts, but not from the environment. +# Keep this in sync with the 'Makefile.am:AM_TESTS_ENVIRONMENT'. +for v in \ + required \ + am_test_protocol \ + am_serial_tests \ + am_test_prefer_config_shell \ + am_original_AUTOMAKE \ + am_original_ACLOCAL \ + am_test_lib_sourced \ + test_lib_sourced \ +; do + eval "$v= && unset $v" || exit 1 +done +unset v + +xecho () { printf '%s\n' "$*"; } +error () { echo "$0: $*" >&2; exit 255; } + +# Some shell flags should be passed over to the test scripts. +shell_opts= +while test $# -gt 0; do + case $1 in + --help) + xecho "Usage: $0 [--shell=PATH] [-k] [SHELL-OPTIONS]" \ + "[VAR=VALUE ...] TEST [TEST-OPTIONS]" + exit $? + ;; + --shell) + test $# -gt 1 || error "missing argument for option '$1'" + AM_TEST_RUNNER_SHELL=$2 + shift + ;; + --shell=*) + AM_TEST_RUNNER_SHELL=${1#--shell=} + ;; + -o) + test $# -gt 1 || error "missing argument for option '$1'" + shell_opts="$shell_opts -o $2" + shift + ;; + -k|--keep-testdir|--keep-testdirs) + keep_testdirs=yes; export keep_testdirs;; + -*) + # Assume it is an option to pass through to the shell. + shell_opts="$shell_opts $1";; + *=*) + var=${1%%=*} val=${1#*=} + xecho "$var" | LC_ALL=C grep '^[a-zA-Z_][a-zA-Z0-9_]*$' >/dev/null \ + || error "'$var': invalid variable name" + eval "$var=\$val && export $var" || exit 1 + ;; + *) + break;; + esac + shift +done + +test $# -gt 0 || error "missing argument" + +tst=$1; shift + +case $tst in + /*) ;; + *) if test -f ./$tst; then + tst=./$tst + # Support for VPATH build. + elif test -f $srcdir/$tst; then + tst=$srcdir/$tst + else + error "could not find test '$tst'" + fi + ;; +esac + +case $tst in + *.sh) + exec $AM_TEST_RUNNER_SHELL $shell_opts "$tst" ${1+"$@"} ;; + *.tap) + exec "$AM_PROVE_CMD" $AM_PROVEFLAGS -e \ + "$AM_TEST_RUNNER_SHELL $shell_opts" "$tst" ${1+"$@"} ;; + *) + error "test '$tst' has an unrecognized extension" ;; +esac + +error "dead code reached" diff --git a/t/ax/tap-setup.sh b/t/ax/tap-setup.sh index 6955c86a0..3c992a388 100644 --- a/t/ax/tap-setup.sh +++ b/t/ax/tap-setup.sh @@ -22,7 +22,7 @@ # Check that we are running from a proper directory: last thing we want # is to overwrite some random user files. -test -f ../../automake && test -f ../../runtest && test -d ../../t \ +test -f ../../bin/automake && test -f ../../runtest && test -d ../../t \ || fatal_ "running from a wrong directory" test ! -f Makefile.am || mv Makefile.am Makefile.am~ \ diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in index 108374322..9662c792b 100644 --- a/t/ax/test-defs.in +++ b/t/ax/test-defs.in @@ -76,6 +76,11 @@ PATH_SEPARATOR='@PATH_SEPARATOR@' host_alias=${host_alias-'@host_alias@'}; export host_alias build_alias=${build_alias-'@build_alias@'}; export build_alias +# Whether the testsuite is being run by faking the presence of a C +# compiler that doesn't grasp the '-c' and '-o' flags together. By +# default, of course, it isn't. +: "${AM_TESTSUITE_SIMULATING_NO_CC_C_O:=no}" + # A concurrency-safe "mkdir -p" implementation. MKDIR_P=${AM_TESTSUITE_MKDIR_P-'@MKDIR_P@'} @@ -136,7 +141,11 @@ FGREP=${AM_TESTSUITE_FGREP-'@FGREP@'} # Compilers and their flags. These can point to non-GNU compilers (and # on non-Linux and non-BSD systems, they probably will). -CC=${AM_TESTSUITE_CC-${CC-'@CC@'}} +if test $AM_TESTSUITE_SIMULATING_NO_CC_C_O = no; then + CC=${AM_TESTSUITE_CC-${CC-'@CC@'}} +else + CC=$am_testaux_builddir/cc-no-c-o +fi CXX=${AM_TESTSUITE_CXX-${CXX-'@CXX@'}} F77=${AM_TESTSUITE_F77-${F77-'@F77@'}} FC=${AM_TESTSUITE_FC-${FC-'@FC@'}} @@ -147,6 +156,11 @@ FFLAGS=${AM_TESTSUITE_FFLAGS-${FFLAGS-'@FFLAGS@'}} CPPFLAGS=${AM_TESTSUITE_CPPFLAGS-${CPPFLAGS-'@CPPFLAGS@'}} # GNU compilers and their flags. +if test $AM_TESTSUITE_SIMULATING_NO_CC_C_O = no; then + GNU_CC=${AM_TESTSUITE_GNU_CC-${GNU_CC-'@GNU_CC@'}} +else + GNU_CC=$am_testaux_builddir/cc-no-c-o +fi GNU_CC=${AM_TESTSUITE_GNU_CC-${GNU_CC-'@GNU_CC@'}} GNU_CXX=${AM_TESTSUITE_GNU_CXX-${GNU_CXX-'@GNU_CXX@'}} GNU_F77=${AM_TESTSUITE_GNU_F77-${GNU_F77-'@GNU_F77@'}} diff --git a/t/c-demo.sh b/t/c-demo.sh index df2fc5540..a0012e2cc 100644 --- a/t/c-demo.sh +++ b/t/c-demo.sh @@ -27,7 +27,6 @@ AC_CONFIG_SRCDIR([tests/test.test]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_AR AC_PROG_RANLIB AM_CONDITIONAL([RUN_TESTS], [test x"$run_tests" != x"no"]) diff --git a/t/ccnoco.sh b/t/ccnoco.sh index cffabd7d1..be9be375e 100644 --- a/t/ccnoco.sh +++ b/t/ccnoco.sh @@ -17,14 +17,12 @@ # 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' AC_PROG_CC -AM_PROG_CC_C_O -# Make sure that $CC can be used after AM_PROG_CC_C_O. -$CC -v || exit 1 +$CC --version; $CC -v; # For debugging. AC_OUTPUT END @@ -44,25 +42,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/ccnoco2.sh b/t/ccnoco2.sh deleted file mode 100644 index a835fa668..000000000 --- a/t/ccnoco2.sh +++ /dev/null @@ -1,55 +0,0 @@ -#! /bin/sh -# Copyright (C) 2006-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/>. - -# Make sure Automake requires AM_PROG_CC_C_O when either per-targets -# flags or subdir-objects are used. - -. test-init.sh - -cat >>configure.ac <<EOF -AC_PROG_CC -AC_OUTPUT -EOF - -cat >Makefile.am <<EOF -bin_PROGRAMS = wish -wish_SOURCES = a.c -wish_CPPFLAGS = -DWHATEVER -EOF - -touch a.c - -$ACLOCAL -$AUTOCONF -AUTOMAKE_fails --copy --add-missing -grep '^Makefile\.am:2:.*per-target.*AM_PROG_CC_C_O' stderr - - -cat >Makefile.am <<EOF -bin_PROGRAMS = wish -wish_SOURCES = sub/a.c -EOF - -mkdir sub -mv a.c sub - -$AUTOMAKE --copy --add-missing - -echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am -AUTOMAKE_fails --copy --add-missing -grep '^Makefile\.am:2:.*subdir.*AM_PROG_CC_C_O' stderr - -: diff --git a/t/ccnoco3.sh b/t/ccnoco3.sh index 7ad5b3bc5..baf3bdfd0 100644 --- a/t/ccnoco3.sh +++ b/t/ccnoco3.sh @@ -16,12 +16,11 @@ # 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' AC_PROG_CC -AM_PROG_CC_C_O $CC --version; $CC -v; # For debugging. AC_OUTPUT END @@ -43,25 +42,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 new file mode 100755 index 000000000..beb02daae --- /dev/null +++ b/t/ccnoco4.sh @@ -0,0 +1,53 @@ +#! /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/>. + +# Check that Automake-generated C compilation rules don't mistakenly +# use the "-c -o" options combination unconditionally (even with losing +# compilers) when the 'subdir-objects' is used but sources are only +# present in the top-level directory. Reported by Nick Bowler in the +# discussion on automake bug#13378: +# <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13378#35> +# <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13378#44> + +required=gcc # For cc-no-c-o. +. test-init.sh + +cat >> configure.ac << 'END' +AC_PROG_CC +$CC --version; $CC -v; # For debugging. +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects +bin_PROGRAMS = foo bar +bar_SOURCES = foo.c +END + +echo 'int main (void) { return 0; }' > foo.c + +# 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 + +./configure +$MAKE +$MAKE distcheck + +: diff --git a/t/check8.sh b/t/check8.sh index a48614764..743d1bd00 100644 --- a/t/check8.sh +++ b/t/check8.sh @@ -22,7 +22,6 @@ required='cc native' cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT END diff --git a/t/compile4.sh b/t/compile4.sh index a06aa8729..ddabe3143 100644 --- a/t/compile4.sh +++ b/t/compile4.sh @@ -46,7 +46,6 @@ absmainobj=$cwd/main.obj cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_AR AC_PROG_RANLIB AC_CONFIG_FILES([sub/Makefile]) diff --git a/t/cond11.sh b/t/cond11.sh index 03c4077ad..7d729d8f1 100644 --- a/t/cond11.sh +++ b/t/cond11.sh @@ -47,7 +47,6 @@ END : > config.guess : > config.sub -: > compile $ACLOCAL $AUTOCONF diff --git a/t/cscope.tap b/t/cscope.tap index 29feec228..9dbe01b2f 100644 --- a/t/cscope.tap +++ b/t/cscope.tap @@ -22,8 +22,10 @@ plan_ 18 ocwd=$(pwd) || fatal_ "getting top-level directory" -cat >> configure.ac << 'END' -AC_CONFIG_FILES([sub/Makefile]) +cat > configure.ac << 'END' +AC_INIT([cscope-test], [1.0]) +AM_INIT_AUTOMAKE([subdir-objects]) +AC_CONFIG_FILES([Makefile sub/Makefile]) AC_SUBST([CC], [who-cares]) AC_SUBST([CXX], [who-cares]) AC_SUBST([FC], [who-cares]) diff --git a/t/cxx-lt-demo.sh b/t/cxx-lt-demo.sh index b778725ba..bbdb93bbf 100644 --- a/t/cxx-lt-demo.sh +++ b/t/cxx-lt-demo.sh @@ -94,10 +94,12 @@ $AUTOCONF $AUTOMAKE --add-missing --copy ls -l . ax # For debugging. -for f in ltmain.sh depcomp config.guess config.sub; do +# Ideally, the 'compile' script should not be required by C++ compilers. +# But alas, LT_INIT seems to invoke AC_PROG_CC anyway, and that brings in +# that script. +for f in ltmain.sh depcomp compile config.guess config.sub; do test -f ax/$f && test ! -h ax/$f || exit 1 done -test ! -e ax/compile # Not required by C++ compilers. cat > src/main.cc << 'END' #include "libfoo.h++" diff --git a/t/depcomp8a.sh b/t/depcomp8a.sh index aa0be3963..d6c73edb7 100644 --- a/t/depcomp8a.sh +++ b/t/depcomp8a.sh @@ -24,7 +24,6 @@ required=cc cat >> configure.ac << 'END' AC_PROG_CC -#x AM_PROG_CC_C_O AC_OUTPUT END @@ -49,7 +48,9 @@ int bar (void) END $ACLOCAL -$AUTOMAKE -a +# FIXME: stop disabling the warnings in the 'unsupported' category +# FIXME: once the 'subdir-objects' option has been mandatory. +$AUTOMAKE -a -Wno-unsupported grep include Makefile.in # For debugging. grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in @@ -64,12 +65,9 @@ DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck # Try again with subdir-objects option. -sed 's/#x //' configure.ac >configure.tmp -mv -f configure.tmp configure.ac echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am -$ACLOCAL -$AUTOMAKE -a +$AUTOMAKE grep include Makefile.in # For debugging. grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in diff --git a/t/depcomp8b.sh b/t/depcomp8b.sh index c2a54da65..879ee1c0d 100644 --- a/t/depcomp8b.sh +++ b/t/depcomp8b.sh @@ -31,6 +31,9 @@ AC_OUTPUT END cat > Makefile.am << 'END' +## FIXME: stop disabling the warnings in the 'unsupported' category +## FIXME: once the 'subdir-objects' option has been mandatory. +AUTOMAKE_OPTIONS = -Wno-unsupported lib_LTLIBRARIES = libzardoz.la libzardoz_la_SOURCES = foo.c sub/bar.c END @@ -42,7 +45,9 @@ echo 'int bar (void) { return 0; }' > sub/bar.c libtoolize $ACLOCAL -$AUTOMAKE -a +# FIXME: stop disabling the warnings in the 'unsupported' category +# FIXME: once the 'subdir-objects' option has been mandatory. +$AUTOMAKE -a -Wno-unsupported grep include Makefile.in # For debugging. grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in @@ -56,12 +61,9 @@ DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck # Try again with subdir-objects option. -sed 's/#x //' configure.ac >configure.tmp -mv -f configure.tmp configure.ac -echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am +echo AUTOMAKE_OPTIONS += subdir-objects >> Makefile.am -$ACLOCAL -$AUTOMAKE -a +$AUTOMAKE grep include Makefile.in # For debugging. grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in diff --git a/t/dist-auxdir-many-subdirs.sh b/t/dist-auxdir-many-subdirs.sh index d49372a1f..ec1a9641f 100644 --- a/t/dist-auxdir-many-subdirs.sh +++ b/t/dist-auxdir-many-subdirs.sh @@ -63,6 +63,7 @@ END required_files=' install-sh missing + compile depcomp py-compile test-driver diff --git a/t/dist-formats.tap b/t/dist-formats.tap index 730fa5d07..bebac374d 100644 --- a/t/dist-formats.tap +++ b/t/dist-formats.tap @@ -20,7 +20,7 @@ am_create_testdir=empty . test-init.sh -plan_ 70 +plan_ 66 # ---------------------------------------------------- # # Common and/or auxiliary subroutines and variables. # @@ -56,12 +56,10 @@ setup_vars_for_compression_format () suffix=NONE compressor=NONE case $1 in gzip) suffix=tar.gz compressor=gzip ;; - tarZ) suffix=tar.Z compressor=compress ;; lzip) suffix=tar.lz compressor=lzip ;; xz) suffix=tar.xz compressor=xz ;; bzip2) suffix=tar.bz2 compressor=bzip2 ;; zip) suffix=zip compressor=zip ;; - shar) suffix=shar.gz compressor=shar ;; *) fatal_ "invalid compression format '$1'";; esac } @@ -73,20 +71,6 @@ have_compressor () # Assume gzip(1) is available on every reasonable portability target. gzip) return 0;; - # On Cygwin, as of 9/2/2012, 'compress' is provided by sharutils - # and is just a dummy script that is not able to actually compress - # (it can only decompress). So, check that the 'compress' program - # is actually able to compress input. - # Note that, at least on GNU/Linux, 'compress' does (and is - # documented to) exit with status 2 if the output is larger than - # the input after (attempted) compression; so we need to pass it - # an input that it can actually reduce in size when compressing. - compress) - for x in 1 2 3 4 5 6 7 8; do - echo aaaaaaaaaaaaaaaaaaaaa - done | compress -c >/dev/null && return 0 - return 1 - ;; *) case $1 in # Do not use --version, or older versions bzip2 would try to @@ -113,7 +97,7 @@ have_compressor () fatal_ "have_compressor(): dead code reached" } -all_compression_formats='gzip tarZ lzip xz bzip2 zip shar' +all_compression_formats='gzip lzip xz bzip2 zip' all_compressors=$( for x in $all_compression_formats; do @@ -305,7 +289,7 @@ END nogzip in am and bzip2 in am nogzip in ac and xz in am nogzip in am and lzip in ac -nogzip in ac and tarZ in ac +nogzip in ac and zip in ac # ----------------------------------------------------------- # @@ -324,13 +308,13 @@ end_subtest # Parallel compression. # # ----------------------- # -# We only use formats requiring 'gzip', 'bzip2' and 'compress' programs, -# since there are the most likely to be all found on the great majority +# We only use formats requiring 'gzip', 'bzip2' and 'xz' programs, +# since there are the most likely to be all found on the majority # of systems. -start_subtest parallel-compression ac_opts=dist-bzip2 am_opts=dist-tarZ +start_subtest parallel-compression ac_opts=dist-bzip2 am_opts=dist-xz -desc=gzip+bzip2+tarZ +desc=gzip+bzip2+xz tarname=parallel-compression-1.0 check_tarball () @@ -353,11 +337,17 @@ check_tarball () command_ok_ "$desc [automake]" $AUTOMAKE -skip_reason= -have_compressor compress || skip_reason="'compress' not available" -have_compressor bzip2 || skip_reason="'bzip2' not available" +if ! have_compressor xz && ! have_compressor bzip2; then + skip_reason="both 'bzip2' and 'xz' are unavailable" +elif ! have_compressor xz; then + skip_reason="'xz' not available" +elif ! have_compressor bzip2; then + skip_reason="'bzip2' not available" +else + skip_reason= +fi if test "$MAKE_j4" = false; then - test -z "$skip_reason" || skip_reason="$skip_reason and " + test -z "$skip_reason" || skip_reason="$skip_reason, and " skip_reason="${skip_reason}make concurrency unavailable" fi @@ -370,7 +360,7 @@ else ls -l # For debugging. command_ok_ "$desc [check .tar.gz tarball]" check_tarball gzip command_ok_ "$desc [check .tar.bz2 tarball]" check_tarball bzip2 - command_ok_ "$desc [check .tar.Z tarball]" check_tarball tarZ + command_ok_ "$desc [check .tar.xz tarball]" check_tarball xz fi unset tarname desc skip_reason @@ -445,8 +435,8 @@ END chmod a+x check-distdir grep-distdir-error for prog in tar $all_compressors; do case $prog in - tar|shar|zip) cp check-distdir $prog;; - *) cp grep-distdir-error $prog;; + tar|zip) cp check-distdir $prog;; + *) cp grep-distdir-error $prog;; esac done unset prog diff --git a/t/lzma.sh b/t/dist-lzma.sh index 30fc689b9..d1d3e4b67 100644 --- a/t/lzma.sh +++ b/t/dist-lzma.sh @@ -25,8 +25,8 @@ $ACLOCAL --force AUTOMAKE_fails -Wnone -Wno-error grep "^Makefile\\.am:1:.*$errmsg" stderr -cat > configure.ac << 'END' -AC_INIT([lzma], [1.0]) +cat > configure.ac <<END +AC_INIT([$me], [1.0]) AM_INIT_AUTOMAKE([no-dist-gzip dist-lzma]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/t/dist-shar.sh b/t/dist-shar.sh new file mode 100755 index 000000000..cd0442552 --- /dev/null +++ b/t/dist-shar.sh @@ -0,0 +1,47 @@ +#! /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 support for no-dist-gzip with dist-shar. + +required=shar +. test-init.sh + +errmsg='support for shar .*deprecated' + +echo AUTOMAKE_OPTIONS = dist-shar > Makefile.am +$ACLOCAL +AUTOMAKE_fails -Wnone -Wobsolete +grep "^Makefile\\.am:1:.*$errmsg" stderr + +cat > configure.ac <<END +AC_INIT([$me], [1.0]) +AM_INIT_AUTOMAKE([no-dist-gzip dist-shar]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +END +: > Makefile.am + +rm -rf autom4te*.cache +$ACLOCAL +AUTOMAKE_run -Wno-error +grep "^configure\\.ac:2:.*$errmsg" stderr + +$AUTOCONF +./configure +$MAKE distcheck +test -f $distdir.shar.gz + +: diff --git a/t/dist-tarZ.sh b/t/dist-tarZ.sh new file mode 100755 index 000000000..f27648166 --- /dev/null +++ b/t/dist-tarZ.sh @@ -0,0 +1,59 @@ +#! /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 support for no-dist-gzip with dist-tarZ. + +. test-init.sh + +# On Cygwin, as of 9/2/2012, 'compress' is provided by sharutils +# and is just a dummy script that is not able to actually compress +# (it can only decompress). So, check that the 'compress' program +# is actually able to compress input. +# Note that, at least on GNU/Linux, 'compress' does (and is +# documented to) exit with status 2 if the output is larger than +# the input after (attempted) compression; so we need to pass it +# an input that it can actually reduce in size when compressing. +for x in 1 2 3 4 5 6 7 8; do + echo aaaaaaaaaaaaaaaaaaaaa +done | compress -c >/dev/null \ + || skip_ "cannot find a working 'compress' program" + +errmsg=".*legacy .*'compress' .*deprecated" + +echo AUTOMAKE_OPTIONS = dist-tarZ > Makefile.am +$ACLOCAL +AUTOMAKE_fails -Wnone -Wobsolete +grep "^Makefile\\.am:1:.*$errmsg" stderr + +cat > configure.ac <<END +AC_INIT([$me], [1.0]) +AM_INIT_AUTOMAKE([no-dist-gzip dist-tarZ]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +END +: > Makefile.am + +rm -rf autom4te*.cache +$ACLOCAL +AUTOMAKE_run -Wno-error +grep "^configure\\.ac:2:.*$errmsg" stderr + +$AUTOCONF +./configure +$MAKE distcheck +test -f dist-tarz-1.0.tar.Z + +: diff --git a/t/distcom2.sh b/t/distcom2.sh index 57154d97c..1f39b6679 100644 --- a/t/distcom2.sh +++ b/t/distcom2.sh @@ -22,7 +22,6 @@ cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_CONFIG_FILES([subdir/Makefile]) AC_OUTPUT END @@ -44,6 +43,8 @@ $ACLOCAL for opt in '' --no-force; do + rm -f compile depcomp + $AUTOMAKE $opt --add-missing test -f compile @@ -74,7 +75,7 @@ for opt in '' --no-force; do $FGREP ' $(top_srcdir)/depcomp ' subdir/dc.txt # The 'compile' script will be listed in the DIST_COMMON of the top-level - # Makefile because it's required in configure.ac (by AM_PROG_CC_C_O). + # Makefile because it's required in configure.ac (by AC_PROG_CC). $FGREP ' $(top_srcdir)/compile ' dc.txt || $FGREP ' compile ' dc.txt done diff --git a/t/dollarvar2.sh b/t/dollarvar2.sh index 718374370..ef2dd06af 100644 --- a/t/dollarvar2.sh +++ b/t/dollarvar2.sh @@ -65,27 +65,22 @@ grep 'recursive variable expansion' stderr cat >Makefile.am <<'EOF' x = 1 bla = $(foo$(x)) -noinst_PROGRAMS = foo -foo_CPPFLAGS = -Dwhatever +oops = $(var-with-dash) EOF -echo AC_PROG_CC >> configure.ac - -$ACLOCAL --force - # Can disable both 'portability' and 'portability-recursive' warnings. $AUTOMAKE -Wno-portability # Disabling 'portability-recursive' warnings should not disable # 'portability' warnings. AUTOMAKE_fails -Wportability -Wno-portability-recursive -grep AM_PROG_CC_C_O stderr +grep 'var-with-dash' stderr grep 'recursive variable expansion' stderr && exit 1 # Enabling 'portability-recursive' warnings should not enable # all the 'portability' warning. AUTOMAKE_fails -Wno-portability -Wportability-recursive -grep AM_PROG_CC_C_O stderr && exit 1 +grep 'var-with-dash' stderr && exit 1 grep 'recursive variable expansion' stderr : @@ -25,6 +25,7 @@ AC_PROG_CXX EOF cat >Makefile.am <<EOF +AUTOMAKE_OPTIONS = subdir-objects bin_PROGRAMS = p q r p_SOURCES = a.cc b.cpp c.cxx q_SOURCES = sub/d.cc sub/e.cpp sub/f.cxx diff --git a/t/extra-dist-wildcards.sh b/t/extra-dist-wildcards.sh index 5e7ef9801..782b8d772 100644 --- a/t/extra-dist-wildcards.sh +++ b/t/extra-dist-wildcards.sh @@ -16,8 +16,8 @@ # Check that wildcards in EXTRA_DIST are honoured. # Suggested by observations from Braden McDaniel. -# See also sister test 'extra11.sh', that checks a similar usage -# with the involvement of the $(wildcard) GNU make builtin. +# See also sister test 'extra-dist-wildcards-gnu.sh', that checks a +# similar usage with the involvement of the $(wildcard) GNU make builtin. required=GNUmake . test-init.sh diff --git a/t/extra-portability.sh b/t/extra-portability.sh index 94dd799e2..63849c768 100644 --- a/t/extra-portability.sh +++ b/t/extra-portability.sh @@ -40,7 +40,7 @@ $ACLOCAL cat >Makefile.am <<END EXTRA_LIBRARIES = libfoo.a -libfoo_a_SOURCES = sub/foo.c +libfoo_a_SOURCES = foo.c END # Sanity check: extra-portability warnings causes the expected error. @@ -62,30 +62,29 @@ $AUTOMAKE -Wall -Wno-portability # Now, a setup where also a "simple" portability warning is present. # -# Per-target flags require the use of AM_PROG_CC_C_O in configure.ac. -echo libfoo_a_CPPFLAGS = -Dwhatever >> Makefile.am +echo 'var = $(foo--bar)' >> Makefile.am # Enabling extra-portability enables portability as well ... AUTOMAKE_fails -Wextra-portability -grep 'requires.*AM_PROG_CC_C_O' stderr +grep 'foo--bar' stderr grep 'requires.*AM_PROG_AR' stderr # ... even if it had been previously disabled. AUTOMAKE_fails -Wno-portability -Wextra-portability -grep 'requires.*AM_PROG_CC_C_O' stderr +grep 'foo--bar' stderr grep 'requires.*AM_PROG_AR' stderr # Disabling extra-portability leaves portability intact (1). AUTOMAKE_fails -Wportability -Wno-extra-portability -grep 'requires.*AM_PROG_CC_C_O' stderr +grep 'foo--bar' stderr grep 'requires.*AM_PROG_AR' stderr && exit 1 # Disabling extra-portability leaves portability intact (2). AUTOMAKE_fails -Wall -Wno-extra-portability -grep 'requires.*AM_PROG_CC_C_O' stderr +grep 'foo--bar' stderr grep 'requires.*AM_PROG_AR' stderr && exit 1 # Enabling portability does not enable extra-portability. AUTOMAKE_fails -Wportability -grep 'requires.*AM_PROG_CC_C_O' stderr +grep 'foo--bar' stderr grep 'requires.*AM_PROG_AR' stderr && exit 1 # Disabling portability disables extra-portability. diff --git a/t/extra2.sh b/t/extra2.sh index b971a4b87..f3c3f5bdb 100644 --- a/t/extra2.sh +++ b/t/extra2.sh @@ -14,7 +14,7 @@ # 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 to make sure EXTRA_foo_SOURCES not defined unnecessarily. +# Check to make sure EXTRA_foo_SOURCES are not defined unnecessarily. . test-init.sh diff --git a/t/fort2.sh b/t/fort2.sh index c99e8b709..d61445296 100644 --- a/t/fort2.sh +++ b/t/fort2.sh @@ -19,6 +19,7 @@ # Cf. 'fort1.sh' and 'link_f90_only.sh'. +required=gfortran # Required only in order to run ./configure. . test-init.sh mkdir sub @@ -30,33 +31,64 @@ AC_FC_SRCEXT([f95]) AC_FC_SRCEXT([f03]) AC_FC_SRCEXT([f08]) AC_FC_SRCEXT([blabla]) +AC_OUTPUT END cat >Makefile.am <<'END' +AUTOMAKE_OPTIONS = subdir-objects +FC = fake-fc bin_PROGRAMS = hello goodbye -hello_SOURCES = hello.f90 foo.f95 sub/bar.f95 hi.f03 sub/howdy.f03 greets.f08 sub/bonjour.f08 +hello_SOURCES = hello.f90 foo.f95 sub/bar.f95 hi.f03 sub/howdy.f03 \ + greets.f08 sub/bonjour.f08 goodbye_SOURCES = bye.f95 sub/baz.f90 -goodbye_FCFLAGS = +goodbye_FCFLAGS = --gby END $ACLOCAL $AUTOMAKE -# The following tests aren't fool-proof, but they don't -# need a Fortran compiler. grep '.\$(LINK)' Makefile.in && exit 1 grep '.\$(FCLINK)' Makefile.in grep '.\$(FCCOMPILE)' Makefile.in > stdout cat stdout grep -v '\$(FCFLAGS_f' stdout && exit 1 grep '.\$(FC.*\$(FCFLAGS_blabla' Makefile.in && exit 1 -# Notice the TAB: -grep '^[ ].*\$(FC.*\$(FCFLAGS_f90).*\.f90' Makefile.in -grep '^[ ].*\$(FC.*\$(FCFLAGS_f95).*\.f95' Makefile.in -grep '^[ ].*\$(FC.*\$(FCFLAGS_f03).*\.f03' Makefile.in -grep '^[ ].*\$(FC.*\$(FCFLAGS_f08).*\.f08' Makefile.in -grep '^[ ].*\$(FC.*\$(FCFLAGS_f90).*\.f95' Makefile.in && exit 1 -grep '^[ ].*\$(FC.*\$(FCFLAGS_f95).*\.f90' Makefile.in && exit 1 -grep '^[ ].*\$(FC.*\$(FCFLAGS_f90).*\.f03' Makefile.in && exit 1 -grep '^[ ].*\$(FC.*\$(FCFLAGS_f08).*\.f90' Makefile.in && exit 1 + +sed '/^AC_FC_SRCEXT.*blabla/d' configure.ac >t +mv -f t configure.ac + +rm -rf autom4te*.cache +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure + +touch hello.f90 foo.f95 sub/bar.f95 hi.f03 sub/howdy.f03 greets.f08 \ + sub/bonjour.f08 bye.f95 sub/baz.f90 + +$MAKE -n \ + FCFLAGS_f90=--@90 FCFLAGS_f95=--@95 FCFLAGS_f03=--@03 FCFLAGS_f08=--@08 \ + > stdout || { cat stdout; exit 1; } +cat stdout +# To make it easier to have stricter grepping below. +sed -e 's/[ ][ ]*/ /g' -e 's/^/ /' -e 's/$/ /' stdout > out +cat out + +grep ' fake-fc .* --@90 .* hello\.f90 ' out +grep ' fake-fc .* --@95 .* foo\.f95 ' out +grep ' fake-fc .* --@95 .* sub/bar\.f95 ' out +grep ' fake-fc .* --@03 .* hi\.f03 ' out +grep ' fake-fc .* --@03 .* sub/howdy\.f03 ' out +grep ' fake-fc .* --@08 .* greets\.f08 ' out +grep ' fake-fc .* --@08 .* sub/bonjour\.f08 ' out +grep ' fake-fc .* --gby .* --@95 .*[` ]bye\.f95 ' out +grep ' fake-fc .* --gby .* --@90 .*[` ]sub/baz\.f90 ' out + +test $(grep -c '.*--gby.*\.f' out) -eq 2 + +$EGREP 'fake-fc.*--@(95|03|08).*\.f90' out && exit 1 +$EGREP 'fake-fc.*--@(90|03|08).*\.f95' out && exit 1 +$EGREP 'fake-fc.*--@(90|95|08).*\.f03' out && exit 1 +$EGREP 'fake-fc.*--@(95|95|03).*\.f08' out && exit 1 : diff --git a/t/fort4.sh b/t/fort4.sh index 822edb8c8..2ef27abeb 100644 --- a/t/fort4.sh +++ b/t/fort4.sh @@ -65,7 +65,7 @@ LDADD = $(FCLIBS) END $ACLOCAL -$AUTOMAKE -a +$AUTOMAKE -a -Wno-unsupported # The Fortran 77 linker should be preferred: grep '.\$(FCLINK)' Makefile.in && exit 1 diff --git a/t/fort5.sh b/t/fort5.sh index 02727061d..7b9991b96 100644 --- a/t/fort5.sh +++ b/t/fort5.sh @@ -75,7 +75,9 @@ END libtoolize --force $ACLOCAL -$AUTOMAKE -a +# FIXME: stop disabling the warnings in the 'unsupported' category +# FIXME: once the 'subdir-objects' option has been mandatory. +$AUTOMAKE -a -Wno-unsupported $AUTOCONF # This test requires Libtool >= 2.0. Earlier Libtool does not diff --git a/t/get-sysconf.sh b/t/get-sysconf.sh index 4c681081e..bd4932f4c 100644 --- a/t/get-sysconf.sh +++ b/t/get-sysconf.sh @@ -46,6 +46,14 @@ $PERL -V || st=1 # happen with older perl installation, or on MinGW/MSYS. $PERL -e 'use TAP::Parser; print $TAP::Parser::VERSION, "\n"' || : +# It's OK if the selected Lex and Yacc programs don't know how to print +# the version number or the help screen; those are usually available only +# for Flex and Bison. +$LEX --version || : +$LEX --help || : +$YACC --version || : +$YACC --help || : + cat "$am_top_builddir/config.log" || st=1 cat "$am_top_builddir/t/wrap/aclocal-$APIVERSION" || st=1 cat "$am_top_builddir/t/wrap/automake-$APIVERSION" || st=1 diff --git a/t/instdir-ltlib.sh b/t/instdir-ltlib.sh index 32d8d409a..273206cba 100644 --- a/t/instdir-ltlib.sh +++ b/t/instdir-ltlib.sh @@ -23,7 +23,6 @@ required='cc libtoolize' cat >>configure.ac <<'END' AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_AR AC_PROG_LIBTOOL AM_PATH_PYTHON @@ -67,22 +66,31 @@ cd build ../configure --prefix="$instdir" PYTHON="echo" \ am_cv_python_pythondir="$instdir/python" \ am_cv_python_pyexecdir="$instdir/pyexec" -$MAKE +xMAKE () +{ + # Early line break here to please maintainer-check. + $MAKE \ + bindir= libdir= pyexecdir= \ + AM_MAKEFLAGS='bindir= libdir= pyexecdir=' \ + "$@" +} + +xMAKE -bindir= libdir= pyexecdir= -export bindir libdir pyexecdir -$MAKE -e install +xMAKE install test ! -e "$instdir" -$MAKE -e install DESTDIR="$destdir" +xMAKE install DESTDIR="$destdir" test ! -e "$instdir" test ! -e "$destdir" -$MAKE -e uninstall > stdout || { cat stdout; exit 1; } +xMAKE uninstall > stdout || { cat stdout; exit 1; } cat stdout # Creative quoting below to please maintainer-check. grep 'rm'' ' stdout && exit 1 -$MAKE -e uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; } +xMAKE uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; } cat stdout # Creative quoting below to please maintainer-check. grep 'rm'' ' stdout && exit 1 +$MAKE + : diff --git a/t/instdir-prog.sh b/t/instdir-prog.sh index 2fa14e5c3..f2b96b8ee 100644 --- a/t/instdir-prog.sh +++ b/t/instdir-prog.sh @@ -23,7 +23,6 @@ required=cc cat >>configure.ac <<'END' AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_AR AC_PROG_RANLIB AM_PATH_PYTHON @@ -66,20 +65,28 @@ cd build ../configure --prefix="$instdir" PYTHON="echo" \ am_cv_python_pythondir="$instdir/python" \ am_cv_python_pyexecdir="$instdir/pyexec" -$MAKE -bindir= libdir= pyexecdir= -export bindir libdir pyexecdir -$MAKE -e install +xMAKE () +{ + # Early line break here to please maintainer-check. + $MAKE \ + bindir= libdir= pyexecdir= \ + AM_MAKEFLAGS='bindir= libdir= pyexecdir=' \ + "$@" +} + +xMAKE + +xMAKE install test ! -e "$instdir" -$MAKE -e install DESTDIR="$destdir" +xMAKE install DESTDIR="$destdir" test ! -e "$instdir" test ! -e "$destdir" -$MAKE -e uninstall > stdout || { cat stdout; exit 1; } +xMAKE uninstall > stdout || { cat stdout; exit 1; } cat stdout # Creative quoting below to please maintainer-check. grep 'rm'' ' stdout && exit 1 -$MAKE -e uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; } +xMAKE uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; } cat stdout # Creative quoting below to please maintainer-check. grep 'rm'' ' stdout && exit 1 diff --git a/t/lex-line.sh b/t/lex-line.sh index d4340e488..258f6af56 100644 --- a/t/lex-line.sh +++ b/t/lex-line.sh @@ -25,7 +25,6 @@ required='cc lex' cat >> configure.ac << 'END' AC_CONFIG_FILES([sub/Makefile]) AC_PROG_CC -AM_PROG_CC_C_O AC_PROG_LEX AC_OUTPUT END @@ -87,7 +86,9 @@ c_outputs='zardoz.c bar-quux.c sub/foo-zardoz.c sub/dir/quux.c' $ACLOCAL $AUTOCONF -$AUTOMAKE -a +# FIXME: stop disabling the warnings in the 'unsupported' category +# FIXME: once the 'subdir-objects' option has been mandatory. +$AUTOMAKE -a -Wno-unsupported for vpath in : false; do diff --git a/t/lex-multiple.sh b/t/lex-multiple.sh new file mode 100755 index 000000000..7383eaf2d --- /dev/null +++ b/t/lex-multiple.sh @@ -0,0 +1,107 @@ +#! /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 we can build a program using several lexers at once +# (assuming Flex is used). That is a little tricky, but possible. +# See: +# <http://lists.gnu.org/archive/html/automake/2010-10/msg00081.html> +# <http://lists.gnu.org/archive/html/automake/2009-03/msg00061.html> + +required='cc flex' +. test-init.sh + +cat >> configure.ac << 'END' +AC_PROG_CC +AC_PROG_LEX +AM_PROG_AR +AC_PROG_RANLIB +AC_OUTPUT +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = zardoz + +zardoz_SOURCES = main.c +# Convenience libraries. +noinst_LIBRARIES = liblex.a liblex-foo.a liblex-bar.a +zardoz_LDADD = $(noinst_LIBRARIES) + +liblex_a_SOURCES = 0.l + +# We need the output to always be named 'lex.yy.c', in order for +# ylwrap to pick it up. +liblex_foo_a_LFLAGS = -Pfoo -olex.yy.c +liblex_foo_a_SOURCES = a.l + +# Ditto. +liblex_bar_a_LFLAGS = -Pbar_ -olex.yy.c +liblex_bar_a_SOURCES = b.l +END + +cat > main.c << 'END' +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int main (int argc, char *argv[]) +{ + if (argc != 2) + abort (); + else if (!strcmp(argv[1], "--vanilla")) + return (yylex () != 121); + else if (!strcmp(argv[1], "--foo")) + return (foolex () != 121); + else if (!strcmp(argv[1], "--bar")) + return (bar_lex () != 121); + else + abort (); +} +END + +cat > 0.l << 'END' +%{ +#define YY_NO_UNISTD_H 1 +%} +%% +"VANILLA" { printf (":%s:\n", yytext); return 121; } +. { printf (":%s:\n", yytext); return 1; } +%% +/* Avoid possible link errors. */ +int yywrap (void) { return 1; } +END + +sed 's/VANILLA/FOO/' 0.l > a.l +sed 's/VANILLA/BAR/' 0.l > b.l + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --add-missing + +./configure +$MAKE + +if ! cross_compiling; then + echo VANILLA | ./zardoz --vanilla + echo FOO | ./zardoz --foo + echo BAR | ./zardoz --bar + ./zardoz --vanilla </dev/null && exit 1 + echo BAR | ./zardoz --foo && exit 1 + : For shells with busted 'set -e'. +fi + +$MAKE distcheck + +: diff --git a/t/lex-subobj-nodep.sh b/t/lex-subobj-nodep.sh index 3282350c2..75e4f0c43 100644 --- a/t/lex-subobj-nodep.sh +++ b/t/lex-subobj-nodep.sh @@ -22,7 +22,6 @@ required='cc lex' cat >>configure.ac <<\END AC_PROG_CC -AM_PROG_CC_C_O AC_PROG_LEX AC_OUTPUT END @@ -21,7 +21,6 @@ required='cc lex' cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_LEX AC_OUTPUT END diff --git a/t/libobj19.sh b/t/libobj19.sh index fdca575b5..1a4cf23d4 100644 --- a/t/libobj19.sh +++ b/t/libobj19.sh @@ -22,7 +22,6 @@ required=cc cat >> configure.ac << 'END' AC_CONFIG_LIBOBJ_DIR([libobj-dir]) AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_AR AC_PROG_RANLIB AC_LIBOBJ([foobar]) @@ -55,7 +54,6 @@ extern int dummy; END cp "$am_scriptdir/ar-lib" . || fatal_ "fetching auxiliary script 'ar-lib'" -cp "$am_scriptdir/compile" . || fatal_ "fetching auxiliary script 'compile'" $ACLOCAL $AUTOCONF diff --git a/t/libtool3.sh b/t/libtool3.sh index fb8c194ed..5653280e6 100644 --- a/t/libtool3.sh +++ b/t/libtool3.sh @@ -28,6 +28,10 @@ AC_OUTPUT END cat > Makefile.am << 'END' +# FIXME: stop disabling the warnings in the 'unsupported' category +# FIXME: once the 'subdir-objects' option has been mandatory. +AUTOMAKE_OPTIONS = -Wno-unsupported + lib_LTLIBRARIES = lib0.la liba/liba.la lib0_la_SOURCES = 0.c liba_liba_la_SOURCES = liba/a.c diff --git a/t/libtool9.sh b/t/libtool9.sh index 26eb5f147..bb6ac87d9 100644 --- a/t/libtool9.sh +++ b/t/libtool9.sh @@ -24,7 +24,6 @@ required='cc libtoolize' cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_AR AC_LIBTOOL_DLOPEN AM_PROG_LIBTOOL diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index 89f7c87a8..ce3639cb1 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -71,10 +71,10 @@ t/get-sysconf.sh \ $(perl_TESTS) \ t/instspc.tap \ t/aclocal.sh \ -t/acloca10.sh \ t/aclocal-I-order-1.sh \ t/aclocal-I-order-2.sh \ t/aclocal-I-order-3.sh \ +t/aclocal-I-and-install.sh \ t/aclocal-acdir.sh \ t/aclocal-amflags.sh \ t/aclocal-autoconf-version-check.sh \ @@ -132,6 +132,7 @@ t/aminit-moreargs-deprecation.sh \ t/amassign.sh \ t/am-config-header.sh \ t/am-prog-cc-stdc.sh \ +t/am-prog-cc-c-o.sh \ t/am-macro-not-found.sh \ t/amopt.sh \ t/amopts-location.sh \ @@ -207,8 +208,8 @@ t/canon7.sh \ t/canon8.sh \ t/canon-name.sh \ t/ccnoco.sh \ -t/ccnoco2.sh \ t/ccnoco3.sh \ +t/ccnoco4.sh \ t/check.sh \ t/check2.sh \ t/check4.sh \ @@ -383,6 +384,9 @@ t/destdir.sh \ t/dir-named-obj-is-bad.sh \ t/discover.sh \ t/dist-formats.tap \ +t/dist-lzma.sh \ +t/dist-tarZ.sh \ +t/dist-shar.sh \ t/dist-auxdir-many-subdirs.sh \ t/dist-auxfile-2.sh \ t/dist-auxfile.sh \ @@ -568,6 +572,7 @@ t/lex-header.sh \ t/lex-lib.sh \ t/lex-lib-external.sh \ t/lex-libobj.sh \ +t/lex-multiple.sh \ t/lex-noyywrap.sh \ t/lex-clean-cxx.sh \ t/lex-clean.sh \ @@ -653,7 +658,6 @@ t/ltinstloc.sh \ t/ltlibobjs.sh \ t/ltlibsrc.sh \ t/ltorder.sh \ -t/lzma.sh \ t/m4-inclusion.sh \ t/maintclean.sh \ t/maintclean-vpath.sh \ @@ -865,6 +869,10 @@ t/pr401.sh \ t/pr401b.sh \ t/pr401c.sh \ t/prefix.sh \ +t/preproc-basics.sh \ +t/preproc-c-compile.sh \ +t/preproc-demo.sh \ +t/preproc-errmsg.sh \ t/primary.sh \ t/primary2.sh \ t/primary3.sh \ @@ -953,7 +961,9 @@ t/remake-macrodir.sh \ t/remake-timing-bug-pr8365.sh \ t/reqd2.sh \ t/repeated-options.sh \ +t/rm-f-probe.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 \ @@ -993,7 +1003,7 @@ t/spell.sh \ t/spell2.sh \ t/spell3.sh \ t/spelling.sh \ -t/spy.sh \ +t/spy-double-colon.sh \ t/spy-rm.tap \ t/stdinc.sh \ t/stamph2.sh \ @@ -1151,9 +1161,9 @@ t/tags.sh \ t/tags2.sh \ t/tagsub.sh \ t/tags-pr12372.sh \ -t/tar.sh \ -t/tar2.sh \ -t/tar3.sh \ +t/tar-ustar.sh \ +t/tar-pax.sh \ +t/tar-opts-errors.sh \ t/tar-ustar-id-too-high.sh \ t/tar-override.sh \ t/target-cflags.sh \ @@ -1163,12 +1173,14 @@ t/tests-environment-and-log-compiler.sh \ t/txinfo-absolute-srcdir-pr408.sh \ t/txinfo-add-missing-and-dist.sh \ t/txinfo-bsd-make-recurs.sh \ +t/txinfo-builddir.sh \ t/txinfo-clean.sh \ t/txinfo-dvi-recurs.sh \ t/txinfo-info-in-srcdir.sh \ t/txinfo-makeinfo-error-no-clobber.sh \ t/txinfo-many-output-formats.sh \ t/txinfo-many-output-formats-vpath.sh \ +t/txinfo-nodist-info.sh \ t/txinfo-no-clutter.sh \ t/txinfo-no-extra-dist.sh \ t/txinfo-no-installinfo.sh \ @@ -1240,10 +1252,10 @@ t/werror3.sh \ t/werror4.sh \ t/whoami.sh \ t/xsource.sh \ -t/yacc4.sh \ -t/yaccdry.sh \ -t/yaccpp.sh \ -t/yaccvpath.sh \ +t/yacc-misc.sh \ +t/yacc-dry.sh \ +t/yacc-cxx-grepping.sh \ +t/yacc-vpath.sh \ t/yacc-auxdir.sh \ t/yacc-basic.sh \ t/yacc-cxx.sh \ diff --git a/t/ltinstloc.sh b/t/ltinstloc.sh index b9670cbac..bae3d49df 100644 --- a/t/ltinstloc.sh +++ b/t/ltinstloc.sh @@ -35,6 +35,7 @@ lib_LTLIBRARIES = liba1.la sub/liba2.la pkglib_LTLIBRARIES = liba1.la nobase_lib_LTLIBRARIES = sub/liba2.la endif +AUTOMAKE_OPTIONS = subdir-objects END libtoolize diff --git a/t/ltlibsrc.sh b/t/ltlibsrc.sh index e58bba716..8c8098bdb 100644 --- a/t/ltlibsrc.sh +++ b/t/ltlibsrc.sh @@ -35,6 +35,8 @@ noinst_LTLIBRARIES = foo.la zoo.d/old2.la $(srcdir)/zoo_d_old2_la.c: $(srcdir)/old_la.c cp $(srcdir)/old_la.c $@ + +AUTOMAKE_OPTIONS = -Wno-unsupported END cat > foo.c << 'END' diff --git a/t/ltorder.sh b/t/ltorder.sh index fe9d7bda2..c243ac78b 100644 --- a/t/ltorder.sh +++ b/t/ltorder.sh @@ -27,6 +27,7 @@ AC_OUTPUT END cat >Makefile.am <<'END' +AUTOMAKE_OPTIONS = subdir-objects nobase_lib_LTLIBRARIES = liba1.la sub/liba2.la sub/liba3.la liba4.la liba5.la sub_liba2_la_LIBADD = liba1.la sub_liba3_la_LIBADD = sub/liba2.la diff --git a/t/parallel-tests-suffix-prog.sh b/t/parallel-tests-suffix-prog.sh index 64f103c70..7b924a33b 100644 --- a/t/parallel-tests-suffix-prog.sh +++ b/t/parallel-tests-suffix-prog.sh @@ -27,6 +27,7 @@ AC_OUTPUT END cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects ## Note that automake should not match the '/test' part of 'sub/test' as ## '.test' suffix, nor the '/chk' part of 'sub/chk' as '.chk' suffix. TESTS = $(dist_TESTS) $(check_PROGRAMS) diff --git a/t/per-target-flags.sh b/t/per-target-flags.sh index ef19e6925..d27a24472 100644 --- a/t/per-target-flags.sh +++ b/t/per-target-flags.sh @@ -26,7 +26,6 @@ AC_INIT([$me], [1.0]) AM_INIT_AUTOMAKE([-Wno-extra-portability]) AC_CONFIG_FILES([$makefiles]) AC_PROG_CC -AM_PROG_CC_C_O AC_PROG_CXX AC_PROG_RANLIB AC_OUTPUT @@ -55,15 +54,8 @@ cat - libMakefile.am > libMakefile2.am << 'END' AUTOMAKE_OPTIONS = no-dependencies END -# Make sure 'compile' is required. -for m in $makefiles; do - AUTOMAKE_fails $m - $EGREP " required file.* '(compile|\./compile)'" stderr -done - makefiles=$(for mkf in $makefiles; do echo $mkf.in; done) -: > compile $AUTOMAKE # Sanity check. diff --git a/t/pr224.sh b/t/pr224.sh index 764d9fb98..b6bf6b986 100644 --- a/t/pr224.sh +++ b/t/pr224.sh @@ -43,7 +43,6 @@ EOF cat >>configure.ac <<'EOF' AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT EOF diff --git a/t/pr401.sh b/t/pr401.sh index f3020429e..89094de75 100644 --- a/t/pr401.sh +++ b/t/pr401.sh @@ -45,7 +45,6 @@ cat >>configure.ac << 'EOF' ## These lines are activated for later tests #: AC_CONFIG_LIBOBJ_DIR([lib]) AC_PROG_CC -#x AM_PROG_CC_C_O AC_LIBOBJ([feep]) AC_LIBSOURCE([feep.c]) AM_PROG_AR @@ -118,7 +117,7 @@ mv -f src/t src/Makefile.am ## Test using LIBOBJS from a sibling directory. ## ## -------------------------------------------- ## -sed 's/#x //; s/lib\/Makefile //' configure.ac >configure.tmp +sed 's/lib\/Makefile //' configure.ac >configure.tmp mv -f configure.tmp configure.ac cat >Makefile.am <<'EOF' diff --git a/t/pr401b.sh b/t/pr401b.sh index 3fa2ad1db..cf7a69885 100644 --- a/t/pr401b.sh +++ b/t/pr401b.sh @@ -45,7 +45,6 @@ cat >>configure.ac << 'EOF' ## These lines are activated for later tests #: AC_CONFIG_LIBOBJ_DIR([lib]) AC_PROG_CC -#x AM_PROG_CC_C_O AC_LIBOBJ([feep]) AC_LIBSOURCE([feep.c]) AM_PROG_AR @@ -118,7 +117,7 @@ mv -f src/t src/Makefile.am ## Test using LTLIBOBJS from a sibling directory. ## ## ---------------------------------------------- ## -sed 's/#x //; s/lib\/Makefile //' configure.ac >configure.tmp +sed 's/lib\/Makefile //' configure.ac >configure.tmp mv -f configure.tmp configure.ac cat >Makefile.am <<'EOF' diff --git a/t/pr401c.sh b/t/pr401c.sh index 07c755d10..22e587629 100644 --- a/t/pr401c.sh +++ b/t/pr401c.sh @@ -47,7 +47,6 @@ cat >>configure.ac << 'EOF' ## These lines are activated for later tests. #: AC_CONFIG_LIBOBJ_DIR([lib]) AC_PROG_CC -#x AM_PROG_CC_C_O AM_PROG_AR AC_PROG_RANLIB AC_FUNC_ALLOCA @@ -120,7 +119,7 @@ mv -f src/t src/Makefile.am ## Test using ALLOCA from a sibling directory. ## ## ------------------------------------------- ## -sed 's/#x //; s/lib\/Makefile //' configure.ac >configure.tmp +sed 's/lib\/Makefile //' configure.ac >configure.tmp mv -f configure.tmp configure.ac cat >Makefile.am <<'EOF' diff --git a/t/preproc-basics.sh b/t/preproc-basics.sh new file mode 100755 index 000000000..6000d883c --- /dev/null +++ b/t/preproc-basics.sh @@ -0,0 +1,106 @@ +#! /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/>. + +# Basic tests for '%...%' preprocessing in included Makefile fragments: +# %reldir% a.k.a. %D% +# %canon_reldir% a.k.a. %C% + +. test-init.sh + +cat >> configure.ac << 'END' +AC_CONFIG_FILES([zot/Makefile]) +AC_OUTPUT +END + +mkdir foo foo/bar foo/foobar zot + +cat > Makefile.am << 'END' +include $(top_srcdir)/foo/local.mk +include $(srcdir)/foo/foobar/local.mk +include local.mk +END + +cat > zot/Makefile.am << 'END' +include $(top_srcdir)/zot/local.mk + +## Check that '%canon_reldir%' doesn't remain overridden +## by the previous include. +%canon_reldir%_zot_whoami: + echo "I am %reldir%/Makefile.am" >$@ + +include $(top_srcdir)/top.mk +include ../reltop.mk +END + +cat > local.mk << 'END' +%canon_reldir%_whoami: + echo "I am %reldir%/local.mk" >$@ +END + +cat > top.mk << 'END' +%canon_reldir%_top_whoami: + echo "I am %reldir%/top.mk" >$@ +END + +cat > reltop.mk << 'END' +%C%_reltop_whoami: + echo "I am %D%/reltop.mk" >$@ +END + +cp local.mk foo +cp local.mk foo/bar +cp local.mk foo/foobar +cp local.mk zot + +cat >> foo/local.mk << 'END' +include %reldir%/bar/local.mk +## Check that '%canon_reldir%' doesn't remain overridden by the +## previous include. The duplicated checks are done to ensure that +## Automake substitutes all pre-processing occurrences on a line, +## not just the first one. +test-%reldir%: + test '%reldir%' = foo && test '%reldir%' = foo + test '%D%' = foo && test '%D%' = foo + test '%canon_reldir%' = foo && test '%C%' = foo +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE +./configure + +check () +{ + test $# -eq 2 || fatal_ "made_into(): bad usage" + target=$1 contents=$2 + rm -f "$target" \ + && $MAKE "$target" \ + && test x"$(cat "$target")" = x"$contents" +} + +check whoami "I am local.mk" +check foo_whoami "I am foo/local.mk" +check foo_bar_whoami "I am foo/bar/local.mk" +check foo_foobar_whoami "I am foo/foobar/local.mk" +$MAKE test-foo + +cd zot +check whoami "I am local.mk" +check ___top_whoami "I am ../top.mk" +check ___reltop_whoami "I am ../reltop.mk" +check zot_whoami "I am Makefile.am" + +: diff --git a/t/preproc-c-compile.sh b/t/preproc-c-compile.sh new file mode 100755 index 000000000..7c398a83e --- /dev/null +++ b/t/preproc-c-compile.sh @@ -0,0 +1,118 @@ +#! /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/>. + +# Test pre-processing substitutions '%reldir%' and '%canon_reldir%' +# with C compilation and subdir objects. + +require=cc +. test-init.sh + +cat >> configure.ac << 'END' +AC_PROG_CC +AM_PROG_CC_C_O +AC_CONFIG_FILES([zot/Makefile]) +AC_OUTPUT +END + +mkdir foo +mkdir foo/bar +mkdir foo/foobar +mkdir zot + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects +SUBDIRS = zot +bin_PROGRAMS = + +include $(top_srcdir)/foo/local.mk +include $(srcdir)/foo/foobar/local.mk +include local.mk + +check-local: + is $(bin_PROGRAMS) == \ + foo/mumble2$(EXEEXT) \ + foo/bar/mumble$(EXEEXT) \ + foo/foobar/mumble$(EXEEXT) \ + mumble$(EXEEXT) + test '$(mumble_SOURCES)' = one.c + test '$(foo_mumble2_SOURCES)' = foo/one.c + test '$(foo_bar_mumble_SOURCES)' = foo/bar/one.c + test '$(foo_foobar_mumble_SOURCES)' = foo/foobar/one.c + test -f mumble$(EXEEXT) + test -f foo/mumble2$(EXEEXT) + test -f foo/bar/mumble$(EXEEXT) + test -f foo/foobar/mumble$(EXEEXT) + test -f zot/mumble$(EXEEXT) + : Test some of the object files too. + test -f one.$(OBJEXT) + test -f foo/foobar/one.$(OBJEXT) + test -f zot/one.$(OBJEXT) +END + +cat > zot/Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects +bin_PROGRAMS = +include $(top_srcdir)/zot/local.mk + +test: + test '$(bin_PROGRAMS)' = mumble$(EXEEXT) + test '$(mumble_SOURCES)' = one.c +check-local: test +END + +cat > local.mk << 'END' +bin_PROGRAMS += %reldir%/mumble +%canon_reldir%_mumble_SOURCES = %reldir%/one.c +END + +echo 'int main (void) { return 0; }' > one.c + +sed 's/mumble/mumble2/' local.mk > foo/local.mk +cp local.mk foo/bar +cp local.mk foo/foobar +cp local.mk zot +echo "include %reldir%/bar/local.mk" >> foo/local.mk + +cp one.c foo +cp one.c foo/bar +cp one.c foo/foobar +cp one.c zot + +$ACLOCAL +$AUTOCONF +$AUTOMAKE +./configure + +$MAKE +$MAKE check-local +if ! cross_compiling; then + ./mumble + ./foo/mumble2 + ./foo/bar/mumble + ./foo/foobar/mumble + ./zot/mumble +fi + +(cd zot && $MAKE test) + +# GNU install refuses to override a just-installed file; since we +# have plenty of 'mumble' dummy programs to install in the same +# location, such "overridden installations" are not a problem for +# us; so just force the use the 'install-sh' script. +ac_cv_path_install=$(pwd)/install-sh; export ac_cv_path_install +$MAKE distcheck + +: diff --git a/t/preproc-demo.sh b/t/preproc-demo.sh new file mode 100755 index 000000000..4c1b2d9dd --- /dev/null +++ b/t/preproc-demo.sh @@ -0,0 +1,230 @@ +#! /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/>. + +# Demo of a package using pre-processing substitutions '%reldir%' and +# '%canon_reldir%', and their respective shorthands '%D%' and '%C%'. + +am_create_testdir=empty +required=cc +. test-init.sh + +if cross_compiling; then + WE_ARE_CROSS_COMPILING=yes +else + WE_ARE_CROSS_COMPILING=no +fi +export WE_ARE_CROSS_COMPILING + +SAFE_PRINT_FAIL=; unset SAFE_PRINT_FAIL + +cat > configure.ac << 'END' +AC_INIT([GNU Demo], [0.7], [bug-automake@gnu.org]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([1.12.6 foreign subdir-objects -Wall]) +AM_CONDITIONAL([NATIVE_BUILD], [test $WE_ARE_CROSS_COMPILING != yes]) +AC_CONFIG_FILES([Makefile]) +AC_PROG_CC +AM_PROG_CC_C_O +AM_PROG_AR +AC_PROG_RANLIB +AC_OUTPUT +END + +mkdir build-aux lib lib/tests src tests + +## Top level. + +cat > Makefile.am << 'END' +bin_PROGRAMS = +check_PROGRAMS = +noinst_LIBRARIES = +AM_CPPFLAGS = +AM_TESTS_ENVIRONMENT = +CLEANFILES = +EXTRA_DIST = +LDADD = +TESTS = + +include $(srcdir)/src/progs.am +include $(srcdir)/lib/gnulib.am +include $(srcdir)/tests/check.am +END + +## Src subdir. + +cat > src/progs.am <<'END' +bin_PROGRAMS += %reldir%/hello + +bin_PROGRAMS += %D%/goodbye +%canon_reldir%_goodbye_SOURCES = %D%/hello.c +%C%_goodbye_CPPFLAGS = $(AM_CPPFLAGS) -DGREETINGS='"Goodbye"' + +# The testsuite should have access to our built programs. +AM_TESTS_ENVIRONMENT += \ + PROGDIR='$(top_builddir)/%reldir%'; \ + export PROGDIR; \ + PATH='$(abs_builddir)/%reldir%'$(PATH_SEPARATOR)$$PATH; \ + export PATH; +END + +cat > src/hello.c <<'END' +#include "safe-print.h" +#include <stdlib.h> +#include <stdio.h> + +#ifndef GREETINGS +# define GREETINGS "Hello" +#endif + +int +main (void) +{ + safe_print (stdout, GREETINGS ", World!\n"); + exit (EXIT_SUCCESS); +} +END + +## Lib subdir. + +cat > lib/gnulib.am << 'END' +noinst_LIBRARIES += %D%/libgnu.a + +AM_CPPFLAGS += -I%D% -I$(top_srcdir)/%D% +LDADD += $(noinst_LIBRARIES) + +%C%_libgnu_a_SOURCES = \ + %D%/safe-print.c \ + %D%/safe-print.h + +if NATIVE_BUILD +include %D%/tests/gnulib-check.am +endif +END + +cat > lib/safe-print.c <<'END' +#include "safe-print.h" +#include <string.h> +#include <stdlib.h> + +void +safe_print (FILE *fp, const char * str) +{ + if (fprintf (fp, "%s", str) != strlen (str) + || fflush (fp) != 0 || ferror (fp)) + { + fprintf (stderr, "I/O error\n"); + exit (EXIT_FAILURE); + } +} + +END + +cat > lib/safe-print.h <<'END' +#include <stdio.h> +void safe_print (FILE *, const char *); +END + +## Lib/Tests (sub)subdir. + +cat > lib/tests/gnulib-check.am <<'END' +check_PROGRAMS += %D%/safe-print-test +TESTS += $(check_PROGRAMS) +AM_TESTS_ENVIRONMENT += EXEEXT='$(EXEEXT)'; export EXEEXT; +END + +cat > lib/tests/safe-print-test.c <<'END' +#include "safe-print.h" +int +main (void) +{ + safe_print (stdout, "dummy\n"); + return 0; +} +END + +## Tests subdir. + +cat > tests/check.am <<'END' +TEST_EXTENSIONS = .sh +SH_LOG_COMPILER = $(SHELL) + +handwritten_TESTS = \ + %D%/hello.sh \ + %D%/built.sh +TESTS += $(handwritten_TESTS) +EXTRA_DIST += $(handwritten_TESTS) + +TESTS += %D%/goodbye.sh +CLEANFILES += %D%/goodbye.sh +%D%/goodbye.sh: %D%/hello.sh + $(MKDIR_P) %D% + rm -f $@ $@-t + sed -e 's/hello/goodbye/' \ + -e 's/Hello/Goodbye/' \ + < $(srcdir)/%D%/hello.sh >$@-t + chmod a-w,a+x $@-t && mv -f $@-t $@ +END + +cat > tests/hello.sh <<'END' +#!/bin/sh +set -x -e +if test "$WE_ARE_CROSS_COMPILING" = yes; then + echo Skipping: cannot run in cross-compilation mode + exit 77 +else + hello || exit 1 + test "`hello`" = 'Hello, World!' || exit 1 +fi +END + +cat > tests/built.sh <<'END' +#!/bin/sh +set -x +test -n "$PROGDIR" || exit 99 +test -f "$PROGDIR/hello$EXEEXT" || exit 1 +test -x "$PROGDIR/hello$EXEEXT" || exit 1 +test -f "$PROGDIR/goodbye$EXEEXT" || exit 1 +test -x "$PROGDIR/goodbye$EXEEXT" || exit 1 +END + + +## Go. + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --add-missing --copy +test ! -e compile +test -f build-aux/compile + +./configure + +$MAKE + +VERBOSE=x $MAKE check >stdout || { cat stdout; exit 1; } +cat stdout +cat tests/built.log +cat tests/hello.log +cat tests/goodbye.log +if cross_compiling; then + test ! -e lib/tests/safe-print-test.log + count_test_results total=3 pass=1 fail=0 xpass=0 xfail=0 skip=2 error=0 +else + count_test_results total=4 pass=4 fail=0 xpass=0 xfail=0 skip=0 error=0 +fi + +$MAKE distcheck + +: diff --git a/t/preproc-errmsg.sh b/t/preproc-errmsg.sh new file mode 100755 index 000000000..704562dcd --- /dev/null +++ b/t/preproc-errmsg.sh @@ -0,0 +1,78 @@ +#! /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/>. + +# Tests error messages when '%reldir%' and '%canon_reldir%' substitutions +# (and their shorthands '%D%' and '%C%') are involved. + +. test-init.sh + +cat >> configure.ac <<'END' +AC_PROG_CC +AC_PROG_RANLIB +AM_PROG_AR +END + +: > ar-lib + +mkdir sub sub/sub2 + +cat > Makefile.am <<'END' +%canon_reldir%_x1_SOURCES = bar.c +include sub/local.mk +END + +cat > sub/local.mk <<'END' +AUTOMAKE_OPTIONS = -Wno-extra-portability +include %D%/sub2/more.mk +noinst_LIBRARIES = %reldir%-one.a %D%-two.a +%C%_x2_SOURCES = foo.c +END + +cat > sub/sub2/more.mk <<'END' +%C%_UNDEFINED += +END + +$ACLOCAL +AUTOMAKE_fails + +cat > expected << 'END' +sub/sub2/more.mk:1: sub_sub2_UNDEFINED must be set with '=' before using '+=' +Makefile.am:2: 'sub/local.mk' included from here +sub/local.mk:2: 'sub/sub2/more.mk' included from here +sub/local.mk:3: 'sub-one.a' is not a standard library name +sub/local.mk:3: did you mean 'libsub-one.a'? +Makefile.am:2: 'sub/local.mk' included from here +sub/local.mk:3: 'sub-two.a' is not a standard library name +sub/local.mk:3: did you mean 'libsub-two.a'? +Makefile.am:2: 'sub/local.mk' included from here +Makefile.am:1: variable 'x1_SOURCES' is defined but no program or +Makefile.am:1: library has 'x1' as canonical name (possible typo) +sub/local.mk:4: variable 'sub_x2_SOURCES' is defined but no program or +sub/local.mk:4: library has 'sub_x2' as canonical name (possible typo) +Makefile.am:2: 'sub/local.mk' included from here +END + +# We need to break these substitutions into multiple sed invocations +# to avoid spuriously triggering the 'sc_tests_logs_duplicate_prefixes' +# maintainer check. +sed -e '/warnings are treated as errors/d' stderr > t1 +sed -e 's/: warning:/:/' t1 > t2 +sed -e 's/: error:/:/' t2 > t3 +sed -e 's/ */ /g' t3 > obtained + +diff expected obtained + +: diff --git a/t/python-virtualenv.sh b/t/python-virtualenv.sh index a67e7c273..faf1d5a50 100644 --- a/t/python-virtualenv.sh +++ b/t/python-virtualenv.sh @@ -178,13 +178,12 @@ $MAKE distclean # Overriding pythondir and pyexecdir at make time should be enough. ./configure --prefix="$cwd/bad-prefix" -pythondir=$py_site pyexecdir=$py_site -export pythondir pyexecdir -check_install -e +check_install pythondir="$py_site" pyexecdir="$py_site" \ + AM_MAKEFLAGS="pythondir='$py_site' pyexecdir='$py_site'" test ! -e bad-prefix $MAKE test-run -check_uninstall -e -unset pythondir pyexecdir +check_uninstall pythondir="$py_site" pyexecdir="$py_site" \ + AM_MAKEFLAGS="pythondir='$py_site' pyexecdir='$py_site'" # Also check that the distribution is self-contained, for completeness. $MAKE distcheck diff --git a/t/remake-renamed-m4-macro-and-file.sh b/t/remake-renamed-m4-macro-and-file.sh index 68d188352..9cd3bc995 100644 --- a/t/remake-renamed-m4-macro-and-file.sh +++ b/t/remake-renamed-m4-macro-and-file.sh @@ -16,7 +16,7 @@ # Test remake rules when an m4 file gets renamed and *simultaneously* # an m4 macro in it gets renamed. Kudos to Bruno Haible for thinking -# about this situation. See also related test 'acloca22.sh'. +# about this situation. See also related test 'aclocal-deleted-header.sh'. . test-init.sh diff --git a/t/repeated-options.sh b/t/repeated-options.sh index af1897bcb..95963c547 100644 --- a/t/repeated-options.sh +++ b/t/repeated-options.sh @@ -24,7 +24,6 @@ cat >configure.ac <<END AC_INIT([$me], [1.0]) AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip no-dist-gzip dist-bzip2]) AC_PROG_CC -AM_PROG_CC_C_O AC_CONFIG_FILES([Makefile]) AC_OUTPUT END @@ -58,7 +57,7 @@ int main (void) } END -cp "$am_scriptdir"/compile "$am_scriptdir"/test-driver . +cp "$am_scriptdir"/test-driver . $ACLOCAL $AUTOMAKE --foreign --foreign -Wall 2>stderr || { cat stderr >&2; exit 1; } diff --git a/t/rm-f-probe.sh b/t/rm-f-probe.sh new file mode 100755 index 000000000..1cb220aa0 --- /dev/null +++ b/t/rm-f-probe.sh @@ -0,0 +1,74 @@ +#! /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/>. + +# Verify our probe that checks that "rm -f" doesn't complain if called +# without file operands works as expected. See automake bug#10828. + +. test-init.sh + +echo AC_OUTPUT >> configure.ac +: > Makefile.am + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +mkdir bin +cat > bin/rm <<'END' +#!/bin/sh +set -e; set -u; +PATH=$original_PATH; export PATH +rm_opts= +while test $# -gt 0; do + case $1 in + -*) rm_opts="$rm_opts $1";; + *) break;; + esac + shift +done +if test $# -eq 0; then + echo "Oops, fake rm called without arguments" >&2 + exit 1 +else + exec rm $rm_opts "$@" +fi +END +chmod a+x bin/rm + +original_PATH=$PATH +PATH=$(pwd)/bin$PATH_SEPARATOR$PATH +export PATH original_PATH + +rm -f && exit 99 # Sanity check. + +./configure 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 + +grep "'rm' program.* unable to run without file operands" stderr +$FGREP "tell bug-automake@gnu.org about your system" stderr +$FGREP "install GNU coreutils" stderr +$EGREP "(^| |')ACCEPT_INFERIOR_RM_PROGRAM($| |')" stderr + +ACCEPT_INFERIOR_RM_PROGRAM=yes; export ACCEPT_INFERIOR_RM_PROGRAM + +./configure +$MAKE +$MAKE distcheck + +# For the sake of our exit trap. +PATH=$original_PATH; export PATH + +: 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 + +: diff --git a/t/silent-c.sh b/t/silent-c.sh index 24af8314c..28f1667b6 100644 --- a/t/silent-c.sh +++ b/t/silent-c.sh @@ -25,7 +25,6 @@ mkdir sub cat >>configure.ac <<'EOF' AC_CONFIG_FILES([sub/Makefile]) AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT EOF diff --git a/t/silent-lex.sh b/t/silent-lex.sh index 018f8a7a9..320e91f1d 100644 --- a/t/silent-lex.sh +++ b/t/silent-lex.sh @@ -22,7 +22,6 @@ required='cc lex' mkdir sub cat >>configure.ac <<'EOF' -AM_PROG_CC_C_O AC_PROG_LEX AC_CONFIG_FILES([sub/Makefile]) AC_OUTPUT diff --git a/t/silent-lt.sh b/t/silent-lt.sh index dc9bf2acc..0ae003719 100644 --- a/t/silent-lt.sh +++ b/t/silent-lt.sh @@ -26,7 +26,6 @@ cat >>configure.ac <<'EOF' AC_CONFIG_FILES([sub/Makefile]) AC_PROG_CC AM_PROG_AR -AM_PROG_CC_C_O AC_PROG_LIBTOOL AC_OUTPUT EOF diff --git a/t/silent-many-languages.sh b/t/silent-many-languages.sh index bffbb6a49..5395af6d9 100644 --- a/t/silent-many-languages.sh +++ b/t/silent-many-languages.sh @@ -93,7 +93,6 @@ do_and_check_verbose_build () mkdir sub cat >>configure.ac <<'EOF' -AM_PROG_CC_C_O AC_PROG_F77 AC_PROG_FC AC_PROG_LEX diff --git a/t/silent-nested-vars.sh b/t/silent-nested-vars.sh index 7dca05696..f03204d0b 100644 --- a/t/silent-nested-vars.sh +++ b/t/silent-nested-vars.sh @@ -22,7 +22,6 @@ cat >>configure.ac <<'EOF' AM_SILENT_RULES AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT EOF diff --git a/t/silent-yacc.sh b/t/silent-yacc.sh index 5017d5069..bb215189f 100644 --- a/t/silent-yacc.sh +++ b/t/silent-yacc.sh @@ -22,7 +22,7 @@ required='cc yacc' mkdir sub cat >>configure.ac <<'EOF' -AM_PROG_CC_C_O +AC_PROG_CC AC_PROG_YACC AC_CONFIG_FILES([sub/Makefile]) AC_OUTPUT diff --git a/t/sourcefile-in-subdir.sh b/t/sourcefile-in-subdir.sh index a01077617..1054f18aa 100644 --- a/t/sourcefile-in-subdir.sh +++ b/t/sourcefile-in-subdir.sh @@ -29,7 +29,7 @@ AC_PROG_CC END $ACLOCAL -$AUTOMAKE +$AUTOMAKE -Wno-unsupported grep '^z\.o: x/z\.c$' Makefile.in diff --git a/t/specflg-dummy.sh b/t/specflg-dummy.sh index 89ac20657..c1b9cd5ce 100644 --- a/t/specflg-dummy.sh +++ b/t/specflg-dummy.sh @@ -64,7 +64,6 @@ AC_PROG_RANLIB AC_PROG_LIBTOOL AM_PROG_UPC AC_PROG_OBJC -AM_PROG_CC_C_O END cat > Makefile.am <<'END' diff --git a/t/specflg6.sh b/t/specflg6.sh index 77d837a53..8178b3446 100644 --- a/t/specflg6.sh +++ b/t/specflg6.sh @@ -22,7 +22,6 @@ cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AM_CONDITIONAL([BAR], [true]) END @@ -36,8 +35,6 @@ foo_CFLAGS = -DFOO foo_SOURCES = foo.c END -: > compile - $ACLOCAL $AUTOMAKE diff --git a/t/specflg7.sh b/t/specflg7.sh index ee3786e23..0a40b5deb 100644 --- a/t/specflg7.sh +++ b/t/specflg7.sh @@ -21,7 +21,6 @@ required='cc native' cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT END diff --git a/t/specflg8.sh b/t/specflg8.sh index 3bb785b91..5e51053ce 100644 --- a/t/specflg8.sh +++ b/t/specflg8.sh @@ -23,7 +23,6 @@ required='cc native' cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT END diff --git a/t/specflg9.sh b/t/specflg9.sh index 0ee90f10a..4f3d3b0c2 100644 --- a/t/specflg9.sh +++ b/t/specflg9.sh @@ -20,11 +20,11 @@ cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT END cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects bin_PROGRAMS = zzfoo zzbar zzfoo_SOURCES = sub/foo.c zzbar_SOURCES = bar.c diff --git a/t/spy.sh b/t/spy-double-colon.sh index 6ca3d0f77..6ca3d0f77 100644 --- a/t/spy.sh +++ b/t/spy-double-colon.sh diff --git a/t/spy-rm.tap b/t/spy-rm.tap index 29840abf4..3b8dd2d10 100644 --- a/t/spy-rm.tap +++ b/t/spy-rm.tap @@ -19,10 +19,10 @@ # to hold on all non-museum systems, and will soon be mandated # by POSIX as well) in future version of automake, to simplify # automake-provided cleanup rules. -# References: -# <http://lists.gnu.org/archive/html/bug-autoconf/2012-02/msg00002.html> -# <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10819> -# <http://austingroupbugs.net/view.php?id=542> +# See automake bug#10828. +# Other references: +# <http://lists.gnu.org/archive/html/bug-autoconf/2012-02/msg00002.html> +# <http://austingroupbugs.net/view.php?id=542> am_create_testdir=empty . test-init.sh diff --git a/t/subobj-clean-lt-pr10697.sh b/t/subobj-clean-lt-pr10697.sh index ddcd112e9..053ce4177 100644 --- a/t/subobj-clean-lt-pr10697.sh +++ b/t/subobj-clean-lt-pr10697.sh @@ -28,7 +28,6 @@ cat >> configure.ac << 'END' AM_PROG_AR AC_PROG_LIBTOOL AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT END diff --git a/t/subobj-clean-pr10697.sh b/t/subobj-clean-pr10697.sh index df97f0708..e244e3d79 100644 --- a/t/subobj-clean-pr10697.sh +++ b/t/subobj-clean-pr10697.sh @@ -26,7 +26,6 @@ required=cc cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_CONFIG_FILES([get-objext.sh:get-objext.in]) AC_OUTPUT END diff --git a/t/subobj.sh b/t/subobj.sh index 2431184b6..f595e68ad 100644 --- a/t/subobj.sh +++ b/t/subobj.sh @@ -14,32 +14,78 @@ # 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 of subdir objects with C. +# Test of subdir objects with C and C++. . test-init.sh -cat >> configure.ac << 'END' +cat >> configure.ac <<'END' AC_PROG_CC -AM_PROG_CC_C_O +AC_PROG_CXX +AC_PROG_YACC +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT END +$ACLOCAL +: > ylwrap + cat > Makefile.am << 'END' -AUTOMAKE_OPTIONS = subdir-objects +SUBDIRS = sub bin_PROGRAMS = wish -wish_SOURCES = generic/a.c generic/b.c +wish_SOURCES = generic/a.c +wish_SOURCES += another/z.cxx END -$ACLOCAL +mkdir sub +cat > sub/Makefile.am << 'END' +dream_SOURCES = generic/b.c more/r.y +bin_PROGRAMS = dream +END + +AUTOMAKE_fails +grep "^Makefile\.am:3:.*'generic/a\.c'.* in a subdirectory" stderr +grep "^Makefile\.am:[34]:.*'another/z\.cxx'.* in a subdirectory" stderr +grep "^sub/Makefile\.am:1:.*'generic/b\.c'.* in a subdirectory" stderr +grep "option 'subdir-objects' is disabled" stderr +# Verbose tips should be given, but not too many times. +for msg in \ + "possible forward-incompatibility" \ + "advi[sc]e.* 'subdir-objects' option throughout" \ + "unconditionally.* object file.* same subdirectory" \ +; do + test $(grep -c "$msg" stderr) -eq 1 +done + +# Guard against stupid typos. +grep 'subdir-object([^s]|$)' stderr && exit 1 + +$AUTOMAKE -Wno-unsupported + +echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am +AUTOMAKE_fails +grep "^Makefile\.am" stderr && exit 1 +grep "^sub/Makefile\.am:.*'generic/b\.c'.* in a subdirectory" stderr +grep "option 'subdir-objects' is disabled" stderr + +sed 's/^AM_INIT_AUTOMAKE/&([subdir-objects])/' configure.ac > configure.tmp +mv -f configure.tmp configure.ac +$ACLOCAL --force +$AUTOMAKE + +rm -f compile $AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; exit 1; } cat stderr >&2 # Make sure compile is installed, and that Automake says so. -grep 'install.*compile' stderr +grep '^configure\.ac:[48]:.*install.*compile' stderr test -f compile grep '^generic/a\.\$(OBJEXT):' Makefile.in -grep '[^/]a\.\$(OBJEXT)' Makefile.in && exit 1 +grep '^generic/b\.\$(OBJEXT):' sub/Makefile.in +grep '^another/z\.\$(OBJEXT):' Makefile.in +$EGREP '(^|[^/])[abz]\.\$(OBJEXT)' Makefile.in sub/Makefile.in && exit 1 # Opportunistically test for a different bug. -grep '^generic/b\.\$(OBJEXT):.*dirstamp' Makefile.in +grep '^another/z\.\$(OBJEXT):.*dirstamp' Makefile.in +grep '^generic/b\.\$(OBJEXT):.*dirstamp' sub/Makefile.in : diff --git a/t/subobj11a.sh b/t/subobj11a.sh index 25cbf4e21..2ff04b567 100644 --- a/t/subobj11a.sh +++ b/t/subobj11a.sh @@ -31,7 +31,6 @@ required=cc cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT END diff --git a/t/subobj11b.sh b/t/subobj11b.sh index 14970a0e4..deaa2b68e 100644 --- a/t/subobj11b.sh +++ b/t/subobj11b.sh @@ -28,10 +28,7 @@ . test-init.sh -cat >> configure.ac << 'END' -AC_PROG_CC -AM_PROG_CC_C_O -END +echo AC_PROG_CC >> configure.ac cat > Makefile.am << 'END' AUTOMAKE_OPTIONS = subdir-objects diff --git a/t/subobj11c.sh b/t/subobj11c.sh index a8a435b3a..7476e47c0 100644 --- a/t/subobj11c.sh +++ b/t/subobj11c.sh @@ -21,10 +21,7 @@ . test-init.sh -cat >> configure.ac << 'END' -AC_PROG_CC -AM_PROG_CC_C_O -END +echo AC_PROG_CC >> configure.ac cat > Makefile.am << 'END' AUTOMAKE_OPTIONS = subdir-objects diff --git a/t/subobj4.sh b/t/subobj4.sh index b1b577d6a..dbbed30be 100644 --- a/t/subobj4.sh +++ b/t/subobj4.sh @@ -21,7 +21,6 @@ cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_PROG_CXX AC_CONFIG_FILES([d1/Makefile d2/Makefile]) AC_OUTPUT @@ -41,11 +40,10 @@ END cat > d2/Makefile.am << 'END' END -: > compile : > d2/z.c $ACLOCAL -$AUTOMAKE +$AUTOMAKE -Wno-unsupported grep '\$(CC) .*\.\./d2/z\.c' d1/Makefile.in diff --git a/t/subobj5.sh b/t/subobj5.sh index 548230409..485142354 100644 --- a/t/subobj5.sh +++ b/t/subobj5.sh @@ -23,7 +23,6 @@ required=cc cat >> configure.ac << 'END' AC_CONFIG_FILES([generic/Makefile]) AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT END diff --git a/t/subobj6.sh b/t/subobj6.sh index 71755fdb2..0e7aa86b6 100644 --- a/t/subobj6.sh +++ b/t/subobj6.sh @@ -21,7 +21,7 @@ required=cc . test-init.sh cat >> configure.ac << 'END' -AM_PROG_CC_C_O +AC_PROG_CC AC_OUTPUT END diff --git a/t/subobj7.sh b/t/subobj7.sh index 2d997c77f..de73cc2dc 100644 --- a/t/subobj7.sh +++ b/t/subobj7.sh @@ -21,11 +21,11 @@ cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT END cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects bin_PROGRAMS = wish wish_SOURCES = foo.c generic/a.c END diff --git a/t/subobj8.sh b/t/subobj8.sh index 51e1727d7..dd03008bf 100644 --- a/t/subobj8.sh +++ b/t/subobj8.sh @@ -23,7 +23,6 @@ AC_INIT([$me], [1.0]) AC_CONFIG_AUX_DIR([tools]) AM_INIT_AUTOMAKE AC_PROG_CC -AM_PROG_CC_C_O AC_CONFIG_FILES([Makefile foo/Makefile]) AC_OUTPUT END diff --git a/t/subpkg-yacc.sh b/t/subpkg-yacc.sh index 639e4156c..9fc676190 100644 --- a/t/subpkg-yacc.sh +++ b/t/subpkg-yacc.sh @@ -49,7 +49,7 @@ mkdir lib/src cat >lib/configure.ac <<'EOF' AC_INIT([lib], [2.3]) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([subdir-objects]) AC_PROG_RANLIB AC_PROG_YACC dnl This comes after YACC and RANLIB checks, deliberately. diff --git a/t/subpkg.sh b/t/subpkg.sh index 6f59ac58d..f9cdc74e2 100644 --- a/t/subpkg.sh +++ b/t/subpkg.sh @@ -62,7 +62,7 @@ mkdir lib/src cat >lib/configure.ac <<'EOF' AC_INIT([lib], [2.3]) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([subdir-objects]) AC_CONFIG_MACRO_DIR([../m4]) AM_PROG_AR AC_PROG_RANLIB diff --git a/t/suffix-custom-subobj-and-specflg.sh b/t/suffix-custom-subobj-and-specflg.sh index e9f35c771..b862d8825 100644 --- a/t/suffix-custom-subobj-and-specflg.sh +++ b/t/suffix-custom-subobj-and-specflg.sh @@ -23,7 +23,6 @@ required=cc cat >>configure.ac <<EOF AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT EOF @@ -54,18 +53,9 @@ END $ACLOCAL $AUTOCONF $AUTOMAKE -a -./configure -$MAKE - -$MAKE distcheck -$MAKE distclean - -# Should also work without subdir-objects. -sed '/subdir-objects/d' < Makefile.am > t -mv -f t Makefile.am -$AUTOMAKE ./configure + $MAKE $MAKE distcheck diff --git a/t/tar3.sh b/t/tar-opts-errors.sh index befc23f7e..befc23f7e 100644 --- a/t/tar3.sh +++ b/t/tar-opts-errors.sh diff --git a/t/tar2.sh b/t/tar-pax.sh index 758d89a7d..758d89a7d 100644 --- a/t/tar2.sh +++ b/t/tar-pax.sh diff --git a/t/tar.sh b/t/tar-ustar.sh index c146ad98a..c146ad98a 100644 --- a/t/tar.sh +++ b/t/tar-ustar.sh diff --git a/t/target-cflags.sh b/t/target-cflags.sh index 3c7d72093..01bcbce93 100644 --- a/t/target-cflags.sh +++ b/t/target-cflags.sh @@ -22,7 +22,6 @@ required=cc cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_OUTPUT END diff --git a/t/txinfo-builddir.sh b/t/txinfo-builddir.sh new file mode 100755 index 000000000..e0156c54d --- /dev/null +++ b/t/txinfo-builddir.sh @@ -0,0 +1,127 @@ +#! /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 info files are built in builddir when needed. +# This test that this can be done through the so far undocumented +# option 'info-in-builddir', as requested by at least GCC, GDB, +# GNU binutils and the GNU bfd library. See automake bug#11034. + +required='makeinfo tex texi2dvi' +. test-init.sh + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = info-in-builddir +info_TEXINFOS = foo.texi subdir/bar.texi mu.texi +subdir_bar_TEXINFOS = subdir/inc.texi +CLEANFILES = mu.info + +# mu.info should not be rebuilt in the current directory, since +# it's up-to-date in $(srcdir). +# This can be caused by a subtle issue related to VPATH handling +# of version.texi (see also the comment in texi-vers.am): because +# stamp-vti is newer than version.texi, the 'version.texi: stamp-vti' +# rule is always triggered. Still that's not a reason for 'make' +# to think 'version.texi' has been created... +check-local: + test ! -e mu.info + test -f ../mu.info +END + +mkdir subdir + +cat > foo.texi << 'END' +\input texinfo +@setfilename foo.info +@settitle foo +@node Top +Hello walls. +@include version.texi +@bye +END + +cat > mu.texi << 'END' +\input texinfo +@setfilename mu.info +@settitle mu +@node Top +Mu mu mu. +@bye +END + +cat > subdir/bar.texi << 'END' +\input texinfo +@setfilename bar.info +@settitle bar +@node Top +Hello walls. +@include inc.texi +@bye +END + +echo "I'm included." > subdir/inc.texi + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +mkdir build +cd build +../configure +$MAKE info +test -f foo.info +test -f subdir/bar.info +test -f mu.info +test -f stamp-vti +test -f version.texi +test ! -e ../foo.info +test ! -e ../subdir/bar.info +test ! -e ../mu.info +test ! -e ../stamp-vti +test ! -e ../version.texi +$MAKE clean +test -f foo.info +test -f subdir/bar.info +test ! -e mu.info +test -f stamp-vti +test -f version.texi + +# Make sure stamp-vti is older that version.texi. +# (A common situation in a real tree). +$sleep +touch stamp-vti + +$MAKE distcheck +# Being distributed, this file should have been rebuilt. +test -f mu.info + +$MAKE distclean +test -f stamp-vti +test -f version.texi +test -f foo.info +test -f subdir/bar.info +test ! -e mu.info + +../configure +$MAKE maintainer-clean +test ! -e stamp-vti +test ! -e version.texi +test ! -e foo.info +test ! -e subdir/bar.info +test ! -e mu.info + +: diff --git a/t/txinfo-nodist-info.sh b/t/txinfo-nodist-info.sh new file mode 100755 index 000000000..265587e4e --- /dev/null +++ b/t/txinfo-nodist-info.sh @@ -0,0 +1,66 @@ +#! /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 we can force generated '.info' info files not to be +# distributed. + +required=makeinfo +. test-init.sh + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = info-in-builddir +info_TEXINFOS = foo.texi +CLEANFILES = foo.info + +# To make distcheck work without requiring TeX and texi2dvi. +dvi: + +# Do not distribute generated '.info' files. +dist-info: + @: +END + +mkdir subdir + +cat > foo.texi << 'END' +\input texinfo +@setfilename foo.info +@settitle foo +@node Top +Hello walls. +@include version.texi +@bye +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a -Wno-override + +./configure +$MAKE distdir +ls -l . $distdir # For debugging. +test ! -e foo.info +test ! -e $distdir/foo.info +$MAKE +test -f foo.info +$MAKE distdir +ls -l $distdir # For debugging. +test ! -f $distdir/foo.info +$MAKE distcheck + +: diff --git a/t/txinfo23.sh b/t/txinfo23.sh index c2b27976d..6c2d9ce3c 100644 --- a/t/txinfo23.sh +++ b/t/txinfo23.sh @@ -53,9 +53,12 @@ I'm included. END $ACLOCAL -$AUTOMAKE --add-missing $AUTOCONF +AUTOMAKE_run --add-missing -Wno-error +grep "Makefile\.am:.*undocumented.* automake hack" stderr +grep "Makefile\.am:.*'info-in-builddir' automake option" stderr + mkdir build cd build ../configure diff --git a/t/txinfo24.sh b/t/txinfo24.sh index bfad312a6..9daa82ec7 100644 --- a/t/txinfo24.sh +++ b/t/txinfo24.sh @@ -41,7 +41,7 @@ Hello walls. END $ACLOCAL -$AUTOMAKE --add-missing +$AUTOMAKE --add-missing -Wno-obsolete $AUTOCONF mkdir build diff --git a/t/txinfo25.sh b/t/txinfo25.sh index 369a75943..aad0cb771 100644 --- a/t/txinfo25.sh +++ b/t/txinfo25.sh @@ -53,9 +53,14 @@ Hello walls. END $ACLOCAL -$AUTOMAKE --add-missing $AUTOCONF +AUTOMAKE_fails --add-missing +grep "Makefile\.am:.*undocumented.* automake hack" stderr +grep "Makefile\.am:.*'info-in-builddir' automake option" stderr + +$AUTOMAKE --add-missing -Wno-obsolete + mkdir build cd build ../configure diff --git a/t/txinfo28.sh b/t/txinfo28.sh index 171632a6b..191a21849 100644 --- a/t/txinfo28.sh +++ b/t/txinfo28.sh @@ -50,7 +50,7 @@ Hello walls. END $ACLOCAL -$AUTOMAKE --add-missing +$AUTOMAKE --add-missing -Wno-error $AUTOCONF mkdir build diff --git a/t/vala-libs.sh b/t/vala-libs.sh index f3e905434..f1ed99ab2 100644 --- a/t/vala-libs.sh +++ b/t/vala-libs.sh @@ -22,7 +22,6 @@ required="valac cc pkg-config libtoolize GNUmake" cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_AR AC_PROG_RANLIB AC_PROG_LIBTOOL @@ -32,6 +31,7 @@ AC_OUTPUT END cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects lib_LIBRARIES = libmu.a lib_LTLIBRARIES = src/libzardoz.la libmu_a_SOURCES = mu.vala mu2.c mu.vapi mu2.h @@ -76,7 +76,7 @@ int main () } END -mkdir src +mkdir -p src cat > src/zardoz-foo.vala << 'END' using GLib; public class Foo { diff --git a/t/vala-mix.sh b/t/vala-mix.sh index 7b7403d8c..1ac851e0b 100644 --- a/t/vala-mix.sh +++ b/t/vala-mix.sh @@ -21,7 +21,6 @@ required='valac cc pkg-config GNUmake' cat >> configure.ac <<'END' AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_VALAC([0.7.3]) PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4]) AC_OUTPUT diff --git a/t/vala-non-recursive-setup.sh b/t/vala-non-recursive-setup.sh index ca65a4f4f..88f67a879 100644 --- a/t/vala-non-recursive-setup.sh +++ b/t/vala-non-recursive-setup.sh @@ -23,7 +23,6 @@ mkdir src cat >> 'configure.ac' << 'END' AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_VALAC([0.7.0]) PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4]) AC_OUTPUT @@ -40,6 +39,7 @@ public class Zardoz { END cat > 'Makefile.am' <<'END' +AUTOMAKE_OPTIONS = subdir-objects bin_PROGRAMS = src/zardoz src_zardoz_CFLAGS = $(GOBJECT_CFLAGS) src_zardoz_LDADD = $(GOBJECT_LIBS) diff --git a/t/vala-per-target-flags.sh b/t/vala-per-target-flags.sh index 346136508..add07cf33 100644 --- a/t/vala-per-target-flags.sh +++ b/t/vala-per-target-flags.sh @@ -23,7 +23,6 @@ mkdir src cat >> configure.ac <<'END' AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_VALAC([0.7.0]) PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4]) AC_CONFIG_FILES([src/Makefile]) diff --git a/t/vala-recursive-setup.sh b/t/vala-recursive-setup.sh index 5c1f4c653..cf7980dd2 100644 --- a/t/vala-recursive-setup.sh +++ b/t/vala-recursive-setup.sh @@ -23,7 +23,6 @@ mkdir src cat >> 'configure.ac' << 'END' AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_VALAC([0.7.0]) PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4]) AC_CONFIG_FILES([src/Makefile]) diff --git a/t/vala-vapi.sh b/t/vala-vapi.sh index 9def25385..ce5ca9d73 100644 --- a/t/vala-vapi.sh +++ b/t/vala-vapi.sh @@ -21,7 +21,6 @@ required='pkg-config valac cc GNUmake' cat >> configure.ac <<'END' AC_PROG_CC -AM_PROG_CC_C_O AM_PROG_VALAC([0.7.3]) PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4]) AC_OUTPUT diff --git a/t/wrap/aclocal.in b/t/wrap/aclocal.in index 3e60eb01e..cdcae1a88 100644 --- a/t/wrap/aclocal.in +++ b/t/wrap/aclocal.in @@ -26,4 +26,4 @@ BEGIN '--automake-acdir=@abs_top_srcdir@/m4', '--system-acdir=@abs_top_srcdir@/m4/acdir'; } -require '@abs_top_builddir@/aclocal'; +require '@abs_top_builddir@/bin/aclocal'; diff --git a/t/wrap/automake.in b/t/wrap/automake.in index bc6eab61b..cf18d7b24 100644 --- a/t/wrap/automake.in +++ b/t/wrap/automake.in @@ -24,4 +24,4 @@ BEGIN if '@srcdir@' ne '.'; unshift @ARGV, '--libdir=@abs_top_srcdir@/lib'; } -require '@abs_top_builddir@/automake'; +require '@abs_top_builddir@/bin/automake'; diff --git a/t/yaccpp.sh b/t/yacc-cxx-grepping.sh index 079014673..079014673 100644 --- a/t/yaccpp.sh +++ b/t/yacc-cxx-grepping.sh diff --git a/t/yacc-dist-nobuild-subdir.sh b/t/yacc-dist-nobuild-subdir.sh index 7ea252884..8b7f7ff9b 100644 --- a/t/yacc-dist-nobuild-subdir.sh +++ b/t/yacc-dist-nobuild-subdir.sh @@ -27,7 +27,6 @@ useless_vpath_rebuild && skip_ "would trip on automake bug#7884" cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_PROG_YACC AC_OUTPUT END diff --git a/t/yaccdry.sh b/t/yacc-dry.sh index 79cf490ae..79cf490ae 100644 --- a/t/yaccdry.sh +++ b/t/yacc-dry.sh diff --git a/t/yacc-grepping2.sh b/t/yacc-grepping2.sh index 9f20798a2..3c5da2255 100644 --- a/t/yacc-grepping2.sh +++ b/t/yacc-grepping2.sh @@ -21,7 +21,6 @@ cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_PROG_YACC END @@ -35,7 +34,9 @@ mkdir sub : > sub/maude.y $ACLOCAL -$AUTOMAKE -a +# FIXME: stop disabling the warnings in the 'unsupported' category +# FIXME: once the 'subdir-objects' option has been mandatory. +$AUTOMAKE -a -Wno-unsupported grep '^maude\.c:.*maude\.y' Makefile.in @@ -48,7 +49,6 @@ bin_PROGRAMS = maude maude_SOURCES = sub/maude.y END -$ACLOCAL $AUTOMAKE -a # No rule needed, the default .y.c: inference rule is enough @@ -65,8 +65,9 @@ maude_SOURCES = sub/maude.y maude_YFLAGS = -d END -$ACLOCAL -$AUTOMAKE -a +# FIXME: stop disabling the warnings in the 'unsupported' category +# FIXME: once the 'subdir-objects' option has been mandatory. +$AUTOMAKE -a -Wno-unsupported # Rule should use maude_YFLAGS. grep 'AM_YFLAGS.*maude' Makefile.in && exit 1 diff --git a/t/yacc-line.sh b/t/yacc-line.sh index ed30c56b3..b034af36e 100644 --- a/t/yacc-line.sh +++ b/t/yacc-line.sh @@ -25,7 +25,6 @@ required='cc yacc' cat >> configure.ac << 'END' AC_CONFIG_FILES([sub/Makefile]) AC_PROG_CC -AM_PROG_CC_C_O AC_PROG_YACC AC_OUTPUT END @@ -77,7 +76,9 @@ c_outputs='zardoz.c bar-quux.c sub/foo-zardoz.c sub/dir/quux.c' $ACLOCAL $AUTOCONF -$AUTOMAKE -a +# FIXME: stop disabling the warnings in the 'unsupported' category +# FIXME: once the 'subdir-objects' option has been mandatory. +$AUTOMAKE -a -Wno-unsupported for vpath in : false; do diff --git a/t/yacc4.sh b/t/yacc-misc.sh index bdadd648e..bdadd648e 100644 --- a/t/yacc4.sh +++ b/t/yacc-misc.sh diff --git a/t/yacc-subdir.sh b/t/yacc-subdir.sh index 9db492178..95788ec8a 100644 --- a/t/yacc-subdir.sh +++ b/t/yacc-subdir.sh @@ -22,7 +22,6 @@ required='cc yacc' cat >> configure.ac << 'END' AC_PROG_CC -AM_PROG_CC_C_O AC_PROG_YACC AC_OUTPUT END diff --git a/t/yaccvpath.sh b/t/yacc-vpath.sh index bd123374f..bd123374f 100644 --- a/t/yaccvpath.sh +++ b/t/yacc-vpath.sh |