print $file_handle unindent <<EOF;
#! /bin/sh
# This file has been automatically generated. DO NOT EDIT BY HAND!
- . ./defs-static || exit '99';
+ . ./defs-static || exit 1
$shell_setup_code
- # In the spirit of VPATH, we prefer a test in the build tree
- # over one in the source tree.
- for dir in . "\$am_top_srcdir"; do
- if test -f "\$dir/$wrapped_test"; then
- echo "\$0: will source \$dir/$wrapped_test"
- . "\$dir/$wrapped_test"; exit "\$?"
- fi
- done
- echo "\$0: cannot find wrapped test '$wrapped_test'" >&2
+ w="\$am_top_srcdir/$wrapped_test"
+ if test -f "\$w"; then
+ echo "\$0: will source '\$w'"
+ . "\$w"
- exit "\$?"
- else
- echo "\$0: cannot find wrapped test '\$w'" >&2
- exit '99'
++ exit \$?
+ fi
++ echo "\$0: cannot find wrapped test '\$w'" >&2
+ exit 99
EOF
}
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2007-2012 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 internal automake variables:
+# - $(am__all_progs).
+# - $(am__all_libs).
+# - $(am__all_ltlibs).
+
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_SUBST([CC], [who-cares])
+m4_define([AM_PROG_AR], [AC_SUBST([AR], [who-cares])])
+AM_PROG_AR
+AC_SUBST([RANLIB], [who-cares])
+AC_SUBST([LIBTOOL], [who-cares])
+AC_SUBST([EXEEXT], [''])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = no-dependencies
+
+check_PROGRAMS = p1
+check_LIBRARIES = lib01.a
+check_LTLIBRARIES = lib1.la
+check_SCRIPTS = x1
+
+EXTRA_PROGRAMS = p2
+EXTRA_LIBRARIES = lib02.a
+EXTRA_LTLIBRARIES = lib2.la
+EXTRA_SCRIPTS = x2
+
+bin_PROGRAMS = p3
+lib_LIBRARIES = lib03.a
+lib_LTLIBRARIES = lib3.la
+bin_SCRIPTS = x3
+
+noinst_PROGRAMS = p4
+noinst_LIBRARIES = lib04.a
+noinst_LTLIBRARIES = lib4.la
+noinst_SCRIPTS = x4
+
+mydir = $(prefix)
+my_PROGRAMS = p5
+my_LIBRARIES = lib05.a
+my_LTLIBRARIES = lib5.la
+my_SCRIPTS = x5
+
+.PHONY: debug test
+debug:
+ @echo PROGS-BEG: $(am__all_progs) :PROGS-END
+ @echo LIBS-BEG: $(am__all_libs) :LIBS-END
+ @echo LTLIBS-BEG: $(am__all_ltlibs) :LTLIBS-END
+test: debug
+ test '$(am__all_progs)' = 'p1 p2 p3 p4 p5'
+ test '$(am__all_libs)' = 'lib01.a lib02.a lib03.a lib04.a lib05.a'
+ test '$(am__all_ltlibs)' = 'lib1.la lib2.la lib3.la lib4.la lib5.la'
+END
+
+: > ltmain.sh
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+$MAKE test
+$MAKE test EXEEXT=.exe
+$MAKE test EXEEXT=.bin
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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 private automake working directory in builddir:
+#
+# * internal variables:
+# $(am__dir)
+# $(am__abs_dir)
+# $(am__top_dir)
+# $(am__abs_top_dir)
+#
+# * cleaning rules and "make distcheck" interaction.
+#
+
++. ./defs || exit 1
+
+d=.am
+
+cat >> configure.ac <<'END'
+AC_CONFIG_FILES([xsrc/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = . xsrc
+all-local: | $(am__dir)
+END
+
+mkdir xsrc
+cat >> xsrc/Makefile.am <<'END'
+subdir:
+ mkdir $@
+all-local: | $(am__dir) subdir
+ : > $(am__dir)/sub
+ : > $(am__top_dir)/top
+ (cd ./subdir && : > $(am__abs_dir)/abs-sub)
+ rmdir subdir
+ (cd /tmp && : > $(am__abs_top_dir)/abs-top)
+END
+
+sort > exp <<END
+$d
+$d/top
+$d/abs-top
+xsrc/$d
+xsrc/$d/sub
+xsrc/$d/abs-sub
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+do_check ()
+{
+ srcdir=$1
+ $srcdir/configure
+ $MAKE
+ find $d xsrc/$d | sort > got
+ cat $srcdir/exp
+ cat got
+ diff $srcdir/exp got
+}
+
+mkdir build
+cd build
+do_check ..
+
+cd ..
+do_check .
+
+$MAKE distcheck
+$MAKE clean
+test -d $d
+$MAKE distclean
+test ! -e $d
+
+:
# Check that AUTOMAKE_OPTIONS support variable expansion.
- . ./defs || Exit 1
+am_create_testdir=empty
+ . ./defs || exit 1
# We want complete control over automake options.
AUTOMAKE=$am_original_AUTOMAKE
install:
END
+: > compile
+: > missing
+: > depcomp
+: > install-sh
+
$ACLOCAL
AUTOMAKE_run
-grep '^Makefile\.am:.*:=.*not portable' stderr
+grep '^Makefile\.am:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
- grep README stderr && Exit 1
- $EGREP '(install|override)' stderr && Exit 1
- $EGREP 'distdir|\.tar' Makefile.in && Exit 1
+ grep README stderr && exit 1
+ $EGREP '(install|override)' stderr && exit 1
++$EGREP 'distdir|\.tar' Makefile.in && exit 1
:
# 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 'configure', 'configure.ac' and 'configure.in' are *not*
-# automatically distributed when placed in a subdirectory.
+# Check that 'configure' and 'configure.ac' are *not* automatically
+# distributed when placed in a subdirectory.
# Related to automake bug#7819.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac <<END
AC_CONFIG_FILES([sub/Makefile])
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Dependency tracking in the face of added/removed/renamed files.
+# This is meant to be sourced by other the tests, after they've
+# set the variables '$xdir' and '$vpath' appropriately.
+
+required=cc
- diff "$1" t && Exit 1
++. ./defs || exit 1
+
+test x${xdir+"set"} = x"set" || fatal_ "\$xdir is unset"
+test x${vpath+"set"} = x"set" || fatal_ "\$vpath is unset"
+
+if test $vpath = no; then
+ srcdir=.
+elif test $vpath = yes; then
+ srcdir=..
+else
+ fatal_ "invalid value for \$vpath: '$vpath'"
+fi
+
+if test -z "$xdir"; then
+ thedir=$srcdir
+else
+ thedir=$srcdir/$xdir
+ xdir=$xdir/
+fi
+
+
+finalize_edit ()
+{
- grep_prog_out () { ./prg && ./prg | grep "$1" || Exit 1; }
++ diff "$1" t && exit 1
+ mv -f t "$2"
+}
+
+func_subst ()
+{
+ subst=$1; shift
+ for file
+ do
+ sed "$subst" "$file" > t
+ finalize_edit "$subst" "$file"
+ done
+}
+
+prepend ()
+{
+ cat "$1" "$2" > t
+ finalize_edit "$@"
+}
+
+if cross_compiling; then
+ grep_prog_out () { :; }
+else
- test $vpath = no || { mkdir build && cd build; } || Exit 99
++ grep_prog_out () { ./prg && ./prg | grep "$1" || exit 1; }
+fi
+
+echo AC_PROG_CC >> configure.ac
+echo AM_PROG_AR >> configure.ac
+echo AC_PROG_RANLIB >> configure.ac
+test -z "$xdir" || echo AM_PROG_CC_C_O >> configure.ac
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am <<END
+noinst_PROGRAMS = prg
+noinst_LIBRARIES = liber.a
+prg_SOURCES = ${xdir}main.c
+liber_a_SOURCES = ${xdir}niam.c
+get-exeext:
+ @echo \$(EXEEXT)
+END
+
+cat configure.ac # For debugging.
+cat Makefile.am # Likewise.
+
+test -z "$xdir" || mkdir "$xdir"
+
+echo '#define THE_STRING "foofoofoo"' > ${xdir}foo.h
+
+cat > ${xdir}main.c << 'END'
+#include "foo.h"
+#include <stdio.h>
+int main (void)
+{
+ printf ("%s\n", THE_STRING);
+ return 0;
+}
+END
+
+sed 's/main/niam/' ${xdir}main.c > ${xdir}niam.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
++test $vpath = no || { mkdir build && cd build; } || exit 99
+
+$srcdir/configure --enable-dependency-tracking
+$MAKE
+grep_prog_out foofoofoo # Sanity check.
+
+EXEEXT=`$MAKE -s --no-print-directory get-exeext` \
+ || fatal_ "cannot get \$EXEEXT"
+
+# Modify an header file.
+$sleep
+echo '#define THE_STRING "oofoofoof"' > $thedir/foo.h
+$MAKE
+is_newest prg$EXEEXT $thedir/foo.h
+is_newest liber.a $thedir/foo.h
+grep_prog_out oofoofoof
+
+# Rename an header file.
+$sleep
+mv $thedir/foo.h $thedir/foo2.h
+func_subst 's|foo\.h|foo2.h|' $thedir/main.c $thedir/niam.c
+$MAKE
+is_newest prg$EXEEXT $thedir/main.c
+is_newest liber.a $thedir/niam.c
+grep_prog_out oofoofoof
+
+# Add an header file, modify another one.
+$sleep
+mv $thedir/foo2.h $thedir/bar.h
+echo '#include "bar.h"' > $thedir/foo2.h
+$MAKE
+grep_prog_out oofoofoof
+is_newest prg$EXEEXT $thedir/foo2.h
+is_newest liber.a $thedir/foo2.h
+
+# Remove an header file, modify another one.
+$sleep
+echo '#define THE_STRING "bazbazbaz"' > $thedir/foo2.h
+rm -f $thedir/bar.h
+$MAKE
+is_newest prg$EXEEXT $thedir/foo2.h
+is_newest liber.a $thedir/foo2.h
+grep_prog_out bazbazbaz
+
+# Add two header files, rename another file.
+$sleep
+echo '#define S_ONE "zar"' > $thedir/1.h
+echo '#define S_TWO "doz"' > $thedir/2.h
+cat > $thedir/baz.h <<'END'
+#include "1.h"
+#include "2.h"
+#define THE_STRING S_ONE S_TWO
+END
+func_subst 's|foo2\.h|baz.h|' $thedir/main.c $thedir/niam.c
+rm -f $thedir/foo2.h
+$MAKE
+is_newest prg$EXEEXT $thedir/*.[ch]
+is_newest liber.a $thedir/*.[ch]
+grep_prog_out zardoz
+
+# Check the distribution.
+$sleep
+echo prg_SOURCES += ${xdir}baz.h ${xdir}1.h ${xdir}2.h >> $srcdir/Makefile.am
+$MAKE distcheck
+
+:
grep_configure_help ()
{
./configure --help > am--all-help \
- || { cat am--all-help; Exit 1; }
+ || { cat am--all-help; exit 1; }
cat am--all-help
extract_configure_help "$1" am--all-help > am--our-help \
- || { cat am--our-help; Exit 1; }
+ || { cat am--our-help; exit 1; }
cat am--our-help
- $EGREP "$2" am--our-help || Exit 1
+ $EGREP "$2" am--our-help || exit 1
}
-# using_gmake
-# -----------
-# Return success if $MAKE is GNU make, return failure otherwise.
-# Caches the result for speed reasons.
-using_gmake ()
-{
- case $am__using_gmake in
- yes)
- return 0;;
- no)
- return 1;;
- '')
- # Use --version AND -v, because SGI Make doesn't fail on --version.
- # Also grep for GNU because newer versions of FreeBSD make do
- # not complain about --version (they seem to silently ignore it).
- if $MAKE --version -v | grep GNU; then
- am__using_gmake=yes
- return 0
- else
- am__using_gmake=no
- return 1
- fi;;
- *)
- fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";;
- esac
-}
-am__using_gmake="" # Avoid interferences from the environment.
-
-# make_can_chain_suffix_rules
-# ---------------------------
-# Return 0 if $MAKE is a make implementation that can chain suffix rules
-# automatically, return 1 otherwise. Caches the result for speed reasons.
-make_can_chain_suffix_rules ()
-{
- if test -z "$am__can_chain_suffix_rules"; then
- if using_gmake; then
- am__can_chain_suffix_rules=yes
- return 0
- else
- mkdir am__chain.dir$$
- cd am__chain.dir$$
- unindent > Makefile << 'END'
- .SUFFIXES: .u .v .w
- .u.v: ; cp $< $@
- .v.w: ; cp $< $@
-END
- echo make can chain suffix rules > foo.u
- if $MAKE foo.w && diff foo.u foo.w; then
- am__can_chain_suffix_rules=yes
- else
- am__can_chain_suffix_rules=no
- fi
- cd ..
- rm -rf am__chain.dir$$
- fi
- fi
- case $am__can_chain_suffix_rules in
- yes) return 0;;
- no) return 1;;
- *) fatal_ "make_can_chain_suffix_rules: internal error";;
- esac
-}
-am__can_chain_suffix_rules="" # Avoid interferences from the environment.
-
-# useless_vpath_rebuild
-# ---------------------
-# Tell whether $MAKE suffers of the bug triggering automake bug#7884.
-# For example, this happens with FreeBSD make, since in a VPATH build
-# it tends to rebuilt files for which there is an explicit or even just
-# a suffix rule, even if said files are already available in the VPATH
-# directory.
-useless_vpath_rebuild ()
-{
- if test -z "$am__useless_vpath_rebuild"; then
- if using_gmake; then
- am__useless_vpath_rebuild=no
- return 1
- fi
- mkdir am__vpath.dir$$
- cd am__vpath.dir$$
- touch foo.a foo.b bar baz
- mkdir build
- cd build
- unindent > Makefile << 'END'
- .SUFFIXES: .a .b
- VPATH = ..
- all: foo.b baz
- .PHONY: all
- .a.b: ; cp $< $@
- baz: bar ; cp ../baz bar
-END
- if $MAKE all && test ! -f foo.b && test ! -f bar; then
- am__useless_vpath_rebuild=no
- else
- am__useless_vpath_rebuild=yes
- fi
- cd ../..
- rm -rf am__vpath.dir$$
- fi
- case $am__useless_vpath_rebuild in
- yes) return 0;;
- no) return 1;;
- "") ;;
- *) fatal_ "no_useless_builddir_remake: internal error";;
- esac
-}
-am__useless_vpath_rebuild=""
-
-yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
-
# seq_ - print a sequence of numbers
# ----------------------------------
# This function simulates GNU seq(1) portably. Valid usages:
case $t in fail*|xpass*|error*) expect_failure=:;; esac
case $t in xfail*|xpass*) xfail_tests="$xfail_tests $t";; esac
done
- test -z "$xfail_tests" || xfail_tests="XFAIL_TESTS='$xfail_tests'"
- st=0
- eval "env $tests $xfail_tests \$MAKE -e check > stdout || st=\$?"
+ set "TESTS=$tests"
+ test -z "$xfail_tests" || set "$@" XFAIL_TESTS="$xfail_tests"
+ st=0; $MAKE "$@" check >stdout || st=$?
cat stdout
if $expect_failure; then
- test $st -gt 0 || Exit 1
+ test $st -gt 0 || exit 1
else
- test $st -eq 0 || Exit 1
+ test $st -eq 0 || exit 1
fi
$PERL "$am_testauxdir"/extract-testsuite-summary.pl stdout >summary.got \
|| fatal_ "cannot extract testsuite summary"
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+#
+# - Automake should handle trailing backslashes in comments the way GNU
+# make does, i.e., considering the next line as a continuation of the
+# comment.
+#
+# - Automake should allow backslash-escaped '#' characters at the end
+# of a line (in variable definitions as well as well as in recipes),
+# because GNU make allows that.
+#
+# - GNU make handles comments following trailing backslashes gracefully,
+# so Automake should do the same.
+#
+# - Automake should not complain if the Makefile ands with a backslash
+# and newline sequence, because GNU make handles that gracefully.
+#
+
++. ./defs || exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+# Avoid possible interferences from the environment.
+var1= var2=; unset var1 var2
+
+cat > Makefile.am << 'END'
+# a comment with backslash \
+var1 = foo
+var2 = bar
+
+var3 = \#
+var4 = $(var3)
+
+var5 = ok \
+# ko
+
+var6 = \# \
+\#\\\\\# seen # not seen
+
+var6 += \# \# # again not seen
+
+.PHONY: test
+test:
+ test -z '$(var1)'
+ test '$(var2)' = bar
+ test '$(var3)' = '#'
+ test '$(var4)' = \#
+ # Use '[', not 'test', here, so that spurious comments
+ # are ensured to cause syntax errors.
+ [ $(var5) = ok ]
+ test '$(var6)' = '# #\\# seen # #'
+
+# Yes, this file ends with a backslash-newline. So what?
+\
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE test
+
+:
$ACLOCAL
$AUTOMAKE
-grep 'install-recursive' Makefile.in && exit 1
+$AUTOCONF
+
+./configure
+
+for t in all check install; do
- $MAKE -n $t-recursive 2>stderr && { cat stderr >&2; Exit 1; }
++ $MAKE -n $t-recursive 2>stderr && { cat stderr >&2; exit 1; }
+ cat stderr >&2
+ grep " [Nn]o rule to make target.*[\`\"']$t-recursive" stderr
+done
:
$AUTOMAKE -a
./configure --prefix "$(pwd)/inst"
- $MAKE check >stdout || { cat stdout; Exit 1; }
+ $MAKE check >stdout || { cat stdout; exit 1; }
cat stdout
grep '^PASS: subrun\.sh *$' stdout
- grep 'PASS.*echo\.sh' stdout && Exit 1
+ grep 'PASS.*echo\.sh' stdout && exit 1
-# check should depend directly on $(BUILT_SOURCES) (similar tests
-# are in check.test and check2.test).
-$EGREP '^check:.* \$\(BUILT_SOURCES\)( |$)' Makefile.in
-$EGREP '^check:.* \$\(BUILT_SOURCES\)( |$)' dir/Makefile.in
-
-$MAKE clean
-# Sanity checks
-test ! -f command1.inc
-test ! -f dir/command2.inc
-# Now make sure these two files are rebuilt during make install.
-$MAKE install
-test -f command1.inc
-test -f dir/command2.inc
+$MAKE distcheck
:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2003-2012 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/>.
+
+# Interaction of BUILT_SOURCES with conditionals.
+
++. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AM_CONDITIONAL([COND1], [test $cond1 = yes])
+AM_CONDITIONAL([COND2], [test $cond2 = yes])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+if COND1
+BUILT_SOURCES = a
+else
+BUILT_SOURCES = b
+endif
+if COND2
+BUILT_SOURCES += c
+endif
+
+a b c:
+ echo who cares > $@
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+cleanup ()
+{
+ # Files in $(BUILT_SOURCES) should be automatically removed
+ # upon maintainer-clean.
+ $MAKE maintainer-clean
+ test ! -f a
+ test ! -f b
+ test ! -f c
+}
+
+./configure cond1=yes cond2=yes
+
+$MAKE
+test -f a
+test ! -f b
+test -f c
+
+cleanup
+
+./configure cond1=no cond2=yes
+
+$MAKE
+test ! -f a
+test -f b
+test -f c
+
+cleanup
+
+./configure cond1=yes cond2=no
+
+$MAKE
+test -f a
+test ! -f b
+test ! -f c
+
+cleanup
+
+./configure cond1=no cond2=no
+
+$MAKE
+test ! -f a
+test -f b
+test ! -f c
+
+cleanup
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2002-2012 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 'install:' honors $(BUILT_SOURCES).
+# PR/359.
+
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_CONFIG_FILES([dir/Makefile])
+AC_OUTPUT
+END
+
+mkdir dir
+
+cat > Makefile.am << 'END'
+BUILT_SOURCES = built1
+SUBDIRS = dir
+built1:
+ echo ok > $@
+CLEANFILES = built1
+install-data-hook:
+ $(MKDIR_P) $(DESTDIR)$(prefix)/dir2
+ cp built1 $(DESTDIR)$(prefix)/built1
+ cp dir/built2 $(DESTDIR)$(prefix)/dir2/built3
+uninstall-hook:
+ rm -f $(DESTDIR)$(prefix)/built1
+ rm -f $(DESTDIR)$(prefix)/dir2/built3
+ rmdir $(DESTDIR)$(prefix)/dir2
+installcheck-local:
+ test -f $(prefix)/built1
+ test -f $(prefix)/dir2/built3
+END
+
+cat > dir/Makefile.am << 'END'
+BUILT_SOURCES = built2
+built2:
+## The next line ensures that command1.inc has been built before
+## recurring into the subdir.
+ cp ../built1 $@
+CLEANFILES = built2
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure --prefix "`pwd`/inst"
+
+# Now make sure these two files are rebuilt during make install.
+$MAKE install
+test -f built1
+test -f dir/built2
+$MAKE installcheck
+$MAKE distcheck
+
+:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test to make sure a sensible default source for libraries is used.
+# Basic test on BUILT_SOURCES.
-required='cc libtool'
+required=cc
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >> configure.ac << 'END'
+cat >> configure.ac <<'END'
AC_PROG_CC
-AM_PROG_AR
-AC_PROG_LIBTOOL
AC_OUTPUT
END
# 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.
+# flags or subdir objects are used.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >>configure.ac <<EOF
+AC_CONFIG_FILES([src/Makefile])
AC_PROG_CC
AC_OUTPUT
EOF
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Look for a bug where FreeBSD make in concurrent mode reported success
-# even when the Automake-generated parallel testsuite harness failed.
+# Look for a bug where make in concurrent mode reported success even
+# when the Automake-generated parallel testsuite harness failed.
+# This issue was originally present only with FreeBSD make, but we
+# keep the test anyway, for extra safety.
# See automake bug#9245.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_OUTPUT
./configure
-# Some make implementations don't grok the '-j' option.
-$MAKE -j1 || exit 77
-
for j in '' -j1 -j2; do
- $MAKE $j check && Exit 1
- $MAKE $j TESTS=foo.test check && Exit 1
- $MAKE $j recheck && Exit 1
- $MAKE $j TESTS=foo check && Exit 1
- $MAKE $j check && exit 1
- TESTS=foo.test $MAKE $j -e check && exit 1
- $MAKE $j recheck && exit 1
- TEST_LOGS=foo.log $MAKE $j -e check && exit 1
++ $MAKE $j check && exit 1
++ $MAKE $j TESTS=foo.test check && exit 1
++ $MAKE $j recheck && exit 1
++ $MAKE $j TESTS=foo check && exit 1
rm -f test-suite.log
- $MAKE $j test-suite.log && Exit 1
- test -f test-suite.log || Exit 1
- $MAKE $j test-suite.log && exit 1
- test -f test-suite.log || exit 1
++ $MAKE $j test-suite.log && exit 1
++ test -f test-suite.log || exit 1
done
:
(
# Do not check for failure in this subshell
set +e
- env TESTS=pass $MAKE -e check
- env TESTS=fail $MAKE -e check
- env TESTS=skip $MAKE -e check
- env TESTS=xfail $MAKE -e check
- env TESTS=xpass $MAKE -e check
- env TESTS="pass pass2" $MAKE -e check
- env TESTS="fail fail2" $MAKE -e check
- env TESTS="skip skip2" $MAKE -e check
- env TESTS="xfail xfail2" $MAKE -e check
- env TESTS="xpass xpass2" $MAKE -e check
- env TESTS='pass skip xfail' $MAKE -e check
+ $MAKE check TESTS="pass"
+ $MAKE check TESTS="fail"
+ $MAKE check TESTS="skip"
+ $MAKE check TESTS="xfail"
+ $MAKE check TESTS="xpass"
+ $MAKE check TESTS="pass pass2"
+ $MAKE check TESTS="fail fail2"
+ $MAKE check TESTS="skip skip2"
+ $MAKE check TESTS="xfail xfail2"
+ $MAKE check TESTS="xpass xpass2"
+ $MAKE check TESTS="pass skip xfail"
$MAKE check
:
- ) >stdout || { cat stdout; Exit 1; }
+ ) >stdout || { cat stdout; exit 1; }
cat stdout
- grep '1 [tT]ests' stdout && Exit 1
- grep '[02-9] [tT]est ' stdout && Exit 1
- grep '1 .* were ' stdout && Exit 1
- grep '[02-9].* was .*run' stdout && Exit 1
- grep 'All 1 ' stdout && Exit 1
- $EGREP '1 (un)?expected (failures|passes)' stdout && Exit 1
- $EGREP '[^1] (un)?expected (failure|pass)\)' stdout && Exit 1
+ grep '1 [tT]ests' stdout && exit 1
+ grep '[02-9] [tT]est ' stdout && exit 1
+ grep '1 .* were ' stdout && exit 1
+ grep '[02-9].* was .*run' stdout && exit 1
+ grep 'All 1 ' stdout && exit 1
+ $EGREP '1 (un)?expected (failures|passes)' stdout && exit 1
+ $EGREP '[^1] (un)?expected (failure|pass)\)' stdout && exit 1
:
./configure
- $MAKE check TESTS=skip >stdout || { cat stdout; Exit 1; }
-env TESTS=skip $MAKE -e check >stdout || { cat stdout; exit 1; }
++$MAKE check TESTS=skip >stdout || { cat stdout; exit 1; }
cat stdout
if test x"$am_serial_tests" = x"yes"; then
- grep '1.*passed' stdout && Exit 1
+ grep '1.*passed' stdout && exit 1
: For shells with buggy 'set -e'.
else
count_test_results total=1 pass=0 fail=0 skip=1 xfail=0 xpass=0 error=0
fi
- $MAKE check TESTS="skip skip2" >stdout || { cat stdout; Exit 1; }
-env TESTS="skip skip2" $MAKE -e check >stdout || { cat stdout; exit 1; }
++$MAKE check TESTS="skip skip2" >stdout || { cat stdout; exit 1; }
cat stdout
if test x"$am_serial_tests" = x"yes"; then
- grep '2.*passed' stdout && Exit 1
+ grep '2.*passed' stdout && exit 1
: For shells with buggy 'set -e'.
else
count_test_results total=2 pass=0 fail=0 skip=2 xfail=0 xpass=0 error=0
: For shells with busted 'set -e'.
fi
- CHECKLOCAL_EXIT_STATUS=1 $MAKE check && Exit 1
+ CHECKLOCAL_EXIT_STATUS=1 $MAKE check && exit 1
grep 'check-local failed :-(' local.log
- # Do not trust the exit status of 'make -k'.
- NAIL=screw B_EXIT_STATUS=23 CHECKLOCAL_EXIT_STATUS=1 $MAKE -k check || :
+ env NAIL=screw B_EXIT_STATUS=23 CHECKLOCAL_EXIT_STATUS=1 \
- $MAKE -k check && Exit 1
++ $MAKE -k check && exit 1
test -f hammer.log
test -f hammer.sum
test -f spanner.log
$AUTOMAKE
./configure
- $MAKE check >stdout || { cat stdout; Exit 1; }
+ $MAKE check >stdout || { cat stdout; exit 1; }
cat stdout
grep '^PASS: subrun\.sh *$' stdout
- grep 'PASS.*echo\.sh' stdout && Exit 1
+ grep 'PASS.*echo\.sh' stdout && exit 1
-# 'check' should depend directly on 'check-am' (similar tests are
-# in check.test and check3.test).
-$EGREP '^check:.* check-recursive( |$)' Makefile.in
-$EGREP '^check:.* check-am( |$)' dir/Makefile.in
+$EGREP '^check:.*check-recursive' Makefile.in
+$EGREP '^check:.*check-am' dir/Makefile.in
# Make sure subrun.sh is still on its line as above. This means Automake
-# hasn't rewritten the TESTS line unnecessarily (we can tell, because all
-# Automake variables are reformatted by VAR_PRETTY).
+# hasn't rewritten the TESTS line unnecessarily.
grep '^ subrun\.sh$' Makefile.in
:
./configure --prefix "$(pwd)/inst"
- $MAKE check >stdout && { cat stdout; Exit 1; }
+ $MAKE check >stdout && { cat stdout; exit 1; }
cat stdout
grep '^FAIL: fail\.sh *$' stdout
- grep '^PASS: ok\.sh *$' stdout && Exit 1
+ grep '^PASS: ok\.sh *$' stdout && exit 1
- $MAKE -k check >stdout && { cat stdout; Exit 1; }
-# The exit status of 'make -k' can be anything
-# (depending on the Make implementation)
-$MAKE -k check >stdout || :
++$MAKE -k check >stdout && { cat stdout; exit 1; }
cat stdout
grep '^FAIL: fail\.sh *$' stdout
grep '^PASS: ok\.sh *$' stdout
# Should also works when -k is not in first position.
- $MAKE -s -k check >stdout && { cat stdout; Exit 1; }
-$MAKE -s -k check >stdout || :
++$MAKE -s -k check >stdout && { cat stdout; exit 1; }
cat stdout
grep '^FAIL: fail\.sh *' stdout
grep '^PASS: ok\.sh *' stdout
-# The rest of the test is for GNU Make.
-
-if using_gmake; then
- # Try with a long-option that do not have a short option equivalent
- # (here, --no-print-directory). That should cause all options to
- # appear verbatim in MAKEFLAGS.
- $MAKE --no-print-directory -k check >stdout || :
- cat stdout
- grep '^FAIL: fail\.sh *$' stdout
- grep '^PASS: ok\.sh *$' stdout
-fi
+# Try with a long-option that do not have a short option equivalent
+# (here, --no-print-directory). That should cause all options to
+# appear verbatim in MAKEFLAGS.
- $MAKE --no-print-directory -k check >stdout && { cat stdout; Exit 1; }
++$MAKE --no-print-directory -k check >stdout && { cat stdout; exit 1; }
+cat stdout
+grep '^FAIL: fail\.sh *$' stdout
+grep '^PASS: ok\.sh *$' stdout
:
$AUTOMAKE -a
./configure
-AM_COLOR_TESTS=always $MAKE check >stdout 2>stderr &&
- { cat stdout; cat stderr >&2; exit 1; }
+AM_COLOR_TESTS=always $MAKE check >stdout 2>stderr \
- && { cat stdout; cat stderr >&2; Exit 1; }
++ && { cat stdout; cat stderr >&2; exit 1; }
cat stdout
cat stderr >&2
grep 'XPASS.* foo$' stdout
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2001-2012 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:
+# - MOSTLYCLEANFILES
+# - CLEANFILES
+# - DISTCLEANFILES
+# - MAINTAINERCLEANFILES
+# Especially checks that it is possible to extend them also from a
+# "wrapper" makefile never processed nor seen by Automake.
+
++. ./defs || exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+setup () { touch mostly plain dist maint mostly2 plain2 dist2 maint2; }
+
+cat > Makefile.am << 'END'
+MOSTLYCLEANFILES = mostly
+CLEANFILES = plain
+DISTCLEANFILES = dist
+MAINTAINERCLEANFILES = maint
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+cat > GNUmakefile << 'END'
+include Makefile
+MOSTLYCLEANFILES += mostly2
+CLEANFILES += plain2
+DISTCLEANFILES += dist2
+MAINTAINERCLEANFILES += maint2
+END
+
+./configure
+cp config.status config.sav # Save for later.
+
+setup
+$MAKE mostlyclean
+test ! -f mostly
+test ! -f mostly2
+test -f plain
+test -f plain2
+test -f dist
+test -f dist2
+test -f maint
+test -f maint2
+
+setup
+$MAKE clean
+test ! -f mostly
+test ! -f mostly2
+test ! -f plain
+test ! -f plain2
+test -f dist
+test -f dist2
+test -f maint
+test -f maint2
+
+setup
+$MAKE distclean
+test ! -f mostly
+test ! -f mostly2
+test ! -f plain
+test ! -f plain2
+test ! -f dist
+test ! -f dist2
+test -f maint
+test -f maint2
+
+setup
+# The "make distclean" before has removed Makefile and config.status.
+mv config.sav config.status
+./config.status Makefile
+$MAKE maintainer-clean
+test ! -f mostly
+test ! -f mostly2
+test ! -f plain
+test ! -f plain2
+test ! -f dist
+test ! -f dist2
+test ! -f maint
+test ! -f maint2
+
+:
# version.good should depend on version.gin.
rm -f version.good
- $MAKE version.good 2>stderr && { cat stderr >&2; Exit 1; }
- $MAKE version.good >output 2>&1 && { cat output; exit 1; }
- cat output
++ $MAKE version.good 2>stderr && { cat stderr >&2; exit 1; }
+ cat stderr >&2
# Try to verify that we errored out for the right reason.
- $FGREP version.gin output
+ $FGREP version.gin stderr
cd .. # Back in top builddir.
cd $srcdir
test_no_color ()
{
- # With make implementations that, like Solaris make, in case of errors
- # print the whole failing recipe on standard output, we should content
- # ourselves with a laxer check, to avoid false positives.
- # Keep this in sync with lib/am/check.am:$(am__color_tests).
- if $FGREP '= Xalways; then' stdout; then
- # Extra verbose make, resort to laxer checks.
- # Note that we also want to check that the testsuite summary is
- # not unduly colorized.
- (
- set +e # In case some grepped regex below isn't matched.
- # Not a useless use of cat; see above comments "grep-nonprinting"
- # requirement in 'test-init.sh'.
- cat stdout | grep "TOTAL.*:"
- cat stdout | grep "PASS.*:"
- cat stdout | grep "FAIL.*:"
- cat stdout | grep "SKIP.*:"
- cat stdout | grep "XFAIL.*:"
- cat stdout | grep "XPASS.*:"
- cat stdout | grep "ERROR.*:"
- cat stdout | grep 'test.*expected'
- cat stdout | grep 'test.*not run'
- cat stdout | grep '===='
- cat stdout | grep '[Ss]ee .*test-suite\.log'
- cat stdout | grep '[Tt]estsuite summary'
- ) | grep "$esc" && exit 1
- : For shells with broken 'set -e'
- else
- cat stdout | grep "$esc" && exit 1
- : For shells with broken 'set -e'
- fi
+ # Not a useless use of cat; see above comments "grep-nonprinting"
+ # requirement in 'test-init.sh'.
- cat stdout | grep "$esc" && Exit 1
++ cat stdout | grep "$esc" && exit 1
+ :
}
for vpath in false :; do
# Forced colorization should take place also with non-ANSI terminals;
# hence the "TERM=dumb" definition.
- TERM=dumb AM_COLOR_TESTS=always $MAKE -e check >stdout \
+ $MAKE check AM_COLOR_TESTS=always TERM=dumb >stdout \
- && { cat stdout; Exit 1; }
+ && { cat stdout; exit 1; }
cat stdout
test_color
- $MAKE check TERM=ansi >stdout && { cat stdout; Exit 1; }
- TERM=ansi $MAKE -e check >stdout && { cat stdout; exit 1; }
++ $MAKE check TERM=ansi >stdout && { cat stdout; exit 1; }
cat stdout
test_no_color
std="$esc\[m"
# This test requires a working a working 'expect' program.
- # Creative quoting required to avoid spurious maintainer-check failure.
- (set +e; expect -c 'exit ''77'; test $? -eq 77) \
+ (set +e; expect -c 'exit 77'; test $? -eq 77) \
|| skip_ "requires a working expect program"
-# Also, if the $MAKE program fails to consider the standard output as a
-# tty (this happens with e.g., BSD make and Solaris dmake when they're
-# run in parallel mode; see the autoconf manual), there is little point
-# in proceeding.
-cat > Makefile <<'END'
-all:
-## Creative quoting in the 'echo' below to avoid risk of spurious output
-## matches by 'expect', below.
- @test -t 1 && echo "stdout" "is" "a" "tty"
-END
-
-cat > expect-check <<'END'
-eval spawn $env(MAKE)
-expect {
- "stdout is a tty" { exit 0 }
- default { exit 1 }
-}
-exit 1
-END
-MAKE=$MAKE expect -f expect-check \
- || skip_ "make spawned by expect should have a tty stdout"
-rm -f expect-check Makefile
-
# Do the tests.
cat >>configure.ac <<END
test_no_color ()
{
- # With make implementations that, like Solaris make, in case of errors
- # print the whole failing recipe on standard output, we should content
- # ourselves with a laxer check, to avoid false positives.
- # Keep this in sync with lib/am/check.am:$(am__color_tests).
- if $FGREP '= Xalways; then' stdout; then
- # Extra verbose make, resort to laxer checks.
- # Note that we also want to check that the testsuite summary is
- # not unduly colorized.
- (
- set +e # In case some grepped regex below isn't matched.
- # Not a useless use of cat; see above comments "grep-nonprinting"
- # requirement in 'test-init.sh'.
- cat stdout | grep "TOTAL.*:"
- cat stdout | grep "PASS.*:"
- cat stdout | grep "FAIL.*:"
- cat stdout | grep "SKIP.*:"
- cat stdout | grep "XFAIL.*:"
- cat stdout | grep "XPASS.*:"
- cat stdout | grep "ERROR.*:"
- cat stdout | grep 'test.*expected'
- cat stdout | grep 'test.*not run'
- cat stdout | grep '===='
- cat stdout | grep '[Ss]ee .*test-suite\.log'
- cat stdout | grep '[Tt]estsuite summary'
- ) | grep "$esc" && exit 1
- : For shells with broken 'set -e'
- else
- cat stdout | grep "$esc" && exit 1
- : For shells with broken 'set -e'
- fi
+ # Not a useless use of cat; see above comments "grep-nonprinting"
+ # requirement in 'test-init.sh'.
- cat stdout | grep "$esc" && Exit 1
++ cat stdout | grep "$esc" && exit 1
+ :
}
cat >expect-make <<'END'
file2 \
file3
-all-local:
- @echo Good
-
+.PHONY: test
+test:
+ test -z '$(SOME_FILES)'
EOF
- grep '#.*file[123]' Makefile && Exit 1
+do_check ()
+{
+ $MAKE test
+ grep '^# SOME_FILES =' Makefile
+ # No useless munging please.
++ grep '#.*file[123]' Makefile && exit 1
+ :
+}
+
$ACLOCAL
$AUTOCONF
$AUTOMAKE
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# For PR/352: make sure we support bin_PROGRAMS being defined conditionally.
+# For PR/352: make sure we support bin_PROGRAMS, lib_LIBRARIES and
+# lib_LTLIBRARIES being defined conditionally.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >>configure.ac <<'EOF'
-AM_CONDITIONAL([C1], [test -z "$two"])
-AM_CONDITIONAL([C2], [test -n "$two"])
+m4_define([AM_PROG_AR], [:])
+AM_PROG_AR
+AM_CONDITIONAL([C1], [test x"$two" != x"yes"])
+AM_CONDITIONAL([C2], [test x"$two" = x"yes"])
AC_OUTPUT
EOF
# with a dot (like "./Makefile"), since the remake rules might be subtly
# broken in that case.
- . ./defs || Exit 1
-required=GNUmake
+ . ./defs || exit 1
cat > configure.ac << END
AC_INIT([$me], [1.0])
# > How-To-Repeat:
# Use AM_CONFIG_HEADER(subdir/config.h) to place configuration
# header in subdirectory and observe that it is not included.
+# Also check that our preprocessing code is smart enough not to pass
+# repeated '-I<DIR>' options on the compiler command line.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
-AC_CONFIG_FILES([include/Makefile])
+AC_CONFIG_FILES([include/Makefile sub/Makefile])
AC_CONFIG_HEADERS([include/config.h])
-AC_PROG_CC
+AC_PROG_FGREP
+AC_OUTPUT
END
-cat > Makefile.am << 'END'
+mkdir include sub
+: > include/config.h.in
+
+cat > c-defs.am << 'END'
+## To bring in the definition of AM_DEFAULT_INCLUDES
+CC = who-cares
+AUTOMAKE_OPTIONS = no-dependencies
bin_PROGRAMS = foo
-foo_SOURCES = foo.c
END
-mkdir include
-: > include/Makefile.am
-: > include/config.h.in
+cat > Makefile.am << 'END'
+include $(top_srcdir)/c-defs.am
+.PHONY: test-default-includes
+test-default-includes:
+ echo ' ' $(AM_DEFAULT_INCLUDES) ' ' \
+ | $(FGREP) ' -I$(top_builddir)/include '
+END
+
+cp Makefile.am sub
+
+cat > include/Makefile.am << 'END'
+include $(top_srcdir)/c-defs.am
+.PHONY: test-default-includes
+test-default-includes:
+ echo ' ' $(AM_DEFAULT_INCLUDES) ' ' | $(FGREP) ' -I. '
+ case ' $(AM_DEFAULT_INCLUDES) ' in \
+ *'$(top_builddir)'*) exit 1;; \
+ *include*) exit 1;; \
+ *-I.*-I.*) exit 1;; \
+ *' -I. ') exit 0;; \
+ *) exit 1;; \
+ esac
+END
$ACLOCAL
+$AUTOCONF
$AUTOMAKE
-grep '^ *DEFAULT_INCLUDES *=.* -I\$(top_builddir)/include' Makefile.in
+./configure
+
+$MAKE test-default-includes
+$MAKE -C sub test-default-includes
+$MAKE -C include test-default-includes
:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2006-2012 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 mixing Fortran 77 and C++.
+
+# For now, require the GNU compilers, to avoid possible spurious failure.
+required='gfortran g++'
- grep '\$(FCLINK)' Makefile.in && Exit 1
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_PROG_CXX
+AC_PROG_F77
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_PROGRAMS = foo
+foo_SOURCES = new.cc old.f
+END
+
+cat > new.cc << 'END'
+#include <iostream>
+using namespace std;
+extern "C" { int cube_ (int *); }
+int main (void)
+{
+ int n = 3;
+ cout << "The Cube of " << n << " is " << cube_ (&n) << endl;
+ return 0;
+}
+END
+
+cat > old.f << 'END'
+ INTEGER FUNCTION CUBE(N)
+C COMPUTES AND RETURN THE CUBE OF THE INTEGER N
+ CUBE=N*N*N
+ RETURN
+ END
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+# The C++ linker should be preferred.
++grep '\$(FCLINK)' Makefile.in && exit 1
+grep '.\$(CXXLINK)' Makefile.in
+
+./configure
+$MAKE
+
+if cross_compiling; then :; else
+ ./foo
+ test "$(./foo)" = "The Cube of 3 is 27"
+fi
+
+$MAKE distcheck
$MAKE
rm -f zardoz.am
- $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
-$sleep # Required to avoid racy failures with FreeBSD make.
-$MAKE >output 2>&1 && { cat output; exit 1; }
-cat output
++$MAKE 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
# This error will come from automake, not make, so we can be stricter
# in our grepping of it.
-grep 'cannot open.*zardoz\.am' output
-grep 'foobar\.am' output && exit 1 # No spurious error, please.
+grep 'cannot open.*zardoz\.am' stderr
- grep 'foobar\.am' stderr && Exit 1 # No spurious error, please.
++grep 'foobar\.am' stderr && exit 1 # No spurious error, please.
# Try with one less indirection.
: > foobar.am
./config.status Makefile
$MAKE # Sanity check.
rm -f foobar.am
- $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
-$sleep # Required to avoid racy failures with FreeBSD make.
-$MAKE >output 2>&1 && { cat output; exit 1; }
-cat output
++$MAKE 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
# This error will come from automake, not make, so we can be stricter
# in our grepping of it.
-grep 'cannot open.*foobar\.am' output
+grep 'cannot open.*foobar\.am' stderr
:
$MAKE
rm -f zardoz.m4
- $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
-$MAKE >output 2>&1 && { cat output; exit 1; }
-cat output
++$MAKE 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
# This error will come from aclocal, not make, so we can be stricter
# in our grepping of it.
-grep ' foobar\.m4:1:.*zardoz\.m4.*does not exist' output
+grep ' foobar\.m4:1:.*zardoz\.m4.*does not exist' stderr
# No spurious errors, please.
- $FGREP -v ' foobar.m4:1:' stderr | $FGREP 'foobar.m4' && Exit 1
-$FGREP -v ' foobar.m4:1:' output | $FGREP 'foobar.m4' && exit 1
++$FGREP -v ' foobar.m4:1:' stderr | $FGREP 'foobar.m4' && exit 1
# Try with one less indirection.
: > foobar.m4
./configure
$MAKE # Sanity check.
rm -f foobar.m4
- $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
-$MAKE >output 2>&1 && { cat output; exit 1; }
-cat output
++$MAKE 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
# This error will come from aclocal, not make, so we can be stricter
# in our grepping of it.
-grep 'foobar\.m4.*does not exist' output
+grep 'foobar\.m4.*does not exist' stderr
# No spurious errors, please (ok, this is really paranoid).
- $FGREP 'zardoz.m4' stderr && Exit 1
-$FGREP 'zardoz.m4' output && exit 1
++$FGREP 'zardoz.m4' stderr && exit 1
:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Dependency tracking:
+# - we can recover if any .Po file in $(DEPDIR) gets removed;
+# - in fact, we can recover if the whole $(DEPDIR) directory gets
+# removed.
+
+required=cc
++. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = . sub
+noinst_PROGRAMS = foo
+foo_SOURCES = main.c foo.c foo.h
+get-depdir:
+ @echo '$(DEPDIR)'
+END
+
+cat > main.c <<'END'
+#include "foo.h"
+int main (void)
+{
+ return foo ();
+}
+END
+cat > foo.c <<'END'
+#include "foo.h"
+int foo (void)
+{
+ return 0;
+}
+END
+echo 'int foo (void);' > foo.h
+
+mkdir sub sub/src
+cat > sub/Makefile.am <<'END'
+noinst_PROGRAMS = foo
+foo_SOURCES = src/main.c src/foo.c src/foo.h
+END
+cp main.c foo.c foo.h sub/src
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+for vpath in : false; do
+
+ if $vpath; then
+ srcdir=..
+ mkdir build
+ cd build
+ else
+ srcdir=.
+ fi
+
+ $srcdir/configure --enable-dependency-tracking
+ $MAKE
+ depdir=`$MAKE -s --no-print-directory get-depdir` \
+ && test -n "$depdir" \
+ && test -d $depdir \
+ && test -d sub/src/$depdir \
+ || fatal_ "cannot find the depdir"
+
+ for remove_stuff in \
+ "rm -f $depdir/main.Po" \
+ "rm -f sub/src/$depdir/foo.Po" \
+ "rm -rf $depdir" \
+ "rm -rf $depdir sub/src/$depdir" \
+ ; do
+ $remove_stuff
+ # We can still use make and order a build, even if we have probably
+ # lost the dependency information registered in removed the .Po files.
+ # TODO: maybe we should detect such a situation and force a clean
+ # TODO: rebuild?
+ $MAKE
+ # But if we force a rebuild by hand by cleaning out the existing
+ # objects, everything works out as expected.
+ $MAKE clean
+ $MAKE
+ test -f $depdir/main.Po
+ test -f $depdir/foo.Po
+ test -f sub/src/$depdir/main.Po
+ test -f sub/src/$depdir/foo.Po
+ done
+
+ cd $srcdir
+
+done
+
+:
#! /bin/sh
- # Copyright (C) 1996-2012 Free Software Foundation, Inc.
-# Copyright (C) 1999-2012 Free Software Foundation, Inc.
++# Copyright (C) 2012 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
#! /bin/sh
- # Copyright (C) 2002-2012 Free Software Foundation, Inc.
-# Copyright (C) 1998-2012 Free Software Foundation, Inc.
++# Copyright (C) 2012 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
# 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 for error for bad syntax.
+# Dependency tracking in the face of added/removed/renamed files.
+# - in-tree build
+# - use of subdir objects
- . ./defs-static || exit '99'
-. ./defs || exit 1
-
-cat > Makefile.am << 'END'
-foo = q \
-
-bin_SCRIPTS = foo.sh
-END
-
-$ACLOCAL
-AUTOMAKE_fails -Wnone
-grep '^Makefile\.am:2:.*blank line following trailing backslash' stderr
-
-:
++. ./defs-static || exit 99
+xdir='sub' vpath='no'
+. "$am_testauxdir"/depcomp-shuffle.sh
#! /bin/sh
- # Copyright (C) 2010-2012 Free Software Foundation, Inc.
-# Copyright (C) 2005-2012 Free Software Foundation, Inc.
++# Copyright (C) 2012 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
# 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 comments following trailing backslashes are diagnosed.
-# Report from Harald Dunkel.
+# Dependency tracking in the face of added/removed/renamed files.
+# - VPATH build
+# - no use of subdir objects
- . ./defs-static || exit '99'
-. ./defs || exit 1
-
-cat > Makefile.am << 'END'
-SUBDIRS = foo \
-# bar
-
-END
-
-mkdir foo
-
-$ACLOCAL
-AUTOMAKE_fails
-grep backslash stderr
++. ./defs-static || exit 99
+xdir='' vpath='yes'
+. "$am_testauxdir"/depcomp-shuffle.sh
--- /dev/null
- # Copyright (C) 2002-2012 Free Software Foundation, Inc.
+#! /bin/sh
- . ./defs-static || exit '99'
++# Copyright (C) 2012 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/>.
+
+# Dependency tracking in the face of added/removed/renamed files.
+# - in-tree build
+# - no use of subdir objects
+
++. ./defs-static || exit 99
+xdir='' vpath='no'
+. "$am_testauxdir"/depcomp-shuffle.sh
cd $distdir
./configure
fi
- $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
- $MAKE >output 2>&1 && { cat output; exit 1; }
- cat output
++ $MAKE 2>stderr && { cat stderr >&2; exit 1; }
+ cat stderr >&2
# This error comes from automake, not make, so we can be stricter
# in our grepping of it.
- grep 'cannot open.*zardoz\.am' output
- grep 'foobar\.am' output && exit 1 # No spurious error, please.
+ grep 'cannot open.*zardoz\.am' stderr
- grep 'foobar\.am' stderr && Exit 1 # No spurious error, please.
++ grep 'foobar\.am' stderr && exit 1 # No spurious error, please.
cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory"
done
cd $distdir
./configure
fi
- $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
- $MAKE >output 2>&1 && { cat output; exit 1; }
- cat output
++ $MAKE 2>stderr && { cat stderr >&2; exit 1; }
+ cat stderr
# This error will come from automake, not make, so we can be stricter
# in our grepping of it.
- grep 'zardoz\.m4.*does not exist' output
- grep 'foobar\.m4' output && exit 1 # No spurious error, please.
+ grep 'zardoz\.m4.*does not exist' stderr
- grep 'foobar\.m4' stderr && Exit 1 # No spurious error, please.
++ grep 'foobar\.m4' stderr && exit 1 # No spurious error, please.
cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory"
done
cd $distdir
./configure
fi
- $MAKE 2>stderr && { cat stderr; Exit 1; }
- $MAKE >output 2>&1 && { cat output; exit 1; }
- cat output
++ $MAKE 2>stderr && { cat stderr; exit 1; }
+ cat stderr
# This error will come from autoconf, not make, so we can be stricter
# in our grepping of it.
- grep 'possibly undefined .*MY_ZARDOZ' output
- grep 'MY_FOOBAR' output && exit 1 # No spurious error, please.
+ grep 'possibly undefined .*MY_ZARDOZ' stderr
- grep 'MY_FOOBAR' stderr && Exit 1 # No spurious error, please.
++ grep 'MY_FOOBAR' stderr && exit 1 # No spurious error, please.
cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory"
done
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# We use EXTRA_DIST to distribute stuff *explicitly* from the srcdir.
+
+am_create_testdir=empty
++. ./defs || exit 1
+
+ocwd=`pwd` || fatal_ "cannot get current working directory"
+
+mkdir src
+cd src
+
+cat >> configure.ac <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile sub/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+
+EXTRA_DIST = \
+ $(srcdir)/one \
+ @srcdir@/two \
+ $(top_srcdir)/three \
+ @top_srcdir@/four
+
+.PHONY: test
+check-local: test
+test: distdir
+ find $(distdir) # For debugging.
+ test -f $(distdir)/one
+ test -f $(distdir)/two
+ test -f $(distdir)/three
+ test -f $(distdir)/four
+ test -f $(distdir)/sub/five
+ test -f $(distdir)/sub/six
+ test ! -f $(distdir)/five
+ test ! -f $(distdir)/six
+ test -f $(distdir)/seven
+ test -f $(distdir)/eight
+ test ! -f $(distdir)/sub/seven
+ test ! -f $(distdir)/sub/eight
+END
+
+mkdir sub
+cat > sub/Makefile.am <<'END'
+EXTRA_DIST = $(srcdir)/five @srcdir@/six
+EXTRA_DIST += $(top_srcdir)/seven @top_srcdir@/eight
+END
+
+touch one two three four sub/five sub/six seven eight
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkdir build
+cd build
+../configure
+$MAKE test
+$MAKE distcheck
+cd "$ocwd"
+
+mkdir a a/b a/b/c
+cd a/b/c
+../../../src/configure
+$MAKE test
+cd "$ocwd"
+
+mkdir build2
+cd build2
+"$ocwd"/src/configure
+$MAKE test
+cd "$ocwd"
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# If we distribute a file whose name that starts with $(srcdir),
+# then the distribution rules should not try to instead distribute
+# a file with the same name from the builddir.
+# Currently, this doesn't work (the reasons and details for this
+# limitation should be explained in depth in comments in file
+# 'lib/am/distdir.am').
+
- $MAKE distdir 2>stderr && { cat stderr >&2; Exit 1; }
++. ./defs || exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am <<'END'
+EXTRA_DIST = $(srcdir)/filename-that-is-easy-to-grep
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkdir build
+cd build
+../configure
+
+echo bad > filename-that-is-easy-to-grep
++$MAKE distdir 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+grep 'filename-that-is-easy-to-grep' stderr
+
+echo good > ../filename-that-is-easy-to-grep
+$MAKE distdir
+test "`cat $distdir/filename-that-is-easy-to-grep`" = good
+
+:
$AUTOMAKE Makefile
./config.status Makefile
- $MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
-$MAKE distcheck >output 2>&1 && { cat output; exit 1; }
-cat output
-grep "^configure:.* success='no', sentence='it works :-)'" output
++$MAKE distcheck 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+grep "^configure:.* success='no', sentence='it works :-)'" stderr
$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes"
# ... but not when "make distcheck" is run from the subpackage.
cd subpkg
- $MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
-$MAKE distcheck >output 2>&1 && { cat output; exit 1; }
-cat output
-grep '^configure:.* dc=KO am_dc=KO' output
++$MAKE distcheck 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+grep '^configure:.* dc=KO am_dc=KO' stderr
:
DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes sentence='it works :-)'"
# Sanity check.
- $MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
-$MAKE distcheck >output 2>&1 && { cat output; exit 1; }
-cat output
-grep "^configure:.* success='no', sentence=''" output
++$MAKE distcheck 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+grep "^configure:.* success='no', sentence=''" stderr
:
# For debugging.
$FGREP 'distcheck-hook' Makefile.in subpkg/Makefile.in
- $FGREP 'distcheck-hook' subpkg/Makefile.in && Exit 1
+ $FGREP 'distcheck-hook' subpkg/Makefile.in && exit 1
-$FGREP '$(MAKE) $(AM_MAKEFLAGS) distcheck-hook' Makefile.in
+$FGREP '$(MAKE) distcheck-hook' Makefile.in
grep '^distcheck-hook:' Makefile.in
./configure
check_no_spurious_error ()
{
- $EGREP -i 'mkdir:|:.*(permission|denied)' output && Exit 1
- grep -i 'autom4te.*\.cache' output && Exit 1
- : # To placate 'set -e'.
+ $EGREP -i 'mkdir:|:.*(permission|denied)' output && exit 1
- # On failure, some make implementations (such as Solaris make) print the
- # whole failed recipe on stdout. The first grep works around this.
- grep -v 'rm -rf ' output | grep -i 'autom4te.*\.cache' && exit 1
++ grep -i 'autom4te.*\.cache' output && exit 1
+ : To placate 'set -e'.
}
./configure
check_no_spurious_error ()
{
- $EGREP -i 'mkdir:|:.*(permission|denied)' output && Exit 1
- grep -i 'autom4te.*\.cache' output && Exit 1
- : # To placate 'set -e'.
+ $EGREP -i 'mkdir:|:.*(permission|denied)' output && exit 1
- # On failure, some make implementations (such as Solaris make) print the
- # whole failed recipe on stdout. The first grep works around this.
- grep -v 'rm -rf ' output | grep -i 'autom4te.*\.cache' && exit 1
++ grep -i 'autom4te.*\.cache' output && exit 1
+ : To placate 'set -e'.
}
# We start to use a new "third-party" macro in a new version
$MAKE
$MAKE distcheck
-infodir="$(pwd)/_info" $MAKE -e distcheck
+$MAKE distcheck infodir="$(pwd)"/_info
- test -f _info/dir || Exit 99 # Sanity check.
+ test -f _info/dir || exit 99 # Sanity check.
:
./configure
# We can build the distribution.
- $MAKE distcheck 2>stderr || { cat stderr >&2; Exit 1; }
-$MAKE distcheck >output 2>&1 || { cat output; exit 1; }
-cat output
++$MAKE distcheck 2>stderr || { cat stderr >&2; exit 1; }
+cat stderr >&2
# Sanity check: verify that our code has hit a problem removing
# the distdir, but has recovered from it.
-grep "rm:.*$destdir" output || fatal_ "expected code path not covered"
+grep "rm:.*$destdir" stderr || fatal_ "expected code path not covered"
:
test -f inst/share/dir
rm -rf inst
- $MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
-$MAKE distcheck >output 2>&1 && { cat output; exit 1; }
-cat output
++$MAKE distcheck 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
-$FGREP 'ERROR: files left after uninstall:' output
-grep '/share/dir *$' output
+grep 'ERROR: files left after uninstall:' stderr
+grep '/share/dir *$' stderr
# A few trickier corner cases.
test -f inst/share/info/more/dir
rm -rf inst
- $MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
-$MAKE distcheck >output 2>&1 && { cat output; exit 1; }
-cat output
++$MAKE distcheck 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
-$FGREP 'ERROR: files left after uninstall:' output
-grep '/mu/share/info/dir *$' output
-grep '/share/info/more/dir *$' output
+grep 'ERROR: files left after uninstall:' stderr
+grep '/mu/share/info/dir *$' stderr
+grep '/share/info/more/dir *$' stderr
:
# Test to make sure that if an auxfile (here depcomp) is required
# by a subdir Makefile.am, it is distributed by that Makefile.am.
- . ./defs || Exit 1
+required=cc
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_CONFIG_FILES([subdir/Makefile])
$ACLOCAL
# Should not warn about missing README, since it is a target.
- $AUTOMAKE --add-missing --gnu >output 2>&1 || { cat output; Exit 1; }
+ $AUTOMAKE --add-missing --gnu >output 2>&1 || { cat output; exit 1; }
cat output
- grep README output && Exit 1
+ grep README output && exit 1
-sed -n -e '/^DIST_COMMON =.*\\$/ {
+sed -n -e '/^am__dist_common =.*\\$/ {
:loop
p
n
# a Makefile in that directory. distcom4.test performs the same
# test without Makefile in the directory.
- . ./defs || Exit 1
+ . ./defs || exit 1
-extract_distcommon ()
-{
- sed -n -e '/^DIST_COMMON =.*\\$/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' -e '/^DIST_COMMON =/ p' ${1+"$@"}
-}
-
cat >> configure.ac << 'END'
AC_CONFIG_FILES([tests/autoconf:tests/wrapper.in],
[chmod +x tests/autoconf])
# sure *srcdir is properly handled. Note that using './', as in
# EXTRA_DIST = ./joe
# does not work portably: it fails with HP-UX and Tru64 make.
-# Also test DISTFILES containing a directory and a file in it,
-# and repeated directories.
+# Also test the situation when the lsit of distributed files contains
+# a directory and a file in it, and repeated directories.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_OUTPUT
ls -l # For debugging.
-# Don't try to use "make -k", because some botched make implementations
-# (HP-UX, IRIX) might still exit on the first error in this situations.
-for lnk in $lnk1 $lnk2 $lnka $lnkb; do
- echo "EXTRA_DIST = $lnk" > Makefile.am
- $AUTOMAKE
- ./configure
- # Distribution must fail, with a decent error message.
- $MAKE distdir >out 2>&1 && { cat out; exit 1; }
- cat out
- $FGREP $lnk out
-done
+# Distribution must fail.
- $MAKE distdir && Exit 1
++$MAKE distdir && exit 1
+
+# Names of distributed broken symlinks should be reported in make output.
- $MAKE -k distdir 2>stderr && { cat stderr >&2; Exit 1; }
++$MAKE -k distdir 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+$FGREP $lnk1 stderr
+$FGREP $lnk2 stderr
+$FGREP $lnka stderr
+$FGREP $lnkb stderr
:
# Java people need this.
# PR/317, reported by Eric Siegerman and Philip Fong.
- . ./defs || Exit 1
-# Require GNU make for this test. SunOS Make does not support
-# '$$' in a target or a dependency (it outputs the empty string instead).
-required=GNUmake
+ . ./defs || exit 1
echo AC_OUTPUT >> configure.ac
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2003-2012 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 double colon rules work.
+# This test not only checks that Automake do not mangle double-colon rules
+# seen in input Makefile.am, but also that GNU make support of double-colon
+# rules is as reliable and well-working as we expect and need.
+
++. ./defs || exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am <<'END'
+all-local:
+ @echo Please select an explicit target; exit 1
+
+# No space after 'a'.
+a:: b
+ echo rule1 >> $@
+# Deliberate space after 'a'.
+a :: c
+ echo rule2 >> $@
+
+# Overlapping rules should work as well
+a2 :: b2
+ echo rule21 >> $@
+a2 :: c2
+ echo rule22 >> $@
+a2:: b2 c2
+ echo rule23 >> $@
+b2 c2:
+ touch $@
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+grep '::' Makefile.in # For debugging.
+test $(grep -c '^a *:: *b *$' Makefile.in) -eq 1
+test $(grep -c '^a *:: *c *$' Makefile.in) -eq 1
+test $(grep -c '^a2 *:: *b2 *$' Makefile.in) -eq 1
+test $(grep -c '^a2 *:: *c2 *$' Makefile.in) -eq 1
+test $(grep -c '^a2 *:: *b2 *c2 *$' Makefile.in) -eq 1
+
+./configure
+
+# Non-overlapping double-colon rules.
+
+touch b c
+$sleep
+: > a
+$MAKE a
+test ! -s a
+$sleep
+touch b
+$MAKE a
+test "$(cat a)" = rule1
+: > a
+$sleep
+touch c
+$MAKE a
+test "$(cat a)" = rule2
+
+: > a
+$sleep
+touch b c
+$MAKE a
+test "$(sort a)" = "rule1${nl}rule2"
+
+rm -f a b c
+
+# Overlapping double-colon rules.
+
+$MAKE a2
+test -f a2
+test -f b2
+test -f c2
+
+: > a2
+$MAKE a2
+test ! -s a2
+$sleep
+touch b2
+$MAKE a2
+test "$(sort a2)" = "rule21${nl}rule23"
+: > a2
+$sleep
+touch c2
+$MAKE a2
+test "$(sort a2)" = "rule22${nl}rule23"
+
+: > a2
+$sleep
+touch b2 c2
+$MAKE a2
+test "$(sort a2)" = "rule21${nl}rule22${nl}rule23"
+
+:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test to make sure empty _SOURCES works.
-# From Paul Berrevoets.
+# A test for missing _SOURCES variable. Also test to make sure empty
+# _SOURCES suppresses assumption about default name.
- . ./defs || Exit 1
+ . ./defs || exit 1
+plan_ 5
+
cat >> configure.ac << 'END'
AC_PROG_CC
-AC_SUBST(ZOO_OBJ)
+AC_SUBST([zoo_obj])
END
cat > Makefile.am << 'END'
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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 Automake-provided internal macro 'am__ensure_dir_exists'.
+
+am_create_testdir=empty
++. ./defs || exit 1
+
+cp "$am_amdir"/header-vars.am . \
+ || fatal_ "fetching makefile fragment headers-vars.am"
+
+# Filter out Automake comments and things that would need configure
+# substitutions.
+LC_ALL=C $EGREP -v '(^##|=.*@[a-zA-Z0-9_]+@)' header-vars.am > defn.mk
+rm -f header-vars.am
+
+cat > Makefile << 'END'
+include ./defn.mk
+
+files = x/1 x/2 x/3
+
+all: $(files)
+.PHONY: all
+
+sanity-check:
+ $(warning $(call am__ensure_dir_exists,x))
+ $(if $(filter $(call am__ensure_dir_exists,x),:MKDIR_P:),, \
+ $(error am__ensure_dir_exists does not contain $$(MKDIR_P)))
+.PHONY: sanity-check
+
+$(files):
+ $(call am__ensure_dir_exists,x)
+ echo dummy > $@
+END
+
+# Sanity check.
+$MAKE sanity-check MKDIR_P=:MKDIR_P:
+
+# Basic usage.
+$MAKE MKDIR_P='mkdir -p'
+test -f x/1
+test -f x/2
+test -f x/3
+
+# Mkdir is not called uselessly.
+rm -rf x
+mkdir x
+$MAKE MKDIR_P=false
+
+# Mkdir is not called too many times.
+rm -rf x
+$MAKE MKDIR_P=mkdir
+test -f x/1
+test -f x/2
+test -f x/3
+
+:
./configure
- $MAKE EXEEXT=.foo print > stdout || { cat stdout; Exit 1; }
-EXEEXT=.foo $MAKE -e print > stdout
++$MAKE EXEEXT=.foo print > stdout || { cat stdout; exit 1; }
cat stdout
grep '1BEG: maude.foo mt.foo :END1' stdout
./configure revert=yes
- $MAKE EXEEXT=.foo print > stdout || { cat stdout; Exit 1; }
-EXEEXT=.foo $MAKE -e print > stdout
++$MAKE EXEEXT=.foo print > stdout || { cat stdout; exit 1; }
cat stdout
grep '1BEG: maude.foo :END1' stdout
# Make sure $(EXEEXT) is appended to programs and to tests that are
# programs, but not to @substitutions@.
-# For gen-testsuite-part: ==> try-with-serial-tests <==
+am_serial_tests=yes
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AM_CONDITIONAL([COND], [test -n "$cond"])
$ACLOCAL
$AUTOMAKE
+$FGREP '%.$(OBJEXT)' Makefile.in # For debugging.
+
for ext in f for f90 f95 F F90 F95 r m mm upc; do
- grep "%.*: %$ext" Makefile.in && Exit 1
- grep "^\.$ext\.o:" Makefile.in
- grep "^$ext\.o:" Makefile.in && exit 1
- : For shells with busted 'set -e'.
++ grep "%.*: %$ext" Makefile.in && exit 1
+ grep "^%\.\$(OBJEXT): %\.$ext$" Makefile.in
done
:
# See also sister test 'extra11.test', that check a similar usage
# with the involvement of the $(wildcard) GNU make builtin.
- . ./defs || Exit 1
-required=GNUmake
+ . ./defs || exit 1
echo AC_OUTPUT >> configure.ac
# Check for more complex usage of wildcards in EXTRA_DIST.
# Suggested by observations from Braden McDaniel.
- . ./defs || Exit 1
-required=GNUmake
+ . ./defs || exit 1
echo AC_OUTPUT >> configure.ac
# $srcdir != $builddir, if properly declared.
# Suggested by observations from Braden McDaniel.
- . ./defs || Exit 1
-required=GNUmake
+ . ./defs || exit 1
echo AC_OUTPUT >> configure.ac
# Cf. fort1.test and link_f90_only.test.
- . ./defs || Exit 1
+required=gfortran # Required only in order to run ./configure.
+ . ./defs || exit 1
mkdir sub
$ACLOCAL
$AUTOMAKE
- grep '.\$(LINK)' Makefile.in && Exit 1
-# 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
+ 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 FC=fake-fc \
+ FCFLAGS_f90=--@90 FCFLAGS_f95=--@95 FCFLAGS_f03=--@03 FCFLAGS_f08=--@08 \
- > stdout || { cat stdout; Exit 1; }
++ > 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
++$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
:
# Test of compiled java.
- . ./defs || Exit 1
+required='gcc gcj'
+ . ./defs || exit 1
cat >> configure.ac << 'END'
-_AM_DEPENDENCIES([GCJ])
-AC_SUBST([GCJ])
+# FIXME: AM_PROG_GCJ should cause OBJEXT and EXEEXT to be set, but
+# FIXME: it currently does not. See also xfailing test 'gcj6.sh'.
+AC_PROG_CC
+AM_PROG_GCJ
+AC_OUTPUT
END
cat > Makefile.am << 'END'
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2002-2012 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 does not warns about nested variables expansion,
+# variables with non-POSIX names, or GNU make function calls.
+
++. ./defs || exit 1
+
+cat > Makefile.am <<'END'
+define get-libname
+$(addprefix lib, $(1))
+endef
+
+v0 = $(shell LC_ALL=C && export LC_ALL && echo foo* bar*)
+v1 = $(sort $(wildcard foo* bar*))
+v2 = $(call get-libname, foo)
+v3 = sub/$(addsuffix .a, ${v2})
+v4 = $(v3)
+v4 += $(notdir ${v3})
+
+x = 1
+mu1 = okey-dokey
+bla = $(mu$x)
+bli = $(mu$(x))
+blo = $(mu${x})
+blu = $(mu1)
+
+bar$(x) = 6
+baz${x} = 7
+zap$x = 8
+
+.a^very-weird!var@name%accepted;by,gnu/make = wow
+
+.PHONY: do/test my/prereq
+my/prereq:
+ @: Do nothing.
+do/test: my/prereq
+ : \
+ && test '$(v0)' = 'foo.sh bar.sh bar.txt' \
+ && test '$(v1)' = 'bar.sh bar.txt foo.sh' \
+ && test $(v3) = sub/libfoo.a \
+ && test '$(v4)' = 'sub/libfoo.a libfoo.a' \
+ && test $(bla) = okey-dokey \
+ && test $(bli) = okey-dokey \
+ && test $(blo) = okey-dokey \
+ && test $(blu) = okey-dokey \
+ && test $(bar1) = 6 \
+ && test $(baz1) = 7 \
+ && test $(zap1) = 8 \
+ && test $(.a^very-weird!var@name%accepted;by,gnu/make) = wow \
+## See automake bug#9587 .
+ && test '$(@F)' = 'test' \
+ && test '$(@D)' = 'do' \
+ && test '$(<F)' = 'prereq' \
+ && test '$(<D)' = 'my'
+END
+
+echo AC_OUTPUT >> configure.ac
+
+$ACLOCAL
+AUTOMAKE_run
+test ! -s stderr
+
+: > foo.sh
+: > bar.sh
+: > bar.txt
+
+$AUTOCONF
+./configure
+$MAKE 'do/test'
+
+:
../configure "--prefix=$(pwd)/../inst-dir" --program-prefix=p
$MAKE all
$MAKE test-install
- $MAKE -k installcheck 2>stderr && { cat stderr >&2; Exit 1; }
-$MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k.
++$MAKE -k installcheck 2>stderr && { cat stderr >&2; exit 1; }
cat stderr >&2
$MAKE grep-stderr
../configure "--prefix=$(pwd)/../inst-dir" --program-prefix=p
$MAKE
$MAKE install
- $MAKE installcheck && Exit 1
- $MAKE -k installcheck 2>stderr && { cat stderr >&2; Exit 1; }
+ $MAKE installcheck && exit 1
-$MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k.
++$MAKE -k installcheck 2>stderr && { cat stderr >&2; exit 1; }
cat stderr >&2
$MAKE grep-stderr
# Automake should not assume that make files are called Makefile.
# Report from Braden McDaniel.
- . ./defs || Exit 1
-required=GNUmake
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_CONFIG_FILES([sub/GNUmakefile])
../configure --prefix="$instdir"
$MAKE
-javadir=
-export javadir
-$MAKE -e install
+xMAKE() { $MAKE javadir= "$@"; }
+
+xMAKE install
test ! -d "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+xMAKE install DESTDIR="$destdir"
test ! -d "$instdir"
test ! -d "$destdir"
- xMAKE uninstall > stdout || { cat stdout; Exit 1; }
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
++xMAKE uninstall > stdout || { cat stdout; exit 1; }
cat stdout
- grep 'rm -f' stdout && Exit 1
+ grep 'rm -f' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+xMAKE uninstall DESTDIR="$destdir"
:
../configure --prefix="$instdir"
$MAKE
-lispdir=
-export lispdir
+xMAKE () { $MAKE lispdir= "$@"; }
-$MAKE -e install
+xMAKE install
test ! -d "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+xMAKE install DESTDIR="$destdir"
test ! -d "$instdir"
test ! -d "$destdir"
- xMAKE uninstall > stdout || { cat stdout; Exit 1; }
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
++xMAKE uninstall > stdout || { cat stdout; exit 1; }
cat stdout
- grep 'rm -f' stdout && Exit 1
+ grep 'rm -f' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+xMAKE uninstall DESTDIR="$destdir"
:
am_cv_python_pyexecdir="$instdir/pyexec"
$MAKE
-bindir= libdir= pyexecdir=
-export bindir libdir pyexecdir
-$MAKE -e install
+xMAKE() { $MAKE bindir= libdir= pyexecdir= "$@"; }
+
+xMAKE install
test ! -d "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+xMAKE install DESTDIR="$destdir"
test ! -d "$instdir"
test ! -d "$destdir"
- xMAKE uninstall > stdout || { cat stdout; Exit 1; }
-$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
- xMAKE uninstall DESTDIR="$destdir" > stdout || { cat stdout; Exit 1; }
+ 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
+ grep 'rm'' ' stdout && exit 1
:
./configure --prefix="$cwd/inst"
doinst
- test ! -d inst || { find inst; Exit 1; }
+ test ! -d inst || { find inst; exit 1; }
$MAKE uninstall
-doinst bin_SCRIPTS=foo.sh AM_MAKEFLAGS='bin_SCRIPTS=foo.sh'
+doinst bin_SCRIPTS=foo.sh
test -f inst/bin/foo.sh
./configure
doinst DESTDIR="$cwd/dest"
- test ! -d dest || { find dest; Exit 1; }
+ test ! -d dest || { find dest; exit 1; }
$MAKE uninstall
-doinst DESTDIR="$cwd/dest" bin_SCRIPTS=foo.sh AM_MAKEFLAGS='bin_SCRIPTS=foo.sh'
+doinst DESTDIR="$cwd/dest" bin_SCRIPTS=foo.sh
test -f dest/usr/local/bin/foo.sh
:
am_cv_python_pyexecdir="$instdir/pyexec"
$MAKE
-bindir= libdir= pyexecdir=
+xMAKE () { $MAKE bindir= libdir= pyexecdir= "$@"; }
+
export bindir libdir pyexecdir
-$MAKE -e install
+xMAKE install
test ! -d "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+xMAKE install DESTDIR="$destdir"
test ! -d "$instdir"
test ! -d "$destdir"
- xMAKE uninstall > stdout || { cat stdout; Exit 1; }
-$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
- xMAKE uninstall DESTDIR="$destdir" > stdout || { cat stdout; Exit 1; }
+ 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
+ grep 'rm'' ' stdout && exit 1
:
../configure --prefix="$instdir"
$MAKE
-pythondir=
-export pythondir
+xMAKE () { $MAKE pythondir= "$@"; }
-$MAKE -e install
+xMAKE install
test ! -d "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+xMAKE install DESTDIR="$destdir"
test ! -d "$instdir"
test ! -d "$destdir"
- xMAKE uninstall > stdout || { cat stdout; Exit 1; }
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
++xMAKE uninstall > stdout || { cat stdout; exit 1; }
cat stdout
- grep 'rm -f' stdout && Exit 1
+ grep 'rm -f' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+xMAKE uninstall DESTDIR="$destdir"
:
$MAKE all dvi ps pdf html
ls -l
-infodir= htmldir= dvidir= psdir= pdfdir=
-export infodir htmldir dvidir psdir pdfdir
+xMAKE () { $MAKE infodir= htmldir= dvidir= psdir= pdfdir= "$@"; }
-$MAKE -e install install-html install-dvi install-ps install-pdf
+xMAKE install install-html install-dvi install-ps install-pdf
test ! -d "$instdir"
-$MAKE -e install install-html install-dvi install-ps install-pdf DESTDIR="$destdir"
+xMAKE install install-html install-dvi install-ps install-pdf DESTDIR="$destdir"
test ! -d "$instdir"
test ! -d "$destdir"
- xMAKE uninstall > stdout || { cat stdout; Exit 1; }
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
++xMAKE uninstall > stdout || { cat stdout; exit 1; }
cat stdout
- grep 'rm -f' stdout && Exit 1
+ grep 'rm -f' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+xMAKE uninstall DESTDIR="$destdir"
:
../configure --prefix="$instdir"
$MAKE
-bindir= datadir= includedir= foodir= bardir= man1dir= man2dir=
-export bindir datadir includedir foodir bardir man1dir man2dir
+xMAKE ()
+{
+ $MAKE bindir= datadir= includedir= foodir= bardir= man1dir= man2dir= "$@"
+}
-$MAKE -e install
+xMAKE install
test ! -d "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+xMAKE install DESTDIR="$destdir"
test ! -d "$instdir"
test ! -d "$destdir"
- xMAKE uninstall > stdout || { cat stdout; Exit 1; }
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
++xMAKE uninstall > stdout || { cat stdout; exit 1; }
cat stdout
- grep 'rm -f' stdout && Exit 1
+ grep 'rm -f' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+xMAKE uninstall DESTDIR="$destdir"
:
../configure --prefix="$instdir"
$MAKE
-bindir= datadir= includedir= foodir= bardir= man1dir= man2dir=
-export bindir datadir includedir foodir bardir man1dir man2dir
+xMAKE ()
+{
+ $MAKE bindir= datadir= includedir= foodir= bardir= man1dir= man2dir= "$@"
+}
-$MAKE -e install
+xMAKE install
test ! -d "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+xMAKE install DESTDIR="$destdir"
test ! -d "$instdir"
test ! -d "$destdir"
- xMAKE uninstall > stdout || { cat stdout; Exit 1; }
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
++xMAKE uninstall > stdout || { cat stdout; exit 1; }
cat stdout
- grep 'rm -f' stdout && Exit 1
+ grep 'rm -f' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+xMAKE uninstall DESTDIR="$destdir"
:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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 some generic Automake-provided internal macros and make functions.
+
+am_create_testdir=empty
++. ./defs || exit 1
+
+plan_ 8
+
+cp "$am_amdir"/header-vars.am . \
+ || fatal_ "fetching makefile fragment headers-vars.am"
+
+# Filter out Automake comments and things that would need configure
+# substitutions.
+LC_ALL=C $EGREP -v '(^##|=.*@[a-zA-Z0-9_]+@)' header-vars.am > defn.mk
+rm -f header-vars.am
+
+# WARNING: there are a lot of embedded tabs in this makefile.
+# DO NOT "NORMALIZE" THEM TO SPACES!
+cat > Makefile << 'END'
+include ./defn.mk
+
+lower = abcdefghijklmnopqrstuvwxyz
+upper = ABCDEFGHIJKLMNOPQRSTUVWXYZ
+digits = 0123456789
+comma = ,
+dollar = $$
+bslash = \\
+
+default:
+ @echo Please select an explicit test; exit 1
+.PHONY: default
+
+.PHONY: test-strip-firstword
+test-strip-firstword:
+ test '$(call am__strip_firstword,)' = ''
+ test '$(call am__strip_firstword,1)' = ''
+ test '$(call am__strip_firstword,1 1)' = '1'
+ test '$(call am__strip_firstword,1 2)' = '2'
+ test '$(call am__strip_firstword,1 2 3 4 5 6 7 8)' = '2 3 4 5 6 7 8'
+ test '$(call am__strip_firstword, 1 2 )' = '2'
+
+.PHONY: test-strip-lastword
+test-strip-lastword:
+ test '$(call am__strip_lastword,)' = ''
+ test '$(call am__strip_lastword,1)' = ''
+ test '$(call am__strip_lastword,1 1)' = '1'
+ test '$(call am__strip_lastword,1 2)' = '1'
+ test '$(call am__strip_lastword,1 2 3 4 5 6 7 8)' = '1 2 3 4 5 6 7'
+ test '$(call am__strip_lastword, 1 2 )' = '1'
+
+.PHONY: test-uniq
+test-uniq:
+ test '$(call am__uniq,)' = ''
+ test '$(call am__uniq,1)' = '1'
+ test '$(call am__uniq,1 1)' = '1'
+ test '$(call am__uniq,1 2)' = '1 2'
+ test '$(call am__uniq,2 1)' = '2 1'
+ test '$(call am__uniq,1 2 3)' = '1 2 3'
+ test '$(call am__uniq,2 3 1)' = '2 3 1'
+ test '$(call am__uniq,1 1 1)' = '1'
+ test '$(call am__uniq,1 2 1)' = '1 2'
+ test '$(call am__uniq,2 1 1)' = '2 1'
+ test '$(call am__uniq,2 1 1)' = '2 1'
+ test '$(call am__uniq,2 2 1)' = '2 1'
+ test '$(call am__uniq,1 1 1 3 1 1 1)' = '1 3'
+ test '$(call am__uniq,3 1 1 4 1 4 1 1)' = '3 1 4'
+ test '$(call am__uniq, 1 3 1 )' = '1 3'
+
+.PHONY: test-strip-suffixes
+test-strip-suffixes:
+ test '$(call am__strip_suffixes,,)' = ''
+ test '$(call am__strip_suffixes, ,)' = ''
+ test '$(call am__strip_suffixes,, )' = ''
+ test '$(call am__strip_suffixes, , )' = ''
+ test '$(call am__strip_suffixes,x,)' = ''
+ test '$(call am__strip_suffixes,x y, )' = ''
+ test '$(call am__strip_suffixes,,x y)' = 'x y'
+ test '$(call am__strip_suffixes, ,x y)' = 'x y'
+ test '$(call am__strip_suffixes,.c,foo.c)' = 'foo'
+ test '$(call am__strip_suffixes,.foo,a.foo b.foo)' = 'a b'
+ test '$(call am__strip_suffixes, x y, ax ay ax)' = 'a a a'
+ test '$(call am__strip_suffixes,x,ax)' = 'a'
+ test '$(call am__strip_suffixes,x,xa)' = 'xa'
+ test '$(call am__strip_suffixes,x,xx)' = 'x'
+ test '$(call am__strip_suffixes,x,xux)' = 'xu'
+ test '$(call am__strip_suffixes, .c .c++, \
+ foo.c bar.c++ baz.cxx zap.c)' = 'foo bar baz.cxx zap'
+ test '$(call am__strip_suffixes, .a .b, \
+ 1.a.a 2.a.b 3.b.a 4.b.b)' = '1.a 2.a 3.b 4.b'
+ # Corner cases: the *first* matched suffix is stripped
+ test '$(call am__strip_suffixes,.a .b,x.a.a)' = 'x.a'
+ test '$(call am__strip_suffixes,.a .b,x.a.b)' = 'x.a'
+ test '$(call am__strip_suffixes,.a .b,x.b.a)' = 'x.b'
+ test '$(call am__strip_suffixes,.a .b,x.b.b)' = 'x.b'
+ test '$(call am__strip_suffixes, .a .b.a, foo.b.a bar.a)' \
+ = 'foo.b bar'
+ test '$(call am__strip_suffixes, .b.a .a, foo.b.a bar.a)' \
+ = 'foo bar'
+
+.PHONY: test-toupper
+test-toupper:
+ test '$(call am__toupper,a)' = A
+ test '$(call am__toupper,A)' = A
+ test '$(call am__toupper,aba)' = ABA
+ test '$(call am__toupper,a b)' = 'A B'
+ test '$(call am__toupper, a B)' = ' A B'
+ test '$(call am__toupper,Ab )' = 'AB '
+ test '$(call am__toupper,A B c )' = 'A B C '
+ test '$(call am__toupper,0)' = 0
+ test '$(call am__toupper,0d)' = 0D
+ test '$(call am__toupper,@:&/?-)' = '@:&/?-'
+ test '$(call am__toupper,a@B)' = A@B
+ test '$(call am__toupper,zxzxzxZXZxzxzxzxzx)' = ZXZXZXZXZXZXZXZXZX
+ test '$(call am__toupper,$(lower))' = '$(upper)'
+ test '$(call am__toupper,$(upper))' = '$(upper)'
+
+.PHONY: test-tolower
+test-tolower:
+ test '$(call am__tolower,A)' = a
+ test '$(call am__tolower,a)' = a
+ test '$(call am__tolower,ABA)' = aba
+ test '$(call am__tolower,A B)' = 'a b'
+ test '$(call am__tolower, A b)' = ' a b'
+ test '$(call am__tolower,aB )' = 'ab '
+ test '$(call am__tolower,a b C )' = 'a b c '
+ test '$(call am__tolower,0)' = 0
+ test '$(call am__tolower,0D)' = 0d
+ test '$(call am__tolower,@:&/?-)' = '@:&/?-'
+ test '$(call am__tolower,a@B)' = a@b
+ test '$(call am__tolower,ZXZXZXzxzXZXZXZXZX)' = zxzxzxzxzxzxzxzxzx
+ test '$(call am__tolower,$(upper))' = '$(lower)'
+ test '$(call am__tolower,$(lower))' = '$(lower)'
+
+.PHONY: test-canonicalize
+test-canonicalize:
+ test '$(call am__canon,A)' = A
+ test '$(call am__canon, b)' = b
+ test '$(call am__canon, foo )' = foo
+ test '$(call am__canon,$(upper)$(lower)$(digits)_)' = '$(upper)$(lower)$(digits)_'
+ test '$(call am__canon,@)' = '@'
+ test '$(call am__canon,%)' = '_'
+ test '$(call am__canon,.&@!;)' = '__@__'
+ test '$(call am__canon,')' = '_'
+ test '$(call am__canon,$(dollar))' = '_'
+ test '$(call am__canon,$(bslash))' = '_'
+ test '$(call am__canon,$(comma))' = '_'
+ test '$(call am__canon,$(bslash)$(comma))' = '__'
+ test '$(call am__canon,x$(comma)@$(bslash))' = 'x_@_'
+
+.PHONY: test-newline
+test-newline:
+ @echo OK > foo$(am__newline)@touch bar$(am__newline)-false > baz
+ test `cat foo` = OK
+ test -f bar
+ test -f baz
+END
+
+command_ok_ am__strip_firstword $MAKE test-strip-firstword
+command_ok_ am__strip_lastword $MAKE test-strip-lastword
+command_ok_ am__uniq $MAKE test-uniq
+command_ok_ am__test_strip_suffixes $MAKE test-strip-suffixes
+command_ok_ am__tolower $MAKE test-tolower
+command_ok_ am__toupper $MAKE test-toupper
+command_ok_ am__canon $MAKE test-canonicalize
+command_ok_ am__newline $MAKE test-newline
+
+:
# 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 exe-specific flags with dependency tracking.
+# Variable interpolation should work even when GNU make functions are
+# involved. This is unfortunately not the case currently, due to
+# historical and hard-to-lift limitations (this is also documented in
+# the manual, using an example that is a stripped-down version of this
+# test case).
- . ./defs || Exit 1
+required=cc
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_PROG_CC
# using slow dependency extractors.
./configure --enable-dependency-tracking
-$MAKE test-deps-exist
$MAKE
- cross_compiling || test "$(./zoo)" = 'Hello, World!' || Exit 1
+$MAKE test-deps-exist
+ cross_compiling || test "$(./zoo)" = 'Hello, World!' || exit 1
$sleep
cat >> my-hdr.h << 'END'
$MAKE all
if ! cross_compiling; then
echo GOOD | ./lexer
- echo BAD | ./lexer && Exit 1
+ echo BAD | ./lexer && exit 1
: For shells with busted 'set -e'.
fi
-yl_distcheck
+$MAKE distcheck
:
# See also sister test 'yacc-line.test'.
required='cc lex'
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
-AC_CONFIG_FILES([sub/Makefile])
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_LEX
$MAKE
# For debugging,
- ls -l . sub sub/dir
+ ls -l . dir
$EGREP 'line|\.l' $c_outputs
- grep '#.*line.*build.*\.l' $c_outputs && Exit 1
+ grep '#.*line.*build.*\.l' $c_outputs && exit 1
# Adjusted "#line" should not contain reference to the absolute
# srcdir.
- $EGREP '#.*line *"?/.*\.l' $c_outputs && Exit 1
+ $EGREP '#.*line *"?/.*\.l' $c_outputs && exit 1
# Adjusted "#line" should not contain reference to the default
# output file names, e.g., 'lex.yy.c'.
- grep '#.*line.*lex\.yy' $c_outputs && Exit 1
+ grep '#.*line.*lex\.yy' $c_outputs && exit 1
# Look out for a silly regression.
- grep "#.*\.l.*\.l" $c_outputs && Exit 1
+ grep "#.*\.l.*\.l" $c_outputs && exit 1
if $vpath; then
grep '#.*line.*"\.\./zardoz\.l"' zardoz.c
- grep '#.*line.*"\.\./dir/quux\.l"' bar-quux.c
- grep '#.*line.*"\.\./\.\./sub/zardoz\.l"' sub/foo-zardoz.c
- grep '#.*line.*"\.\./\.\./sub/dir/quux\.l"' sub/dir/quux.c
+ grep '#.*line.*"\.\./dir/quux\.l"' dir/bar-quux.c
else
grep '#.*line.*"zardoz\.l"' zardoz.c
- grep '#.*line.*"dir/quux\.l"' bar-quux.c
- grep '#.*line.*"zardoz\.l"' sub/foo-zardoz.c
- grep '#.*line.*"dir/quux\.l"' sub/dir/quux.c
+ grep '#.*line.*"dir/quux\.l"' dir/bar-quux.c
fi
cd $srcdir
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Ensure subdirs for subdir scanners are generated when subdir-objects
-# are used, even when dependency tracking is disabled.
+# Ensure subdirs for subdir scanners are generated, even when dependency
+# tracking is disabled.
required='cc lex'
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >>configure.ac <<\END
AC_PROG_CC
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test error reporting for AC_CONFIG_LIBOBJ_DIR.
-# See also sister tests 'libobj20a.test' and 'libobj20c.test' .
+# See also sister test 'libobj20c.sh'.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_CONFIG_LIBOBJ_DIR([libobj-dir])
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test error reporting for AC_CONFIG_LIBOBJ_DIR.
-# See also sister tests 'libobj20a.test' and 'libobj20b.test' .
+# See also sister test 'libobj20b.sh'.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_CONFIG_LIBOBJ_DIR([libobj-dir])
# Make sure .libs directories are removed for _PROGRAMS.
# Report from Guillermo Ontañón.
+# Also make sure the 'so_locations' files generated by some linkers
+# (OSF, IRIX) are removed.
+# And also make sure the generated 'libtool' script as well as the
+# *.lo files are removed when they should.
required='cc libtoolize'
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AM_PROG_AR
$AUTOCONF
./configure
$MAKE all check
+: > lib/so_locations
+: > src/so_locations
$MAKE clean
- ls *.lo && Exit 1
++ls *.lo && exit 1
+test -f libtool
test ! -d src/.libs
test ! -d src/_libs
test ! -d check/.libs
$AUTOCONF
$AUTOMAKE --add-missing --copy
-# We need explicit rules to build 1.o and a.lo. Make sure
-# Automake did not output additional rules for 1.lo and and a.lo.
-$FGREP '1.o:' Makefile.in
-$FGREP '1.lo:' Makefile.in && exit 1
-$FGREP 'a.o:' Makefile.in && exit 1
-$FGREP 'a.lo:' Makefile.in
+# We shouldn't need explicit rules.
- $EGREP '[^%]\.(o|obj|lo|\$\(OBJEXT\)) *:' Makefile.in && Exit 1
++$EGREP '[^%]\.(o|obj|lo|\$\(OBJEXT\)) *:' Makefile.in && exit 1
./configure
$AUTOMAKE --add-missing --copy
./configure
-env LDFLAGS=ldflags AM_LDFLAGS=am_ldflags libmod1_la_LDFLAGS=lm1_la_ldflags \
- CFLAGS=cflags AM_CFLAGS=am_cflags prg2_CFLAGS=prg2_cflags \
- $MAKE -e print >output 2>&1 || { cat output; exit 1; }
+$MAKE LDFLAGS=ldflags AM_LDFLAGS=am_ldflags \
+ CFLAGS=cflags AM_CFLAGS=am_cflags \
+ libmod1_la_LDFLAGS=lm1_la_ldflags \
+ prg2_CFLAGS=prg2_cflags \
- print >output 2>&1 || { cat output; Exit 1; }
++ print >output 2>&1 || { cat output; exit 1; }
cat output
grep '1BEG: libmod1.la mod2.la :END1' output
grep '2BEG: mod2.la :END2' output
# Sanity check.
rm -f foo foo.exe
- $MAKE CC=false && Exit 99
-CC=false $MAKE -e && exit 99
++$MAKE CC=false && exit 99
$MAKE distclean
# Sanity check.
rm -f foo foo.exe
- $MAKE CXX=false && Exit 99
-CXX=false $MAKE -e && exit 99
++$MAKE CXX=false && exit 99
:
unique=0a3346e2af8a689b85002b53df09142a
$sleep
echo "(message \"$unique\")(provide 'am-three)" > am-three.el
- $MAKE 2>stderr || { cat stderr >&2; Exit 1; }
-$MAKE >output 2>&1 || { cat output; exit 1; }
-cat output
-grep $unique output
++$MAKE 2>stderr || { cat stderr >&2; exit 1; }
+cat stderr >&2
+grep $unique stderr
# It should also work for VPATH-builds.
$MAKE distcheck
# Check the recover rule of lisp_LISP with parallel make.
-required='GNUmake emacs'
+required=emacs
- . ./defs || Exit 1
+ . ./defs || exit 1
cat > Makefile.am << 'EOF'
dist_lisp_LISP = am-one.el am-two.el am-three.el
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2001-2012 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/>.
+
+# The 'all-local', 'check-local' and 'installdirs-local' targets can
+# also be defined by included or wrapper Makefiles that Automake never
+# sees, as well as through GNU make constructs that Automake does not
+# parse.
+
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_SUBST([SafeInclude], [include])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+@SafeInclude@ ./inc.mk
+$(foreach x,all check installdirs,$(eval $(x)-local:: ; : > main-$(x)))
+END
+
+cat > inc.mk << 'END'
+all-local check-local installdirs-local:: %-local:
+ : > incl-$*
+END
+
+cat > GNUmakefile << 'END'
+include ./Makefile
+all-local check-local installdirs-local:: %-local:
+ : > wrap-$*
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE check installdirs
+test -f wrap-all
+test -f wrap-check
+test -f wrap-installdirs
+test -f incl-all
+test -f incl-check
+test -f incl-installdirs
+test -f main-all
+test -f main-check
+test -f main-installdirs
+
+:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Long lines of += should be wrapped.
+# Long lines of = and += should be wrapped.
# Report from Simon Josefsson.
- . ./defs || Exit 1
+ . ./defs || exit 1
-(echo DUMMY = some_long_filename_1;
-for i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20;
-do
- echo DUMMY += some_long_filename_$i
-done) > Makefile.am
+i=0
+while test $i -lt 30; do
+ echo some_very_very_long_variable_content_$i
+ i=$((i + 1))
+done > t
+
+{ echo "DUMMY =" && sed 's/^/DUMMY +=/' t; } > Makefile.am
+{ echo "ZARDOZ =" && cat t; } | tr '\012\015' ' ' >> Makefile.am
$ACLOCAL
$AUTOMAKE
# depend on the time at which autoconf and automake update the cache
# via autom4te.
- . ./defs || Exit 1
-required=GNUmake
+ . ./defs || exit 1
cat >configure.ac <<END
m4_include([version.m4])
# Test to make sure known BSD 'make -jN' issues are fixed:
# without -B, it may reuse the same shell for separate commands in a
# rule, which can lead to interesting results.
+# Problems like this shouldn't happen with GNU make, but we keep the
+# test anyway for the moment, for extra safety.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >>configure.ac <<'END'
AC_OUTPUT
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Ensure that 'make -n dist' and 'make -n distcheck' do not change files
+# Ensure that "make -n dist" and "make -n distcheck" do not change files
# on disk, due to GNU make executing rules containing '$(MAKE)'.
-# Also, ensure that 'make -n dist' and 'make -n distcheck' show what
-# would happen, at least when using GNU make.
+# Also, ensure that "make -n dist" and "make -n distcheck" show what
+# would happen.
- . ./defs || Exit 1
+ . ./defs || exit 1
mkdir sub
# as well as tags, TAGS.
# For gen-testsuite-part: ==> try-with-serial-tests <==
- . ./defs || Exit 1
+ . ./defs || exit 1
-# Does $MAKE support the '.MAKE' special target?
-have_dotmake=false
-if using_gmake; then
- have_dotmake=: # GNU make must support it.
-else
- unindent > mk.tmp << 'END'
- targ.tmp:
- : > $@
- .MAKE: targ.tmp
-END
- if $MAKE -n -f mk.tmp targ.tmp && test -f targ.tmp; then
- have_dotmake=:
- fi
-fi
-
mkdir sub sub2
cat >> configure.ac << 'END'
case $target in
install-* | installdirs | tags | TAGS ) ;;
*)
- grep "stamp-$target$" stdout || Exit 1
- test ! -f "stamp-$target$" || Exit 1
- if $have_dotmake; then
- grep "stamp-$target$" stdout || exit 1
- fi
++ grep "stamp-$target$" stdout || exit 1
+ test ! -f "stamp-$target$" || exit 1
;;
esac
case $target in
install-* | installdirs ) ;;
*)
- grep "stamp-$target-sub" stdout || Exit 1
- test ! -f "sub/stamp-$target-sub" || Exit 1
- if $have_dotmake; then
- grep "stamp-$target-sub" stdout || exit 1
- fi
++ grep "stamp-$target-sub" stdout || exit 1
+ test ! -f "sub/stamp-$target-sub" || exit 1
;;
esac
case $target in
distclean | maintainer-clean ) ;;
*)
- grep "should-not-be-executed" stdout || Exit 1
- test ! -f "sub2/sub2-$target-should-not-be-executed" || Exit 1
- if $have_dotmake; then
- grep "should-not-be-executed" stdout || exit 1
- fi
++ grep "should-not-be-executed" stdout || exit 1
+ test ! -f "sub2/sub2-$target-should-not-be-executed" || exit 1
;;
esac
done
# even if the 'missing' script is involved.
required=help2man
- . ./defs || Exit 1
+ . ./defs || exit 1
-# Avoid a spurious failure due to a known FreeBSD make incompatibility.
-useless_vpath_rebuild \
- && skip_ "VPATH useless rebuild detected (see bug#7884)"
-
cat > Makefile.am << 'END'
dist_man_MANS = $(srcdir)/foobar.1 bazquux.1 zardoz.1
dist_bin_SCRIPTS = foobar bazquux zardoz
# Check for a bug in distcheck w.r.t. generated manpages.
- . ./defs || Exit 1
+ . ./defs || exit 1
-# Avoid a spurious failure due to a known FreeBSD make incompatibility.
-useless_vpath_rebuild \
- && skip_ "VPATH useless rebuild detected (see bug#7884)"
-
cat > Makefile.am << 'END'
dist_man_MANS = foo.1
foo.1:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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 Automake-provided memoization for make variables.
+
+am_create_testdir=empty
++. ./defs || exit 1
+
+plan_ 17
+
+ocwd=`pwd` || fatal_ "couldn't get current working directory"
+
+cp "$am_amdir"/header-vars.am . \
+ || fatal_ "fetching makefile fragment headers-vars.am"
+
+# Filter out Automake comments and things that would need configure
+# substitutions.
+LC_ALL=C $EGREP -v '(^##|=.*@[a-zA-Z0-9_]+@)' header-vars.am > defn.mk
+rm -f header-vars.am
+
+T ()
+{
+ tcount=`expr $tcount + 1`
+ mkdir $tcount.d
+ cd $tcount.d
+ echo include ../defn.mk > Makefile
+ cat >> Makefile
+ command_ok_ "$1" "$MAKE" test
+ cd ..
+}
+tcount=0
+
+#---------------------------------------------------------------------------
+
+## NOTE: Every repeated check in the recipes of the tests below is
+## really intended!
+
+#---------------------------------------------------------------------------
+
+T "basic usage" <<'END'
+
+foo = $(call am__memoize,foo,ok)
+
+test:
+ test '$(foo)' = ok
+ test '$(foo)' = ok
+END
+
+#---------------------------------------------------------------------------
+
+T "variables expanding to blanks only (1)" <<'END'
+
+foo = $(call am__memoize,foo,$(am__empty) )
+
+test:
+ test '$(foo)' = ' '
+ test '$(foo)' = ' '
+END
+
+#---------------------------------------------------------------------------
+
+T "variables expanding to blanks only (2)" <<END
+
+blank = \$(am__empty) $tab$tab \$(am__empty)
+foo = \$(call am__memoize,foo,\$(blank))
+
+test:
+ test '\$(foo)' = ' $tab$tab '
+ test '\$(foo)' = ' $tab$tab '
+END
+
+#---------------------------------------------------------------------------
+
+# $var will be 3 * 2^12 ~ 12000 characters long.
+var=foo
+for i in 1 2 3 4 5 6 7 8 9 10 11 12; do
+ var=$var$var
+done
+
+T "very long variable name" <<END
+
+$var = \$(call am__memoize,$var,foo)
+
+test:
+ test '\$($var)' = foo
+ test '\$($var)' = foo
+END
+
+#---------------------------------------------------------------------------
+
+# $var and $val will be 3 * 2^12 ~ 12000 characters long.
+var=foo
+val=bar
+for i in 1 2 3 4 5 6 7 8 9 10 11 12; do
+ var=$var$var
+ val=$val$val
+done
+
+T "very long variable name with long content" <<END
+
+$var = \$(call am__memoize,$var,$val)
+
+test:
+ test '\$($var)' = '$val'
+ test '\$($var)' = '$val'
+END
+
+#---------------------------------------------------------------------------
+
+T "memoize indirect recursive variable expansion" <<'END'
+
+foo = $(call am__memoize,foo,$(indir))
+
+## This is delibrately placed after the memoize call.
+indir = zardoz
+
+test:
+ test '$(foo)' = zardoz
+ test '$(foo)' = zardoz
+END
+
+#---------------------------------------------------------------------------
+
+T "memoize indirect immediate variable expansion" <<'END'
+
+foo = $(call am__memoize,foo,$(indir))
+
+## This is delibrately placed after the memoize call.
+indir := blob
+
+test:
+ test '$(foo)' = blob
+ test '$(foo)' = blob
+END
+
+#---------------------------------------------------------------------------
+
+T "memoize function call (containing builtin calls)" <<'END'
+
+my_func = $(firstword $(sort $(1)))
+foo = $(call am__memoize,foo,$(call my_func, 6 3 1 7))
+
+test:
+ test '$(foo)' = 1
+ test '$(foo)' = 1
+END
+
+#---------------------------------------------------------------------------
+
+T "expanded as function argument" <<'END'
+
+foo = $(call am__memoize,foo,bar)
+func = ::$(0)::$(1)::
+
+test:
+ test '$(call func,$(foo))' = ::func::bar::
+ test '$(foo)' = bar
+ # Once more.
+ test '$(call func,$(foo))' = ::func::bar::
+END
+
+#---------------------------------------------------------------------------
+
+T "expanded as function argument (trickier)" <<'END'
+
+foo = $(call am__memoize,foo,zardoz)
+indir_func = ::$($1)::
+
+test:
+ test '$(call indir_func,foo)' = ::zardoz::
+ test '$(foo)' = zardoz
+ # Once more.
+ test '$(call indir_func,foo)' = ::zardoz::
+END
+
+#---------------------------------------------------------------------------
+
+T "expanded into another memoized variable" <<'END'
+
+foo = $(call am__memoize,foo,one $(bar))
+bar = $(call am__memoize,bar,two $(baz))
+baz = $(call am__memoize,baz,$(sort 4 3))
+
+test:
+ test '$(foo)' = 'one two 3 4'
+ test '$(bar)' = 'two 3 4'
+END
+
+#---------------------------------------------------------------------------
+
+T "memoization actually takes place (1)" <<'END'
+
+indir := ok
+foo = $(call am__memoize,foo,$(indir))
+expand-it := $(foo)
+override indir := ko
+
+test:
+ test '$(foo)' = ok
+ test '$(indir)' = ko
+END
+
+#---------------------------------------------------------------------------
+
+T "memoization actually takes place (2)" <<'END'
+
+indir := ok
+expand = $(eval expanded-to := $$($1))
+foo = $(call am__memoize,foo,$(indir))
+$(call expand,foo)
+override indir := ko
+
+test:
+ test '$(foo)' = ok
+ test '$(indir)' = ko
+ test '$(expanded-to)' = ok
+END
+
+#---------------------------------------------------------------------------
+
+T "memoization actually takes place (3)" <<'END'
+
+foo1 = $(call am__memoize,foo1,$(shell test -f x && echo "+"))
+foo2 = $(call am__memoize,foo2,$(shell test -f y || echo "-"))
+
+test: one two
+two: one
+.PHONY: one two one-setup two-setup
+one-setup:
+ rm -f y
+ echo dummy > x
+one: one-setup
+ test -f x
+ test '$(foo1)' = '+'
+ test ! -f y
+ test '$(foo2)' = '-'
+two-setup:
+ rm -f x
+ echo dummy > y
+two: two-setup
+ test ! -f x
+ test '$(foo1)' = '+'
+ test -f y
+ test '$(foo2)' = '-'
+END
+
+#---------------------------------------------------------------------------
+
+
+T "definition on multiple lines" <<'END'
+
+foo = $(call am__memoize,foo,a \
+ b \
+ c \
+ \
+ d)
+
+test:
+ test '$(foo)' = 'a b c d'
+ test '$(foo)' = 'a b c d'
+END
+
+#---------------------------------------------------------------------------
+
+# This usage has been known to cause problems with GNU make <= 3.82,
+# tickling this bug:
+# <http://lists.gnu.org/archive/html/bug-make/2012-05/msg00013.html>
+# <https://savannah.gnu.org/patch/?7534>
+
+T "known GNU make issue (https://savannah.gnu.org/patch/?7534)" <<'END'
+
+setup := $(shell mkdir -p t/pm && : > t/pm/Cond2.pl)
+
+TESTS = $(wildcard t/pm/Cond2.pl)
+am__test_bases = $(call am__memoize,am__test_bases,$(TESTS))
+
+test:
+ test '$(am__test_bases)' = 't/pm/Cond2.pl'
+END
+
+#---------------------------------------------------------------------------
+
+# Try memoization with variables having a very long content. Our first
+# (unpublished) memoization implementation didn't work in that case -- it
+# triggered errors like "*** unterminated variable reference. Stop" when
+# the content's length because big enough.
+
+line='dummy abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ='
+
+# About 1 million lines.
+echo " $line \\" > t
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
+ cat t t > t1
+ mv -f t1 t
+done
+
+echo "list = \$(call am__memoize,list,$line \\" >> big.mk
+cat t >> big.mk
+echo " $line)" >> big.mk
+
+cat >> big.mk << 'END'
+test:
+ test x'$(word 1, $(list))' = x'dummy'
+ test x'$(word 3, $(list))' = x'='
+ test x'$(word 31, $(list))' = x'dummy'
+ test x'$(word 93, $(list))' = x'='
+END
+
+T "very long variable content" < big.mk
+
+#---------------------------------------------------------------------------
+
+:
# 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 mkinstalldirs with spaces in directory names.
+# Test "install-sh -d" with spaces in directory names.
am_create_testdir=empty
- . ./defs || Exit 1
+ . ./defs || exit 1
cwd=$(pwd) || fatal_ "getting current working directory"
# FIXME: the features tested by this script has been moved in contrib.
# FIXME: We should move this script accordingly.
-required='gcc GNUmake'
+required=gcc
- . ./defs || Exit 1
+ . ./defs || exit 1
mldir=$am_top_srcdir/contrib/multilib
mkdir m4
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Projects using only Fortran or C++ shouldn't need C-related stuff.
+
+am_create_testdir=empty
++. ./defs || exit 1
+
+plan_ 6
+
+only_ ()
+{
+ test $# -eq 3 || fatal_ "only_: bad usage"
+ lang=$1; shift
+ macro=$1; shift
+ sources=$*
+ : ================ $lang ================ :
+ mkdir "$macro"
+ cd "$macro"
+ unindent > configure.ac <<END
+ AC_INIT([Only $2], [1.0])
+ AM_INIT_AUTOMAKE
+ AC_CONFIG_FILES([Makefile])
+ $macro
+END
+ echo bin_PROGRAMS = foo > Makefile.am
+ echo foo_SOURCES = $sources >> Makefile.am
+ r=ok
+ $ACLOCAL \
+ && $AUTOMAKE -a \
+ && not $EGREP '\(CC\)|\(CFLAGS\)|AM_CFLAGS' Makefile.in \
+ || r='not ok'
+ result_ "$r" "$lang only"
+ cd ..
+}
+
+only_ "C++" AC_PROG_CXX '1.cxx 2.cpp 3.c++ 4.cc 5.C'
+only_ "Fortran" AC_PROG_FC 'a.f90 b.f95 c.f03 d.f08'
+only_ "Fortran 77" AC_PROG_F77 'x.f y.for'
+only_ "Java" AM_PROG_GCJ 'foo.java bar.class'
+only_ "Objective C" AC_PROG_OBJC 'zardoz.m fu.m'
+only_ "Objective C++" AC_PROG_OBJCXX 'foo.mm bar.mm'
+
+:
$ACLOCAL
$AUTOMAKE
- $EGREP 'INCLUDE|-compile|\$\(OBJEXT\)|tab\.[ch]' Makefile.in && Exit 1
-$EGREP 'DEFAULT_INCLUDES|@am__isrc@|-compile|\$\(OBJEXT\)|tab\.[ch]' \
- Makefile.in && exit 1
++$EGREP 'INCLUDE|-compile|\$\(OBJEXT\)|tab\.[ch]' Makefile.in && exit 1
:
$AUTOMAKE
grep '^am_eyeball_OBJECTS' Makefile.in
-grep '^DIST_SOURCES =' Makefile.in
-grep '^DIST_SOURCES =.*nodist' Makefile.in && exit 1
+grep '^am__dist_sources =' Makefile.in
- grep '^am__dist_sources =.*nodist' Makefile.in && Exit 1
++grep '^am__dist_sources =.*nodist' Makefile.in && exit 1
:
$ACLOCAL
$AUTOMAKE
- grep '^dist:' Makefile.in && Exit 1
- grep 'am__dist_sources' Makefile.in && Exit 1
+ grep '^dist:' Makefile.in && exit 1
-grep '^DIST_SOURCES =' Makefile.in && exit 1
++grep 'am__dist_sources' Makefile.in && exit 1
:
# Test to make sure nostdinc option works correctly.
-# We don't require a C compiler explicitly, because the first part of the
-# test (where 'Makefile.in' is grepped) does not require one. Insted, we
-# just skip the rest of the test if configure fails to find a working C
-# compiler.
-
+required=cc
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_PROG_CC
# Test with $builddir != $srcdir
mkdir build
cd build
-../configure || exit $?
-$EGREP '.*-I *(\.|\$.srcdir.)' Makefile && exit 1
+../configure
- $MAKE V=1 > output || { cat output; Exit 1; }
++$MAKE V=1 > output || { cat output; exit 1; }
+cat output
- grep '.*-I *\.' stdout && Exit 1
++grep '.*-I *\.' stdout && exit 1
+$MAKE clean
+# Shouldn't be picked up from builddir either.
+cp ../stdlib.h .
+$MAKE
+cd ..
# Test with $builddir = $srcdir
-cd ..
-./configure || exit $?
-$EGREP '.*-I *(\.|\$.srcdir.)' Makefile && exit 1
+./configure
- $MAKE V=1 > output || { cat output; Exit 1; }
++$MAKE V=1 > output || { cat output; exit 1; }
+cat output
- grep '.*-I *\.' output && Exit 1
++grep '.*-I *\.' output && exit 1
-exit 0
+:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Naming a subdirectory 'obj/' is a bad idea. Automake should say so.
+# A directory named 'obj' could create problems with BSD make, but
+# shouldn't with GNU make; so check that
+# - the old portability warning diagnosing it is gone, and
+# - such a directory truly causes no problems with GNU make.
- . ./defs || Exit 1
+am_create_testdir=empty
+ . ./defs || exit 1
-mkdir obj
-
-cat >>configure.ac << 'END'
-AC_CONFIG_FILES([obj/Makefile])
+cat > configure.ac <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([obj])
+AM_INIT_AUTOMAKE
+AC_REQUIRE_AUX_FILE([Makefile])
+AC_CONFIG_FILES([Makefile])
AC_OUTPUT
END
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test to make sure '.txi' extension works.
+# Automake-NG should recognize the (no-op) 'ng' option.
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat > Makefile.am << 'END'
-info_TEXINFOS = foo.txi
+cat > configure.ac <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([ng])
+AC_CONFIG_FILES([Makefile])
END
-echo '@setfilename foo.info' > foo.txi
-: > texinfo.tex
+echo AUTOMAKE_OPTIONS = ng > Makefile.am
$ACLOCAL
$AUTOMAKE
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# The parallel-tests driver should be able to cope with test scripts
+# whose names end with several concatenated suffixes.
+
- $MAKE $j check >>stdout || { cat stdout; Exit 1; }
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_OUTPUT
+END
+
+tests='foo.sh foo.t.sh foo.sh.t foo.x.x foo.x.t.sh foo.t.x.sh foo.sh.t.x'
+
+for t in $tests; do
+ (echo '#!/bin/sh' && echo 'echo == /$0 ==') > $t
+ chmod a+x $t
+done
+
+cat > Makefile.am <<END
+TEST_EXTENSIONS = .t .sh .x
+TESTS = $tests
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+for j in '' -j4; do
+
+ # Use append mode here to avoid dropping output. See automake bug#11413.
+ # Also, use 'echo' here to "nullify" the previous contents of 'stdout',
+ # since Solaris 10 /bin/sh would try to optimize a ':' away after the
+ # first iteration, even if it is redirected.
+ echo " " >stdout
++ $MAKE $j check >>stdout || { cat stdout; exit 1; }
+ cat stdout
+ count_test_results total=7 pass=7 fail=0 skip=0 xfail=0 xpass=0 error=0
+ for t in $tests; do grep "^PASS: $t *$" stdout; done
+
+ grep '== .*/foo\.sh ==' foo.log
+ grep '== .*/foo\.t\.sh ==' foo.t.log
+ grep '== .*/foo\.sh\.t ==' foo.sh.log
+ grep '== .*/foo\.x\.x ==' foo.x.log
+ grep '== .*/foo\.x\.t\.sh ==' foo.x.t.log
+ grep '== .*/foo\.t\.x\.sh ==' foo.t.x.log
+ grep '== .*/foo\.sh\.t\.x ==' foo.sh.t.log
+
+ $MAKE $j clean
+ test ! -f foo.log
+ test ! -f foo.t.log
+ test ! -f foo.sh.log
+ test ! -f foo.x.log
+ test ! -f foo.x.t.log
+ test ! -f foo.t.x.log
+ test ! -f foo.sh.t.log
+
+done
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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 dynamic content for $(TESTS) is supported, both when set from
+# inside the Makefile.am and when overridden from the command line.
+
- $MAKE check > stdout || { cat stdout; Exit 1; }
++. ./defs || exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+cat > ok <<'END'
+#!/bin/sh
+exit 0
+END
+
+cat > ko <<'END'
+#!/bin/sh
+exit 1
+END
+
+cat > sk <<'END'
+#!/bin/sh
+exit 77
+END
+
+cat > er << 'END'
+#!/bin/sh
+echo $0 should not be run >&2
+exit 99
+END
+
+chmod a+x ko ok sk
+
+mkdir t
+cp ok t/nosuffix
+
+cp ok g1.sh
+cp ok g2.sh
+cp ok g3.sh
+cp ok g4.sh
+cp er g5.sh
+
+cp ok t00-foo.sh
+cp ok t02.sh
+cp ok t57_mu.sh
+cp ok t7311.sh
+cp ko t98S.sh
+cp ko t99.sh
+cp er t1.sh
+cp er t9.sh
+cp er tx98.sh
+
+cp sk fu.sh
+cp sk mu
+
+cat > get-tests-list <<END
+#!/bin/sh
+echo "g1.sh ${tab}g2.sh "
+if :; then echo ' g3.sh'; fi
+echo
+echo g4.sh
+END
+chmod a+x get-tests-list
+
+cat > Makefile.am << 'END'
+my_add_dirprefix = $(strip $(1))/$(strip $(2))
+EXTRA_DIST = $(TESTS) get-tests-list
+TEST_EXTENSIONS = .sh
+
+t1 = fu
+t2 = mux
+
+# Also try an empty match suffix, to ensure that the ':=' in there is
+# not confused by the parser with an immediate assignment operator.
+TESTS = $(t1:=.sh) $(t2:x=)
+TESTS += $(wildcard $(srcdir)/t[0-9][0-9]*.sh)
+TESTS += $(shell $(srcdir)/get-tests-list)
+TESTS += $(call my_add_dirprefix, t, nosuffix)
+XFAIL_TESTS = $(wildcard $(srcdir)/t9[0-9]*.sh)
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
- $MAKE distcheck > stdout || { cat stdout; Exit 1; }
++$MAKE check > stdout || { cat stdout; exit 1; }
+cat stdout
+
+count_test_results total=13 pass=9 fail=0 xpass=0 xfail=2 skip=2 error=0
+
+grep '^PASS: t/nosuffix$' stdout
+grep '^PASS: g1\.sh$' stdout
+grep '^PASS: g2\.sh$' stdout
+grep '^PASS: g3\.sh$' stdout
+grep '^PASS: g4\.sh$' stdout
+grep '^PASS: t00-foo\.sh$' stdout
+grep '^PASS: t02\.sh$' stdout
+grep '^PASS: t57_mu\.sh$' stdout
+grep '^PASS: t7311\.sh$' stdout
+grep '^XFAIL: t98S\.sh$' stdout
+grep '^XFAIL: t99\.sh$' stdout
+grep '^SKIP: fu\.sh$' stdout
+grep '^SKIP: mu$' stdout
+
+$MAKE mostlyclean
+test "`find . -name *.log`" = ./config.log
+
- > stdout || { cat stdout; Exit 1; }
++$MAKE distcheck > stdout || { cat stdout; exit 1; }
+cat stdout
+count_test_results total=13 pass=9 fail=0 xpass=0 xfail=2 skip=2 error=0
+
+$MAKE check tests1='$(wildcard t00*.sh t98?.sh)' \
+ tests2='$(shell ./get-tests-list | sed 1d)' \
+ TESTS='$(tests1) $(tests2)' \
- > stdout || { cat stdout; Exit 1; }
++ > stdout || { cat stdout; exit 1; }
+cat stdout
+
+count_test_results total=4 pass=3 fail=0 xpass=0 xfail=1 skip=0 error=0
+
+grep '^PASS: g3\.sh$' stdout
+grep '^PASS: g4\.sh$' stdout
+grep '^PASS: t00-foo\.sh' stdout
+grep '^XFAIL: t98S\.sh' stdout
+
+$MAKE mostlyclean
+test "`find . -name *.log`" = ./config.log
+
+$MAKE check TESTS='$(shell echo t00 | sed "s/$$/-foo/") t99'
+test -f t00-foo.log
+test -f t99.log
+
+$MAKE check \
+ foo='E9E9E' \
+ a='t00.err' \
+ b='${a:.err=-foo}' \
+ TESTS='$(b) t$(subst E,,$(foo)) $(call my_add_dirprefix,t,nosuffix)' \
++ > stdout || { cat stdout; exit 1; }
+cat stdout
+
+count_test_results total=3 pass=2 fail=0 xpass=0 xfail=1 skip=0 error=0
+grep '^PASS: t/nosuffix' stdout
+grep '^PASS: t00-foo\.sh' stdout
+grep '^XFAIL: t99\.sh' stdout
+
+:
# 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 parallel-tests features:
-# - empty TESTS
-# - empty TEST_LOGS
+# Check parallel-tests features: empty TESTS
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
diff exp-fail got-fail
st=1
-XFAIL_TESTS="$failure_statuses 99" $MAKE -e check >stdout && st=0
+$MAKE check XFAIL_TESTS="$failure_statuses 99" >stdout && st=0
cat stdout
cat test-suite.log
- test $st -gt 0 || Exit 1
+ test $st -gt 0 || exit 1
LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | LC_ALL=C sort > got-xfail-1
diff exp-xfail-1 got-xfail-1
st=0
-XFAIL_TESTS="$failure_statuses" TESTS="0 77 $failure_statuses" \
- $MAKE -e check >stdout || st=$?
+$MAKE check \
+ XFAIL_TESTS="$failure_statuses" \
+ TESTS="0 77 $failure_statuses" \
+ > stdout || st=$?
cat stdout
cat test-suite.log
- test $st -eq 0 || Exit 1
+ test $st -eq 0 || exit 1
LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | LC_ALL=C sort > got-xfail-2
diff exp-xfail-2 got-xfail-2
echo 'int main (void) { return 0; }' > none.c
st=0
-RECHECK_LOGS= $MAKE -e check >stdout || st=$?
+$MAKE check AM_LAZY_CHECK=yes >stdout || st=$?
cat stdout
ls -l
- test $st -eq 0 || Exit 1
+ test $st -eq 0 || exit 1
# For debugging.
stat stamp foo.log bar.log baz.log || :
{
st=0
log=$1; shift
- env "$@" $MAKE -e check >output 2>&1 || st=$?
+ $MAKE "$@" check >output 2>&1 || st=$?
cat output
- $FGREP '::OOPS::' output && Exit 1 # Possible infinite recursion.
+ $FGREP '::OOPS::' output && exit 1 # Possible infinite recursion.
- # Check that at least we don't create a botched global log file.
- test ! -f "$log"
- if using_gmake; then
- grep "[Cc]ircular.*dependency" output | $FGREP "$log"
- test $st -gt 0
- else
- # Look for possible error messages about circular dependencies from
- # either make or our own recipes. At least one such a message must
- # be present. OTOH, some make implementations (e.g., NetBSD's), while
- # smartly detecting the circular dependency early and diagnosing it,
- # still exit with a successful exit status (yikes!). So don't check
- # the exit status of non-GNU make, to avoid spurious failures.
- # this case.
- err_seen=no
- for err_rx in \
- 'circular.* depend' \
- 'depend.* circular' \
- 'graph cycle' \
- 'infinite (loop|recursion)' \
- 'depend.* on itself' \
- ; do
- $EGREP -i "$err_rx" output | $FGREP "$log" || continue
- err_seen=yes
- break
- done
- test $err_seen = yes || exit 1
- fi
+ grep "[Cc]ircular.*dependency" output | $FGREP "$log"
+ grep "$log:.*depends on itself" output
+ test $st -gt 0
}
: > test-suite.test
grep '^ERROR: foo$' test-suite.log
cd sub
- $MAKE DISABLE_HARD_ERRORS='' check && Exit 1
-# The '-e' is wanted here.
-DISABLE_HARD_ERRORS='' $MAKE -e check && exit 1
++$MAKE DISABLE_HARD_ERRORS='' check && exit 1
cat test-suite.log
grep '^ERROR: bar$' test-suite.log
cd ..
# 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 that := definitions work as expected at make time.
+# Some internals of the parallel testsuite harness implementation.
- . ./defs || Exit 1
-required=GNUmake
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_OUTPUT
test -f bli.suff.log
test -f sub/test.log
- $MAKE check T_LOG_FLAGS=--bad && Exit 1
-T_LOG_FLAGS=--bad $MAKE -e check && exit 1
++$MAKE check T_LOG_FLAGS=--bad && exit 1
cat test-suite.log
cat bla.log
# With the above flag overridden, bla.t should fail ...
cp test-suite.log orig
$MAKE clean
- test -f test-suite.log && Exit 99 # Sanity check.
+ test -f test-suite.log && exit 99 # Sanity check.
# Check that we can override the testsuite log file at runtime.
-TEST_SUITE_LOG=zardoz.log $MAKE -e check
+$MAKE check TEST_SUITE_LOG=zardoz.log
ls -l
test ! -f test-suite.log
cat zardoz.log
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test the example of usage of generic and extension-specific
-# LOG_COMPILER and LOG_FLAGS given in the manual.
+# LOG_COMPILER, LOG_FLAGS and LOG_DEPENDNECIES given in the manual.
required=python
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac <<END
AC_SUBST([PERL], ['$PERL'])
cat foo.log
cat bar.log
cat baz.log
- test $st -eq 0 || Exit $st
+cat foo.trs
+cat bar.trs
+cat baz.trs
+ test $st -eq 0 || exit $st
# Check that the wrappers have been run with the expected flags.
grep '[rR]eversed.*+=.*operator.*foo\.pl' foo.log
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# The parallel-tests driver must prefer tests with an extension to
+# extension-less tests. This is required to allow the user to have
+# a, say, 'all.test' test case even in the face of the 'all' target.
+
++. ./defs || exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+cat > foo <<'END'
+#!/bin/sh
+echo "foo without suffix run" >&2
+exit 99
+END
+
+cat > foo.test <<'END'
+#!/bin/sh
+echo "$0 has been run"
+END
+chmod a+x foo.test
+
+cp foo.test all.test
+cp foo.test dist.test
+cp foo.test install.test
+cp foo.test bad-target.test
+
+cat > Makefile.am << 'END'
+bad-target:
+ @echo $@ has been run >&2; exit 1
+install-data-local:
+ @echo $@ has been run >&2; exit 1
+TESTS = foo.test all.test install.test dist.test bad-target.test
+EXTRA_DIST = oops-this-does-not-exist
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure --prefix="`pwd`/inst"
+
+$MAKE check
+ls -l # For debugging.
+test ! -d inst
+for t in foo all install dist bad-target; do
+ grep "$t\.test has been run" $t.log
+done
+
+:
./configure
mv config.log config-log # Avoid possible false positives below.
- $MAKE check AM_COLOR_TESTS=always && Exit 1
-AM_COLOR_TESTS=always $MAKE -e check && exit 1
++$MAKE check AM_COLOR_TESTS=always && exit 1
# Not a useless use of cat; see above comments "grep-nonprinting"
# requirement in 'test-init.sh'.
- cat *.log | grep "$esc" && Exit 1
+ cat *.log | grep "$esc" && exit 1
:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test to make sure that mdate-sh is added to the right directory.
-# Report from Kevin Dalley.
+# The parallel-tests harness do not cause the same test to be
+# uselessly run multiple times.
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >> configure.ac << 'END'
-AC_CONFIG_FILES([sub/Makefile])
-END
-
-cat > Makefile.am << 'END'
-SUBDIRS = sub
-END
+echo AC_OUTPUT >> configure.ac
+echo TESTS = foo.test > Makefile.am
-mkdir sub
-
-cat > sub/Makefile.am << 'END'
-info_TEXINFOS = textutils.texi
-END
-
-cat > sub/textutils.texi << 'END'
-@include version.texi
-@setfilename textutils.info
+cat > foo.test <<'END'
+#! /bin/sh
+ls -l && mkdir bar
END
+chmod a+x foo.test
$ACLOCAL
+$AUTOCONF
$AUTOMAKE -a
-ls -l sub
-test -f sub/mdate-sh
+
+./configure
+
- $MAKE -j1 check || { cat test-suite.log; Exit 1; }
++$MAKE -j1 check || { cat test-suite.log; exit 1; }
+rmdir bar
- $MAKE -j2 check || { cat test-suite.log; Exit 1; }
++$MAKE -j2 check || { cat test-suite.log; exit 1; }
+rmdir bar
- $MAKE -j4 check || { cat test-suite.log; Exit 1; }
++$MAKE -j4 check || { cat test-suite.log; exit 1; }
:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# The user should be able to easily specify extra dependencies for
+# the test cases, depending on their extension (or lack thereof).
+# We do so with the help of "${prefix}LOG_DEPENDENCIES" variables.
+# See the last wishlist in automake bug#11287.
+
++. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AC_SUBST([EXEEXT], [.bin])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_EXTENSIONS = .test .sh
+TESTS = foo.test foo2.test bar.sh baz zard.oz quux.bin mu.test.bin
+
+TEST_LOG_DEPENDENCIES = test-dep
+SH_LOG_DEPENDENCIES = sh-dep1 sh-dep2
+LOG_DEPENDENCIES = dep
+
+DEPS = test-dep sh-dep1 sh-dep2 dep new-test-dep
+$(DEPS):
+ echo dummy > $@
+CLEANFILES = $(DEPS)
+
+.PHONY: setup
+setup:
+ chmod a+x $(TESTS)
+EXTRA_DIST = $(TESTS)
+END
+
+cat > foo.test <<'END'
+#! /bin/sh
+test -f test-dep || test -f new-test-dep
+END
+
+cat > foo2.test <<'END'
+#! /bin/sh
+test -f test-dep
+END
+
+cp foo2.test mu.test.bin
+
+cat > bar.sh <<'END'
+#! /bin/sh
+test -f sh-dep1 && test -f sh-dep2
+END
+
+cat > baz <<'END'
+#! /bin/sh
+test -f dep
+END
+
+cp baz quux.bin
+
+cat > zard.oz <<'END'
+#! /bin/sh
+test -f dep
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE setup
+
+cleanup () { rm -f test-dep sh-dep1 sh-dep2 dep; }
+
+$MAKE check -j4
+test ! -f new-test-dep
+test -f test-dep
+test -f sh-dep1
+test -f sh-dep2
+test -f dep
+test -f quux.log # Sanity check.
+test -f mu.log # Likewise.
+
+cleanup
+
+$MAKE check TESTS=foo.test
+test -f test-dep
+test ! -f sh-dep1
+test ! -f sh-dep2
+test ! -f dep
+
+cleanup
+rm -f bar.log
+$MAKE check TESTS=bar.sh AM_LAZY_CHECK=yes
+test ! -f test-dep
+test -f sh-dep1
+test -f sh-dep2
+test ! -f dep
+
+cleanup
+$MAKE check TESTS=baz
+test ! -f test-dep
+test ! -f sh-dep1
+test ! -f sh-dep2
+test -f dep
+
+cleanup
+$MAKE check TESTS='foo bar'
+test -f test-dep
+test -f sh-dep1
+test -f sh-dep2
+test ! -f dep
+
+cleanup
+$MAKE check TESTS=zard.oz
+test ! -f test-dep
+test ! -f sh-dep1
+test ! -f sh-dep2
+test -f dep
+
+cleanup
+$MAKE check TESTS=mu.test.bin
+test -f test-dep
+test ! -f sh-dep1
+test ! -f sh-dep2
+test ! -f dep
+
+cleanup
+$MAKE check TESTS='quux.bin bar.sh'
+test ! -f test-dep
+test -f sh-dep1
+test -f sh-dep2
+test -f dep
+
+cleanup
+$MAKE check TESTS=foo TEST_LOG_DEPENDENCIES=new-test-dep
+test -f new-test-dep
+test ! -f test-dep
+test ! -f sh-dep1
+test ! -f sh-dep2
+test ! -f dep
+
+cleanup
+$MAKE check TESTS=baz XFAIL_TESTS=baz LOG_DEPENDENCIES=
+test ! -f dep
+grep ':test-result: XFAIL' baz.trs
+
+$MAKE distcheck
+
+:
# 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 ':test-results:' directives in test scripts' output doesn't
-# originate spurious results in the testsuite summary.
+# Check parallel-tests features: listing $(srcdir)/ in TESTS works.
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >> configure.ac << 'END'
-AC_OUTPUT
-END
+echo AC_OUTPUT >> configure.ac
cat > Makefile.am << 'END'
-TESTS = foo.test bar.test
+TESTS = \
+ $(srcdir)/foo \
+ @srcdir@/foo2 \
+ @srcdir@/bar.test \
+ ${srcdir}/sub/baz.test \
+ built.test
+
+XFAIL_TESTS = $(srcdir)/bar.test foo2
+
+built.test:
+ (echo '#!/bin/sh' && echo 'exit 77') >$@-t
+ chmod a-w,a+x $@-t && mv -f $@-t $@
END
-cat > foo.test <<'END'
-#! /bin/sh
-echo :test-result:XFAIL
-echo :test-result: SKIP
-echo :test-result:ERROR
+cat > foo <<'END'
+#!/bin/sh
exit 0
END
-cat > bar.test <<'END'
-#! /bin/sh
-echo :test-result: ERROR
-echo :test-result:FAIL
-echo :test-result: XPASS
-exit 0
+chmod a+x foo
+
+cat > foo2 <<'END'
+#!/bin/sh
+exit 1
END
-chmod a+x foo.test bar.test
+chmod a+x foo2
+
+cp foo2 bar.test
+
+mkdir sub
+cp foo sub/baz.test
$ACLOCAL
$AUTOCONF
./configure
-for files in \
- 'foo.log bar.log' \
- 'foo.trs bar.trs' \
- 'foo.trs bar.log' \
- 'foo.log bar.trs' \
-; do
+doit ()
+{
+ rm -f $*
$MAKE check
rm -f test-suite.log
- chmod a-r $files
- $MAKE test-suite.log || { ls -l; exit 1; }
- ls -l
- grep '^foofoofoo$' foo.log
- grep '^:test-result: PASS' foo.trs
- grep '^barbarbar$' bar.log
- grep '^:test-result: SKIP' bar.trs
- grep '^SKIP: bar' test-suite.log
- grep '^barbarbar$' test-suite.log
- $EGREP ':.*foo|foofoofoo' test-suite.log && exit 1
- : For shells with busted 'set -e'.
+ chmod a-r $*
- $MAKE test-suite.log 2>stderr && { cat stderr >&2; Exit 1; }
++ $MAKE test-suite.log 2>stderr && { cat stderr >&2; exit 1; }
+ cat stderr >&2
+}
+
+could_not_read ()
+{
+ # We have to settle for weak checks to avoid spurious failures due to
+ # the differences in error massages on different systems; for example:
+ #
+ # $ cat unreadable-file # GNU/Linux or NetBSD
+ # cat: unreadable-file: Permission denied
+ # $ cat unreadable-file # Solaris 10
+ # cat: cannot open unreadable
+ #
+ # $ grep foo unreadable-file # GNU/Linux and NetBSD
+ # grep: unreadable: Permission denied
+ # $ grep foo unreadable-file # Solaris 10
+ # grep: can't open "unreadable"
+ #
+ # Plus, we must cater to error messages displayed by our own awk
+ # script: "cannot read "unreadable"".
+ #
+ # FIXME: this might still needs adjustments on other systems ...
+ #
+ grep "$1:.*[pP]ermission denied" stderr \
+ || $EGREP "can(no|')t (open|read) [\"'\`]?$1" stderr
+}
+
+for lst in bar.log 'foo.log bar.log'; do
+ doit $lst
+ could_not_read bar.log
+ grep 'test-suite\.log:.* I/O error reading test results' stderr
done
+doit foo.trs
+could_not_read foo.trs
+grep 'test-suite\.log:.* I/O error reading test results' stderr
+
+doit foo.trs bar.trs
+could_not_read foo.trs
+could_not_read bar.trs
+grep 'test-suite\.log:.* I/O error reading test results' stderr
+
+doit foo.trs bar.log
+could_not_read foo.trs
+grep 'test-suite\.log:.* I/O error reading test results' stderr
+
:
# - log files, and what goes in 'test-suite.log'
# - make clean
# - dependencies between tests
-# - TESTS redefinition at runtime
-# - TEST_LOGS redefinition at runtime
-# - RECHECK_LOGS redefinition at runtime
+# - TESTS redefinition at runtime (with and without test suffixes)
+# - AM_LAZY_CHECK
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_OUTPUT
# Check dependencies: baz.test needs to run before bar.test,
# but foo.test is not needed.
-# Note that this usage has a problem: the summary will only
-# take bar.log into account, because the $(TEST_SUITE_LOG) rule
-# does not "see" baz.log. Hmm.
-env TESTS='bar.test' $MAKE -e check >stdout && { cat stdout; exit 1; }
+# FIXME: Note that this usage has a problem: the summary will only
+# FIXME: take bar.log into account, because the $(TEST_SUITE_LOG)
+# FIXME: rule does not "see" baz.log. Hmm.
- $MAKE check TESTS=bar.test >stdout && { cat stdout; Exit 1; }
++$MAKE check TESTS=bar.test >stdout && { cat stdout; exit 1; }
cat stdout
grep '^FAIL: baz\.test$' stdout
grep '^ERROR: bar\.test$' stdout
# Note that the previous test and this one taken together expose the timing
# issue that requires the check-TESTS rule to always remove TEST_SUITE_LOG
# before running the tests lazily.
- $MAKE check AM_LAZY_CHECK=yes > stdout && { cat stdout; Exit 1; }
-env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; }
++$MAKE check AM_LAZY_CHECK=yes > stdout && { cat stdout; exit 1; }
cat stdout
test -f foo.log
grep '^PASS: foo\.test$' stdout
# Now, explicitly retry with all test logs already updated, and ensure
# that the summary is still displayed.
- $MAKE check AM_LAZY_CHECK=yes > stdout && { cat stdout; Exit 1; }
-env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; }
++$MAKE check AM_LAZY_CHECK=yes > stdout && { cat stdout; exit 1; }
cat stdout
- grep foo.test stdout && Exit 1
- grep bar.test stdout && Exit 1
- grep baz.test stdout && Exit 1
+ grep foo.test stdout && exit 1
+ grep bar.test stdout && exit 1
+ grep baz.test stdout && exit 1
grep '^# PASS: *1$' stdout
grep '^# FAIL: *1$' stdout
grep '^# ERROR: *1$' stdout
-# Lazily rerunning only foo should only rerun this one test.
-env RECHECK_LOGS=foo.log $MAKE -e check > stdout && { cat stdout; exit 1; }
-cat stdout
-grep foo.test stdout
-grep bar.test stdout && exit 1
-grep baz.test stdout && exit 1
-grep '^# PASS: *1$' stdout
-grep '^# FAIL: *1$' stdout
-grep '^# ERROR: *1$' stdout
-
$MAKE clean
- $MAKE check TESTS=baz > stdout && { cat stdout; Exit 1; }
-env TEST_LOGS=baz.log $MAKE -e check > stdout && { cat stdout; exit 1; }
++$MAKE check TESTS=baz > stdout && { cat stdout; exit 1; }
cat stdout
- grep foo.test stdout && Exit 1
- grep bar.test stdout && Exit 1
+ grep foo.test stdout && exit 1
+ grep bar.test stdout && exit 1
grep baz.test stdout
$MAKE clean
- $MAKE check TESTS=baz.test > stdout && { cat stdout; Exit 1; }
-env TESTS=baz.test $MAKE -e check > stdout && { cat stdout; exit 1; }
++$MAKE check TESTS=baz.test > stdout && { cat stdout; exit 1; }
cat stdout
- grep foo.test stdout && Exit 1
- grep bar.test stdout && Exit 1
+ grep foo.test stdout && exit 1
+ grep bar.test stdout && exit 1
grep baz.test stdout
:
# Actually, this test doesn't ensure that things happen concurrently.
# It merely serves as demonstration. :-)
-required='cc native GNUmake'
+required='cc native'
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_PROG_CC
# Check parallel-tests features:
# - empty TESTS
-# BSD make will expand '$(TESTS:=.log)' to '.log' unless overridden.
# See parallel-tests10.test for a similar issue.
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >> configure.ac << 'END'
-AC_OUTPUT
-END
- cat >> configure.ac << 'END'
- AC_OUTPUT
-cat > Makefile.am << 'END'
-TESTS =
--END
++echo AC_OUTPUT >> configure.ac
+
- cat > Makefile.am << 'END'
- TESTS =
- END
++echo TESTS = > Makefile.am
$ACLOCAL
$AUTOCONF
grep "^# $x: *0$" stdout
done
- Exit 0
-exit 0
++:
# 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 parallel-tests features:
-# - generated distributed tests.
-# - listing $(srcdir)/ or $(top_srcdir)/ in TESTS doesn't work ATM,
-# and is thus diagnosed.
-
-# TODO: this test should also ensure that the 'make' implementation
-# properly adheres to rules in all cases. See the Autoconf
-# manual for the ugliness in this area, when VPATH comes into
-# play. :-/
+# Check parallel-tests features: generated distributed tests.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_OUTPUT
# 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 a documented limitation of the Automake's Makefile parser
-# w.r.t. POSIX variable substitutions used in the name of targets.
-# See Section "General Operation" in the Automake manual.
-# If you cause some parts of this test to fail, chances are that you've
-# improved the Automake parser ;-)
-# See: <http://lists.gnu.org/archive/html/automake/2010-08/msg00074.html>
-# or: <http://thread.gmane.org/gmane.comp.sysutils.automake.general/11943/focus=11962>
+# Automake do not complain about nor messes up pattern rules.
- . ./defs || Exit 1
+ . ./defs || exit 1
+echo AC_OUTPUT >> configure.ac
+
cat > Makefile.am <<'END'
-$(FOO:=x): bar
+foo/%.out: bar/%.in
+ test -d $(dir $@) || $(MKDIR_P) $(dir $@)
+ cp $< $@
+%.sh: %/z
+ cp $< $@
+%:
+ echo True > $@
+noinst_DATA = foo/one.out
+noinst_SCRIPTS = two.sh mu.py
END
+mkdir bar two
+echo "123456789" > bar/one.in
+echo "#!/bin/sh" > two/z
+
$ACLOCAL
-AUTOMAKE_fails
+$AUTOCONF
+$AUTOMAKE
-grep 'bad characters.*variable name.*\$(FOO' stderr
-grep ':=.*assignments.*not portable' stderr
+for vpath in : false; do
+ if $vpath; then
+ mkdir build
+ cd build
+ srcdir=..
+ else
+ srcdir=.
+ fi
+ $srcdir/configure
+ $MAKE
+ diff $srcdir/bar/one.in ./foo/one.out
+ diff $srcdir/two/z ./two.sh
+ test `cat mu.py` = True
+ cd $srcdir
+done
:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 1999-2012 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 executable-specific and library-specific flags, both with
+# and without dependency tracking.
+
- $FGREP ')-c' $makefiles && Exit 1
++. ./defs || exit 1
+
+cat > configure.ac << END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([-Wno-extra-portability])
+AC_CONFIG_FILES([Makefile libMakefile Makefile2 libMakefile2])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_CXX
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+$ACLOCAL
+
+makefiles='Makefile libMakefile Makefile2 libMakefile2'
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c
+foo_CFLAGS = -DBAR
+END
+
+cat > libMakefile.am << 'END'
+lib_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c bar.cc
+libfoo_a_CFLAGS = -DBAR
+libfoo_a_CXXFLAGS = -DZOT
+END
+
+cat - Makefile.am > Makefile2.am << 'END'
+AUTOMAKE_OPTIONS = no-dependencies
+END
+
+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
+
+: > compile
+$AUTOMAKE
+
+# Regression test for missing space.
- $FGREP '.o.o' $makefiles && Exit 1
- $FGREP '.obj.obj' $makefiles && Exit 1
- $FGREP '.$(OBJEXT).$(OBJEXT)' $makefiles && Exit 1
++$FGREP ')-c' $makefiles && exit 1
+
+# Regression test for botchedly transformed object names.
- $EGREP '[^-](foo|bar)\.[o$]' $makefiles && Exit 1
++$FGREP '.o.o' $makefiles && exit 1
++$FGREP '.obj.obj' $makefiles && exit 1
++$FGREP '.$(OBJEXT).$(OBJEXT)' $makefiles && exit 1
+
+# Watch against non-transformed "foo.$(OBJEXT)", "foo.o" and "foo.obj"
+# (and similarly for bar).
- grep 'COMPILE. [^-]' $makefiles && Exit 1
- grep 'COMPILE. .[^c]' $makefiles && Exit 1
++$EGREP '[^-](foo|bar)\.[o$]' $makefiles && exit 1
+
+# All our programs and libraries have per-target flags, so all
+# the compilers invocations must use an explicit '-c' option.
++grep 'COMPILE. [^-]' $makefiles && exit 1
++grep 'COMPILE. .[^c]' $makefiles && exit 1
+
+$FGREP 'foo-foo.$(OBJEXT)' Makefile.in
+$FGREP 'foo-foo.$(OBJEXT)' Makefile2.in
+$FGREP 'libfoo_a-foo.$(OBJEXT)' libMakefile.in
+$FGREP 'libfoo_a-foo.$(OBJEXT)' libMakefile2.in
+$FGREP 'libfoo_a-bar.$(OBJEXT)' libMakefile.in
+$FGREP 'libfoo_a-bar.$(OBJEXT)' libMakefile2.in
+
+$FGREP '$(foo_CFLAGS)' Makefile.in
+$FGREP '$(foo_CFLAGS)' Makefile2.in
+$FGREP '$(libfoo_a_CFLAGS)' libMakefile.in
+$FGREP '$(libfoo_a_CFLAGS)' libMakefile2.in
+
+:
# == Report ==
# When AC_CONFIG_AUX_DIR is set (in my case to 'support'), make dist
# no longer automatically includes config.guess, config.sub, install-sh,
-# ltconfig, ltmain.sh, mdate-sh, missing, and mkinstalldirs. In fact,
-# the entire 'support/' directory is omitted.
+# ltconfig, ltmain.sh, mdate-sh, and missing. In fact, the entire
+# 'support/' directory is omitted.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat > configure.ac << END
AC_INIT([$me], [1.0])
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Check that the "all" target triggers rebuilt of outdated Makefiles.
-# See also sister test 'remake-all-2.test'.
- . ./defs || Exit 1
+ . ./defs || exit 1
mkfile=Makefile
: > sub/$mkfile.am
$ACLOCAL
+$AUTOCONF
$AUTOMAKE
-$EGREP "^all-am:.* $mkfile( |$)" $mkfile.in sub/$mkfile.in
-
-$AUTOCONF
./configure
- $FGREP "$magic1" mkfile.in && Exit 1 # Sanity check.
+ $FGREP "$magic1" mkfile.in && exit 1 # Sanity check.
# Two code paths in configure.am:
# See also the other similar tests 'remake-subdir*.test', and the
# related test 'aclocal5.test'
- . ./defs || Exit 1
-required=GNUmake
+ . ./defs || exit 1
magic1='::MagicString::One::'
magic2='__MagicString__Two__'
# See also the other similar tests 'remake-subdir*.test', and the
# related test 'aclocal5.test'.
- . ./defs || Exit 1
+ . ./defs || exit 1
-if using_gmake; then
- remake=$MAKE
-else
- remake="$MAKE Makefile"
-fi
-
magic1='::MagicString::One::'
magic2='__MagicString__Two__'
$sleep
echo "m4_define([my_fingerprint], [DummyValue])" > $top_srcdir/foo.m4
- using_gmake || $remake
$MAKE distcheck
- $FGREP $magic1 Makefile && Exit 1 # Sanity check.
- $FGREP $magic2 Makefile && Exit 1 # Likewise.
- $FGREP $magic3 Makefile && Exit 1 # Likewise.
+ $FGREP $magic1 Makefile && exit 1 # Sanity check.
+ $FGREP $magic2 Makefile && exit 1 # Likewise.
+ $FGREP $magic3 Makefile && exit 1 # Likewise.
$MAKE distclean
$sleep
echo "FINGERPRINT = DummyValue" > $top_srcdir/foo.am
- using_gmake || $remake
$MAKE distcheck
- $FGREP $magic1 Makefile && Exit 1 # Sanity check.
- $FGREP $magic2 Makefile && Exit 1 # Likewise.
- $FGREP $magic3 Makefile && Exit 1 # Likewise.
+ $FGREP $magic1 Makefile && exit 1 # Sanity check.
+ $FGREP $magic2 Makefile && exit 1 # Likewise.
+ $FGREP $magic3 Makefile && exit 1 # Likewise.
$MAKE distclean
$sleep
echo "AC_DEFUN([my_fingerprint], [DummyValue])" > $top_srcdir/m4/foo.m4
echo "AC_DEFUN([AM_UNUSED], [NoSuchMacro])" > $top_srcdir/m4/bar.m4
- using_gmake || $remake
$MAKE distcheck
- $FGREP $magic1 Makefile && Exit 1 # Sanity check.
- $FGREP $magic2 Makefile && Exit 1 # Likewise.
- $FGREP $magic3 Makefile && Exit 1 # Likewise.
+ $FGREP $magic1 Makefile && exit 1 # Sanity check.
+ $FGREP $magic2 Makefile && exit 1 # Likewise.
+ $FGREP $magic3 Makefile && exit 1 # Likewise.
$MAKE distclean
END
mv -f t zardoz.am
cat zardoz.am # For debugging.
-if using_gmake; then
- $MAKE nil
-else
- $MAKE zardoz
-fi
+$MAKE nil
$FGREP my-check zardoz # Sanity check.
- $FGREP $magic1 zardoz zardoz.in && Exit 1
+ $FGREP $magic1 zardoz zardoz.in && exit 1
$FGREP $magic2 zardoz
$FGREP $magic2 zardoz.in
echo 'FOO = dummy' >> quux.am
echo 'BAR = $(BAZ)' > top.in
echo "BAZ = $magic3" > bot.in
-is_gmake || $MAKE zardoz
$MAKE test
$FGREP my-check zardoz # Sanity check.
- $FGREP $magic3 quux.in && Exit 1
+ $FGREP $magic3 quux.in && exit 1
$FGREP $magic3 zardoz
- $FGREP $magic1 zardoz && Exit 1
- $FGREP $magic2 zardoz && Exit 1
+ $FGREP $magic1 zardoz && exit 1
+ $FGREP $magic2 zardoz && exit 1
# After the remake above, the files 'zardoz.am' and 'zardoz.in'
# should be no more needed.
echo 'endif' > zardoz.am # Put in a syntax error.
# but not all.
# Report from Ralf Corsepius.
- . ./defs || Exit 1
+ . ./defs || exit 1
-if using_gmake; then
- remake="$MAKE"
-else
- remake="$MAKE Makefile"
-fi
-
cat >>configure.ac <<'EOF'
AM_MAINTAINER_MODE
m4_include([foo.m4])
grep 'AUTOCONF.*=.*false' Makefile
: > rebuild_ok
./configure --no-create
-$remake
+$MAKE
- grep 'AUTOCONF.*=.*false' Makefile && Exit 1
+ grep 'AUTOCONF.*=.*false' Makefile && exit 1
# Make sure rebuild rules do work if --enable-maintainer-mode is given.
./configure --enable-maintainer-mode
$sleep
echo 'sed "s/^\\(FINGERPRINT\\)=.*/\\1='$magic2'/"' \
> $srcdir/tweak-configure-in
- remake_
+ $MAKE nil
$FGREP FINGERPRINT Makefile # For debugging.
- $FGREP $magic1 Makefile && Exit 1
+ $FGREP $magic1 Makefile && exit 1
$FGREP $magic2 Makefile
test x"$(./foo.sh)" = x"$magic2"
echo cat > $srcdir/tweak-configure-in # Make it a no-op again.
sed "s/^\\(FINGERPRINT\\)=.*/\\1=DummyValue/" $srcdir/configure.ac >t
mv -f t $srcdir/configure.ac
- using_gmake || remake_
$MAKE distcheck
- $FGREP $magic1 Makefile && Exit 1 # Sanity check.
- $FGREP $magic2 Makefile && Exit 1 # Likewise.
+ $FGREP $magic1 Makefile && exit 1 # Sanity check.
+ $FGREP $magic2 Makefile && exit 1 # Likewise.
$MAKE distclean
# Test remake rules when Makefile.am or its prerequisites change.
# Keep in sync with the other sister tests 'remake9*.test'.
- . ./defs || Exit 1
+ . ./defs || exit 1
-if using_gmake; then
- remake_() { $MAKE nil; }
-else
- remake_() { $MAKE Makefile && $MAKE foo.sh; }
-fi
-
magic1=::MagicStringOne::
magic2=__MagicStringTwo__
$sleep
echo 'sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = '$magic2'/"' \
> $srcdir/tweak-makefile-am
- remake_
+ $MAKE nil
$FGREP FINGERPRINT Makefile # For debugging.
- $FGREP $magic1 Makefile && Exit 1
+ $FGREP $magic1 Makefile && exit 1
$FGREP $magic2 Makefile
test x"$(./foo.sh)" = x"$magic2"
echo cat > $srcdir/tweak-makefile-am # Make it a no-op again.
sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = DummyValue/" $srcdir/Makefile.am >t
mv -f t $srcdir/Makefile.am
- using_gmake || remake_
$MAKE distcheck
- $FGREP $magic1 Makefile && Exit 1 # Sanity check.
- $FGREP $magic2 Makefile && Exit 1 # Likewise.
+ $FGREP $magic1 Makefile && exit 1 # Sanity check.
+ $FGREP $magic2 Makefile && exit 1 # Likewise.
$MAKE distclean
$sleep
echo "echo 'AC_DEFUN([my_fingerprint], [$magic2])'" \
> $srcdir/tweak-acinclude-m4
- remake_
+ $MAKE nil
$FGREP FINGERPRINT Makefile # For debugging.
- $FGREP $magic1 Makefile && Exit 1
+ $FGREP $magic1 Makefile && exit 1
$FGREP $magic2 Makefile
test x"$(./foo.sh)" = x"$magic2"
$sleep
echo : > $srcdir/tweak-acinclude-m4 # Make it a no-op again.
echo "AC_DEFUN([my_fingerprint], [DummyValue])" > $srcdir/acinclude.m4
- using_gmake || remake_
$MAKE distcheck
- $FGREP $magic1 Makefile && Exit 1 # Sanity check.
- $FGREP $magic2 Makefile && Exit 1 # Likewise.
+ $FGREP $magic1 Makefile && exit 1 # Sanity check.
+ $FGREP $magic2 Makefile && exit 1 # Likewise.
$MAKE distclean
$sleep
echo "sed 's/.*dnl *%%%.*/AC_DEFUN([my_fingerprint], [$magic2])/'" \
> $srcdir/tweak-aclocal-m4
- remake_
+ $MAKE nil
$FGREP FINGERPRINT Makefile # For debugging.
- $FGREP $magic1 Makefile && Exit 1
+ $FGREP $magic1 Makefile && exit 1
$FGREP $magic2 Makefile
test x"$(./foo.sh)" = x"$magic2"
$sleep
echo cat > $srcdir/tweak-aclocal-m4 # Make it a no-op again.
echo 'AC_DEFUN([my_fingerprint], [DummyValue])' >> $srcdir/aclocal.m4
- using_gmake || remake_
$MAKE distcheck
- $FGREP $magic1 Makefile && Exit 1 # Sanity check.
- $FGREP $magic2 Makefile && Exit 1 # Likewise.
+ $FGREP $magic1 Makefile && exit 1 # Sanity check.
+ $FGREP $magic2 Makefile && exit 1 # Likewise.
$MAKE distclean
# Check that automake does not complain on repeated options, nor
# generate broken or incorrect makefiles.
-required='cc bzip2'
+required=bzip2
- . ./defs || Exit 1
+ . ./defs || exit 1
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
+AM_INIT_AUTOMAKE([foreign foreign dist-bzip2 no-dist-gzip dist-bzip2])
- AC_PROG_CC
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
END
cat > Makefile.am <<'END'
-AUTOMAKE_OPTIONS = parallel-tests subdir-objects subdir-objects
-AUTOMAKE_OPTIONS += dist-bzip2 parallel-tests
-TESTS = foo.test
-EXTRA_DIST = $(TESTS)
-TESTS_ENVIRONMENT = EXEEXT='$(EXEEXT)'
-bin_PROGRAMS = sub/foo
-.PHONY: test-build
-test-build:
- ls -l . sub
- test -f sub/foo.$(OBJEXT)
- test -f sub/foo$(EXEEXT)
+AUTOMAKE_OPTIONS = no-dist-gzip no-dist-gzip dist-bzip2
+AUTOMAKE_OPTIONS += dist-bzip2 foreign
END
-mkdir sub
-
-cat > foo.test <<'END'
-#!/bin/sh
-test -f sub/foo$EXEEXT && test -x sub/foo$EXEEXT
-END
-chmod a+x foo.test
-
-cat > sub/foo.c <<'END'
-int main (void)
-{
- return 0;
-}
-END
-
-cp "$am_scriptdir"/compile "$am_scriptdir"/test-driver .
-
$ACLOCAL
-$AUTOMAKE --foreign --foreign -Wall 2>stderr || { cat stderr >&2; exit 1; }
-test -s stderr && { cat stderr >&2; exit 1; }
-rm -f stderr
$AUTOCONF
- || { cat stderr >&2; Exit 1; }
+$AUTOMAKE --foreign --foreign -Wall 2>stderr && test ! -s stderr \
++ || { cat stderr >&2; exit 1; }
./configure
+
$MAKE
-$MAKE test-build
-$MAKE check
-ls -l
-test -f foo.log
-test -f test-suite.log
-$MAKE clean
$MAKE distcheck
-ls -l
test -f $me-1.0.tar.bz2
test ! -r $me-1.0.tar.gz
do_check 'do not create nor chdir in testdir' \
'am_create_testdir=no' \
- 'test ! -d t/_self.dir || Exit 1
- test ! -f t/_self.dir || Exit 1
- test ! -r t/_self.dir || Exit 1
- grep "compare-autodiffs" Makefile || Exit 1
- case $(pwd) in '"$cwd"') : ;; *) Exit 1;; esac'
+ 'test ! -d t/_self.dir || exit 1
+ test ! -f t/_self.dir || exit 1
+ test ! -r t/_self.dir || exit 1
- grep "self-check-dir\.tap" Makefile || exit 1
++ grep "compare-autodiffs" Makefile || exit 1
+ case $(pwd) in '"$cwd"') : ;; *) exit 1;; esac'
:
hasnt_parallel_tests ()
{
- $EGREP -i 'test_suite_log|test_(logs|bases)|\.log.*:' $1 && Exit 1
- grep 'recheck.*:' $1 && Exit 1
- $EGREP 'TEST_SUITE_LOG|TEST_LOGS|\.log.*:' $1 && exit 1
++ $EGREP -i 'test_suite_log|test_(logs|bases)|\.log.*:' $1 && exit 1
+ grep 'recheck.*:' $1 && exit 1
- grep '^check-TESTS: \$(TESTS)$' $1
+ grep '^check-TESTS: \$(am__cooked_tests)$' $1
}
has_parallel_tests ()
# Check silent-rules mode for Lex.
required='cc lex'
- . ./defs || Exit 1
+ . ./defs || exit 1
-mkdir sub
-
cat >>configure.ac <<'EOF'
AM_PROG_CC_C_O
AC_PROG_LEX
$AUTOCONF
# Ensure per-target rules are used, to ensure their coverage below.
- $FGREP 'foo2-foo.c' Makefile.in || Exit 99
+ $FGREP 'foo2-foo.c' Makefile.in || exit 99
-$FGREP 'bar2-bar.c' sub/Makefile.in || exit 99
./configure --enable-silent-rules
- $MAKE >stdout || { cat stdout; Exit 1; }
+ $MAKE >stdout || { cat stdout; exit 1; }
cat stdout
- $EGREP ' (-c|-o)' stdout && Exit 1
- $EGREP '(mv|ylwrap) ' stdout && Exit 1
+ $EGREP ' (-c|-o)' stdout && exit 1
+ $EGREP '(mv|ylwrap) ' stdout && exit 1
grep 'LEX .*foo\.' stdout
-grep 'LEX .*bar\.' stdout
grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
grep 'CCLD .*foo1' stdout
-grep 'CCLD .*bar1' stdout
grep 'CCLD .*foo2' stdout
-grep 'CCLD .*bar2' stdout
# Cleaning and then rebuilding with the same V flag (and without
# removing the generated sources in between) shouldn't trigger a
# Ensure a truly clean rebuild.
$MAKE clean
-rm -f *foo.c sub/*bar.c
+rm -f *foo.c
- $MAKE V=1 >stdout || { cat stdout; Exit 1; }
+ $MAKE V=1 >stdout || { cat stdout; exit 1; }
cat stdout
grep ' -c ' stdout
mv -f t stdout
cat stdout
- $EGREP ' (-c|-o)' stdout && Exit 1
- $EGREP '(mv|ylwrap) ' stdout && Exit 1
+ $EGREP ' (-c|-o)' stdout && exit 1
+ $EGREP '(mv|ylwrap) ' stdout && exit 1
+ grep ' CC .*bar\.' stdout
grep 'CXX .*foo1\.' stdout
- grep 'CXX .*baz1\.' stdout
- grep 'FC .*foo2\.' stdout
- grep 'FC .*baz2\.' stdout
+ grep ' FC .*foo2\.' stdout
grep 'F77 .*foo3\.' stdout
- grep 'F77 .*baz3\.' stdout
grep ' CC .*foo5\.' stdout
- grep ' CC .*baz5\.' stdout
grep ' CC .*foo6\.' stdout
- grep ' CC .*baz6\.' stdout
grep 'CXXLD .*foo' stdout
- grep 'CCLD .*bar' stdout
+ grep ' CCLD .*bar' stdout
grep 'CXXLD .*baz' stdout
- grep 'CCLD .*bla' stdout
if ! $rebuild; then
grep 'YACC .*foo6\.' stdout
$FGREP am_cv_CXX_dependencies_compiler_type configure
# Ensure per-target rules are used, to ensure their coverage below.
# (We do not do an exhaustive check, that wouldn't be practical).
- $FGREP 'bar-bar.$(OBJEXT)' Makefile.in || Exit 99
- $FGREP 'baz-foo5.c' Makefile.in || Exit 99
- $FGREP 'baz-foo6.c' Makefile.in || Exit 99
-$FGREP 'bar-bar.o' Makefile.in
-$FGREP 'fo2-foo5.c' Makefile.in
-$FGREP 'fo2-foo6.c' Makefile.in
++$FGREP 'bar-bar.$(OBJEXT)' Makefile.in || exit 99
++$FGREP 'baz-foo5.c' Makefile.in || exit 99
++$FGREP 'baz-foo6.c' Makefile.in || exit 99
# Force gcc ("fast") depmode.
depmodes="am_cv_CC_dependencies_compiler_type=gcc \
mv -f t stdout
cat stdout
- $EGREP ' (-c|-o)' stdout && Exit 1
- $EGREP '(mv|ylwrap) ' stdout && Exit 1
+ $EGREP ' (-c|-o)' stdout && exit 1
+ $EGREP '(mv|ylwrap) ' stdout && exit 1
+ grep ' CC .*bar\.' stdout
grep 'CXX .*foo1\.' stdout
- grep 'CXX .*baz1\.' stdout
- grep 'FC .*foo2\.' stdout
- grep 'FC .*baz2\.' stdout
+ grep ' FC .*foo2\.' stdout
grep 'F77 .*foo3\.' stdout
- grep 'F77 .*baz3\.' stdout
grep ' CC .*foo5\.' stdout
- grep ' CC .*baz5\.' stdout
grep ' CC .*foo6\.' stdout
- grep ' CC .*baz6\.' stdout
grep 'CXXLD .*foo' stdout
- grep 'CCLD .*bar' stdout
+ grep ' CCLD .*bar' stdout
grep 'CXXLD .*baz' stdout
- grep 'CCLD .*bla' stdout
if ! $rebuild; then
grep 'YACC .*foo6\.' stdout
# Ensure per-target rules are used, to ensure their coverage below.
# (We do not do an exhaustive check, that wouldn't be practical).
- $FGREP 'bar-bar.$(OBJEXT)' Makefile.in || Exit 99
- $FGREP 'baz-foo5.c' Makefile.in || Exit 99
- $FGREP 'baz-foo6.c' Makefile.in || Exit 99
-$FGREP 'bar-bar.o' Makefile.in
-$FGREP 'fo2-foo5.c' Makefile.in
-$FGREP 'fo2-foo6.c' Makefile.in
++$FGREP 'bar-bar.$(OBJEXT)' Makefile.in || exit 99
++$FGREP 'baz-foo5.c' Makefile.in || exit 99
++$FGREP 'baz-foo6.c' Makefile.in || exit 99
# Force dependency tracking explicitly, so that slow dependency
# extractors are not rejected. Try also with dependency tracking
--- /dev/null
- . ./defs || Exit 1
+#!/bin/sh
+# Copyright (C) 2009-2012 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 texinfo rules in silent-rules mode.
+
+required='makeinfo tex texi2dvi dvips'
- stdout stderr && Exit 1
++. ./defs || exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am <<'EOF'
+info_TEXINFOS = foo.texi sub/zardoz.texi
+EOF
+
+cat > foo.texi <<'EOF'
+\input texinfo
+@setfilename foo.info
+@settitle foo manual
+@bye
+EOF
+
+mkdir sub
+cat > sub/zardoz.texi <<'EOF'
+\input texinfo
+@setfilename zardoz.info
+@settitle zardoz manual
+@bye
+EOF
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure --disable-silent-rules
+
+# Silent mode output.
+st=0
+$MAKE V=0 dvi html info ps pdf >stdout 2>stderr || st=$?
+cat stdout
+cat stderr >&2
+test $st -eq 0
+grep '^ DVIPS foo\.ps$' stdout
+grep '^ MAKEINFO foo\.html$' stdout
+grep '^ MAKEINFO foo\.info$' stdout
+grep '^ TEXI2DVI foo\.dvi$' stdout
+grep '^ TEXI2PDF foo\.pdf$' stdout
+grep '^ DVIPS sub/zardoz.ps$' stdout
+grep '^ MAKEINFO sub/zardoz.html$' stdout
+grep '^ MAKEINFO sub/zardoz.info$' stdout
+grep '^ TEXI2DVI sub/zardoz.dvi$' stdout
+grep '^ TEXI2PDF sub/zardoz.pdf$' stdout
+# No make recipe is displayed before being executed.
+$EGREP 'texi2(dvi|pdf)|dvips|makeinfo|(rm|mv) ' \
- stdout stderr && Exit 1
++ stdout stderr && exit 1
+# No verbose output from TeX nor dvips.
+$EGREP '(zardoz|foo)\.log|3\.14|Copyright|This is|[Oo]utput ' \
- $MAKE clean || Exit 1
- $MAKE V=1 dvi html info ps pdf >output 2>&1 || { cat output; Exit 1; }
++ stdout stderr && exit 1
+
+# Verbose mode output.
- $EGREP '(DVIPS|MAKEINFO|TEXI2(PDF|DVI)) ' output && Exit 1
++$MAKE clean || exit 1
++$MAKE V=1 dvi html info ps pdf >output 2>&1 || { cat output; exit 1; }
+cat output
++$EGREP '(DVIPS|MAKEINFO|TEXI2(PDF|DVI)) ' output && exit 1
+# Verbose output from TeX.
+grep '[Oo]utput .*foo\.pdf' output
+grep '[Oo]utput .*zardoz\.pdf' output
+$FGREP 'foo.log' output
+$FGREP 'zardoz.log' output
+# Verbose output from dvips.
+$FGREP ' dvips' output
+
+:
# Keep this in sync with sister test 'silent-yacc-gcc.test'.
required='cc yacc'
- . ./defs || Exit 1
+ . ./defs || exit 1
-mkdir sub
-
cat >>configure.ac <<'EOF'
AM_PROG_CC_C_O
AC_PROG_YACC
$AUTOCONF
# Ensure per-target rules are used, to ensure their coverage below.
- $FGREP 'foo2-foo.c' Makefile.in || Exit 99
+ $FGREP 'foo2-foo.c' Makefile.in || exit 99
-$FGREP 'bar2-bar.c' sub/Makefile.in || exit 99
./configure --enable-silent-rules
- $MAKE >stdout || { cat stdout; Exit 1; }
+ $MAKE >stdout || { cat stdout; exit 1; }
cat stdout
- $EGREP ' (-c|-o)' stdout && Exit 1
- $EGREP '(mv|ylwrap) ' stdout && Exit 1
+ $EGREP ' (-c|-o)' stdout && exit 1
+ $EGREP '(mv|ylwrap) ' stdout && exit 1
grep 'YACC .*foo\.' stdout
-grep 'YACC .*bar\.' stdout
-grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
-grep 'CCLD .*foo1' stdout
-grep 'CCLD .*bar1' stdout
-grep 'CCLD .*foo2' stdout
-grep 'CCLD .*bar2' stdout
+grep ' CC .*foo\.' stdout
+grep 'CCLD .*foo1' stdout
+grep 'CCLD .*foo2' stdout
# Cleaning and then rebuilding with the same V flag (and without
# removing the generated sources in between) shouldn't trigger a
# different set of rules.
$MAKE clean
- $MAKE >stdout || { cat stdout; Exit 1; }
+ $MAKE >stdout || { cat stdout; exit 1; }
cat stdout
- $EGREP ' (-c|-o)' stdout && Exit 1
- $EGREP '(mv|ylwrap) ' stdout && Exit 1
+ $EGREP ' (-c|-o)' stdout && exit 1
+ $EGREP '(mv|ylwrap) ' stdout && exit 1
# Don't look for YACC, as probably yacc hasn't been re-run.
-grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
-grep 'CCLD .*foo1' stdout
-grep 'CCLD .*bar1' stdout
-grep 'CCLD .*foo2' stdout
-grep 'CCLD .*bar2' stdout
+grep ' CC .*foo\.' stdout
+grep 'CCLD .*foo1' stdout
+grep 'CCLD .*foo2' stdout
# Ensure a truly clean rebuild.
$MAKE clean
-rm -f *foo.[ch] sub/*bar.[ch]
+rm -f *foo.[ch]
- $MAKE V=1 >stdout || { cat stdout; Exit 1; }
+ $MAKE V=1 >stdout || { cat stdout; exit 1; }
cat stdout
grep ' -c ' stdout
$AUTOCONF
./configure --enable-silent-rules
- $MAKE >stdout || { cat stdout; Exit 1; }
+ $MAKE >stdout || { cat stdout; exit 1; }
cat stdout
- $EGREP ' (-c|-o)|(mv|mkdir) ' stdout && Exit 1
-$EGREP ' (-c|-o)' stdout && exit 1
-grep 'mv ' stdout && exit 1
-grep 'CC .*foo\.' stdout
-grep 'CC .*bar\.' stdout
-grep 'CC .*baz\.' stdout
-grep 'CC .*bla\.' stdout
-grep 'CCLD .*foo' stdout
-grep 'CCLD .*bar' stdout
-grep 'CCLD .*baz' stdout
-grep 'CCLD .*bla' stdout
++$EGREP ' (-c|-o)|(mv|mkdir) ' stdout && exit 1
+grep ' CC *foo\.o' stdout
+grep ' CC *bar-bar\.o' stdout
+grep ' CC *sub/baz\.o' stdout
+grep ' CC *sub/sub_bla-bla\.o' stdout
+grep ' CCLD *foo' stdout
+grep ' CCLD *bar' stdout
+grep ' CCLD *sub/baz' stdout
+grep ' CCLD *sub/bla' stdout
$MAKE clean
- $MAKE V=1 >stdout || { cat stdout; Exit 1; }
+ $MAKE V=1 >stdout || { cat stdout; exit 1; }
cat stdout
grep ' -c' stdout
grep ' -o foo' stdout
- $EGREP '(CC|LD) ' stdout && Exit 1
+grep ' -o sub/baz' stdout
+ $EGREP '(CC|LD) ' stdout && exit 1
:
$AUTOCONF
./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules
- $MAKE >stdout || { cat stdout; Exit 1; }
+ $MAKE >stdout || { cat stdout; exit 1; }
cat stdout
- $EGREP ' (-c|-o)|(mv|mkdir) ' stdout && Exit 1
-$EGREP ' (-c|-o)' stdout && exit 1
-grep 'mv ' stdout && exit 1
-grep 'CC .*foo\.' stdout
-grep 'CC .*bar\.' stdout
-grep 'CC .*baz\.' stdout
-grep 'CC .*bla\.' stdout
-grep 'CCLD .*foo' stdout
-grep 'CCLD .*bar' stdout
-grep 'CCLD .*baz' stdout
-grep 'CCLD .*bla' stdout
++$EGREP ' (-c|-o)|(mv|mkdir) ' stdout && exit 1
+grep ' CC *foo\.o' stdout
+grep ' CC *bar-bar\.o' stdout
+grep ' CC *sub/baz\.o' stdout
+grep ' CC *sub/sub_bla-bla\.o' stdout
+grep ' CCLD *foo' stdout
+grep ' CCLD *bar' stdout
+grep ' CCLD *sub/baz' stdout
+grep ' CCLD *sub/bla' stdout
$MAKE clean
- $MAKE V=1 >stdout || { cat stdout; Exit 1; }
+ $MAKE V=1 >stdout || { cat stdout; exit 1; }
cat stdout
grep ' -c' stdout
grep ' -o foo' stdout
- $EGREP '(CC|LD) ' stdout && Exit 1
+grep ' -o sub/baz' stdout
+ $EGREP '(CC|LD) ' stdout && exit 1
:
$AUTOCONF
./configure --enable-silent-rules
- $MAKE >stdout || { cat stdout; Exit 1; }
+ $MAKE >stdout || { cat stdout; exit 1; }
cat stdout
- $EGREP ' (-c|-o)|(mv|mkdir) ' stdout && Exit 1
-$EGREP ' (-c|-o)' stdout && exit 1
-grep 'mv ' stdout && exit 1
-grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
-grep ' CC .*baz\.' stdout
-grep ' CC .*bla\.' stdout
-grep ' CCLD .*foo' stdout
-grep ' CCLD .*bar' stdout
-grep ' CCLD .*baz' stdout
-grep ' CCLD .*bla' stdout
++$EGREP ' (-c|-o)|(mv|mkdir) ' stdout && exit 1
+grep ' CC *libfoo\.lo' stdout
+grep ' CC *libbar_la-libbar\.lo' stdout
+grep ' CC *sub/libbaz\.lo' stdout
+grep ' CC *sub/sub_libbla_la-libbla\.lo' stdout
+grep ' CCLD *libfoo\.la' stdout
+grep ' CCLD *libbar\.la' stdout
+grep ' CCLD *sub/libbaz\.la' stdout
+grep ' CCLD *sub/libbla\.la' stdout
$MAKE clean
- $MAKE V=1 >stdout || { cat stdout; Exit 1; }
+ $MAKE V=1 >stdout || { cat stdout; exit 1; }
cat stdout
grep ' -c' stdout
grep ' -o libfoo' stdout
+grep ' -o sub/libbaz' stdout
# The libtool command line can contain e.g. a '--tag=CC' option.
- sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && Exit 1
+ sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && exit 1
:
$AUTOCONF
./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules
- $MAKE >stdout || { cat stdout; Exit 1; }
+ $MAKE >stdout || { cat stdout; exit 1; }
cat stdout
- $EGREP ' (-c|-o)|(mv|mkdir) ' stdout && Exit 1
-$EGREP ' (-c|-o)' stdout && exit 1
-grep 'mv ' stdout && exit 1
-grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
-grep ' CC .*baz\.' stdout
-grep ' CC .*bla\.' stdout
-grep ' CCLD .*foo' stdout
-grep ' CCLD .*bar' stdout
-grep ' CCLD .*baz' stdout
-grep ' CCLD .*bla' stdout
++$EGREP ' (-c|-o)|(mv|mkdir) ' stdout && exit 1
+grep ' CC *libfoo\.lo' stdout
+grep ' CC *libbar_la-libbar\.lo' stdout
+grep ' CC *sub/libbaz\.lo' stdout
+grep ' CC *sub/sub_libbla_la-libbla\.lo' stdout
+grep ' CCLD *libfoo\.la' stdout
+grep ' CCLD *libbar\.la' stdout
+grep ' CCLD *sub/libbaz\.la' stdout
+grep ' CCLD *sub/libbla\.la' stdout
$MAKE clean
- $MAKE V=1 >stdout || { cat stdout; Exit 1; }
+ $MAKE V=1 >stdout || { cat stdout; exit 1; }
cat stdout
grep ' -c' stdout
grep ' -o libfoo' stdout
+grep ' -o sub/libbaz' stdout
# The libtool command line can contain e.g. a '--tag=CC' option.
- sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && Exit 1
+ sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && exit 1
:
$AUTOCONF
./configure --disable-dependency-tracking --enable-silent-rules
- $MAKE >stdout || { cat stdout; Exit 1; }
+ $MAKE >stdout || { cat stdout; exit 1; }
cat stdout
- $EGREP ' (-c|-o)|(mv|mkdir) ' stdout && Exit 1
-$EGREP ' (-c|-o)' stdout && exit 1
-grep 'mv ' stdout && exit 1
-grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
-grep ' CC .*baz\.' stdout
-grep ' CC .*bla\.' stdout
-grep ' CCLD .*foo' stdout
-grep ' CCLD .*bar' stdout
-grep ' CCLD .*baz' stdout
-grep ' CCLD .*bla' stdout
++$EGREP ' (-c|-o)|(mv|mkdir) ' stdout && exit 1
+grep ' CC *libfoo\.lo' stdout
+grep ' CC *libbar_la-libbar\.lo' stdout
+grep ' CC *sub/libbaz\.lo' stdout
+grep ' CC *sub/sub_libbla_la-libbla\.lo' stdout
+grep ' CCLD *libfoo\.la' stdout
+grep ' CCLD *libbar\.la' stdout
+grep ' CCLD *sub/libbaz\.la' stdout
+grep ' CCLD *sub/libbla\.la' stdout
$MAKE clean
- $MAKE V=1 >stdout || { cat stdout; Exit 1; }
+ $MAKE V=1 >stdout || { cat stdout; exit 1; }
cat stdout
grep ' -c' stdout
grep ' -o libfoo' stdout
+grep ' -o sub/libbaz' stdout
# The libtool command line can contain e.g. a '--tag=CC' option.
- sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && Exit 1
+ sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && exit 1
:
am_cv_CXX_dependencies_compiler_type=gcc
do
./configure $config_args --enable-silent-rules
- $MAKE >stdout || { cat stdout; Exit 1; }
+ $MAKE >stdout || { cat stdout; exit 1; }
cat stdout
- $EGREP ' (-c|-o)' stdout && Exit 1
- grep 'mv ' stdout && Exit 1
+ $EGREP ' (-c|-o)' stdout && exit 1
+ grep 'mv ' stdout && exit 1
- grep 'CXX .*foo\.' stdout
- grep 'CXX .*baz\.' stdout
- grep 'CXX .*quux\.' stdout
- grep 'CXX .*bar\.' stdout
- grep 'CXXLD .*foo1' stdout
- grep 'CXXLD .*bar1' stdout
- grep 'CXXLD .*foo2' stdout
- grep 'CXXLD .*bar2' stdout
+ grep ' CXX *foo\.o' stdout
+ grep ' CXX *baz\.o' stdout
+ grep ' CXX *quux\.o' stdout
+ grep ' CXX *foo2-foo\.o' stdout
+ grep ' CXX *foo2-baz\.o' stdout
+ grep ' CXX *foo2-quux\.o' stdout
+ grep ' CXX *sub/bar\.o' stdout
+ grep ' CXX *sub/bar2-bar\.o' stdout
+ grep ' CXXLD *foo1' stdout
+ grep ' CXXLD *bar1' stdout
+ grep ' CXXLD *foo2' stdout
+ grep ' CXXLD *bar2' stdout
# Ensure a clean rebuild.
$MAKE clean
cat stdout
grep ' -c ' stdout
- grep ' -o ' stdout
+ grep ' -o quux' stdout
+ grep ' -o bar2' stdout
- $EGREP '(CC|CXX|LD) ' stdout && Exit 1
+ $EGREP '(CC|CXX|LD) ' stdout && exit 1
# Ensure a clean reconfiguration/rebuild.
$MAKE clean
--enable-dependency-tracking --disable-dependency-tracking
do
./configure $config_args --enable-silent-rules
- $MAKE >stdout || { cat stdout; Exit 1; }
+ $MAKE >stdout || { cat stdout; exit 1; }
cat stdout
- $EGREP ' (-c|-o)' stdout && Exit 1
- grep 'mv ' stdout && Exit 1
+ $EGREP ' (-c|-o)' stdout && exit 1
+ grep 'mv ' stdout && exit 1
- grep 'CXX .*foo\.' stdout
- grep 'CXX .*baz\.' stdout
- grep 'CXX .*quux\.' stdout
- grep 'CXX .*bar\.' stdout
- grep 'CXXLD .*foo1' stdout
- grep 'CXXLD .*bar1' stdout
- grep 'CXXLD .*foo2' stdout
- grep 'CXXLD .*bar2' stdout
+ grep ' CXX *foo\.o' stdout
+ grep ' CXX *baz\.o' stdout
+ grep ' CXX *quux\.o' stdout
+ grep ' CXX *foo2-foo\.o' stdout
+ grep ' CXX *foo2-baz\.o' stdout
+ grep ' CXX *foo2-quux\.o' stdout
+ grep ' CXX *sub/bar\.o' stdout
+ grep ' CXX *sub/bar2-bar\.o' stdout
+ grep ' CXXLD *foo1' stdout
+ grep ' CXXLD *bar1' stdout
+ grep ' CXXLD *foo2' stdout
+ grep ' CXXLD *bar2' stdout
# Ensure a clean rebuild.
$MAKE clean
cat stdout
grep ' -c ' stdout
- grep ' -o ' stdout
+ grep ' -o quux' stdout
+ grep ' -o bar2' stdout
- $EGREP '(CXX|LD) ' stdout && Exit 1
+ $EGREP '(CXX|LD) ' stdout && exit 1
# Ensure a clean reconfiguration/rebuild.
$MAKE clean
mv -f t stdout
cat stdout
- $EGREP ' (-c|-o)' stdout && Exit 1
- grep 'mv ' stdout && Exit 1
+ $EGREP ' (-c|-o)' stdout && exit 1
+ grep 'mv ' stdout && exit 1
-grep 'F77 .*foo\.' stdout
-grep 'F77 .*bar\.' stdout
-grep 'F77LD .*foo1' stdout
-grep 'F77LD .*bar1' stdout
-grep 'F77LD .*foo2' stdout
-grep 'F77LD .*bar2' stdout
+grep ' F77 *foo\.' stdout
+grep ' F77 *foo2-foo\.' stdout
+grep ' F77 *sub/bar\.' stdout
+grep ' F77 *sub/bar2-bar\.' stdout
+grep ' F77LD *foo1' stdout
+grep ' F77LD *foo2' stdout
+grep ' F77LD *sub/bar1' stdout
+grep ' F77LD *bar2' stdout
- $EGREP '(FC|FCLD) ' stdout && Exit 1
+ $EGREP '(FC|FCLD) ' stdout && exit 1
# Ensure a clean rebuild.
$MAKE clean
mv -f t stdout
cat stdout
- $EGREP ' (-c|-o)' stdout && Exit 1
- grep 'mv ' stdout && Exit 1
+ $EGREP ' (-c|-o)' stdout && exit 1
+ grep 'mv ' stdout && exit 1
-grep 'FC .*foo\.' stdout
-grep 'FC .*bar\.' stdout
-grep 'FCLD .*foo1' stdout
-grep 'FCLD .*bar1' stdout
-grep 'FCLD .*foo2' stdout
-grep 'FCLD .*bar2' stdout
+grep ' FC *foo\.' stdout
+grep ' FC *foo2-foo\.' stdout
+grep ' FC *sub/bar\.' stdout
+grep ' FC *sub/bar2-bar\.' stdout
+grep ' FCLD *foo1' stdout
+grep ' FCLD *foo2' stdout
+grep ' FCLD *sub/bar1' stdout
+grep ' FCLD *bar2' stdout
- $EGREP '(F77|F77LD) ' stdout && Exit 1
+ $EGREP '(F77|F77LD) ' stdout && exit 1
# Ensure a clean rebuild.
$MAKE clean
# Test to make sure misspellings in _SOURCES variables cause failure.
- . ./defs || Exit 1
+required=cc
+ . ./defs || exit 1
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
cat > Makefile.am << 'END'
bin_PROGRAMS = zardoz foo
zardoz_SOURCES = x.c
boo_SOURCES = y.c
END
+echo 'int main (void) { return 0; }' > x.c
+echo 'int main (void) { return 0; }' > y.c
+
$ACLOCAL
-AUTOMAKE_fails
-grep 'Makefile.am:3:.*boo' stderr
+$AUTOCONF
+$AUTOMAKE
+
+./configure
- $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
++$MAKE 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+
+LC_ALL=C sed 's/^Makefile:[0-9][0-9]*: //' stderr > got
+
+cat > exp << 'END'
+variable 'boo_SOURCES' is defined but no program
+ or library has 'boo' as canonical name
+*** Some Automake-NG error occurred. Stop.
+END
+
+diff exp got
+
+:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test to make sure misspellings in _SOURCES variables cause failure.
+# Test to make sure misspellings in _LDADD variable cause failure.
- . ./defs || Exit 1
+required=cc
+ . ./defs || exit 1
-echo AC_PROG_CC >> configure.ac
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
cat > Makefile.am << 'END'
bin_PROGRAMS = zardoz
zardoz_SOURCES = x.c
-qardoz_LDADD = -ljoe
+qardoz_LDADD = -lm
END
+echo 'int main (void) { return 0; }' > x.c
+
$ACLOCAL
-AUTOMAKE_fails
-grep 'Makefile.am:3:.*qardoz' stderr
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
- $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
++$MAKE 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+
+LC_ALL=C sed 's/^Makefile:[0-9][0-9]*: //' stderr > got
+
+cat > exp << 'END'
+variable 'qardoz_LDADD' is defined but no program
+ or library has 'qardoz' as canonical name
+*** Some Automake-NG error occurred. Stop.
+END
+
+diff exp got
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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 that our expectations on the behaviour of (some) GNU make
+# automatic variables are correct.
+# This test is quite incomplete, and should be filled out whenever
+# we want to start assuming and using a further behaviour of
+# automatic variables of GNU make.
+
+am_create_testdir=empty
++. ./defs || exit 1
+
+cat > Makefile <<'END'
+foo:
+ test $@ = foo
+ test $(@D) = .
+ test $(@F) = foo
+./bar:
+ test $@ = ./bar || test $@ = bar
+ test $(@D) = .
+ test $(@F) = bar
+../baz:
+ test $@ = ../baz
+ test $(@D) = ..
+ test $(@F) = baz
+1/2/3:
+ test $@ = 1/2/3
+ test $(@D) = 1/2
+ test $(@F) = 3
+/abs/path:
+ test $@ = /abs/path
+ test $(@D) = /abs
+ test $(@F) = path
+END
+
+$MAKE foo
+$MAKE ./foo
+$MAKE bar
+$MAKE ./bar
+$MAKE ../baz
+$MAKE 1/2/3
+$MAKE ./1/2/3
+$MAKE /abs/path
+
+:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test to make sure Automake supports implicit rules "confusing"
-# extensions. Inspired by a mail from Alex Hornby.
+# Check that, if we have two pattern rules from which the same file (or
+# set of files) can be built, and both are applicable, the first one wins.
+# This is used at least in our 'parallel-tests' support.
- . ./defs || Exit 1
+am_create_testdir=empty
+ . ./defs || exit 1
-cat > Makefile.am << 'END'
-SUFFIXES = .idl S.cpp C.h
-SUFFIXES += C.cpp S.h
-.idlC.cpp:
+cat > Makefile <<'END'
+default:
+
+%.foo: %
+ cp $< $@
+%.foo: %.x
cp $< $@
+
+%.bar: %.x
+ cp $< $@
+%.bar: %
+
+%.mu %.fu: %.1
+ cp $< $*.mu && cp $< $*.fu
+%.mu %.fu: %.2
+ cp $< $*.mu && cp $< $*.fu
END
-$ACLOCAL
-$AUTOMAKE
+echo one > all
+echo two > all.x
+$MAKE all.foo all.bar
+diff all all.foo
+diff all.x all.bar
-# Make sure Automake has NOT recognized .cpp and .idlC as two new
-# extensions.
-grep 'SUFFIXES.* \.cpp' Makefile.in && exit 1
-grep 'SUFFIXES.* \.idlC' Makefile.in && exit 1
+echo one > x.1
+echo two > x.2
+$MAKE x.mu
+diff x.mu x.1
+diff x.fu x.1
:
# 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 libtool is removed.
-# Report from Kevin Dalley.
+# Check that the '.PHONY' semantics we expect truly hold.
-required=libtool
+am_create_testdir=empty
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >> configure.ac << 'END'
-AC_LIBTOOL_DLOPEN
-AC_DISABLE_SHARED
-AC_PROG_LIBTOOL
-AC_SUBST([LIBTOOL_DEPS])
+cat > Makefile <<'END'
+.PHONY: pdir pfile
+pdir rdir:
+ echo foo > $@/foo
+pfile rfile:
+ echo bar >$@
+.PHONY: other
+other:
+ echo baz >> dummy
+indirect: other
+ echo run > $@
END
-: > Makefile.am
-
-: > ltmain.sh
-: > config.guess
-: > config.sub
-
-$ACLOCAL
-$AUTOMAKE
-
-grep 'rm -f libtool' Makefile.in
+: > rfile
+mkdir rdir
+$MAKE rdir rfile
+test ! -s rfile
+test ! -f rdir/foo
+
+: > pfile
+mkdir pdir
+$MAKE pdir pfile
+test "`cat pfile`" = bar
+test "`cat pdir/foo`" = foo
+
+$MAKE other
+test "`cat dummy`" = baz
+$MAKE other
+test "`cat dummy`" = "baz${nl}baz"
+
+echo not run > indirect
+$MAKE indirect
+test "`cat indirect`" = run
+test "`cat dummy`" = "baz${nl}baz${nl}baz"
:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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 GNU make line-continuation with backslash-newline has the
+# semantic we expect.
+
+am_create_testdir=empty
- $MAKE rule1 && Exit 1
++. ./defs || exit 1
+
+cat > Makefile << 'END'
+default:
+
+hash = \#
+ok: ; true :--$(hash)--:
+
+var1 = \
+rule1:
+
+rule2: \
+; echo ok > sentinel
+
+# The backslash doesn't cause we to continue to read after
+# the fist blank line.
+rule3: \
+
+var2 = ok
+
+# Ditto.
+var3 = a \
+
+b:
+
+# The backslash will cause the next line to be a comment as well \
+$(error comment not continued)
+
+var4 = foo \
+# not seen
+
+.PHONY: test
+test:
+ test $(var1) = rule1:
+ test $(var2) = ok
+ test $(var3) = a
+ test $(var4) = foo
+ test -z '$(var5)'
+
+var5 = \
+END
+
+$MAKE
+$MAKE ok
+$MAKE ok | grep ':--#--:'
++$MAKE rule1 && exit 1
+$MAKE rule2
+test -f sentinel
+$MAKE rule3
+$MAKE test
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# GNU make allows us to append to undefined variables.
+# Also, if we override a variable definition from the command line,
+# any '+=' appending to it gets overridden as well.
+
+am_create_testdir=empty
- $MAKE "$@" 2>stderr && test ! -s stderr || { cat stderr >&2; Exit 1; }
++. ./defs || exit 1
+
+cat > Makefile << 'END'
+var0 += foo
+
+var1 += bar
+var1 += baz
+
+var2 = a
+var2 += b
+
+var3 := x
+var3 += y
+
+.PHONY: test1 test2
+test1:
+ test x'$(var0)' = x'foo'
+ test x'$(var1)' = x'bar baz'
+ test x'$(var2)' = x'a b'
+ test x'$(var3)' = x'x y'
+test2:
+ test x'$(var0)' = x'mu'
+ test x'$(var1)' = x
+ test x'$(var2)' = x'two'
+ test x'$(var3)' = x'three'
+END
+
+checkit ()
+{
++ $MAKE "$@" 2>stderr && test ! -s stderr || { cat stderr >&2; exit 1; }
+}
+
+checkit test1
+checkit test2 var0=mu var1= var2=two var3=three
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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 the automatic variable '$<' always undergoes VPATH rewrite.
+# We use that assumption in some of our rules, so it better explicitly
+# check that it truly holds.
+
- test ! -f $srcdir/bar && test ! -d $srcdir/bar || Exit 1
- test ! -f $srcdir/he && test ! -d $srcdir/he || Exit 1
++. ./defs || exit 1
+
+ocwd=`pwd` || fatal_ "couldn't get current working directory"
+
+mkdir src
+cd src
+
+cat > mk <<'END'
+.SUFFIXES:
+.SUFFIXES: .a .b .a2 .b2 .a3 .b3 .a4 .b4
+
+empty =
+source = $<
+
+all: one.b two.b2 three.b3 four.b4
+all: www.d xxx.d2 yyy.d3 zzz.d4
+all: bar/mu.x is.ok zardoz
+all: here here2 he/re
+
+.a.b:
+ cp $< $@
+
+.a2.b2:
+ cp '$<' $@
+
+.a3.b3:
+ cp $(empty)$<$(empty) $@
+
+.a4.b4:
+ cp $(source) $@
+
+%.d: %.c
+ cp $< $@
+
+%.d2: %.c2
+ cp '$(source)' $@
+
+%.d3: %.c3 %.cc
+ cp `echo '$<'` $@
+
+%.d4: %.c4 ignore-me
+ orig=x$(<)x && orig=`expr "$$orig" : 'x\(.*\)x$$'` && cp $$orig $@
+
+bar/%: foo/%
+ mkdir $(dir $@)
+ cp $< $@
+
+%.ok: zap/%
+ cp "$<" $@
+
+%: zap/sub/%
+ cp '$<' $@
+
+here: there
+ cp $< $@
+
+here2: there2 ignore-me
+ cp '$<' $@
+
+he/re: the/re
+ mkdir $(dir $@)
+ cp "$(source)" $@
+END
+
+mkdir foo zap zap/sub the
+for file in \
+ one.a \
+ two.a2 \
+ three.a3 \
+ four.a4 \
+ www.c \
+ xxx.c2 \
+ yyy.c3 \
+ zzz.c4 \
+ foo/mu.x \
+ zap/is \
+ zap/sub/zardoz \
+ there \
+ there2 \
+ the/re \
+; do
+ echo $file > $file
+done
+touch yyy.cc ignore-me
+
+do_test ()
+{
+ srcdir=$1
+ cp $srcdir/mk Makefile
+ $MAKE -k all VPATH=$srcdir
+ if test "$srcdir" != "."; then
++ test ! -f $srcdir/bar && test ! -d $srcdir/bar || exit 1
++ test ! -f $srcdir/he && test ! -d $srcdir/he || exit 1
+ fi
+ diff $srcdir/one.a one.b
+ diff $srcdir/two.a2 two.b2
+ diff $srcdir/three.a3 three.b3
+ diff $srcdir/four.a4 four.b4
+ diff $srcdir/www.c www.d
+ diff $srcdir/xxx.c2 xxx.d2
+ diff $srcdir/yyy.c3 yyy.d3
+ diff $srcdir/zzz.c4 zzz.d4
+ diff $srcdir/foo/mu.x bar/mu.x
+ diff $srcdir/zap/is is.ok
+ diff $srcdir/zap/sub/zardoz zardoz
+ diff $srcdir/there here
+ diff $srcdir/the/re he/re
+}
+
+cd "$ocwd"
+mkdir build
+cd build
+do_test ../src
+
+cd "$ocwd"
+mkdir build2
+cd build2
+do_test "$ocwd"/src
+
+cd "$ocwd"
+cd src
+mkdir build
+cd build
+do_test ..
+
+cd "$ocwd"
+cd src
+do_test .
+
+:
# 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 that := definitions produce warnings, but otherwise work.
+# Check that the behaviour of the $(wildcard) builtin in corner cases
+# matches the assumptions done in our recipes.
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat > Makefile.am << 'END'
-ICONS := $(wildcard *.xbm)
-END
+mkdir dir
+echo dummy > file
-$ACLOCAL
-AUTOMAKE_fails
-grep ':=.*not portable' stderr
+cat > Makefile <<'END'
+.PHONY: test
+test:
+ test x'$(wildcard dir)' = x'dir'
+ test x'$(wildcard file)' = x'file'
+ test x'$(wildcard dir/)' = x'dir/'
+ test x'$(wildcard file/.)' = x''
+END
-$AUTOMAKE -Wno-portability
-grep '^ICONS *:= *\$(wildcard \*\.xbm) *$' Makefile.in
+$MAKE test
:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test to make sure .info-less @setfilename works.
+# Check that automake rules do not use repeated "-I $(srcdir)" in the
+# compiler invocation.
-required='makeinfo tex texi2dvi'
+required=cc
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
+AC_PROG_CC
AC_OUTPUT
END
$AUTOCONF
$AUTOMAKE --add-missing
-grep '^INFO_DEPS.*textutils$' Makefile.in
-
-# We should not use single suffix inference rules (with separate
-# dependencies), this confuses Solaris make.
-grep '^\.texi:$' Makefile.in && exit 1
-grep 'textutils: *textutils\.texi' Makefile.in
-
+# Test with $builddir != $srcdir
+mkdir build
+cd build
+../configure
- $MAKE V=1 > stdout || { cat stdout; Exit 1; }
++$MAKE V=1 > stdout || { cat stdout; exit 1; }
+cat stdout
+grep '.*-I *\. .*-I *\.\. ' stdout
- grep '.*-I *\. .*-I *\. ' stdout && Exit 1
++grep '.*-I *\. .*-I *\. ' stdout && exit 1
+cd ..
+
+# Test with $builddir = $srcdir
./configure
- $MAKE V=1 > stdout || { cat stdout; Exit 1; }
-$MAKE distcheck
++$MAKE V=1 > stdout || { cat stdout; exit 1; }
+cat stdout
+grep '.*-I *\. ' stdout
- grep '.*-I *\..*-I *\.' stdout && Exit 1
++grep '.*-I *\..*-I *\.' stdout && exit 1
:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test to make sure install-sh and mkinstalldirs correctly found in
-# subdirs.
+# Test to make sure install-sh is correctly found in subdirs.
- . ./defs || Exit 1
+ . ./defs || exit 1
mkdir zot
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 1999-2012 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 subdir objects with C, building both a library and an executable.
+# Keep in sync with sister test 'subobj-cxx.sh'.
+
+required=cc
- $AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; Exit 1; }
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = progs/wish
+lib_LIBRARIES = libs/libhope.a
+progs_wish_SOURCES = generic/a.c generic/b.c
+libs_libhope_a_SOURCES = sub/sub2/foo.c
+
+.PHONY: remake-single-object
+remake-single-object:
+ rm -rf generic
+ $(MAKE) generic/a.$(OBJEXT)
+ test -f generic/a.$(OBJEXT)
+ test ! -f generic/b.$(OBJEXT)
+ rm -rf generic
+ $(MAKE) generic/b.$(OBJEXT)
+ test ! -f generic/a.$(OBJEXT)
+ test -f generic/b.$(OBJEXT)
+ rm -rf sub generic
+ $(MAKE) sub/sub2/foo.$(OBJEXT)
+ test -f sub/sub2/foo.$(OBJEXT)
+ test ! -d generic
+END
+
+mkdir generic sub sub/sub2
+
+cat > generic/a.c <<END
+int main (void)
+{
+ extern int i;
+ return i;
+}
+END
+echo 'int i = 0;' > generic/b.c
+
+cat > sub/sub2/foo.c <<'END'
+int answer (void)
+{
+ return 42;
+}
+END
+
+$ACLOCAL
- $EGREP '[^/](a|b|foo)\.\$(OBJEXT)' Makefile.in && Exit 1
++$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
+test -f compile
+
++$EGREP '[^/](a|b|foo)\.\$(OBJEXT)' Makefile.in && exit 1
+
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+$MAKE
+
+test -d progs
+test -d libs
+test -d generic
+test -d sub/sub2
+
+if test -f progs/wish; then
+ EXEEXT=
+elif test -f progs/wish.exe; then
+ EXEEXT=.exe
+else
+ fatal_ "couldn't determine extension of executables"
+fi
+
+# The libraries and executables are not uselessly remade.
+: > xstamp
+$sleep
+echo dummy > progs/change-dir-timestamp
+echo dummy > libs/change-dir-timestamp
+echo dummy > generic/change-dir-timestamp
+echo dummy > sub/change-dir-timestamp
+echo dummy > sub/sub2/change-dir-timestamp
+$MAKE
+is_newest xstamp progs/wish$EXEEXT libs/libhope.a
+
+$MAKE remake-single-object
+
+# Must work also with dependency tracking disabled.
+# Also sanity check the distribution.
+$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-dependency-tracking
+
+:
# 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++.
+# Grepping checks on the use of subdir objects with C++.
+# See relate test 't/subobj-cxx-grep.sh' for semantic checks.
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >> configure.ac << 'END'
-AC_PROG_CXX
-END
+echo AC_PROG_CXX >> configure.ac
cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = wish
wish_SOURCES = generic/a.cc generic/b.cxx
END
$AUTOMAKE
$FGREP 'generic/a.$(OBJEXT)' Makefile.in
-grep '[^/]a\.\$(OBJEXT)' Makefile.in && exit 1
-grep '.*-c -o' Makefile.in
+$FGREP 'generic/b.$(OBJEXT)' Makefile.in
- grep '[^/][ab]\.\$(OBJEXT)' Makefile.in && Exit 1
- grep '.*-c -o' Makefile.in
++grep '[^/][ab]\.\$(OBJEXT)' Makefile.in && exit 1
++grep '.* -c -o ' Makefile.in
:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 1999-2012 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 subdir objects with C++, building both a library and an executable.
+# Keep in sync with sister test 'subobj-c.sh'.
+
+required=c++
- $EGREP '[^/](a|b|foo)\.\$(OBJEXT)' Makefile.in && Exit 1
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_PROG_CXX
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = progs/wish
+lib_LIBRARIES = libs/libhope.a
+progs_wish_SOURCES = generic/a.cc generic/b.c++
+libs_libhope_a_SOURCES = sub/sub2/foo.cxx
+
+.PHONY: remake-single-object
+remake-single-object:
+ rm -rf generic
+ $(MAKE) generic/a.$(OBJEXT)
+ test -f generic/a.$(OBJEXT)
+ test ! -f generic/b.$(OBJEXT)
+ rm -rf generic
+ $(MAKE) generic/b.$(OBJEXT)
+ test ! -f generic/a.$(OBJEXT)
+ test -f generic/b.$(OBJEXT)
+ rm -rf sub generic
+ $(MAKE) sub/sub2/foo.$(OBJEXT)
+ test -f sub/sub2/foo.$(OBJEXT)
+ test ! -d generic
+END
+
+mkdir generic sub sub/sub2
+
+cat > generic/a.cc <<END
+using namespace std; // Make this valid C++ but invalid C.
+extern int b (void);
+int main (void)
+{
+ return b ();
+}
+END
+
+cat > generic/b.c++ <<END
+using namespace std; // Make this valid C++ but invalid C.
+int b (void)
+{
+ return 0;
+}
+END
+
+cat > sub/sub2/foo.cxx <<'END'
+using namespace std; // Make this valid C++ but invalid C.
+int answer (void)
+{
+ return 42;
+}
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+test ! -f compile # This is not needed by C++ support.
++$EGREP '[^/](a|b|foo)\.\$(OBJEXT)' Makefile.in && exit 1
+
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+$MAKE
+
+test -d progs
+test -d libs
+test -d generic
+test -d sub/sub2
+
+if test -f progs/wish; then
+ EXEEXT=
+elif test -f progs/wish.exe; then
+ EXEEXT=.exe
+else
+ fatal_ "couldn't determine extension of executables"
+fi
+
+# The libraries and executables are not uselessly remade.
+: > xstamp
+$sleep
+echo dummy > progs/change-dir-timestamp
+echo dummy > libs/change-dir-timestamp
+echo dummy > generic/change-dir-timestamp
+echo dummy > sub/change-dir-timestamp
+echo dummy > sub/sub2/change-dir-timestamp
+$MAKE
+is_newest xstamp progs/wish$EXEEXT libs/libhope.a
+
+$MAKE remake-single-object
+
+# Must work also with dependency tracking disabled.
+# Also sanity check the distribution.
+$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-dependency-tracking
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 1999-2012 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 of subdir objects with libtool.
+
+required='cc libtoolize'
- $AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; Exit 1; }
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AM_PROG_AR
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_LTLIBRARIES = libs/libfoo.la
+libs_libfoo_la_SOURCES = generic/1.c generic/2.c sub/subsub/3.c
+
+.PHONY: remake-single-object
+remake-single-object:
+ rm -rf generic
+ $(MAKE) generic/1.lo
+ test -f generic/1.lo
+ test ! -f generic/2.lo
+ rm -rf generic
+ $(MAKE) generic/2.lo
+ test ! -f generic/1.lo
+ test -f generic/2.lo
+ rm -rf sub generic
+ $(MAKE) sub/subsub/3.lo
+ test -f sub/subsub/3.lo
+ test ! -d generic
+END
+
+mkdir generic sub sub/subsub
+echo 'int one (void) { return 1; }' > generic/1.c
+echo 'int two (void) { return 2; }' > generic/2.c
+echo 'int three (void) { return 3; }' > sub/subsub/3.c
+
+libtoolize
+$ACLOCAL
+
- grep '[^/][123]\.lo' Makefile.in && Exit 1
++$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
+test -f compile
+
++grep '[^/][123]\.lo' Makefile.in && exit 1
+
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+$MAKE
+
+test -d libs
+test -d generic
+test -d sub/subsub
+
+# The libraries and executables are not uselessly remade.
+: > xstamp
+$sleep
+echo dummy > libs/change-dir-timestamp
+echo dummy > generic/change-dir-timestamp
+echo dummy > sub/change-dir-timestamp
+echo dummy > sub/subsub/change-dir-timestamp
+$MAKE
+is_newest xstamp libs/libfoo.la
+
+$MAKE remake-single-object
+
+# VPATH builds must work also with dependency tracking disabled.
+# Also sanity check the distribution.
+$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-dependency-tracking
+
+:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# PR 492: Test asm subdir-objects.
+# PR 492: Test asm subdir objects.
required=gcc
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat > configure.ac << END
-AC_INIT([$me], [1.0])
-AM_INIT_AUTOMAKE([subdir-objects])
-
+cat >> configure.ac << 'END'
AM_PROG_AS
AM_PROG_AR
AC_PROG_RANLIB
# 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 that automake works around a bug of Solaris Make. The bug is the
-# following. If we have a Makefile containg a file inclusion like this:
+# If we have a Makefile containing a file inclusion like this:
+#
# include .//foo.mk
-# Solaris make fails with a message like:
+#
+# Solaris 10 make fails with a message like:
+#
# make: ... can't find '/foo.mk': No such file or directory
# make: fatal error ... read of include file '/foo.mk' failed
-# (even if the file 'foo.mk' exists). The error disappear by collapsing
-# the repeated slash '/' characters into a single one.
#
-# See also sister "grepping" test 'subobj11b.test', and related test
-# 'subobj11c.test'.
+# (even if the file 'foo.mk' exists). Our dependency tracking support
+# code used to generate include directives like that sometimes, thus
+# causing spurious failures.
+#
+# GNU make shouldn't suffer from that Solaris make bug, but we check
+# the problematic setup anyway -- better safe than sorry.
+#
required=cc
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_PROG_CC
# 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 'compile' is included when subdir-objects is used in a subdir.
+# Make sure 'compile' is included when subdir objects are used in a
+# subdir.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat > configure.ac << END
AC_INIT([$me], [1.0])
# forgets '.../<file>.o'.
required='c++ libtoolize'
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat > configure.ac << END
-AC_INIT([$me], [1.0])
-AM_INIT_AUTOMAKE([subdir-objects])
+cat >> configure.ac << END
AC_PROG_CXX
AM_PROG_AR
AM_PROG_LIBTOOL
# properly, when a subpackage is involved.
required='cc yacc'
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >>configure.ac <<'END'
+cat > configure.ac <<'END'
+AC_INIT([suya], [0.5a], [automake-ng@gnu.org])
+AM_INIT_AUTOMAKE([foreign -Wall])
AC_PROG_CC
+AC_CONFIG_FILES([GNUmakefile])
AC_CONFIG_SUBDIRS([lib])
AC_OUTPUT
END
$AUTOMAKE -Wno-override --add-missing
cd ..
- ./configure >stdout || { cat stdout; Exit 1; }
-./configure
++./configure >stdout || { cat stdout; exit 1; }
+cat stdout
+grep '^checking whether cc understands -c and -o together' stdout
+
$MAKE
$MAKE distcheck
test ! -d subpack-1 # Make sure distcheck cleans up after itself.
# This is unrelated to the rest of this test. But while we are
# at it, make sure we don't use am__helldl_SOURCES_DIST here, since
-# it's not needed. DIST_SOURCES should contain $(helldl_SOURCES).
+# it's not needed. am__dist_sources should contain $(helldl_SOURCES).
- grep am__helldl_SOURCES_DIST Makefile && Exit 1
+ grep am__helldl_SOURCES_DIST Makefile && exit 1
-grep 'DIST_SOURCES.*\$(helldl_SOURCES)' Makefile
+grep 'am__dist_sources.*\$(helldl_SOURCES)' Makefile
:
# See automake bug#7824 and bug#7670.
required=cc
- . ./defs || Exit 1
+ . ./defs || exit 1
-plan_ 8
-
cat >> configure.ac <<'END'
AC_PROG_CC
AC_OUTPUT
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2002-2012 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/>.
+
+# Interaction between user-defined extensions for files in _SOURCES
+# and the use of AM_DEFAULT_SOURCE_EXT.
+
+required=c++
++. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AC_PROG_CXX
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+AM_DEFAULT_SOURCE_EXT = .cc
+bin_PROGRAMS = foo bar baz qux
+%.cc: %.zoo
+ sed 's/INTEGER/int/g' $< >$@
+EXTRA_DIST = $(addsuffix .zoo,$(bin_PROGRAMS))
+generated_cc_sources = $(addsuffix .cc,$(bin_PROGRAMS))
+CLEANFILES = $(generated_cc_sources)
+# We don't want the generated C++ files to be distributed, and this
+# is the best workaround we've found so far. Not very clean, but it
+# works.
+dist-hook:
+ rm -f $(addprefix $(distdir)/,$(generated_cc_sources))
+END
+
+# This is deliberately valid C++, but invalid C.
+cat > foo.zoo <<'END'
+using namespace std;
+INTEGER main (void)
+{
+ return 0;
+}
+END
+cp foo.zoo bar.zoo
+cp foo.zoo baz.zoo
+cp foo.zoo qux.zoo
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+$MAKE all
+$MAKE distdir
+ls -l $distdir
+test ! -f $distdir/foo.cc
+test ! -f $distdir/bar.cc
+test ! -f $distdir/baz.cc
+test ! -f $distdir/qux.cc
+$MAKE distcheck
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2002-2012 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 support entries with user-defined extensions of
+# files in _SOURCES, and we can override the choice of a link in case
+# the Automake default (C linker) would be inappropriate.
+
+required=c++
++. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AC_PROG_CXX
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+%.$(OBJEXT): %.xt
+## Creative quoting to plase maintainer checks.
+ sed -e 's/@/o/g' -e 's/!/;/g' -e 's/<-/<''</g' $< >$*-t.cc \
+ && $(CXX) -c $*-t.cc \
+ && rm -f $*-t.cc \
+ && mv -f $*-t.$(OBJEXT) $@
+bin_PROGRAMS = foo
+foo_SOURCES = 1.xt 2.xt
+foo_LINK = $(CXX) -o $@
+END
+
+cat > 1.xt <<'END'
+#include <cstdlib>
+void say_hell@ (v@id)!
+int main (v@id)
+{
+ say_hell@ ()!
+ std::exit(0)!
+}
+END
+
+cat > 2.xt <<'END'
+#include <i@stream>
+void say_hell@ (v@id)
+{
+ using namespace std!
+ c@ut <- "Hell@, W@rld\n" <- endl!
+}
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+$MAKE all
+if cross_compiling; then :; else
+ ./foo
+ ./foo | grep 'Hello, World'
+fi
+
+$MAKE distcheck
+
+:
# 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 that Automake understands suffix rules with subdir objects.
-# Reported by John Ratliff.
+# Tests that pattern rules with subdir objects are understood.
+# Originally reported by John Ratliff against suffix rules.
required=cc
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >>configure.ac <<EOF
AC_PROG_CC
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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 support entries with user-defined extensions of
+# files in _SOURCES, if there is a rule to turn files with that
+# extension in object files.
+# See also related test 'suffix-custom-go.sh' for a check using a
+# real-world third party compiler (Go from Google).
+
+required=cc
- AC_DEFINE([EXIT_OK], [0], [Exit status for success])
- AC_DEFINE([EXIT_KO], [1], [Exit status for failure])
++. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AC_CONFIG_HEADERS([config.h])
++AC_DEFINE([EXIT_OK], [0], [The exit status for success])
++AC_DEFINE([EXIT_KO], [1], [The exit status for failure])
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+AM_DEFAULT_SOURCE_EXT = .my-c
+MY_CFLAGS = $(if $(filter .,$(srcdir)),,-I $(srcdir)) $(CPPFLAGS)
+%.$(OBJEXT): %.my-c
+ sed -e 's/@/o/g' -e 's/~/0/g' $< >$*-t.c \
+ && $(CC) $(MY_CFLAGS) -c $*-t.c \
+ && rm -f $*-t.c \
+ && mv -f $*-t.$(OBJEXT) $@
+bin_PROGRAMS = foo
+bin_PROGRAMS += zardoz
+zardoz_SOURCES = main.c protos.h greet.my-c cleanup.my-c
+END
+
+cat > foo.my-c <<'END'
+#include <stdi@.h>
+#include <stdlib.h>
+int main (v@id)
+{
+ printf ("Dummy\n");
+ exit (~);
+}
+END
+
+cat > protos.h << 'END'
+void greet (void);
+int cleanup (void);
+#include <stdio.h>
+END
+
+cat > greet.my-c << 'END'
+#include "pr@t@s.h"
+void greet (v@id)
+{
+ printf ("Hell@, ");
+}
+END
+
+cat > cleanup.my-c << 'END'
+#include "pr@t@s.h"
+int cleanup (v@id)
+{
+ return (fcl@se (std@ut) == ~);
+}
+END
+
+cat > main.c <<'END'
+#include <config.h>
+#include "protos.h"
+int main (void)
+{
+ greet ();
+ puts ("W@rld!\n");
+ return (cleanup () ? EXIT_OK : EXIT_KO);
+}
+END
+
+$ACLOCAL
+$AUTOHEADER
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+$MAKE all
+if cross_compiling; then :; else
+ ./foo
+ ./zardoz
+ ./zardoz | grep 'Hello, W@rld!'
+fi
+
+$MAKE distcheck
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Use of "custom" headers (with custom suffix).
+
+required='cc native'
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_PROGRAMS = zardoz
+nodist_zardoz_SOURCES = foo.c
+EXTRA_DIST = bar.my-h foo.my-c
+BUILT_SOURCES = bar.h
+%.c: %.my-c
+ sed 's/INTEGER/int/' $< >$@
+%.h: %.my-h
+ sed 's/SUBSTITUTE/#define/' $< >$@
+CLEANFILES = $(nodist_zardoz_SOURCES) $(BUILT_SOURCES)
+END
+
+cat > foo.my-c << 'END'
+#include "bar.h"
+INTEGER main (void)
+{
+ printf ("Hello, %s!\n", PLANET);
+ return 0;
+}
+END
+
+cat > bar.my-h << 'END'
+#include <stdio.h>
+SUBSTITUTE PLANET "Mars"
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure --enable-dependency-tracking
+
+$MAKE
+./zardoz
+test "$(./zardoz)" = 'Hello, Mars!'
+
+$sleep
+$PERL -npi -e 's/\bMars\b/Jupiter/' bar.my-h
+
+$MAKE
+./zardoz
+test "$(./zardoz)" = 'Hello, Jupiter!'
+
+$MAKE distdir
+test -f $distdir/foo.my-c
+test -f $distdir/bar.my-h
+test ! -f $distdir/foo.c
+test ! -f $distdir/bar.h
+
+$MAKE clean
+test ! -f foo.c
+test ! -f bar.h
+
+$MAKE distcheck
+
+:
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test to make sure that '.o' and '.obj' are handled like '.$(OBJEXT)'.
-# See also related "grepping" test suffix6.test.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
# $(LINK) is not defined automatically by Automake, since the *_SOURCES
# 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 libtool clean targets exist.
-# Report from Eric Magnien.
+# Automake-NG still accepts old-fashioned suffix rules.
- . ./defs || Exit 1
-required=libtoolize
+ . ./defs || exit 1
cat >> configure.ac << 'END'
-AC_PROG_CC
-AM_PROG_AR
-AC_PROG_LIBTOOL
AC_CONFIG_FILES([sub/Makefile])
AC_OUTPUT
END
# (related to PR/37)
required='cc libtoolize yacc'
- . ./defs || Exit 1
+ . ./defs || exit 1
-plan_ 7
-
cat >>configure.ac <<EOF
AC_PROG_CC
AC_PROG_YACC
# 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 that Automake understands suffix rules with renamed objects
-# and subdir objects.
-# Reported by Florian Briegel.
+# Tests that Automake understands suffix-based pattern rules with
+# renamed objects and subdir objects. Reported by Florian Briegel.
required=cc
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >>configure.ac <<EOF
AC_PROG_CC
# 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 proper suffix rules for C compilation are produced,
+# Make sure proper pattern rules for C compilation are produced,
# and only once, even for libtool libraries.
# See also related test 'suffix.test'.
-required=libtoolize
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_PROG_CC
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test to make sure that suffix rules chain.
+
+required=c++
- $FGREP '$(LINK)' Makefile.in && Exit 1
- $FGREP 'AM_CFLAGS' Makefile.in && Exit 1
- $FGREP '$(CFLAGS)' Makefile.in && Exit 1
- $FGREP '$(CC)' Makefile.in && Exit 1
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_PROG_CXX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+%.cc: %.zoo
+ sed 's/INTEGER/int/g' $< >$@
+bin_PROGRAMS = zardoz
+nodist_zardoz_SOURCES = foo.cc
+EXTRA_DIST = foo.zoo
+CLEANFILES = foo.cc
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+# Automake has been clearly told that foo.zoo is eventually transformed
+# into foo.o, and to use this latter file (to link foo).
+$FGREP 'foo.$(OBJEXT)' Makefile.in
+# Finally, our dummy package doesn't use C in any way, so it the
+# Makefile shouldn't contain stuff related to the C compiler.
++$FGREP '$(LINK)' Makefile.in && exit 1
++$FGREP 'AM_CFLAGS' Makefile.in && exit 1
++$FGREP '$(CFLAGS)' Makefile.in && exit 1
++$FGREP '$(CC)' Makefile.in && exit 1
+
+
+$AUTOCONF
+./configure
+
+# This is deliberately valid C++, but invalid C.
+cat > foo.zoo <<'END'
+using namespace std;
+INTEGER main (void)
+{
+ return 0;
+}
+END
+
+$MAKE all
+$MAKE distcheck
+
+# Intermediate files should not be distributed.
+$MAKE distdir
+test ! -r $me-1.0/foo.cc
+
+:
# From PR/37.
required='cc libtoolize'
- . ./defs || Exit 1
+ . ./defs || exit 1
-plan_ 10
-
cat >>configure.ac <<'END'
AM_PROG_AR
AM_PROG_LIBTOOL
ok
END
- $MAKE check TESTS=all.test >stdout && { cat stdout; Exit 1; }
-TESTS=all.test $MAKE -e check >stdout && { cat stdout; exit 1; }
++$MAKE check TESTS=all.test >stdout && { cat stdout; exit 1; }
cat stdout
count_test_results total=14 pass=6 fail=5 xpass=1 xfail=1 skip=1 error=0
ERROR: c.test - Bail out! FUBAR!
END
- $MAKE TESTS='a.test b.test c.test' check >stdout && { cat stdout; Exit 1; }
-TESTS='a.test b.test c.test' $MAKE -e check >stdout \
- && { cat stdout; exit 1; }
++$MAKE TESTS='a.test b.test c.test' check >stdout && { cat stdout; exit 1; }
cat stdout
count_test_results total=5 pass=1 fail=0 xpass=0 xfail=0 skip=1 error=3
ok 3
END
-TESTS='foo.test bar.test baz.test' $MAKE -e check >stdout \
+$MAKE TESTS='foo.test bar.test baz.test' check >stdout \
- && { cat stdout; Exit 1; }
+ && { cat stdout; exit 1; }
cat stdout
count_test_results total=5 pass=1 fail=0 xpass=0 xfail=0 skip=1 error=3
# Doing the sums above, we have:
test_counts='total=12 pass=3 fail=1 xpass=1 xfail=1 skip=1 error=5'
-TESTS='a.test b.test c.test d.test e.test' $MAKE -e check >stdout \
+$MAKE TESTS='a.test b.test c.test d.test e.test' check >stdout \
- && { cat stdout; Exit 1; }
+ && { cat stdout; exit 1; }
cat stdout
count_test_results $test_counts
ok 1
END
- $MAKE TESTS=bail.test check >stdout && { cat stdout; Exit 1; }
-TESTS=bail.test $MAKE -e check >stdout && { cat stdout; exit 1; }
++$MAKE TESTS=bail.test check >stdout && { cat stdout; exit 1; }
cat stdout
count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1
test -f test-suite.log
grep '^ERROR: bail\.test - Bail out!' stdout
- grep '^PASS:' stdout && Exit 1
+ grep '^PASS:' stdout && exit 1
test $($FGREP -c ': bail.test' stdout) -eq 1
- $FGREP 'success.test' stdout && Exit 1
+ $FGREP 'success.test' stdout && exit 1
-# Override TEST_LOGS from the command line, making it point to a test
+# Override TESTS from the command line, making it point to a test
# (ok.test) that has to be generated at make time.
rm -f *.log *.test
- $MAKE TESTS=ok check >stdout || { cat stdout; Exit 1; }
-TEST_LOGS=ok.log $MAKE -e check >stdout || { cat stdout; exit 1; }
++$MAKE TESTS=ok check >stdout || { cat stdout; exit 1; }
cat stdout
count_test_results total=3 pass=1 fail=0 xpass=0 xfail=1 skip=1 error=0
test_no_color ()
{
- # With make implementations that, like Solaris make, in case of errors
- # print the whole failing recipe on standard output, we should content
- # ourselves with a laxer check, to avoid false positives.
- # Keep this in sync with lib/am/check.am:$(am__color_tests).
- if $FGREP '= Xalways; then' stdout; then
- # Extra verbose make, resort to laxer checks.
- # But we also want to check that the testsuite summary is not unduly
- # colorized.
- (
- set +e # In case some grepped regex below isn't matched.
- # Not a useless use of cat; see above comments "grep-nonprinting"
- # requirement in 'test-init.sh'.
- cat stdout | grep "TOTAL.*:"
- cat stdout | grep "PASS.*:"
- cat stdout | grep "FAIL.*:"
- cat stdout | grep "SKIP.*:"
- cat stdout | grep "XFAIL.*:"
- cat stdout | grep "XPASS.*:"
- cat stdout | grep "ERROR.*:"
- cat stdout | grep "^#"
- cat stdout | grep 'test.*expected'
- cat stdout | grep 'test.*not run'
- cat stdout | grep '===='
- cat stdout | grep '[Ss]ee .*test-suite\.log'
- cat stdout | grep '[Tt]estsuite summary'
- ) | grep "$esc" && exit 1
- : For shells with broken 'set -e'
- else
- cat stdout | grep "$esc" && exit 1
- : For shells with broken 'set -e'
- fi
+ # Not a useless use of cat; see above comments "grep-nonprinting"
+ # requirement in 'test-init.sh'.
- cat stdout | grep "$esc" && Exit 1
- :
++ cat stdout | grep "$esc" && exit 1
++ : For 'set -e'.
}
+# It should be possible to override AM_COLOR_TESTS also from the
+# environment.
# Forced colorization should take place also with non-ANSI terminals;
# hence the "TERM=dumb" definition.
--TERM=dumb AM_COLOR_TESTS=always $MAKE check >stdout \
- && { cat stdout; Exit 1; }
++AM_COLOR_TESTS=always $MAKE TERM=dumb check >stdout \
+ && { cat stdout; exit 1; }
cat stdout
test_color
- $MAKE check TERM=ansi >stdout && { cat stdout; Exit 1; }
-TERM=ansi $MAKE -e check >stdout \
- && { cat stdout; exit 1; }
++$MAKE check TERM=ansi >stdout && { cat stdout; exit 1; }
cat stdout
test_no_color
# Auxiliary test to set up common data used by many tests on TAP support.
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >> configure.ac << END
-AC_OUTPUT
-END
+echo AC_OUTPUT >> configure.ac
cat > Makefile.am << 'END'
TEST_LOG_DRIVER = $(srcdir)/tap-driver
# Basic TAP test protocol support:
# - dependencies between test scripts
- . ./defs || Exit 1
+ . ./defs || exit 1
cat > Makefile.am << 'END'
-# The tests are *deliberately* listed in inversed order here.
+# The tests are *deliberately* listed in inverted order here.
TESTS = c.test b.test a.test
b.log: a.log
c.log: b.log
# all.test: Shell metacharacters here: $metacharacters
END
- $MAKE check >stdout || { cat stdout; Exit 1; }
+ $MAKE check >stdout || { cat stdout; exit 1; }
cat stdout
- $EGREP "#.*all\\.test|a comment|(Tests|Shell) " stdout && Exit 1
-$EGREP -i "#.*all\\.test|a comment|(Tests|Shell) " stdout && exit 1
++$EGREP "#.*all\\.test|a comment|(Tests|Shell) " stdout && exit 1
count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0
echo 'AM_TEST_LOG_DRIVER_FLAGS = --comments' >> Makefile
diff exp got
count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0
-TEST_LOG_DRIVER_FLAGS="--no-comments" $MAKE -e check >stdout \
+$MAKE check TEST_LOG_DRIVER_FLAGS="--no-comments" >stdout \
- || { cat stdout; Exit 1; }
+ || { cat stdout; exit 1; }
cat stdout
- $EGREP "#.*all\\.test|a comment|(Tests|Shell) " stdout && Exit 1
-$EGREP -i "#.*all\\.test|a comment|(Tests|Shell) " stdout && exit 1
++$EGREP "#.*all\\.test|a comment|(Tests|Shell) " stdout && exit 1
count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0
# The "#"-prepended lines here shouldn't be parsed as test results.
case $MAKE in *\ -j*) skip_ "can't work easily with concurrent make";; esac
- $MAKE check >stdout && { cat stdout; Exit 1; }
-# Prevent Sun Distributed Make from trying to run in parallel.
-DMAKE_MODE=serial; export DMAKE_MODE
-
+ $MAKE check >stdout && { cat stdout; exit 1; }
cat stdout
cat > exp <<'END'
grep '^Please report to bug-automake@gnu\.org$' stdout
-env \
+$MAKE check \
TESTS='foo.test baz.test' \
TEST_LOG_DRIVER_FLAGS='--comments --ignore-exit' \
- > stdout || { cat stdout; Exit 1; }
- $MAKE -e check >stdout || { cat stdout; exit 1; }
++ > stdout || { cat stdout; exit 1; }
cat > exp <<'END'
PASS: foo.test 1 - Swallows fly
END
# We don't care about the exit status of "make check" here.
-TESTS="$(echo *.test)" $MAKE -e check || :
+$MAKE TESTS="$(echo *.test)" check || :
cat test-suite.log
- grep ':.*ok|not seen' test-suite.log && Exit 1
+ grep ':.*ok|not seen' test-suite.log && exit 1
for s in skip todo fail xpass bail error; do
$FGREP "::$s::" test-suite.log
tests=$(echo *.test) # Also required later.
- $MAKE TESTS="$tests" check >stdout && { cat stdout; Exit 1; }
-TESTS="$tests" $MAKE -e check >stdout && { cat stdout; exit 1; }
++$MAKE TESTS="$tests" check >stdout && { cat stdout; exit 1; }
cat stdout
# Dirty trick required here.
done
rm -f test-suite.log
- $MAKE TESTS="$tests" test-suite.log && Exit 1
-TESTS="$tests" $MAKE -e test-suite.log && exit 1
++$MAKE TESTS="$tests" test-suite.log && exit 1
cat test-suite.log
have_rst_section ()
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# TAP support:
-# - RECHECK_LOGS
+# TAP support: AM_LAZY_CHECK
- . ./defs || Exit 1
+ . ./defs || exit 1
cat > Makefile.am << 'END'
TEST_LOG_COMPILER = cat
grep '^# ERROR: *1$' stdout
}
- $MAKE check && Exit 1
-$MAKE -e check && exit 1
++$MAKE check && exit 1
test -f foo.log
test -f bar.log
test -f baz.log
rm -f foo.log bar.log
- $MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; Exit 1; }
-env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; }
++$MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; exit 1; }
cat stdout
test -f foo.log
test -f bar.log
# We re-run only a successful test, but the tests that failed in the
# previous run should still be taken into account, and cause an overall
# failure.
- $MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; Exit 1; }
-env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; }
++$MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; exit 1; }
cat stdout
grep '^PASS: foo\.test 1$' stdout
grep '^PASS: foo\.test 2$' stdout
$sleep
touch zardoz
- $MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; Exit 1; }
-env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; }
++$MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; exit 1; }
cat stdout
grep '^ERROR: baz\.test' stdout
- $EGREP '(foo|bar)\.test' stdout && Exit 1
+ $EGREP '(foo|bar)\.test' stdout && exit 1
is_newest baz.log zardoz
grep_summary
# Now, explicitly retry with all test logs already updated, and ensure
# that the summary is still displayed.
- $MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; Exit 1; }
-env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; exit 1; }
++$MAKE AM_LAZY_CHECK=yes check > stdout && { cat stdout; exit 1; }
cat stdout
- $EGREP '(foo|bar|baz)\.test' stdout && Exit 1
+ $EGREP '(foo|bar|baz)\.test' stdout && exit 1
grep_summary
-# The following should re-run foo.test (and only foo.test), even if its
-# log file is up-to-date.
-: > older
-env RECHECK_LOGS=foo.log $MAKE -e check > stdout && { cat stdout; exit 1; }
-cat stdout
-grep '^PASS: foo\.test 1$' stdout
-grep '^PASS: foo\.test 2$' stdout
-grep 'ba[rz]\.test' stdout && exit 1
-is_newest foo.log older
-grep_summary
-
:
chmod a+x *.test
- $MAKE check TEST_SUITE_LOG=my.log && Exit 1
-TEST_SUITE_LOG=my.log $MAKE -e check && exit 1
++$MAKE check TEST_SUITE_LOG=my.log && exit 1
ls -l # For debugging.
test ! -f test-suite.log
test ! -f global.log
# See that the option '--no-merge' can override the effect of '--merge'.
-TEST_LOG_DRIVER_FLAGS=--no-merge $MAKE -e check >stdout \
+$MAKE check TEST_LOG_DRIVER_FLAGS=--no-merge >stdout \
- || { cat stdout; Exit 1; }
+ || { cat stdout; exit 1; }
cat stdout
count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
echo 'Bail out! 0' > a.test
echo 'Bail out! 0.0' > b.test
- $MAKE TESTS='a.test b.test' check >stdout && { cat stdout; Exit 1; }
-TESTS='a.test b.test' $MAKE -e check >stdout && { cat stdout; exit 1; }
++$MAKE TESTS='a.test b.test' check >stdout && { cat stdout; exit 1; }
cat stdout
count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=2
echo '1..0 # SKIP 0' > a.test
echo '1..0 # SKIP 0.0' > b.test
- $MAKE TESTS='a.test b.test' check >stdout || { cat stdout; Exit 1; }
-TESTS='a.test b.test' $MAKE -e check >stdout || { cat stdout; exit 1; }
++$MAKE TESTS='a.test b.test' check >stdout || { cat stdout; exit 1; }
cat stdout
count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=0
ok 17
END
-TESTS='a.test b.test c.test d.test' $MAKE -e check >stdout \
+$MAKE TESTS='a.test b.test c.test d.test' check >stdout \
- && { cat stdout; Exit 1; }
+ && { cat stdout; exit 1; }
cat stdout
count_test_results total=17 pass=8 fail=0 xpass=0 xfail=1 skip=0 error=8
done
done
-env TEST_LOG_DRIVER_FLAGS='--ignore-exit' $MAKE -e check
+$MAKE check TEST_LOG_DRIVER_FLAGS='--ignore-exit'
- $FGREP ".test - exited with status" *.log && Exit 1
+ $FGREP ".test - exited with status" *.log && exit 1
:
$weirdchars
END
- $MAKE TESTS=ok.test check || { cat ok.log; Exit 1; }
-TESTS=ok.test $MAKE -e check || { cat ok.log; exit 1; }
++$MAKE TESTS=ok.test check || { cat ok.log; exit 1; }
cat ok.log
for rx in \
END
for pos in leading trailing; do
- TESTS="$pos-repeated.test" $MAKE -e check >stdout \
+ $MAKE TESTS="$pos-repeated.test" check >stdout \
- && { cat stdout; Exit 1; }
+ && { cat stdout; exit 1; }
cat stdout
count_test_results total=2 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=1
grep "^ERROR: $pos-repeated\\.test - multiple test plans$" stdout
1..2
END
-env TESTS="leading-repeated.test trailing-repeated.test" \
- $MAKE -e check >stdout && { cat stdout; exit 1; }
+$MAKE TESTS="leading-repeated.test trailing-repeated.test" check >stdout \
- && { cat stdout; Exit 1; }
++ && { cat stdout; exit 1; }
cat stdout
count_test_results total=6 pass=3 fail=0 xpass=0 xfail=0 skip=0 error=3
grep "^ERROR: leading-repeated\\.test - multiple test plans$" stdout
1..0 # SKIP
END
-env TESTS="1.test 2.test 3.test 4.test" \
- $MAKE -e check >stdout && { cat stdout; exit 1; }
+$MAKE TESTS="1.test 2.test 3.test 4.test" check >stdout \
- && { cat stdout; Exit 1; }
++ && { cat stdout; exit 1; }
cat stdout
count_test_results total=8 pass=0 fail=0 xpass=0 xfail=0 skip=4 error=4
for i in 1 2 3 4; do
ok 5
END
- $MAKE check >stdout && { cat stdout; Exit 1; }
-$MAKE -e check >stdout && { cat stdout; exit 1; }
++$MAKE check >stdout && { cat stdout; exit 1; }
cat stdout
count_test_results total=8 pass=5 fail=0 xpass=0 xfail=0 skip=0 error=3
ok 3
END
- $MAKE check >stdout && { cat stdout; Exit 1; }
-$MAKE -e check >stdout && { cat stdout; exit 1; }
++$MAKE check >stdout && { cat stdout; exit 1; }
cat stdout
count_test_results total=5 pass=2 fail=0 xpass=0 xfail=0 skip=0 error=3
ok 5
END
- $MAKE check >stdout && { cat stdout; Exit 1; }
-$MAKE -e check >stdout && { cat stdout; exit 1; }
++$MAKE check >stdout && { cat stdout; exit 1; }
cat stdout
count_test_results total=7 pass=3 fail=0 xpass=0 xfail=0 skip=0 error=4
echo 1..00 > e.test
echo '1..000 # SKIP' > f.test
-env TESTS='a.test b.test c.test d.test e.test f.test' \
- $MAKE -e check >stdout || { cat stdout; exit 1; }
+$MAKE TESTS='a.test b.test c.test d.test e.test f.test' check >stdout \
- || { cat stdout; Exit 1; }
++ || { cat stdout; exit 1; }
cat stdout
count_test_results total=115 pass=113 xfail=0 skip=2 fail=0 xpass=0 error=0
tests_list=$(echo *.test)
- $MAKE TESTS="$tests_list" check >stdout && { cat stdout; Exit 1; }
-TESTS="$tests_list" $MAKE -e check >stdout && { cat stdout; exit 1; }
++$MAKE TESTS="$tests_list" check >stdout && { cat stdout; exit 1; }
cat stdout
count_test_results total=9 pass=2 fail=0 xpass=0 xfail=2 skip=0 error=5
tests=$(echo *.test)
for tap_flags in "" "--comments"; do
- env TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS="$tests" \
- $MAKE -e check >stdout || { cat stdout; exit 1; }
+ $MAKE check TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS="$tests" >stdout \
- || { cat stdout; Exit 1; }
++ || { cat stdout; exit 1; }
cat stdout
count_test_results total=12 pass=7 xfail=2 skip=3 fail=0 xpass=0 error=0
done
ok 1
END
- $MAKE TESTS='foo.test bar.test' check >stdout || { cat stdout; Exit 1; }
-TESTS='foo.test bar.test' $MAKE -e check >stdout || { cat stdout; exit 1; }
++$MAKE TESTS='foo.test bar.test' check >stdout || { cat stdout; exit 1; }
cat stdout
count_test_results total=3 pass=3 fail=0 error=0 xpass=0 xfail=0 skip=0
END
for tap_flags in "" "--comments"; do
- env TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS='top.test bot.test' \
- $MAKE -e check >stdout || { cat stdout; exit 1; }
+ $MAKE TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS="top.test bot.test" \
- check >stdout || { cat stdout; Exit 1; }
++ check >stdout || { cat stdout; exit 1; }
cat stdout
count_test_results total=7 pass=5 xfail=1 skip=1 fail=0 xpass=0 error=0
done
a later non-TAP line
END
-TESTS='foo.test foo2.test bar.test' $MAKE -e check >stdout \
+$MAKE TESTS='foo.test foo2.test bar.test' check >stdout \
- || { cat stdout; Exit 1; }
+ || { cat stdout; exit 1; }
cat stdout
count_test_results total=3 pass=0 fail=0 xpass=0 xfail=0 skip=3 error=0
echo "1..0 # $c1$c2$c3$c4 foobar" > $j.test
done; done; done; done
- $MAKE TESTS="$(echo *.test)" check >stdout || { cat stdout; Exit 1; }
-TESTS="$(echo *.test)" $MAKE -e check >stdout || { cat stdout; exit 1; }
++$MAKE TESTS="$(echo *.test)" check >stdout || { cat stdout; exit 1; }
cat stdout
count_test_results total=16 pass=0 fail=0 xpass=0 xfail=0 skip=16 error=0
1..0
END
- $MAKE TESTS='foo.test bar.test' check >stdout || { cat stdout; Exit 1; }
-TESTS='foo.test bar.test' $MAKE -e check >stdout || { cat stdout; exit 1; }
++$MAKE TESTS='foo.test bar.test' check >stdout || { cat stdout; exit 1; }
cat stdout
grep '^SKIP: foo\.test .* from the last line$' stdout
1..0 # SKIP
END
- $MAKE TESTS='foo.test bar.test' check >stdout && { cat stdout; Exit 1; }
-TESTS='foo.test bar.test' $MAKE -e check >stdout && { cat stdout; exit 1; }
++$MAKE TESTS='foo.test bar.test' check >stdout && { cat stdout; exit 1; }
cat stdout
count_test_results total=5 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=3
1..0 # SKIP${tab} Strip${tab}external preserve ${tab}middle ${tab}${sp}
END
-TESTS='foo.test bar.test baz.test' $MAKE -e check > stdout \
+$MAKE TESTS='foo.test bar.test baz.test' check > stdout \
- || { cat stdout; Exit 1; }
+ || { cat stdout; exit 1; }
cat stdout
count_test_results total=3 pass=0 fail=0 error=0 xpass=0 xfail=0 skip=3
1..0 # SKIP $weirdchars
END
-env TESTS='foo.test bar.test baz.test wget.test curl.test mu.test' \
- $MAKE -e check >stdout || { cat stdout; exit 1; }
+$MAKE TESTS='foo.test bar.test baz.test wget.test curl.test mu.test' \
- check >stdout || { cat stdout; Exit 1; }
++ check >stdout || { cat stdout; exit 1; }
cat stdout
count_test_results total=6 pass=0 fail=0 xpass=0 xfail=0 skip=6 error=0
ok 0 # TODO
END
-TESTS='a.test b.test c.test d.test e.test' $MAKE -e check >stdout \
+$MAKE TESTS='a.test b.test c.test d.test e.test' check >stdout \
- && { cat stdout; Exit 1; }
+ && { cat stdout; exit 1; }
cat stdout
count_test_results total=5 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=5
not ok 4
ok 5 # SKIP
END
- $MAKE XFAIL_TESTS=all.test check >stdout && { cat stdout; Exit 1; }
-XFAIL_TESTS=all.test $MAKE -e check >stdout && { cat stdout; exit 1; }
++$MAKE XFAIL_TESTS=all.test check >stdout && { cat stdout; exit 1; }
cat stdout
count_test_results total=6 pass=0 fail=0 xpass=0 xfail=1 skip=1 error=4
grep '^ERROR: all\.test - too many tests run (expected 2, got 5)$' stdout
# Custom test drivers: try the "recheck" functionality with test protocols
# that allow multiple testcases in a single test script. In particular,
-# check that this still works when we override $(TESTS) and $(TEST_LOGS)
-# at make runtime.
-# See also related tests 'test-driver-custom-multitest-recheck.test' and
-# 'parallel-tests-recheck-override.test'.
+# check that this still works when we override $(TESTS) at make runtime.
+# See also related tests 'test-driver-custom-multitest-recheck.test'.
- . ./defs || Exit 1
+ . ./defs || exit 1
cp "$am_testauxdir"/trivial-test-driver . \
|| fatal_ "failed to fetch auxiliary script trivial-test-driver"
$ACLOCAL
$AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -a
for vpath in : false; do
++
if $vpath; then
mkdir build
cd build
rm -f *.run
- : An empty '$(TESTS)' or '$(TEST_LOGS)' means that no test should be run.
- for var in TESTS TEST_LOGS; do
- env "$var=" $MAKE -e recheck >stdout || { cat stdout; exit 1; }
- cat stdout
- count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
- test ! -r a.run
- test ! -r b.run
- test ! -r c.run
- done
- unset var
+ : An empty '$(TESTS)' means that no test should be run.
- $MAKE TESTS= recheck >stdout || { cat stdout; Exit 1; }
++ $MAKE TESTS= recheck >stdout || { cat stdout; exit 1; }
+ cat stdout
+ count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
+ test ! -r a.run
+ test ! -r b.run
+ test ! -r c.run
: a.test was successful the first time, no need to re-run it.
- $MAKE TESTS=a.test recheck >stdout || { cat stdout; Exit 1; }
- env TESTS=a.test $MAKE -e recheck >stdout \
- || { cat stdout; exit 1; }
++ $MAKE TESTS=a.test recheck >stdout || { cat stdout; exit 1; }
cat stdout
count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
test ! -r a.run
: b.test failed, it should be re-run. And make it pass this time.
echo OK > b.ok
- $MAKE TESTS=b recheck >stdout || { cat stdout; Exit 1; }
- TEST_LOGS=b.log $MAKE -e recheck >stdout \
- || { cat stdout; exit 1; }
++ $MAKE TESTS=b recheck >stdout || { cat stdout; exit 1; }
cat stdout
test ! -r a.run
test -f b.run
rm -f *.run
: No need to re-run a.test or b.test anymore.
- $MAKE TESTS=b recheck >stdout || { cat stdout; Exit 1; }
- TEST_LOGS=b.log $MAKE -e recheck >stdout \
- || { cat stdout; exit 1; }
++ $MAKE TESTS=b recheck >stdout || { cat stdout; exit 1; }
cat stdout
count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
test ! -r a.run
test ! -r b.run
test ! -r c.run
- $MAKE TESTS='a.test b.test' recheck >stdout || { cat stdout; Exit 1; }
- TESTS='a.test b.test' $MAKE -e recheck >stdout \
- || { cat stdout; exit 1; }
++ $MAKE TESTS='a.test b.test' recheck >stdout || { cat stdout; exit 1; }
cat stdout
count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
test ! -r a.run
# Use 'echo' here, since Solaris 10 /bin/sh would try to optimize
# a ':' away after the first iteration, even if it is redirected.
echo dummy > c.err
- $MAKE TESTS='a.test c' recheck >stdout && { cat stdout; Exit 1; }
- env TEST_LOGS='a.log c.log' $MAKE -e recheck >stdout \
- && { cat stdout; exit 1; }
++ $MAKE TESTS='a.test c' recheck >stdout && { cat stdout; exit 1; }
cat stdout
count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1
test ! -r a.run
: This time, make it pass
# Use 'echo', not ':'; see comments above for why.
echo dummy > c.ok
- $MAKE TESTS='c.test a.test' recheck >stdout || { cat stdout; Exit 1; }
- env TESTS='c.test a.test' $MAKE -e recheck >stdout \
- || { cat stdout; exit 1; }
++ $MAKE TESTS='c.test a.test' recheck >stdout || { cat stdout; exit 1; }
cat stdout
count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
test ! -r a.run
grep '%% pass-xpass-fail-xfail-skip-error %%' test-suite.log
test $(grep -c '%% ' test-suite.log) -eq 4
- TESTS='pass.t pass3-skip2-xfail.t' $MAKE -e check >stdout \
+ $MAKE TESTS='pass.t pass3-skip2-xfail.t' check >stdout \
- || { cat stdout; cat test-suite.log; Exit 1; }
+ || { cat stdout; cat test-suite.log; exit 1; }
cat test-suite.log
cat stdout
count_test_results total=7 pass=4 fail=0 skip=2 xfail=1 xpass=0 error=0
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Expose bug in conditional definition of TEST_EXTENSIONS.
+# Conditional definition of TEST_EXTENSIONS is supported.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
-AM_CONDITIONAL([COND], [:])
-AM_CONDITIONAL([COND2], [:])
+AC_CONFIG_FILES([sub/Makefile])
+AM_CONDITIONAL([COND1], [test x"$cond1" = x"yes"])
+AM_CONDITIONAL([COND2], [test x"$cond2" = x"yes"])
+AC_OUTPUT
END
-$ACLOCAL
+mkdir sub
-cat > 1.am << 'END'
-TESTS =
-if COND
-## lineno 4
-TEST_EXTENSIONS = .foo
+cat > Makefile.am << 'END'
+SUBDIRS = sub
+TESTS = foo.sh bar.test
+if COND1
+TEST_EXTENSIONS = .sh
endif
END
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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_EXTENSIONS with contents dynamically determined at make time
+
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_SUBST([suf], [.tap])
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+mkdir sub
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub
+TESTS = foo.sh bar.test baz.t1 mu.t1.t2 zardoz.tap
+TEST_EXTENSIONS = .test @suf@ $(foreach i,1 2,.t$(i))
+TEST_EXTENSIONS += $(subst &,.,$(call am__tolower,&SH))
+END
+
+cat > sub/Makefile.am << 'END'
+TESTS = 1.sh 2.bar 3
+TEST_EXTENSIONS = $(suffix $(TESTS))
+END
+
+cat > foo.sh << 'END'
+#!/bin/sh
+exit 0
+END
+chmod a+x foo.sh
+
+cp foo.sh bar.test
+cp foo.sh baz.t1
+cp foo.sh mu.t1.t2
+cp foo.sh zardoz.tap
+cp foo.sh sub/1.sh
+cp foo.sh sub/2.bar
+cp foo.sh sub/3
+
+do_setup ()
+{
+ $MAKE check ${1+"$@"}
+ ls -l . sub
+}
+
+do_clean ()
+{
+ $MAKE clean
+ test "$(find . -name '*.log')" = ./config.log
+}
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+
+do_setup
+test -f foo.log
+test -f bar.log
+test -f baz.log
+test -f mu.t1.log
+test -f zardoz.log
+test -f sub/1.log
+test -f sub/2.log
+test -f sub/3.log
+
+do_clean
+
+do_setup TEST_EXTENSIONS='.sh .t2 $(subst o,e,.tost) ${suf}'
+test -f foo.log
+test -f bar.log
+test -f baz.t1.log
+test -f mu.t1.log
+test -f zardoz.log
+test -f sub/1.log
+test -f sub/2.bar.log
+test -f sub/3.log
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2011-2012 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 that Automake can handle "funny chars" in TEST_EXTENSIONS,
+# as long as they can be used in GNU make variable names.
+
- grep 'Hello Zardoz' zardoz.log && Exit 1
- test $st -eq 0 || Exit 1
++. ./defs || exit 1
+
+fetch_tap_driver
+
+echo AC_OUTPUT >> configure.ac
+
+cat >> Makefile.am <<'END'
+TEST_EXTENSIONS = .@ .2 .f-o-o .l!Nu.x
+TESTS = foo.@ bar.f-o-o baz.2 zardoz.l!Nu.x
+XFAIL_TESTS = zardoz.l!Nu.x
+@_LOG_COMPILER = $(SHELL)
+2_LOG_COMPILER = $(SHELL)
+F-O-O_LOG_DRIVER = $(srcdir)/tap-driver
+L!NU.X_LOG_COMPILER = false
+EXTRA_DIST = $(TESTS) tap-driver
+END
+
+touch foo.@ bar.f-o-o zardoz.l!Nu.x \
+ || skip_ "your file system doesn't support funny characters"
+
+# Try to ensure this file fails if executed directly.
+cat > foo.@ << 'END'
+#! /bin/false
+echo @K @K @K
+exit 0
+END
+cp foo.@ baz.2
+# We don't want them to be executable, either. So do this for
+# extra safety.
+chmod a-x foo.@ baz.2
+
+cat > bar.f-o-o << 'END'
+#! /bin/sh
+echo 1..4
+echo "ok - good"
+echo "ok 2 # SKIP"
+echo "not ok 3 # TODO"
+echo ok
+END
+chmod a+x bar.f-o-o
+
+cat > zardoz.l!Nu.x << 'END'
+#! /bin/sh
+echo Hello Zardoz
+exit 0
+END
+chmod a+x zardoz.l!Nu.x
+
+count_all ()
+{
+ count_test_results total=7 pass=4 fail=0 skip=1 xfail=2 xpass=0 error=0
+ grep '^PASS: foo\.@$' stdout
+ grep '^PASS: baz\.2$' stdout
+ grep '^XFAIL: zardoz.l!Nu\.x$' stdout
+ grep '^PASS: bar\.f-o-o 1 - good' stdout
+ grep '^SKIP: bar\.f-o-o 2 # SKIP' stdout
+ grep '^XFAIL: bar\.f-o-o 3 # TODO' stdout
+ grep '^PASS: bar\.f-o-o 4$' stdout
+}
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+st=0; $MAKE check >stdout || st=$?
+cat stdout
+ls -l
+cat test-suite.log
+cat foo.log
+grep '@K @K @K' foo.log
+cat baz.log
+grep '@K @K @K' baz.log
+cat bar.log
+cat zardoz.log
- test $st -gt 0 || Exit 1
++grep 'Hello Zardoz' zardoz.log && exit 1
++test $st -eq 0 || exit 1
+count_all
+
+$MAKE clean
+test ! -f test-suite.log
+test ! -f foo.log
+test ! -f bar.log
+test ! -f baz.log
+test ! -f zardoz.log
+
+st=0
+$MAKE check TESTS=zardoz L!NU.X_LOG_COMPILER=/bin/sh >stdout || st=$?
+cat stdout
+count_test_results total=1 pass=0 fail=0 skip=0 xfail=0 xpass=1 error=0
+cat test-suite.log
+test ! -f foo.log
+test ! -f bar.log
+test ! -f baz.log
+cat zardoz.log
+grep 'Hello Zardoz' zardoz.log
- $MAKE recheck >stdout || { cat stdout; Exit 1; }
++test $st -gt 0 || exit 1
+
- $MAKE recheck >stdout || { cat stdout; Exit 1; }
++$MAKE recheck >stdout || { cat stdout; exit 1; }
+cat stdout
+count_test_results total=1 pass=0 fail=0 skip=0 xfail=1 xpass=0 error=0
+grep '^XFAIL: zardoz.l!Nu\.x$' stdout
+
- $MAKE distcheck >stdout || { cat stdout; Exit 1; }
++$MAKE recheck >stdout || { cat stdout; exit 1; }
+cat stdout
+count_test_results total=0 pass=0 fail=0 skip=0 xfail=0 xpass=0 error=0
+
++$MAKE distcheck >stdout || { cat stdout; exit 1; }
+cat stdout
+count_all
+
+:
# 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 'acconfig.h' is automatically distributed if it exists
-# (at automake runtime).
-# Related to automake bug#7819.
+# Make sure that invalid entries in TEST_EXTENSIONS are diagnosed at
+# make runtime. See automake bug#9400.
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >> configure.ac <<END
-AC_OUTPUT
-END
+echo AC_OUTPUT >> configure.ac
-cat > Makefile.am <<'END'
-.PHONY: test
-test: distdir
- ls -l $(distdir)
- echo ' ' $(DIST_COMMON) ' ' | grep '[ /]acconfig\.h '
- test -f $(distdir)/acconfig.h
+cat > Makefile.am << 'END'
+TESTS =
+TEST_EXTENSIONS = mu x1 .foo _ x2
END
-: > acconfig.h
-
$ACLOCAL
-$AUTOMAKE
$AUTOCONF
+$AUTOMAKE -a
./configure
-$MAKE test
+
- $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
++$MAKE 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+for suf in mu x1 _ x2; do
+ $FGREP "invalid test extension: '$suf'" stderr
+done
+
+# Verify that we don't report valid suffixes, even if intermixed
+# with invalid ones.
- grep 'invalid.*extension.*foo' stderr && Exit 1
++grep 'invalid.*extension.*foo' stderr && exit 1
:
./configure
- $MAKE TEST_SUITE_LOG=my.log check && Exit 1
-TEST_SUITE_LOG=my.log $MAKE -e check && exit 1
++$MAKE TEST_SUITE_LOG=my.log check && exit 1
ls -l # For debugging.
test ! -f test-suite.log
test ! -f global.log
:test-result: XFAIL
END
- $MAKE check && Exit 1
+cat > mu << 'END'
+:test-result: PASS
+:global-test-result: XFAIL
+:test-result: PASS
+:test-result: PASS
+END
+
+ $MAKE check && exit 1
cat test-suite.log
have_result <<END
:test-result: ERROR
END
: > zar-doz.x
+: > mu
- $MAKE check && Exit 1
+ $MAKE check && exit 1
cat test-suite.log
have_result <<END
:test-global-result: SKIP
:test-result: FAIL
END
-cat > bar.test <<END
+cat > bar <<END
:test-global-result: PASS
END
- mk_check && Exit 1
+ mk_check && exit 1
count_test_results total=1 pass=0 fail=1 xpass=0 xfail=0 skip=0 error=0
cat > foo.test <<END
:test-result: XPASS
:test-result: ERROR
END
-: > bar.test
+: > bar
- mk_check && Exit 1
+ mk_check && exit 1
count_test_results total=6 pass=1 fail=1 xpass=1 xfail=1 skip=1 error=1
-cp foo.test bar.test
+cp foo.test bar
- mk_check && Exit 1
+ mk_check && exit 1
count_test_results total=12 pass=2 fail=2 xpass=2 xfail=2 skip=2 error=2
# Check that we are liberal w.r.t. whitespace use.
|:test-result:$RESULT $tab|
|:test-result:$tab$tab $RESULT$tab $tab |
END
- echo " $tab $tab$tab :test-result: $RESULT" >> bar.test
+ echo " $tab $tab$tab :test-result: $RESULT" >> bar
done
cat foo.test # For debugging.
-cat bar.test # Likewise.
+cat bar # Likewise.
- mk_check && Exit 1
+ mk_check && exit 1
count_test_results total=30 pass=5 fail=5 xpass=5 xfail=5 skip=5 error=5
:
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# parallel-tests:
-# - non-existent scripts listed in TESTS get diagnosed
-# See also related test 'test-missing2.test'.
+# parallel-tests: non-existent scripts listed in TESTS get diagnosed.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_OUTPUT
./configure
- $MAKE check >stdout 2>stderr && { cat stdout; cat stderr >&2; Exit 1; }
-$MAKE check >output 2>&1 && { cat output; exit 1; }
-cat output
++$MAKE check >stdout 2>stderr && { cat stdout; cat stderr >&2; exit 1; }
+cat stdout; cat stderr >&2
test -f ok.log
-grep '^PASS: ok\.test' output
-$FGREP 'zardoz.log' output
+grep '^PASS: ok\.test' stdout
+$FGREP 'zardoz.log' stderr
test ! -f test-suite.log
- $MAKE TESTS='zardoz2.test' check 2>stderr && { cat stderr >&2; Exit 1; }
-TESTS='zardoz2.test' $MAKE -e check >output 2>&1 \
- && { cat output; exit 1; }
-cat output
-$FGREP 'zardoz2.log' output
++$MAKE TESTS='zardoz2.test' check 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr
+$FGREP 'zardoz2.log' stderr
test ! -f test-suite.log
- $MAKE TESTS='zardoz3' check 2>stderr && { cat stderr >&2; Exit 1; }
-TEST_LOGS='zardoz3.log' $MAKE -e check >output 2>&1 \
- && { cat output; exit 1; }
-cat output
-$FGREP 'zardoz3.log' output
++$MAKE TESTS='zardoz3' check 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+$FGREP 'zardoz3.log' stderr
test ! -f test-suite.log
# The errors should persist even after 'test-suite.log'
$MAKE check
rm -f zardoz.test
- $MAKE check 2>stderr && { cat stderr >&2; Exit 1; }
-$MAKE check >output 2>&1 && { cat output; exit 1; }
-cat output
-$FGREP 'zardoz.log' output
++$MAKE check 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+$FGREP 'zardoz.log' stderr
test ! -f test-suite.log
:
# 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 'acconfig.h' is *not* automatically distributed when
-# placed in a subdirectory.
-# Related to automake bug#7819.
+# Check parallel harness features:
+# - recovery from deleted '.log' and '.trs' files, with parallel make
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >> configure.ac <<END
-AC_CONFIG_FILES([sub/Makefile])
-AC_OUTPUT
-END
+all= log= trs=
+for i in 1 2 3 4 5 6 7 8 9 10 11 12; do
+ all="$all $i" log="$log $i" trs="$trs $i"
+done
-cat > Makefile.am <<'END'
-SUBDIRS = sub
-sub/acconfig.h:
- echo target $@ should not be built >&2; exit 1
-check-local: distdir
- ls -l $(distdir)/sub
- test ! -f $(distdir)/sub/acconfig.h
-END
+echo AC_OUTPUT >> configure.ac
+echo TESTS = > Makefile.am
-mkdir sub
+for i in $all; do
+ echo TESTS += $i.test >> Makefile.am
+ (echo "#!/bin/sh" && echo "mkdir $i.d") > $i.test
+ chmod a+x $i.test
+done
-cat > sub/Makefile.am <<'END'
-acconfig.h:
- echo target $@ should not be built >&2; exit 1
-check-local:
- echo $(DISTFILES) | grep 'acconfig\.h' && exit 1; :
- echo $(DIST_COMMON) | grep 'acconfig\.h' && exit 1; :
-END
-
-: > sub/acconfig.h
+ls -l # For debugging.
$ACLOCAL
-$AUTOMAKE
$AUTOCONF
+$AUTOMAKE -a
./configure
+
+: Create the required log files.
$MAKE check
+for n in 1 2 5 7 12; do
+ for suf in log trs; do
+ rmdir *.d
+ rm -f *.$suf
+ $MAKE -j$n check
+ for f in $all; do
+ test -f $f.log
+ test -f $f.trs
+ done
+ done
+done
+
:
rm -f foo.trs
update_stamp
touch bar.test
- $MAKE AM_LAZY_CHECK=yes check >stdout || { cat stdout; Exit 1; }
-RECHECK_LOGS= $MAKE -e check >stdout || { cat stdout; exit 1; }
++$MAKE AM_LAZY_CHECK=yes check >stdout || { cat stdout; exit 1; }
cat stdout
# Check that make has updated what it needed to, but no more.
test -f foo.trs
grep '^See \./my_test_suite\.log$' stdout
mkdir bar
- $MAKE TEST_SUITE_LOG=bar/bar.log check >stdout && { cat stdout; Exit 1; }
-TEST_SUITE_LOG=bar/bar.log $MAKE -e check >stdout && { cat stdout; exit 1; }
++$MAKE TEST_SUITE_LOG=bar/bar.log check >stdout && { cat stdout; exit 1; }
cat stdout
grep '^See \./bar/bar\.log$' stdout
grep '^See sub/test-suite\.log$' stdout
cd ..
- $MAKE TEST_SUITE_LOG=foo.log check >stdout && { cat stdout; Exit 1; }
-TEST_SUITE_LOG=foo.log $MAKE -e check >stdout && { cat stdout; exit 1; }
++$MAKE TEST_SUITE_LOG=foo.log check >stdout && { cat stdout; exit 1; }
cat stdout
grep '^See sub/foo\.log$' stdout
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Texinfo input files using @include directives. Check both in-tree
+# and VPATH builds, and both top-level and subdir input.
+
+required='makeinfo tex texi2dvi'
++. ./defs || exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am << 'END'
+info_TEXINFOS = main.texi sub/more.texi
+main_TEXINFOS = one.texi two.texi three.texi
+sub_more_TEXINFOS = sub/one.texi sub/two.texi
+END
+
+cat > main.texi << 'END'
+\input texinfo
+@setfilename main.info
+@settitle main
+@ifnottex
+@node Top
+@top GNU dummy.
+@menu
+* one:: Chapter one
+* two:: Chapter two
+* three:: Chapter three
+@end menu
+@end ifnottex
+@include one.texi
+@include two.texi
+@include three.texi
+@bye
+END
+
+cat > one.texi << 'END'
+@node one
+@chapter Chapter one
+Foo bar, baz.
+END
+
+cat > two.texi << 'END'
+@node two
+@chapter Chapter two
+Blah Blah Blah.
+END
+
+cat > three.texi << 'END'
+@node three
+@chapter Chapter two
+GNU's Not Unix.
+END
+
+mkdir sub
+
+cat > sub/more.texi << 'END'
+\input texinfo
+@setfilename more.info
+@settitle main
+@ifnottex
+@node Top
+@top GNU more.
+@menu
+* desc:: Description of this program
+* hist:: History of this program
+@end menu
+@end ifnottex
+@include one.texi
+@include two.texi
+@bye
+END
+
+cat > sub/one.texi << 'END'
+@node desc
+@chapter Description of this program
+It does something, really.
+END
+
+cat > sub/two.texi << 'END'
+@node hist
+@chapter History of this program
+It was written somehow.
+END
+
+cat > exp << 'END'
+./main.info
+./sub/more.info
+END
+
+check_info_contents ()
+{
+ srcdir=${1-.}
+ $FGREP "Foo bar, baz." $srcdir/main.info
+ $FGREP "Blah Blah Blah." $srcdir/main.info
+ $FGREP "GNU's Not Unix." $srcdir/main.info
+ $FGREP 'It does something, really.' $srcdir/sub/more.info
+ $FGREP 'It was written somehow.' $srcdir/sub/more.info
+}
+
+get_info_names ()
+{
+ find ${1-.} -type f -name '*.info' | LC_ALL=C sort > got
+}
+
+check_expected ()
+{
+ cat exp
+ cat got
+ diff exp got
+}
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure
+
+$MAKE info
+get_info_names
+check_expected
+
+check_info_contents
+
+$MAKE dvi
+test -f main.dvi
+test -f sub/more.dvi
+
+$MAKE maintainer-clean
+test ! -f main.dvi
+test ! -f sub/more.dvi
+test ! -f main.info
+test ! -f sub/more.info
+
+mkdir build
+cd build
+../configure
+$MAKE all dvi
+
+get_info_names ..
+sed 's|^\./|../|' ../exp > exp
+check_expected
+
+test -f main.dvi
+test -f sub/more.dvi
+
+check_info_contents ..
+
+$MAKE distcheck
+
+:
# 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 we only create texinfo-related targets once.
+# Some grepping checks on Texinfo support.
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat > Makefile.am << 'END'
-info_TEXINFOS = maude.texi liver.txi heart.texinfo
-END
+echo AC_OUTPUT >> configure.ac
+
+$ACLOCAL
-echo '@setfilename maude.info' > maude.texi
-echo '@setfilename liver.info' > liver.txi
-echo '@setfilename heart.info' > heart.texinfo
: > texinfo.tex
-$ACLOCAL
+echo info_TEXINFOS = main.texi other.texi sub/x.texi > Makefile.am
+mkdir sub
+echo @setfilename main.info > main.texi
+echo @setfilename other.info > other.texi
+echo @setfilename sub/x.info > sub/x.texi
$AUTOMAKE
+$EGREP '\.(info|pdf|ps|dvi|html|texi)' Makefile.in # For debugging.
+test $(grep -c '^%\.info: %\.texi$' Makefile.in) -eq 1
+test $(grep -c '^%\.html: %\.texi$' Makefile.in) -eq 1
+test $(grep -c '^%\.dvi: %\.texi$' Makefile.in) -eq 1
+test $(grep -c '^%\.pdf: %\.texi$' Makefile.in) -eq 1
+test $(grep -c '^%\.ps: %\.dvi$' Makefile.in) -eq 1
-# These are just examples -- basically for many targets in texinfos.am
-# we only want them to appear once. But grepping them all would be
-# overkill.
for t in info dist-info dvi-am install-html uninstall-pdf-am; do
- $EGREP "(^| )$t*.:" Makefile.in # For debugging.
- test $($EGREP -c "(^| )$t(:| *.:)" Makefile.in) -eq 1
+ $FGREP $t Makefile.in # For debugging.
+ test $(grep -c "^$t *:" Makefile.in) -eq 1
done
:
# 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 backslash-newline-hash combinations are diagnosed as
-# comments following a trailing backslash, even when the combination
-# follows a variable assignment that is preceded by a comment.
+# Test that automake complains properly when texinfo input files
+# specify output info files with an invalid extension.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat > Makefile.am << 'END'
-# initial comment
-variable = value-before-comment \
-#
-
-# comment
-SUBDIRS = foo \
-# bar
-
+info_TEXINFOS = foo.texi bar.texi baz.texi
END
-mkdir foo
+echo '@setfilename foo.inf' > foo.texi
+echo '@setfilename bar' > bar.texi
+echo '@setfilename baz.texi' > baz.texi
+: > texinfo.tex
$ACLOCAL
AUTOMAKE_fails
$ACLOCAL
$AUTOMAKE --add-missing
- grep 'foobar' Makefile.in && Exit 1
-grep 'example' Makefile.in && exit 1
-grep 'texinfo:' Makefile.in
++grep 'foobar' Makefile.in && exit 1
+grep 'texinfo\.info:' Makefile.in
+
+:
END
# makeinfo will bail out, but we should conserve the old info files.
- $MAKE && Exit 1
+ $MAKE && exit 1
-test -f main
-test -f main-1
+test -f main.info
+test -f main.info-1
# Restore main.texi, and break sub/main.texi.
cp main.texi sub/main.texi
mv main.old main.texi
- $MAKE && Exit 1
+ $MAKE && exit 1
-test -f main
-test ! -f main-1
-test -f sub/main
-test -f sub/main-1
+test -f main.info
+test ! -f main.info-1
+test -f sub/main.info
+test -f sub/main.info-1
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2003-2012 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 support for building HTML documentation, and the many
+# install-DOC flavors, in VPATH builds.
+# Keep in sync with sister test 'txinfo21.sh'.
+# FIXME: in the long term, the best thing to do is probably to
+# FIXME: convert this test and the sister test 'txinfo21.sh' to
+# FIXME: TAP, and merge them.
+
+required='makeinfo tex texi2dvi'
++. ./defs || exit 1
+
+cat >>configure.ac <<\EOF
+AC_CONFIG_FILES([rec/Makefile])
+
+# At the time of writing, Autoconf does not supplies any of these
+# definitions (and those below are purposely not those of the standard).
+AC_SUBST([dvidir], ['${datadir}/${PACKAGE}/dvi'])
+AC_SUBST([htmldir], ['${datadir}/${PACKAGE}/html'])
+AC_SUBST([pdfdir], ['${datadir}/${PACKAGE}/pdf'])
+AC_SUBST([psdir], ['${datadir}/${PACKAGE}/ps'])
+
+AC_OUTPUT
+EOF
+
+cat > Makefile.am << 'END'
+SUBDIRS = rec
+info_TEXINFOS = main.texi sub/main2.texi
+END
+
+cat > main.texi << 'END'
+\input texinfo
+@setfilename main.info
+@settitle main
+@node Top
+Hello walls.
+@bye
+END
+
+mkdir sub
+cat > sub/main2.texi << 'END'
+\input texinfo
+@setfilename main2.info
+@settitle main2
+@node Top
+Hello walls.
+@bye
+END
+
+mkdir rec
+cat > rec/main3.texi << 'END'
+\input texinfo
+@setfilename main3.info
+@settitle main3
+@node Top
+Hello walls.
+@bye
+END
+
+cat > rec/Makefile.am << 'END'
+info_TEXINFOS = main3.texi
+
+install-pdf-local:
+ @$(MKDIR_P) "$(pdfdir)"
+ :> "$(pdfdir)/hello"
+uninstall-local:
+ rm -f "$(pdfdir)/hello"
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+
+$MAKE
+
+$sleep
+# Test production of split-per-node HTML.
+$MAKE html
+test -d main.html
+test -d sub/main2.html
+test -d rec/main3.html
+
+# Rebuilding main.html should cause its timestamp to be updated.
+is_newest main.html ../main.texi
+$sleep
+touch ../main.texi
+$MAKE html
+is_newest main.html ../main.texi
+
+$MAKE clean
+test ! -d main.html
+test ! -d sub/main2.html
+test ! -d rec/main3.html
+
+# Test production of a single HTML file.
+$MAKE MAKEINFOFLAGS=--no-split html
+test -f main.html
+test -f sub/main2.html
+test -f rec/main3.html
+$MAKE clean
+test ! -f main.html
+test ! -f sub/main2.html
+test ! -f rec/main3.html
+
+# Make sure AM_MAKEINFOHTMLFLAGS is supported, and override AM_MAKEINFO.
+cat >> ../Makefile.am <<\EOF
+AM_MAKEINFOHTMLFLAGS = --no-headers --no-split
+AM_MAKEINFOFLAGS = --unsupported-option
+EOF
+../configure --prefix "`pwd`"
+$MAKE html
+test -f main.html
+test -f sub/main2.html
+test -d rec/main3.html
+$MAKE clean
+test ! -f main.html
+test ! -f sub/main2.html
+test ! -d rec/main3.html
+
+$MAKE install-html
+test -f share/$me/html/main.html
+test -f share/$me/html/main2.html
+test -d share/$me/html/main3.html
+$MAKE uninstall
+test ! -f share/$me/html/main.html
+test ! -f share/$me/html/main2.html
+test ! -d share/$me/html/main3.html
+
+$MAKE install-dvi
+test -f share/$me/dvi/main.dvi
+test -f share/$me/dvi/main2.dvi
+test -f share/$me/dvi/main3.dvi
+$MAKE uninstall
+test ! -f share/$me/dvi/main.dvi
+test ! -f share/$me/dvi/main2.dvi
+test ! -f share/$me/dvi/main3.dvi
+
+dvips --help || skip_ "dvips is missing"
+
+$MAKE install-ps
+test -f share/$me/ps/main.ps
+test -f share/$me/ps/main2.ps
+test -f share/$me/ps/main3.ps
+$MAKE uninstall
+test ! -f share/$me/ps/main.ps
+test ! -f share/$me/ps/main2.ps
+test ! -f share/$me/ps/main3.ps
+
+pdfetex --help || pdftex --help \
+ || skip_ "pdftex and pdfetex are both missing"
+
+$MAKE install-pdf
+test -f share/$me/pdf/main.pdf
+test -f share/$me/pdf/main2.pdf
+test -f share/$me/pdf/main3.pdf
+test -f share/$me/pdf/hello
+$MAKE uninstall
+test ! -f share/$me/pdf/main.pdf
+test ! -f share/$me/pdf/main2.pdf
+test ! -f share/$me/pdf/main3.pdf
+test ! -f share/$me/pdf/hello
+
+:
: > $inst/share/foobar.txt
chmod a-w $inst/share
- $MAKE uninstall 2>stderr && { cat stderr >&2; Exit 1; }
-$MAKE uninstall >output 2>&1 && { cat output; exit 1; }
-cat output
++$MAKE uninstall 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
if test $rm_f_is_silent_on_error = yes; then
: "rm -f" is silent on errors, skip the grepping of make output
else
chmod a-rwx $inst/share
(cd $inst/share) && skip_ "cannot make directories fully unreadable"
- $MAKE uninstall 2>stderr && { cat stderr >&2; Exit 1; }
- cat stderr >&2
-$MAKE uninstall >output 2>&1 && { cat output; exit 1; }
-cat output
++$MAKE uninstall 2>stderr && { cat stderr >&2; exit 1; }
#
# Some shells, like Solaris 10 /bin/sh and /bin/ksh, do not report
# the name of the 'cd' builtin upon a chdir error:
# Test to make sure compiling Vala code really works with recursive make.
-required="pkg-config valac gcc GNUmake"
+required="pkg-config valac gcc"
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_PROG_CC
# Building libraries (libtool and static) from Vala sources.
# And use of vapi files to call C code from Vala.
-required="valac cc pkg-config libtoolize GNUmake"
+required="valac cc pkg-config libtoolize"
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_PROG_CC
# Vala sources and C sources in the same program. Functional test.
-required='valac cc GNUmake'
+required='valac cc'
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac <<'END'
AC_PROG_CC
# Vala sources, C and C++ sources and C and C++ headers in the same
# program. Functional test. See automake bug#10894.
-required='valac cc c++ GNUmake'
+required='valac cc c++'
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac <<'END'
AC_PROG_CC
# Vala support with parallel make.
-required='valac cc GNUmake'
+required='valac cc'
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac <<'END'
AC_PROG_CC
# Test and that vapi files are correctly handled by Vala support.
-required='valac cc GNUmake'
+required='valac cc'
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac <<'END'
AC_PROG_CC
# Test to make sure vala support handles from-scratch VPATH builds.
# See automake bug#8753.
-required="cc valac GNUmake"
+required="cc valac"
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_CONFIG_SRCDIR([hello.vala])
# Test to make sure compiling Vala code really works with recursive make.
-required="pkg-config valac gcc GNUmake"
+required="pkg-config valac gcc"
- . ./defs || Exit 1
+ . ./defs || exit 1
mkdir src
# Test to make sure compiling Vala code really works with non-recursive make.
-required="pkg-config valac gcc GNUmake"
+required="pkg-config valac gcc"
- . ./defs || Exit 1
+ . ./defs || exit 1
mkdir src
# Test per-target flags.
-required="pkg-config valac gcc GNUmake"
+required="pkg-config valac gcc"
- . ./defs || Exit 1
+ . ./defs || exit 1
mkdir src
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Automake should allow us top append to undefined variables, for
+# consistency with GNU make. For the same reason, if we override
+# a variable definition from the command line, any '+=' appending
+# to it should get overridden as well.
+# See also "spy" test 'spy-var-append.sh'.
+
- $MAKE "$@" 2>stderr && test ! -s stderr || { cat stderr >&2; Exit 1; }
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AM_CONDITIONAL([COND_NO], [false])
+AM_CONDITIONAL([COND_YES], [:])
+AM_CONDITIONAL([COND_YES2], [:])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+var0 += foo0
+
+if COND_NO
+var00 += foo00
+endif
+
+if COND_YES
+if COND_YES2
+var000 += foo000
+endif
+endif
+
+if COND_NO
+var1 = oops
+endif
+var1 += bar
+if COND_YES
+var1 += baz
+endif
+if COND_NO
+var1 += oops
+endif
+
+if COND_YES
+var2 = a
+endif
+var2 += b
+
+if COND_YES
+var3 := c
+endif
+var3 += d
+
+var4 = cuckoo
+var4 += nightingale
+
+.PHONY: test1 test2
+test1:
+ test x'$(var0)' = x'foo0'
+ test x'$(var00)' = x''
+ test x'$(var000)' = x'foo000'
+ test x'$(var1)' = x'bar baz'
+ test x'$(var2)' = x'a b'
+ test x'$(var3)' = x'c d'
+ test x'$(var4)' = x'cuckoo nightingale'
+test2:
+ test x'$(var0)' = x
+ test x'$(var1)' = x'one'
+ test x'$(var2)' = x'two'
+ test x'$(var3)' = x'three'
+ test x'$(var4)' = x''
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+checkit ()
+{
++ $MAKE "$@" 2>stderr && test ! -s stderr || { cat stderr >&2; exit 1; }
+}
+
+checkit test1
+checkit test2 var0= var1=one var2=two var3=three var4=
+
+:
# 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 for _AM_OUTPUT_DEPENDENCY_COMMANDS grouping bug,
-# reported by Markus Duft.
+# Automake do not complain about nor messes up GNU make specific
+# variable assignments (":=" and "?=").
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >>configure.ac << END
-AC_PROG_CC
-AC_OUTPUT
-END
+echo AC_OUTPUT >> configure.ac
-cat > Makefile.am << END
-bin_PROGRAMS = foo
-foo_SOURCES = foo.c foo.h
-END
+unset PREFOO FOO BAR BAZ XFOO XBAZ || :
+
+cat > Makefile.am <<'END'
+PREFOO = bar
+FOO := foo$(PREFOO)$(XFOO)
+XFOO = fail
+BAR ?= barbar
-cat >foo.c << END
-#include "foo.h"
+.PHONY: test1 test2
+test1:
+ test $(FOO) = foobar
+ test $(BAR) = barbar
+test2:
+ test $(FOO) = foobar
+ test $(BAR) = rabrab
END
-: >foo.h
$ACLOCAL
-$AUTOMAKE
$AUTOCONF
-./configure --disable-dependency-tracking 2>stderr || {
- stat=$?; cat stderr >&2; exit $stat;
-}
-cat stderr >&2
-grep shift stderr && exit 1
+$AUTOMAKE
+./configure
+$MAKE test1
+PREFOO=notseen FOO=notseen BAR=rabrab $MAKE test2
:
# Targets and macros are two different name spaces.
- . ./defs || Exit 1
+ . ./defs || exit 1
cat > Makefile.am << 'END'
-install = install
-install:
- $(install) install
+xinstall = xinstall
+xinstall:
+ $(xinstall) xinstall
END
$ACLOCAL
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2010-2012 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 we warn about possible variable typos for the
+# *_DEPENDENCIES when we should, and do not warn about them
+# when we should not.
+
- $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
++. ./defs || exit 1
+
+subdirs='ok1 ok2 ko1 ko2'
+mkdir $subdirs
+
+errgrep ()
+{
+ grep "variable '${1}_DEPENDENCIES' is defined" stderr
+ grep "'$1' as canonical name" stderr
+}
+
+cat >> configure.ac <<END
+AC_CONFIG_FILES([$(for d in $subdirs; do echo $d/Makefile; done)])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+AM_LDFLAGS = unused
+ETAGS_ARGS = --unused
+TAGS_DEPENDENCIES = foo.c
+CONFIG_STATUS_DEPENDENCIES = cvs-version.sh
+CONFIGURE_DEPENDENCIES = cvs-version.sh
+foo.c:
+ echo 'int main (void) { return 0; }' > $@
+END
+
+: > cvs-version.sh
+
+cat > ok1/Makefile.am <<'END'
+TESTS = unused ignored.test
+LOG_DEPENDENCIES = unused
+TEST_LOG_DEPENDENCIES = unused
+END
+
+cat > ok2/Makefile.am <<'END'
+TESTS = ignored.sh notseen.tap
+TEST_EXTENSIONS = .sh .tap
+LOG_DEPENDENCIES = unused
+SH_LOG_DEPENDENCIES = unused
+TAP_LOG_DEPENDENCIES = unused
+END
+
+cat > ko1/Makefile.am <<'END'
+LOG_DEPENDENCIES =
+TEST_LOG_DEPENDENCIES =
+END
+
+cat > ko2/Makefile.am <<'END'
+TESTS = unused ignored.test
+TEST_LOG_DEPENDENCIES =
+LOG_DEPENDENCIES =
+SH_LOG_DEPENDENCIES =
+CONFIGSTATUS_DEPENDENCIES =
+CONFIG_DEPENDENCIES =
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE
+(cd ok1 && $MAKE)
+(cd ok2 && $MAKE)
+
+cd ko1
- $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
++$MAKE 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+errgrep LOG
+errgrep TEST_LOG
+cd ..
+
+cd ko2
- $EGREP "'(TEST_)?LOG" stderr && Exit 1
++$MAKE 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+errgrep SH_LOG
+errgrep CONFIG
+errgrep CONFIGSTATUS
++$EGREP "'(TEST_)?LOG" stderr && exit 1
+cd ..
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2010-2012 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 we allow the use to whitelist false positives in our
+# detection of variable typos. Inspired by the GNU coreutils (8.17)
+# build system.
+
+required=cc
- $MAKE AM_VARTYPOS_WHITELIST= 2>stderr && { cat stderr; Exit 1; }
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_SUBST([LIBSELINUX], ["$l_selinux"])
+AC_OUTPUT
+END
+
+l_selinux=; export l_selinux=
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = cp mv rm
+noinst_LIBRARIES = libremove.a libcopy.a
+remove_LDADD = libremove.a
+copy_LDADD = libcopy.a
+copy_LDADD += @LIBSELINUX@
+cp_LDADD = $(copy_LDADD)
+rm_LDADD = $(remove_LDADD)
+mv_LDADD = $(copy_LDADD) $(remove_LDADD)
+AM_VARTYPOS_WHITELIST = copy_LDADD remove_LDADD
+EXTRA_DIST = libcopy.h libremove.h
+END
+
+echo 'extern void cu_copy (void);' > libcopy.h
+echo 'extern void cu_remove (void);' > libremove.h
+
+cat > libcopy.c << 'END'
+#include "libcopy.h"
+void cu_copy (void) { return; }
+END
+
+cat > libremove.c << 'END'
+#include "libremove.h"
+void cu_remove (void) { return; }
+END
+
+cat > cp.c <<'END'
+#include "libcopy.h"
+int main (void)
+{
+ cu_copy ();
+ return 0;
+}
+END
+
+cat > rm.c <<'END'
+#include "libremove.h"
+int main (void)
+{
+ cu_remove ();
+ return 0;
+}
+END
+
+cat > mv.c <<'END'
+#include "libremove.h"
+#include "libcopy.h"
+int main (void)
+{
+ cu_copy ();
+ cu_remove ();
+ return 0;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE
+
+# If we remove the whitelisting, failure ensues.
- $MAKE AM_VARTYPOS_WHITELIST=remove_LDADD 2>stderr && { cat stderr; Exit 1; }
++$MAKE AM_VARTYPOS_WHITELIST= 2>stderr && { cat stderr; exit 1; }
+cat stderr >&2
+grep "'copy_LDADD' is defined but no program" stderr
+grep "'remove_LDADD' is defined but no program" stderr
- grep "remove_LDADD" stderr && Exit 1
++$MAKE AM_VARTYPOS_WHITELIST=remove_LDADD 2>stderr && { cat stderr; exit 1; }
+cat stderr >&2
+grep "'copy_LDADD' is defined but no program" stderr
++grep "remove_LDADD" stderr && exit 1
+
+# Sanity check the distribution.
+$MAKE distcheck
+
+:
# Make sure we warn about possible variable typos when we should.
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >>configure.ac <<'END'
+: > ltmain.sh
+
+cat >> configure.ac <<'END'
+m4_define([AC_PROG_RANLIB], [AC_SUBST([RANLIB], [who-cares])])
+m4_define([AM_PROG_AR], [AC_SUBST([AR], [who-cares])])
+m4_define([LT_INIT], [AC_SUBST([LIBTOOL], [who-cares])])
+LT_INIT
+AM_PROG_AR
AC_PROG_RANLIB
AC_OUTPUT
END
END
$ACLOCAL
-AUTOMAKE_fails -Wno-extra-portability
-# The expected diagnostic is:
-# automake: warnings are treated as errors
-# Makefile.am:2: warning: variable 'nodist_foo_SOURCES' is defined but no program or
-# Makefile.am:2: library has 'foo' as canonical name (possible typo)
-# Makefile.am:1: warning: variable 'foo_SOURCES' is defined but no program or
-# Makefile.am:1: library has 'foo' as canonical name (possible typo)
-# Makefile.am:9: warning: variable 'libfoo_a_SOURCES' is defined but no program or
-# Makefile.am:9: library has 'libfoo_a' as canonical name (possible typo)
-# Makefile.am:10: warning: variable 'nodist_libfoo_a_SOURCES' is defined but no program or
-# Makefile.am:10: library has 'libfoo_a' as canonical name (possible typo)
-# Makefile.am:11: warning: variable 'EXTRA_libfoo_a_SOURCES' is defined but no program or
-# Makefile.am:11: library has 'libfoo_a' as canonical name (possible typo)
-# Makefile.am:3: warning: variable 'EXTRA_foo_SOURCES' is defined but no program or
-# Makefile.am:3: library has 'foo' as canonical name (possible typo)
-# Makefile.am:12: warning: variable 'libfoo_a_LIBADD' is defined but no program or
-# Makefile.am:12: library has 'libfoo_a' as canonical name (possible typo)
-# Makefile.am:4: warning: variable 'foo_LDADD' is defined but no program or
-# Makefile.am:4: library has 'foo' as canonical name (possible typo)
-# Makefile.am:5: warning: variable 'foo_LDFLAGS' is defined but no program or
-# Makefile.am:5: library has 'foo' as canonical name (possible typo)
-# Makefile.am:14: warning: variable 'EXTRA_libfoo_a_DEPENDENCIES' is defined but no program or
-# Makefile.am:14: library has 'libfoo_a' as canonical name (possible typo)
-# Makefile.am:7: warning: variable 'EXTRA_foo_DEPENDENCIES' is defined but no program or
-# Makefile.am:7: library has 'foo' as canonical name (possible typo)
-# Makefile.am:6: warning: variable 'foo_DEPENDENCIES' is defined but no program or
-# Makefile.am:6: library has 'foo' as canonical name (possible typo)
-# Makefile.am:13: warning: variable 'libfoo_a_DEPENDENCIES' is defined but no program or
-# Makefile.am:13: library has 'libfoo_a' as canonical name (possible typo)
-
-grep 'as canonical' stderr | grep -v ' .foo. ' | grep -v ' .libfoo_a. ' \
- && exit 1
-test $(grep -c 'variable.*is defined but' stderr) -eq 13
-
-# If we add a global -Wnone, all warnings should disappear.
-$AUTOMAKE -Wnone
-
-# Likewise, if matching programs or libraries are defined.
-cat >>Makefile.am <<'END'
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
- $MAKE nihil 2>stderr && { cat stderr >&2; Exit 1; }
++$MAKE nihil 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+
+$FGREP 'as canonical' stderr \
- | $EGREP -v " '(foo|libfoo_a|libbar_la)' " && Exit 1
++ | $EGREP -v " '(foo|libfoo_a|libbar_la)' " && exit 1
+test 36 -eq $(grep -c 'variable.*is defined but' stderr)
+
+# If matching programs or libraries are defined, all errors should
+# disappear.
+cat >> Makefile.am <<'END'
bin_PROGRAMS = foo
lib_LIBRARIES = libfoo.a
+lib_LTLIBRARIES = libbar.la
END
-$AUTOMAKE -Wno-extra-portability
+# FIXME! We have to remake the Makefile by hand! This is unacceptable.
+$AUTOMAKE Makefile
+./config.status Makefile
+$MAKE nihil
:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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 line starting with '!' used in our internal .am fragments is
+# passed verbatim to the output Makefile, and in the right place
+# too. Yes, this test is hacky ... as is the behaviour it tests
+# after all ;-)
+
- grep '^!' Makefile.in | grep -v '^!unmodified!$' && Exit 1
++. ./defs || exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+long1=long
+long2="$long1 $long1"
+long4="$long2 $long2"
+long8="$long4 $long4"
+long16="$long8 $long8"
+long32="$long16 $long16"
+long64="$long32 $long32"
+long128="$long64 $long64"
+long256="$long128 $long128"
+long512="$long256 $long265"
+
+# Sanity check.
+case $long512 in
+ *' long long '*) ;;
+ *) fatal_ 'defining $long512' ;;
+esac
+
+mkdir am
+cp "$am_amdir"/*.am ./am
+
+echo pkgdata_DATA = configure.ac > Makefile.am
+
+# The '.am' file are read-only when this test is run under
+# "make distcheck", so we need to unlink any of them we want
+# to overwrite.
+rm -f am/data.am
+cat > am/data.am << 'END'
+include 0.am
+include 1.am
+include 2.am
+include 3.am
+END
+
+echo "!x = $long256" > am/0.am
+
+cat >> am/1.am << 'END'
+!## unmodified
+!xyz = \
+rule:
+ @echo Go Custom Rule
+!!unmodified!
+.PHONY: test-xyz
+test-xyz:
+ test '$(xyz)' = '!unmodified!'
+END
+
+cat > am/2.am << 'END'
+!badrule1: ; @echo "'$@' unexpectedly won over 'all'!"; exit 1
+!badrule2:
+! @echo "'$@' unexpectedly won over 'all'!"; exit 1
+all-local: verbatim-rule
+ test -f $<.ok
+!verbatim-rule:
+!ifeq (ok,ok)
+! @echo $@ run correctly
+! : > $@.ok
+!else
+! echo $@ failure; exit 1
+!endif
+# We want this deliberately after verbatim-rule.
+x = ok
+END
+
+cat > am/3.am << 'END'
+x1 := 1
+x2 := 2
+
+foo = .
+
+!ifndef FOO
+!foo += $(x1)
+!else
+!foo += $(x2)
+!endif
+
+!ifeq ($(BAR),1)
+!bar = aaa
+!else
+!ifeq "$(BAR)" "2"
+!bar = lol
+!else
+!bar = default
+!endif # this comment should be comment ignored
+!endif
+
+check-var:
+ test '$($(var))' = '$(val)'
+END
+
+# Avoid interferences from the environment.
+FOO= BAR=; unset FOO BAR
+
+$ACLOCAL
+$AUTOMAKE --libdir=.
+
- $MAKE | grep 'Custom Rule' && Exit 1
++grep '^!' Makefile.in | grep -v '^!unmodified!$' && exit 1
+
+# Use perl, to avoid possible issues with regex length in vendor greps.
+$PERL -e "
+ while (<>) { exit (0) if (/^x = $long256$/); }
+ exit (1);
+" Makefile.in
+
+grep '^!unmodified!$' Makefile.in
+test $(grep -c '^!unmodified!$' Makefile.in) -eq 1
+grep '^## unmodified$' Makefile.in
+grep '^xyz = \\$' Makefile.in
+
+$EGREP 'foo|bar' Makefile.in # For debugging.
+test `grep -c '^foo +=' Makefile.in` -eq 2
+test `grep -c '^bar =' Makefile.in` -eq 3
+
+$AUTOCONF
+./configure
+
+# The created makefile is not broken.
+$MAKE -n
+
+$MAKE rule
+test ! -f verbatim-rule.ok
+$MAKE
+test -f verbatim-rule.ok
++$MAKE | grep 'Custom Rule' && exit 1
+$MAKE test-xyz
+
+$MAKE check-var var=foo val='. 1'
+$MAKE check-var var=foo val='. 1' FOO=''
+$MAKE check-var var=foo val='. 2' FOO=yes
+$MAKE check-var var=foo val='. 2' FOO=' who cares!'
+
+$MAKE check-var var=bar val=default
+$MAKE check-var var=bar val=aaa BAR=1
+$MAKE check-var var=bar val=lol BAR=2
+$MAKE check-var var=bar val=default BAR=3
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# In a VPATH build, a target starting with $(srcdir) is triggered to
+# build a source with the same name but without the $(srcdir).
+
+required=cc
++. ./defs || exit 1
+
+ocwd=`pwd` || fatal_ "couldn't get current working directory"
+
+cat >> configure.ac <<'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+noinst_PROGRAMS = p1 p2 p3 tp1 tp2 tp3
+
+write-it = echo 'int main (void) { return 0; }' >$@
+
+# We keep all the targets on separate lines to make sure the dumb
+# Automake parser actually sees them all.
+$(srcdir)/p1.c:
+ $(write-it)
+${srcdir}/p2.c:
+ $(write-it)
+@srcdir@/p3.c:
+ $(write-it)
+$(top_srcdir)/tp1.c:
+ $(write-it)
+${top_srcdir}/tp2.c:
+ $(write-it)
+@top_srcdir@/tp3.c:
+ $(write-it)
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+mkdir build
+cd build
+../configure
+$MAKE all
+
+cd "$ocwd"
+rm -f *.c
+mkdir -p sub1/sub2/sub3
+cd sub1/sub2/sub3
+"$ocwd"/configure --disable-dependency-tracking
+$MAKE all
+
+cd "$ocwd"
+rm -f *.c
+./configure
+$MAKE all
+$MAKE distcheck
+
+:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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 Automake-provided internal make macros to deal with VPATH rewrites.
+
++. ./defs || exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am << END
+bsub:
+ mkdir \$@
+bsub/foo: bsub
+ mkdir \$@
+bsub/foo/bar: bsub/foo
+ mkdir \$@
+bsub/mu.c++: bsub/foo
+ touch \$@
+bsub/foo/pu.cxx: bsub/foo
+ touch \$@
+
+clean-local:
+ rm -rf bsub
+
+## Yes, I'm a lazy typist.
+vr = \$(am__vpath_rewrite)
+
+test-common: bsub/foo/bar bsub/mu.c++ bsub/foo/pu.cxx
+ test '\$(call vr,Makefile)' = Makefile
+ test '\$(call vr,$tab config.status )' = config.status
+ test '\$(call vr,.)' = .
+## FIXME: These two do not work apparently :-( Such use cases are not
+## FIXME: required presently though, so this is not a big deal.
+ : test '\$(call vr, bsub$tab )' = bsub
+ : test '\$(call vr,bsub)' = bsub
+ test '\$(call vr,bsub/.)' = bsub/.
+ test '\$(call vr,bsub/mu.c++)' = bsub/mu.c++
+ test '\$(call vr,bsub/foo/pu.cxx)' = bsub/foo/pu.cxx
+ test '\$(call vr,bsub/foo )' = bsub/foo
+ test '\$(call vr,bsub/foo/bar)' = bsub/foo/bar
+ test '\$(call vr,nonesuch)' = \$(srcdir)/nonesuch
+ test '\$(call vr, $tab nonesuch2 )' = \$(srcdir)/nonesuch2
+ test '\$(call vr, sub/none)' = \$(srcdir)/sub/none
+
+test-vpath: test-common
+ test '\$(call vr,ssub)' = \$(srcdir)/ssub
+ test '\$(call vr,ssub/foo )' = \$(srcdir)/ssub/foo
+ test '\$(call vr, ssub/foo/bar)' = \$(srcdir)/ssub/foo/bar
+ test '\$(call vr,Makefile.in )' = \$(srcdir)/Makefile.in
+ test '\$(call vr,zap/paz.c)' = \$(srcdir)/zap/paz.c
+ test '\$(call vr,configure $tab)' = \$(srcdir)/configure
+ test '\$(call vr, configure.ac$tab )' = \$(srcdir)/configure.ac
+
+test-intree: test-common
+ test '\$(call vr,ssub)' = ssub
+ test '\$(call vr,ssub/foo )' = ssub/foo
+ test '\$(call vr, ssub/foo/bar)' = ssub/foo/bar
+ test '\$(call vr,Makefile.in )' = Makefile.in
+ test '\$(call vr,zap/paz.c)' = zap/paz.c
+ test '\$(call vr,configure $tab)' = configure
+ test '\$(call vr, configure.ac$tab )' = configure.ac
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+mkdir zap ssub ssub/foo ssub/foo/bar
+: > zap/paz.c
+
+./configure
+$MAKE test-intree
+$MAKE distclean
+
+mkdir build
+cd build
+../configure
+$MAKE test-vpath
+cd ..
+
+ocwd=`pwd` || fatal_ "couldn't get current working directory"
+mkdir build2 build2/subbuild
+cd build2/subbuild
+"$ocwd"/configure
+$MAKE test-vpath
+
+:
# Test to make sure VPATH can be overridden.
# Report from Anthony Green.
- . ./defs || Exit 1
+ . ./defs || exit 1
+echo AC_OUTPUT >> configure.ac
+
cat > Makefile.am << 'END'
VPATH = zardoz
+%.bar: %.foo
+ cp $< $@
END
$ACLOCAL
+$AUTOCONF
$AUTOMAKE
-grep VPATH Makefile.in # For debugging.
-grep '^VPATH = zardoz$' Makefile.in
-grep 'VPATH.*@srcdir@' Makefile.in && exit 1
+mkdir build
+cd build
+mkdir zardoz
+../configure
+
+echo OK > zardoz/file.foo
+echo KO > ../file.foo
+$MAKE file.bar
+test "$(cat file.bar)" = OK
+rm -f file.bar zardoz/file.foo
- $MAKE file.bar && Exit 1
++$MAKE file.bar && exit 1
+test ! -f file.bar
:
# Make sure that we can enable or disable warnings on a per-file basis.
- . ./defs || Exit 1
+ . ./defs || exit 1
-cat >>configure.ac <<END
+cat >> configure.ac << 'END'
+AC_PROG_CC
AC_CONFIG_FILES([sub/Makefile])
+AM_CONDITIONAL([COND_FALSE], [false])
AC_OUTPUT
END
$ACLOCAL
AUTOMAKE_fails
# The expected diagnostic is
-# Makefile.am:3: warning: variable 'foo_SOURCES' is defined but no program or
-# library has 'foo' as canonical name (possible typo)
-# sub/Makefile.am:2: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS'
-grep '^Makefile.am:.*foo_SOURCES' stderr
-grep '^sub/Makefile.am:.*INCLUDES' stderr
-grep '^sub/Makefile.am:.*foo_SOURCES' stderr && exit 1
-grep '^Makefile.am:.*INCLUDES' stderr && exit 1
-# Only three lines of warnings.
-test $(grep -v 'warnings are treated as errors' stderr | wc -l) -eq 3
+# automake: warnings are treated as errors
+# Makefile.am:6: warning: compiling 'sub/foo.c' in subdir requires 'AM_PROG_CC_C_O' in 'configure.ac'
+# sub/Makefile.am:1: warning: 'AUTOMAKE_OPTIONS' cannot have conditional contents
+grep '^Makefile\.am:.*sub/foo\.c.*AM_PROG_CC_C_O' stderr
+grep '^sub/Makefile.am:.*AUTOMAKE_OPTIONS' stderr
- grep '^sub/Makefile\.am:.*AM_PROG_CC_C_O' stderr && Exit 1
- grep '^Makefile\.am:.*AUTOMAKE_OPTIONS' stderr && Exit 1
++grep '^sub/Makefile\.am:.*AM_PROG_CC_C_O' stderr && exit 1
++grep '^Makefile\.am:.*AUTOMAKE_OPTIONS' stderr && exit 1
+# Only two lines of warnings.
+test $(grep -v 'warnings are treated as errors' stderr | wc -l) -eq 2
-# On fast machines the autom4te.cache created during the above run of
-# $AUTOMAKE is likely to have the same time stamp as the configure.ac
-# created below; thus causing traces for the old configure.ac to be
-# used. We could do '$sleep', but it's faster to erase the
-# directory. (Erase autom4te*.cache, not autom4te.cache, because some
-# bogus installations of Autoconf use a versioned cache).
rm -rf autom4te*.cache
# If we add a global -Wnone, all warnings should disappear.
# Test to make sure -Werror and --add-missing work together.
- . ./defs || Exit 1
+am_create_testdir=empty
+ . ./defs || exit 1
-: > Makefile.am
-
-rm -f install-sh depcomp missing mkinstalldirs
+cat > configure.ac <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+END
+: > Makefile.am
+test ! -f install-sh # Sanity check.
$ACLOCAL
$AUTOMAKE -Werror --add-missing
+test -f install-sh # Sanity check.
+
+:
# succeed if make is run a second time immediately afterwards.
# Report from Harlan Stenn.
- . ./defs || Exit 1
+ . ./defs || exit 1
-echo AC_OUTPUT>>configure.ac
+echo AC_OUTPUT >> configure.ac
: > Makefile.am
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Make sure depcomp does not needlessly update headers and objects
-# for yacc rules. This test still fails with FreeBSD make (but passes
-# with NetBSD make).
+# for yacc rules.
required='cc yacc'
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
AC_PROG_CC
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Check that VPATH builds and "make distcheck" works with packages
-# using yacc and the automake 'subdir-objects' option.
-# Exposes automake bug#8485.
+# using yacc sources in a subdir option. Exposes automake bug#8485.
required='cc yacc'
- . ./defs || Exit 1
+ . ./defs || exit 1
-# This test is bounded to fail for any implementation that
-# triggers automake bug#7884.
-useless_vpath_rebuild && skip_ "would trip on automake bug#7884"
-
cat >> configure.ac << 'END'
AC_PROG_CC
AM_PROG_CC_C_O
# Try to enable dependency tracking even with slow dependency
# extractors, to improve coverage.
../configure --enable-dependency-tracking YACC=false
-$MAKE
+
+$MAKE all YACC=false
- ls -l sub/*.[ch] && Exit 1
+ ls -l sub/*.[ch] && exit 1
-env DISTCHECK_CONFIGURE_FLAGS='YACC=false' $MAKE distcheck
+$MAKE distcheck YACC=false DISTCHECK_CONFIGURE_FLAGS='YACC=false'
:
mkdir build2
cd build2
../$distdir/configure
- $MAKE 2>stderr && { cat stderr >&2; Exit 1; }
-$MAKE >out 2>&1 && { cat out; exit 1; }
-cat out
-$FGREP parse.c out
++$MAKE 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+$FGREP parse.c stderr
:
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2011-2012 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/>.
+
+# Yacc + C++ support for a program built only from yacc sources.
+# Lex + C++ support for a program built only from lex sources.
+
+required='c++ yacc'
- echo b | ./foo && Exit 1
++. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_PROG_CXX
+AC_PROG_LEX
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo bar
+foo_SOURCES = foo.yy
+bar_SOURCES = bar.lxx
+
+.PHONY: check-dist
+check-dist: distdir
+ echo ' ' $(am__dist_common) ' ' | grep '[ /]foo\.cc'
+ echo ' ' $(am__dist_common) ' ' | grep '[ /]bar\.cxx'
+ ls -l $(distdir)
+ test -f $(distdir)/foo.cc
+ test -f $(distdir)/bar.cxx
+END
+
+cat > foo.yy << 'END'
+%{
+// Valid C++, but deliberately invalid C.
+#include <cstdio>
+#include <cstdlib>
+// "std::" qualification required by Sun C++ 5.9.
+int yylex (void) { return std::getchar (); }
+void yyerror (const char *s) { return; }
+%}
+%%
+a : 'a' { exit(0); };
+%%
+int main (void)
+{
+ yyparse ();
+ return 1;
+}
+END
+
+cat > bar.lxx << 'END'
+%{
+#define YY_NO_UNISTD_H 1
+int isatty (int fd) { return 0; }
+%}
+%%
+"x" return EOF;
+.
+%%
+// Valid C++, but deliberately invalid C.
+#include <cstdlib>
+int main (void)
+{
+ /* We don't use a 'while' loop here (like a real lexer would do)
+ to avoid possible hangs. */
+ if (yylex () == EOF)
+ std::exit (0);
+ else
+ std::exit (1);
+}
+
+/* Avoid possible link errors. */
+int yywrap (void) { return 1; }
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE
+
+# The Yacc-derived and Lex-derived C++ sources must be created, and not
+# removed once compiled (i.e., not treated like "intermediate files" in
+# the GNU make sense).
+test -f foo.cc
+test -f bar.cxx
+
+if cross_compiling; then :; else
+ echo a | ./foo
- echo y | ./bar && Exit 1
++ echo b | ./foo && exit 1
+ echo x | ./bar
++ echo y | ./bar && exit 1
+ : # Don't trip on 'set -e'.
+fi
+
+# The Yacc-derived and Lex-derived C++ sources must be shipped.
+$MAKE check-dist
+
+# Sanity check on distribution.
+$MAKE distcheck
+
+:
# See also sister test 'lex-line.test'.
required='cc yacc'
- . ./defs || Exit 1
+ . ./defs || exit 1
cat >> configure.ac << 'END'
-AC_CONFIG_FILES([sub/Makefile])
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_YACC
$EGREP 'line|\.y' $c_outputs
# Adjusted "#line" should not contain reference to the builddir.
- grep '#.*line.*build.*\.y' $c_outputs && Exit 1
+ grep '#.*line.*build.*\.y' $c_outputs && exit 1
# Adjusted "#line" should not contain reference to the absolute
# srcdir.
- $EGREP '#.*line *"?/.*\.y' $c_outputs && Exit 1
+ $EGREP '#.*line *"?/.*\.y' $c_outputs && exit 1
# Adjusted "#line" should not contain reference to the default
# output file names, e.g., 'y.tab.c' and 'y.tab.h'.
- grep '#.*line.*y\.tab\.' $c_outputs && Exit 1
+ grep '#.*line.*y\.tab\.' $c_outputs && exit 1
# Look out for a silly regression.
- grep "#.*\.y.*\.y" $c_outputs && Exit 1
+ grep "#.*\.y.*\.y" $c_outputs && exit 1
if $vpath; then
grep '#.*line.*"\.\./zardoz\.y"' zardoz.c
- grep '#.*line.*"\.\./dir/quux\.y"' bar-quux.c
- grep '#.*line.*"\.\./\.\./sub/zardoz\.y"' sub/foo-zardoz.c
- grep '#.*line.*"\.\./\.\./sub/dir/quux\.y"' sub/dir/quux.c
+ grep '#.*line.*"\.\./zardoz\.y"' baz-zardoz.c
+ grep '#.*line.*"\.\./dir/quux\.y"' dir/quux.c
else
grep '#.*line.*"zardoz\.y"' zardoz.c
- grep '#.*line.*"dir/quux\.y"' bar-quux.c
- grep '#.*line.*"zardoz\.y"' sub/foo-zardoz.c
- grep '#.*line.*"dir/quux\.y"' sub/dir/quux.c
+ grep '#.*line.*"zardoz\.y"' baz-zardoz.c
+ grep '#.*line.*"dir/quux\.y"' dir/quux.c
fi
cd $srcdir
--- /dev/null
- . ./defs || Exit 1
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Ensure subdirs for subdir parsers are generated when subdir objects
+# are used, even when dependency tracking is disabled.
+
+required='cc yacc'
++. ./defs || exit 1
+
+cat >configure.ac <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([no-dependencies])
+AC_CONFIG_FILES([Makefile])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat >Makefile.am <<END
+bin_PROGRAMS = p1 p2
+p1_SOURCES = sub1/s1.y
+p2_SOURCES = sub2/s2.y
+p2_CPPFLAGS = -DWHATEVER
+END
+
+mkdir sub1 sub2
+
+cat >sub1/s1.y <<END
+%{
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+int main (void) { yyparse (); return 1; }
+%}
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+cp sub1/s1.y sub2/s2.y
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+mkdir build
+cd build
+
+# Sanity check.
+../configure --help # For debugging.
+../configure --help | $EGREP '(dis|en)able-depend' \
+ && fatal_ "couldn't disable dependency tracking support globally"
+
+../configure
+$MAKE sub1/s1.c
+$MAKE sub2/s2.c
+rm -rf sub1 sub2
+$MAKE
+
+:
bin_PROGRAMS = maude
maude_SOURCES = sub/maude.y
END
-
-$ACLOCAL
$AUTOMAKE -a
-
# No rule needed, the default .y.c: inference rule is enough
# (but there may be an additional dependency on a dirstamp file).
- grep '^sub/maude\.c:.*maude\.y' Makefile.in && Exit 1
+ grep '^sub/maude\.c:.*maude\.y' Makefile.in && exit 1
-
## Try again with per-exe flags.
cat > Makefile.am << 'END'
bin_PROGRAMS = maude
maude_SOURCES = sub/maude.y
-## A particularly trickey case.
+## A particularly tricky case.
maude_YFLAGS = -d
END
-
-$ACLOCAL
$AUTOMAKE -a
-
+grep '^sub/maude-maude\.c:.*sub/maude\.y' Makefile.in
# Rule should use maude_YFLAGS.
- grep 'AM_YFLAGS.*maude' Makefile.in && Exit 1
+ grep 'AM_YFLAGS.*maude' Makefile.in && exit 1
-
# Silly regression.
- grep 'maudec' Makefile.in && Exit 1
+ grep 'maudec' Makefile.in && exit 1
-
# Make sure the .o file is required.
grep '^am_maude_OBJECTS.*maude' Makefile.in