AC_INIT: allow bugreport to contain '?'
[autoconf.git] / tests / Makefile.am
blob669e6033ccc6a892cf7af715068241a7cb357e2f
1 ## Make Autoconf tests.
3 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 # 2009, 2010 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 \
24              atlocal.in wrapper.as statesave.m4
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
35 ## ------------ ##
36 ## package.m4.  ##
37 ## ------------ ##
39 # The `:;' works around a redirected compound command bash exit status bug.
40 package.m4: Makefile
41         :;{ \
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)])' && \
48           echo 'm4_define([AT_PACKAGE_URL],       [$(PACKAGE_URL)])'; \
49         } > $@-t
50         mv $@-t $@
54 ## ---------- ##
55 ## Wrappers.  ##
56 ## ---------- ##
58 wrappers = autoconf autoheader autom4te autoreconf autoscan autoupdate ifnames
59 CLEANFILES = wrapper.in $(wrappers) package.m4
61 wrapper.in: $(srcdir)/wrapper.as $(m4sh_m4f_dependencies)
62         $(MY_AUTOM4TE) --language=M4sh $(srcdir)/wrapper.as -o $@
64 edit = sed \
65         -e 's|@wrap_program[@]|$@|g' \
66         -e 's|@abs_top_srcdir[@]|@abs_top_srcdir@|g' \
67         -e 's|@abs_top_builddir[@]|@abs_top_builddir@|g' \
68         -e "s|@configure_input[@]|Generated from $$input.|g"
70 $(wrappers): wrapper.in
71         rm -f $@ $@.tmp
72         input=wrapper.in; \
73         $(edit) wrapper.in >$@.tmp
74         chmod +x $@.tmp
75         chmod a-w $@.tmp
76         mv -f $@.tmp $@
80 ## ------------ ##
81 ## Test suite.  ##
82 ## ------------ ##
84 TESTSUITE_GENERATED_AT = \
85         $(srcdir)/aclang.at \
86         $(srcdir)/acc.at \
87         $(srcdir)/acfortran.at \
88         $(srcdir)/acgeneral.at \
89         $(srcdir)/acstatus.at \
90         $(srcdir)/acautoheader.at \
91         $(srcdir)/acautoupdate.at \
92         $(srcdir)/acspecific.at \
93         $(srcdir)/acfunctions.at \
94         $(srcdir)/acheaders.at \
95         $(srcdir)/actypes.at \
96         $(srcdir)/aclibs.at \
97         $(srcdir)/acprograms.at
99 TESTSUITE_HAND_AT = \
100         suite.at \
101         m4sugar.at m4sh.at autotest.at \
102         base.at tools.at torture.at \
103         compile.at c.at erlang.at fortran.at \
104         semantics.at \
105         autoscan.at \
106         foreign.at
108 TESTSUITE_AT = $(TESTSUITE_GENERATED_AT) $(TESTSUITE_HAND_AT)
109 TESTSUITE = ./testsuite
111 # Run the non installed autom4te.
112 # Don't use AUTOM4TE since `make alpha' makes it unavailable although
113 # we are allowed to use it (since we ship it).
114 AUTOTEST = $(MY_AUTOM4TE) --language=autotest
115 $(TESTSUITE): package.m4 \
116               local.at \
117               $(TESTSUITE_AT) \
118               $(autotest_m4f_dependencies)
119         cd $(top_builddir)/lib/autotest && $(MAKE) $(AM_MAKEFLAGS) autotest.m4f
120         $(AUTOTEST) -I . -I $(srcdir) suite.at -o $@.tmp
121         mv $@.tmp $@
123 atconfig: $(top_builddir)/config.status
124         cd $(top_builddir) && ./config.status tests/$@
126 # Avoid a race condition that would make parallel "distclean" fail.
127 # The rule in clean-local tests for existence of $(TESTSUITE), and
128 # if found, attempts to run it.  But the distclean-generic rule may
129 # be running in parallel, and it removes $(DISTCLEANFILES) which
130 # includes $(TESTSUITE).  This is the Automake rule, plus our
131 # dependency, and we silence the warning from 'automake -Wall' by
132 # hiding the dependency behind a variable.
133 # TODO - fix this if newer automake accomodates the dependency.
134 distclean_generic = distclean-generic
135 $(distclean_generic): clean-local
137 clean-local:
138         test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
139         rm -f *.tmp
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)/erlang.m4 \
172                  $(autoconfdir)/fortran.m4 \
173                  $(autoconfdir)/headers.m4 \
174                  $(autoconfdir)/libs.m4 \
175                  $(autoconfdir)/types.m4 \
176                  $(autoconfdir)/programs.m4
178 $(TESTSUITE_GENERATED_AT): mktests.stamp
179 ## Recover from the removal of $@
180         @if test -f $@; then :; else \
181           rm -f mktests.stamp; \
182           $(MAKE) $(AM_MAKEFLAGS) mktests.stamp; \
183         fi
185 mktests.stamp : mktests.sh $(AUTOCONF_FILES)
186         @rm -f mktests.tmp
187         @touch mktests.tmp
188         cd $(srcdir) && ./mktests.sh \
189           `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, ../lib/autoconf/,g'`
190         @mv -f mktests.tmp $@
192 ## Distribute the stamp file, since we distribute the generated files.
193 EXTRA_DIST += mktests.stamp
194 CLEANFILES += mktests.tmp
195 MAINTAINERCLEANFILES += mktests.stamp
197 ## maintainer-check ##
199 # These cannot be run in parallel.
200 maintainer-check:
201         $(MAKE) $(AM_MAKEFLAGS) maintainer-check-posix
202         $(MAKE) $(AM_MAKEFLAGS) maintainer-check-c++
204 # The hairy heredoc is more robust than using echo.
205 CLEANFILES += expr
206 expr:
207         :;{                                     \
208           echo '#! $(SHELL)';                   \
209           echo 'result=`$(EXPR) "$$@"`';        \
210           echo 'estatus=$$?';                   \
211           echo 'cat <<EOF';                     \
212           echo '$${result:-0}';                 \
213           echo 'EOF';                           \
214           echo 'exit $$estatus';                \
215         } > $@-t
216         chmod +x $@-t
217         mv $@-t $@
219 # Try the test suite with more severe environments.
220 maintainer-check-posix: expr
221         POSIXLY_CORRECT=yes $(MAKE) $(AM_MAKEFLAGS) check
222         rm expr
224 # Try using G++ as a C compiler.
225 maintainer-check-c++:
226         CC=g++ $(MAKE) $(AM_MAKEFLAGS) check