1 ## Make Autoconf tests.
3 # Copyright (C) 2000-2017, 2020-2023 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
18 # We don't actually distribute the built testsuite or package.m4, since one
19 # only needs m4 to build them, and m4 is required to install Autoconf.
20 # But if you are borrowing from this file for setting up autotest in your
21 # project, remember to distribute both testsuite and package.m4.
29 # Running the uninstalled scripts. Build them upon 'all', for the manpages.
30 noinst_SCRIPTS
= $(wrappers
)
31 DISTCLEANFILES
+= tests
/atconfig tests
/atlocal
$(TESTSUITE
)
33 # The ':;' works around a redirected compound command bash exit status bug.
34 tests
/package.m4
: Makefile
36 echo
'# Signature of the current package.' && \
37 echo
'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])' && \
38 echo
'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])' && \
39 echo
'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])' && \
40 echo
'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])' && \
41 echo
'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])' && \
42 echo
'm4_define([AT_PACKAGE_URL], [$(PACKAGE_URL)])'; \
66 tests
/wrapper.in
: $(srcdir)/tests
/wrapper.
as $(m4sh_m4f_dependencies
)
67 $(MY_AUTOM4TE
) --language
=M4sh
$(srcdir)/tests
/wrapper.
as -o
$@
70 -e
's|@wrap_program[@]|$(@F)|g' \
71 -e
's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \
72 -e
's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
73 -e
"s|@configure_input[@]|Generated from $$input.|g"
75 $(wrappers
): tests
/wrapper.in
77 input
=tests
/wrapper.in \
78 && $(edit_wrapper
) tests
/wrapper.in
>$@.tmp
89 TESTSUITE_GENERATED_AT
= \
97 tests
/acautoheader.at \
98 tests
/acautoupdate.at \
100 tests
/acfunctions.at \
106 TESTSUITE_HAND_AT
= \
124 tests
/data
/ax_prog_cc_for_build_v18.m4 \
125 tests
/data
/ax_prog_cxx_for_build_v3.m4 \
126 tests
/data
/gnulib_std_gnu11_2020_08_17.m4
128 CLEANFILES
+= $(TESTSUITE_GENERATED_AT
)
129 EXTRA_DIST
+= $(TESTSUITE_HAND_AT
) $(TESTSUITE_EXTRA
)
131 TESTSUITE_AT
= $(TESTSUITE_GENERATED_AT
) $(TESTSUITE_HAND_AT
)
132 TESTSUITE
= tests
/testsuite
134 # Run the non installed autom4te.
135 # Don't use AUTOM4TE since 'make alpha' makes it unavailable although
136 # we are allowed to use it (since we ship it).
137 AUTOTESTFLAGS
= -I tests
-I
$(srcdir)/tests
138 AUTOTEST
= $(MY_AUTOM4TE
) --language
=autotest
139 $(TESTSUITE
): tests
/package.m4 \
142 lib
/autotest
/autotest.m4f
143 $(AUTOTEST
) $(AUTOTESTFLAGS
) suite.at
-o
$@.tmp
146 # Factor out invocation of the testsuite script.
147 run_testsuite
= $(SHELL
) $(TESTSUITE
) -C tests MAKE
=$(MAKE
)
149 # Avoid a race condition that would make parallel "distclean" fail.
150 # The rule in clean-local tests for existence of $(TESTSUITE), and
151 # if found, attempts to run it. But the distclean-generic rule may
152 # be running in parallel, and it removes $(DISTCLEANFILES) which
153 # includes $(TESTSUITE). This is the Automake rule, plus our
154 # dependency, and we silence the warning from 'automake -Wall' by
155 # hiding the dependency behind a variable.
156 # TODO - fix this if newer automake accommodates the dependency.
157 distclean_generic
= distclean-generic
158 $(distclean_generic
): clean-local
161 test ! -f
$(TESTSUITE
) ||
$(run_testsuite
) --clean
163 rm -f
-r autom4te.cache
165 check-local
: tests
/atconfig tests
/atlocal
$(TESTSUITE
)
166 +$(run_testsuite
) $(TESTSUITEFLAGS
)
168 # Automake doesn't know how to regenerate this file because
169 # it's created via AC_CONFIG_COMMANDS.
170 tests
/atconfig
: $(top_builddir
)/config.status
171 cd
$(top_builddir
) && $(SHELL
) .
/config.status
$@
173 # Run the test suite on the *installed* tree.
174 installcheck-local
: tests
/atconfig tests
/atlocal
$(TESTSUITE
)
175 +$(run_testsuite
) AUTOTEST_PATH
="$(bindir)" $(TESTSUITEFLAGS
)
179 ## ------------------ ##
180 ## Maintainer rules. ##
181 ## ------------------ ##
183 MAINTAINERCLEANFILES
+= $(TESTSUITE_GENERATED_AT
)
185 ## Producing the test files.
187 # The files which contain macros we check for syntax. Use $(srcdir)
188 # for the benefit of non-GNU make.
189 autoconfdir
= $(srcdir)/lib
/autoconf
190 AUTOCONF_FILES
= $(autoconfdir
)/general.m4 \
191 $(autoconfdir
)/status.m4 \
192 $(autoconfdir
)/autoheader.m4 \
193 $(autoconfdir
)/autoupdate.m4 \
194 $(autoconfdir
)/specific.m4 \
195 $(autoconfdir
)/functions.m4 \
196 $(autoconfdir
)/lang.m4 \
197 $(autoconfdir
)/c.m4 \
198 $(autoconfdir
)/erlang.m4 \
199 $(autoconfdir
)/fortran.m4 \
200 $(autoconfdir
)/go.m4 \
201 $(autoconfdir
)/headers.m4 \
202 $(autoconfdir
)/libs.m4 \
203 $(autoconfdir
)/types.m4 \
204 $(autoconfdir
)/programs.m4
206 $(TESTSUITE_GENERATED_AT
): tests
/mktests.stamp
207 ## Recover from the removal of $@
208 @if
test -f
$@
; then
:; else \
209 rm -f tests
/mktests.stamp
; \
210 $(MAKE
) $(AM_MAKEFLAGS
) tests
/mktests.stamp
; \
213 tests
/mktests.stamp
: tests
/mktests.pl
$(AUTOCONF_FILES
)
214 @
rm -f tests
/mktests.tmp
215 @touch tests
/mktests.tmp
216 $(PERL
) $(srcdir)/tests
/mktests.pl tests
$(AUTOCONF_FILES
)
217 @mv
-f tests
/mktests.tmp
$@
219 CLEANFILES
+= tests
/mktests.tmp tests
/mktests.stamp
221 ## maintainer-check ##
223 # The test suite cannot be run in parallel with itself.
225 $(MAKE
) $(AM_MAKEFLAGS
) check
226 $(MAKE
) $(AM_MAKEFLAGS
) maintainer-check-posix
228 # The hairy heredoc is more robust than using echo.
232 echo
'#! $(SHELL)'; \
233 echo
'result=`$(EXPR) "$$@"`'; \
234 echo
'estatus=$$?'; \
236 echo
'$${result:-0}'; \
238 echo
'exit $$estatus'; \
243 # Try the test suite with more severe environments.
244 maintainer-check-posix
: expr
245 POSIXLY_CORRECT
=yes
$(MAKE
) $(AM_MAKEFLAGS
) check