1 ## Make Autoconf tests.
3 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
4 # Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # We don't actually distribute the built testsuite or package.m4, since one
20 # only needs m4 to build them, and m4 is required to install Autoconf.
21 # But if you are borrowing from this file for setting up autotest in your
22 # project, remember to distribute both testsuite and package.m4.
23 EXTRA_DIST = $(TESTSUITE_AT) local.at mktests.sh \
26 # Running the uninstalled scripts. Build them upon `all', for the manpages.
27 noinst_SCRIPTS = $(wrappers)
28 DISTCLEANFILES = atconfig atlocal $(TESTSUITE)
29 MAINTAINERCLEANFILES = Makefile.in
31 # Import the dependencies on Autotest and M4sh.
32 include ../lib/freeze.mk
39 # The `:;' works around a redirected compound command bash exit status bug.
42 echo '# Signature of the current package.' && \
43 echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])' && \
44 echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])' && \
45 echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])' && \
46 echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])' && \
47 echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
57 wrappers = autoconf autoheader autom4te autoreconf autoscan autoupdate ifnames
58 CLEANFILES = wrapper.in $(wrappers) package.m4
60 wrapper.in: $(srcdir)/wrapper.as $(m4sh_m4f_dependencies)
61 $(MY_AUTOM4TE) --language=M4sh $(srcdir)/wrapper.as -o $@
64 -e 's|@wrap_program[@]|$@|g' \
65 -e 's|@abs_top_srcdir[@]|@abs_top_srcdir@|g' \
66 -e 's|@abs_top_builddir[@]|@abs_top_builddir@|g' \
67 -e "s|@configure_input[@]|Generated from $$input.|g"
69 $(wrappers): wrapper.in
72 $(edit) wrapper.in >$@.tmp
83 TESTSUITE_GENERATED_AT = \
86 $(srcdir)/acfortran.at \
87 $(srcdir)/acgeneral.at \
88 $(srcdir)/acstatus.at \
89 $(srcdir)/acautoheader.at \
90 $(srcdir)/acautoupdate.at \
91 $(srcdir)/acspecific.at \
92 $(srcdir)/acfunctions.at \
93 $(srcdir)/acheaders.at \
94 $(srcdir)/actypes.at \
96 $(srcdir)/acprograms.at
100 m4sugar.at m4sh.at autotest.at \
101 base.at tools.at torture.at \
102 compile.at c.at fortran.at \
107 TESTSUITE_AT = $(TESTSUITE_GENERATED_AT) $(TESTSUITE_HAND_AT)
108 TESTSUITE = ./testsuite
110 # Run the non installed autom4te.
111 # Don't use AUTOM4TE since `make alpha' makes it unavailable although
112 # we are allowed to use it (since we ship it).
113 AUTOTEST = $(MY_AUTOM4TE) --language=autotest
114 $(TESTSUITE): package.m4 \
117 $(autotest_m4f_dependencies)
118 cd $(top_builddir)/lib/autotest && $(MAKE) $(AM_MAKEFLAGS) autotest.m4f
119 $(AUTOTEST) -I . -I $(srcdir) suite.at -o $@.tmp
122 atconfig: $(top_builddir)/config.status
123 cd $(top_builddir) && ./config.status tests/$@
125 # Avoid a race condition that would make parallel "distclean" fail.
126 # The rule in clean-local tests for existence of $(TESTSUITE), and
127 # if found, attempts to run it. But the distclean-generic rule may
128 # be running in parallel, and it removes $(DISTCLEANFILES) which
129 # includes $(TESTSUITE). This is the Automake rule, plus our
130 # dependency, and we silence the warning from 'automake -Wall'.
131 # TODO - fix this if newer automake accomodates the dependency.
132 AUTOMAKE_OPTIONS = -Wno-override
133 distclean-generic: clean-local
134 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
135 -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
138 test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
140 rm -f -r autom4te.cache
142 check-local: atconfig atlocal $(TESTSUITE)
143 $(SHELL) $(TESTSUITE) $(TESTSUITEFLAGS)
145 # Run the test suite on the *installed* tree.
146 installcheck-local: atconfig atlocal $(TESTSUITE)
147 $(SHELL) $(TESTSUITE) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
151 ## ------------------ ##
152 ## Maintainer rules. ##
153 ## ------------------ ##
155 MAINTAINERCLEANFILES += $(TESTSUITE_GENERATED_AT)
157 ## Producing the test files.
159 # The files which contain macros we check for syntax. Use $(top_srcdir)
160 # for the benefit of non-GNU make. Fix the names in the rule below
161 # where we `cd' to $srcdir.
162 autoconfdir = $(top_srcdir)/lib/autoconf
163 AUTOCONF_FILES = $(autoconfdir)/general.m4 \
164 $(autoconfdir)/status.m4 \
165 $(autoconfdir)/autoheader.m4 \
166 $(autoconfdir)/autoupdate.m4 \
167 $(autoconfdir)/specific.m4 \
168 $(autoconfdir)/functions.m4 \
169 $(autoconfdir)/lang.m4 \
170 $(autoconfdir)/c.m4 \
171 $(autoconfdir)/fortran.m4 \
172 $(autoconfdir)/headers.m4 \
173 $(autoconfdir)/libs.m4 \
174 $(autoconfdir)/types.m4 \
175 $(autoconfdir)/programs.m4
177 $(TESTSUITE_GENERATED_AT): mktests.stamp
178 ## Recover from the removal of $@
179 @if test -f $@; then :; else \
180 rm -f mktests.stamp; \
181 $(MAKE) $(AM_MAKEFLAGS) mktests.stamp; \
184 mktests.stamp : mktests.sh $(AUTOCONF_FILES)
187 cd $(srcdir) && ./mktests.sh \
188 `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, ../lib/autoconf/,g'`
189 @mv -f mktests.tmp $@
191 ## Distribute the stamp file, since we distribute the generated files.
192 EXTRA_DIST += mktests.stamp
193 CLEANFILES += mktests.tmp
194 MAINTAINERCLEANFILES += mktests.stamp
196 ## maintainer-check ##
198 # These cannot be run in parallel.
200 $(MAKE) $(AM_MAKEFLAGS) maintainer-check-posix
201 $(MAKE) $(AM_MAKEFLAGS) maintainer-check-c++
203 # The hairy heredoc is more robust than using echo.
207 echo '#! $(SHELL)'; \
208 echo 'result=`$(EXPR) "$$@"`'; \
209 echo 'estatus=$$?'; \
211 echo '$${result:-0}'; \
213 echo 'exit $$estatus'; \
218 # Try the test suite with more severe environments.
219 maintainer-check-posix: expr
220 POSIXLY_CORRECT=yes $(MAKE) $(AM_MAKEFLAGS) check
223 # Try using G++ as a C compiler.
224 maintainer-check-c++:
225 CC=g++ $(MAKE) $(AM_MAKEFLAGS) check