# only needs m4 to build them, and m4 is required to install Autoconf.
# But if you are borrowing from this file for setting up autotest in your
# project, remember to distribute both testsuite and package.m4.
-EXTRA_DIST = $(TESTSUITE_AT) local.at mktests.sh \
- atlocal.in wrapper.as statesave.m4
+EXTRA_DIST += \
+ $(TESTSUITE_AT) \
+ tests/local.at \
+ tests/mktests.sh \
+ tests/atlocal.in \
+ tests/wrapper.as \
+ tests/statesave.m4
# Running the uninstalled scripts. Build them upon 'all', for the manpages.
noinst_SCRIPTS = $(wrappers)
-DISTCLEANFILES = atconfig atlocal $(TESTSUITE)
-MAINTAINERCLEANFILES = Makefile.in
-
-# Import the dependencies on Autotest and M4sh.
-include ../lib/freeze.mk
-
-
-## ------------ ##
-## package.m4. ##
-## ------------ ##
+DISTCLEANFILES += tests/atconfig tests/atlocal $(TESTSUITE)
# The ':;' works around a redirected compound command bash exit status bug.
-package.m4: Makefile
+tests/package.m4: Makefile
:;{ \
echo '# Signature of the current package.' && \
echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])' && \
## Wrappers. ##
## ---------- ##
-wrappers = autoconf autoheader autom4te autoreconf autoscan autoupdate ifnames
-CLEANFILES = wrapper.in $(wrappers) package.m4
-
-wrapper.in: $(srcdir)/wrapper.as $(m4sh_m4f_dependencies)
- $(MY_AUTOM4TE) --language=M4sh $(srcdir)/wrapper.as -o $@
-
-edit = sed \
- -e 's|@wrap_program[@]|$@|g' \
- -e 's|@abs_top_srcdir[@]|@abs_top_srcdir@|g' \
- -e 's|@abs_top_builddir[@]|@abs_top_builddir@|g' \
+wrappers = \
+ tests/autoconf \
+ tests/autoheader \
+ tests/autom4te \
+ tests/autoreconf \
+ tests/autoscan \
+ tests/autoupdate \
+ tests/ifnames
+
+CLEANFILES += \
+ tests/package.m4 \
+ tests/wrapper.in \
+ $(wrappers)
+
+tests/wrapper.in: $(srcdir)/tests/wrapper.as $(m4sh_m4f_dependencies)
+ $(MY_AUTOM4TE) --language=M4sh $(srcdir)/tests/wrapper.as -o $@
+
+edit_wrapper = sed \
+ -e 's|@wrap_program[@]|$(@F)|g' \
+ -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \
+ -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
-e "s|@configure_input[@]|Generated from $$input.|g"
-$(wrappers): wrapper.in
+$(wrappers): tests/wrapper.in
rm -f $@ $@.tmp
- input=wrapper.in; \
- $(edit) wrapper.in >$@.tmp
+ input=tests/wrapper.in \
+ && $(edit_wrapper) tests/wrapper.in >$@.tmp
chmod +x $@.tmp
chmod a-w $@.tmp
mv -f $@.tmp $@
## ------------ ##
TESTSUITE_GENERATED_AT = \
- $(srcdir)/aclang.at \
- $(srcdir)/acc.at \
- $(srcdir)/acfortran.at \
- $(srcdir)/acgo.at \
- $(srcdir)/acgeneral.at \
- $(srcdir)/acstatus.at \
- $(srcdir)/acautoheader.at \
- $(srcdir)/acautoupdate.at \
- $(srcdir)/acspecific.at \
- $(srcdir)/acfunctions.at \
- $(srcdir)/acheaders.at \
- $(srcdir)/actypes.at \
- $(srcdir)/aclibs.at \
- $(srcdir)/acprograms.at
+ $(srcdir)/tests/aclang.at \
+ $(srcdir)/tests/acc.at \
+ $(srcdir)/tests/acfortran.at \
+ $(srcdir)/tests/acgo.at \
+ $(srcdir)/tests/acgeneral.at \
+ $(srcdir)/tests/acstatus.at \
+ $(srcdir)/tests/acautoheader.at \
+ $(srcdir)/tests/acautoupdate.at \
+ $(srcdir)/tests/acspecific.at \
+ $(srcdir)/tests/acfunctions.at \
+ $(srcdir)/tests/acheaders.at \
+ $(srcdir)/tests/actypes.at \
+ $(srcdir)/tests/aclibs.at \
+ $(srcdir)/tests/acprograms.at
TESTSUITE_HAND_AT = \
- suite.at \
- m4sugar.at m4sh.at autotest.at \
- base.at tools.at torture.at \
- compile.at c.at erlang.at fortran.at go.at \
- semantics.at \
- autoscan.at \
- foreign.at
+ tests/suite.at \
+ tests/m4sugar.at \
+ tests/m4sh.at \
+ tests/autotest.at \
+ tests/base.at \
+ tests/tools.at \
+ tests/torture.at \
+ tests/compile.at \
+ tests/c.at \
+ tests/erlang.at \
+ tests/fortran.at \
+ tests/go.at \
+ tests/semantics.at \
+ tests/autoscan.at \
+ tests/foreign.at
TESTSUITE_AT = $(TESTSUITE_GENERATED_AT) $(TESTSUITE_HAND_AT)
-TESTSUITE = ./testsuite
+TESTSUITE = tests/testsuite
# Run the non installed autom4te.
# Don't use AUTOM4TE since 'make alpha' makes it unavailable although
# we are allowed to use it (since we ship it).
+AUTOTESTFLAGS = -I tests -I $(srcdir)/tests
AUTOTEST = $(MY_AUTOM4TE) --language=autotest
-$(TESTSUITE): package.m4 \
- local.at \
+$(TESTSUITE): tests/package.m4 \
+ tests/local.at \
$(TESTSUITE_AT) \
- $(autotest_m4f_dependencies)
- cd $(top_builddir)/lib/autotest && $(MAKE) $(AM_MAKEFLAGS) autotest.m4f
- $(AUTOTEST) -I . -I $(srcdir) suite.at -o $@.tmp
+ lib/autotest/autotest.m4f
+ $(AUTOTEST) $(AUTOTESTFLAGS) suite.at -o $@.tmp
mv $@.tmp $@
-atconfig: $(top_builddir)/config.status
- cd $(top_builddir) && ./config.status tests/$@
+# Factor out invocation of the testsuite script.
+run_testsuite = $(SHELL) $(TESTSUITE) -C tests
# Avoid a race condition that would make parallel "distclean" fail.
# The rule in clean-local tests for existence of $(TESTSUITE), and
$(distclean_generic): clean-local
clean-local:
- test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
+ test ! -f $(TESTSUITE) || $(run_testsuite) --clean
rm -f *.tmp
rm -f -r autom4te.cache
-check-local: atconfig atlocal $(TESTSUITE)
- $(SHELL) $(TESTSUITE) $(TESTSUITEFLAGS)
+check-local: tests/atconfig tests/atlocal $(TESTSUITE)
+ $(run_testsuite) $(TESTSUITEFLAGS)
# Run the test suite on the *installed* tree.
-installcheck-local: atconfig atlocal $(TESTSUITE)
- $(SHELL) $(TESTSUITE) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
+installcheck-local: tests/atconfig tests/atlocal $(TESTSUITE)
+ $(run_testsuite) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
## Producing the test files.
-# The files which contain macros we check for syntax. Use $(top_srcdir)
+# The files which contain macros we check for syntax. Use $(srcdir)
# for the benefit of non-GNU make. Fix the names in the rule below
# where we 'cd' to $srcdir.
-autoconfdir = $(top_srcdir)/lib/autoconf
+autoconfdir = $(srcdir)/lib/autoconf
AUTOCONF_FILES = $(autoconfdir)/general.m4 \
$(autoconfdir)/status.m4 \
$(autoconfdir)/autoheader.m4 \
$(autoconfdir)/types.m4 \
$(autoconfdir)/programs.m4
-$(TESTSUITE_GENERATED_AT): mktests.stamp
+$(TESTSUITE_GENERATED_AT): tests/mktests.stamp
## Recover from the removal of $@
@if test -f $@; then :; else \
- rm -f mktests.stamp; \
- $(MAKE) $(AM_MAKEFLAGS) mktests.stamp; \
+ rm -f tests/mktests.stamp; \
+ $(MAKE) $(AM_MAKEFLAGS) tests/mktests.stamp; \
fi
-mktests.stamp : mktests.sh $(AUTOCONF_FILES)
- @rm -f mktests.tmp
- @touch mktests.tmp
- cd $(srcdir) && ./mktests.sh \
- `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, ../lib/autoconf/,g'`
- @mv -f mktests.tmp $@
+tests/mktests.stamp : tests/mktests.sh $(AUTOCONF_FILES)
+ @rm -f tests/mktests.tmp
+ @touch tests/mktests.tmp
+ cd $(srcdir) && $(SHELL) tests/mktests.sh \
+ `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, lib/autoconf/,g'`
+ @mv -f tests/mktests.tmp $@
## Distribute the stamp file, since we distribute the generated files.
-EXTRA_DIST += mktests.stamp
-CLEANFILES += mktests.tmp
-MAINTAINERCLEANFILES += mktests.stamp
+EXTRA_DIST += tests/mktests.stamp
+CLEANFILES += tests/mktests.tmp
+MAINTAINERCLEANFILES += tests/mktests.stamp
## maintainer-check ##
as_me=`echo "$0" | sed 's|.*[\\/]||'`
+outdir=tests
+acdefuns=$outdir/acdefuns.tmp
+audefuns=$outdir/audefuns.tmp
+requires=$outdir/requires.tmp
+
trap 'echo "'"$as_me"': failed." >&2
- rm -f acdefuns audefuns requires *.tat
+ rm -f $acdefuns $audefuns $requires $outdir/*.tat
trap "" 0
exit 1' \
0 1 2 15
# Get the list of macros that are required: there is little interest
# in testing them since they will be run by the guy who requires them.
sed -n 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' $src |
- sort -u >requires
+ sort -u >$requires
# exclude_list
for file in $src
do
base=`echo "$file" | sed 's|.*[\\/]||;s|\..*||'`
+ acbase=$outdir/ac$base
# Get the list of macros which are defined in Autoconf level.
# Get rid of the macros we are not interested in.
sed -n -e 's/^AC_DEFUN(\[*\([a-zA-Z0-9_]*\).*$/\1/p' \
-e 's/^AC_DEFUN_ONCE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' $file |
awk "$ac_exclude_script" |
- sort -u >acdefuns
+ sort -u >$acdefuns
# Get the list of macros which are defined in Autoupdate level.
sed -n 's/^AU_DEFUN(\[*\([a-zA-Z][a-zA-Z0-9_]*\).*$/\1/p' $file |
awk "$au_exclude_script" |
- sort -u >audefuns
+ sort -u >$audefuns
# Filter out required macros.
{
MK_EOF
echo "# Modern macros."
- comm -23 acdefuns requires | sed 's/.*/AT_CHECK_MACRO([&])/'
+ comm -23 $acdefuns $requires | sed 's/.*/AT_CHECK_MACRO([&])/'
echo
echo "# Obsolete macros."
- comm -23 audefuns requires | sed 's/.*/AT_CHECK_AU_MACRO([&])/'
- } >ac$base.tat
+ comm -23 $audefuns $requires | sed 's/.*/AT_CHECK_AU_MACRO([&])/'
+ } >$acbase.tat
# In one atomic step so that if something above fails, the trap
# preserves the old version of the file. If there is nothing to
# check, output /rien du tout/[1].
- if grep AT_CHECK ac$base.tat >/dev/null 2>&1; then
- mv -f ac$base.tat ac$base.at
+ if grep AT_CHECK $acbase.tat >/dev/null 2>&1; then
+ mv -f $acbase.tat $acbase.at
else
- rm -f ac$base.tat ac$base.at
- touch ac$base.at
+ rm -f $acbase.tat $acbase.at
+ touch $acbase.at
fi
# Help people not to update these files by hand.
- chmod a-w ac$base.at
+ chmod a-w $acbase.at
done
-rm -f acdefuns audefuns requires
+rm -f $acdefuns $audefuns $requires
trap '' 0
exit 0