1## Make Autoconf tests. 2 3## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 4## Free Software Foundation, Inc. 5 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 2, or (at your option) 9## any later version. 10 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. 15 16## You should have received a copy of the GNU General Public License 17## along with this program; if not, write to the Free Software 18## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19## 02110-1301, USA. 20 21# We don't actually distribute the testsuite, since one only 22# needs m4 to build it, m4 being required anyway to install Autoconf. 23EXTRA_DIST = $(TESTSUITE_AT) local.at mktests.sh \ 24 atlocal.in package.m4 wrapper.as 25 26# Running the uninstalled scripts. 27check_SCRIPTS = $(wrappers) 28DISTCLEANFILES = atconfig atlocal $(TESTSUITE) 29MAINTAINERCLEANFILES = Makefile.in 30 31# Import the dependencies on Autotest and M4sh. 32include ../lib/freeze.mk 33 34 35## ------------ ## 36## package.m4. ## 37## ------------ ## 38 39$(srcdir)/package.m4: $(top_srcdir)/configure.ac 40 { \ 41 echo '# Signature of the current package.'; \ 42 echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \ 43 echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])'; \ 44 echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])'; \ 45 echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])'; \ 46 echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \ 47 } >$(srcdir)/package.m4 48 49 50 51## ---------- ## 52## Wrappers. ## 53## ---------- ## 54 55wrappers = autoconf autoheader autom4te autoreconf autoscan autoupdate ifnames 56CLEANFILES = wrapper.in $(wrappers) 57 58wrapper.in: $(srcdir)/wrapper.as $(m4sh_m4f_dependencies) 59 $(MY_AUTOM4TE) --language=M4sh $(srcdir)/wrapper.as -o $@ 60 61edit = sed \ 62 -e 's|@wrap_program[@]|$@|g' \ 63 -e 's|@abs_top_srcdir[@]|@abs_top_srcdir@|g' \ 64 -e 's|@abs_top_builddir[@]|@abs_top_builddir@|g' \ 65 -e "s|@configure_input[@]|Generated from $$input.|g" 66 67$(wrappers): wrapper.in 68 rm -f $@ $@.tmp 69 input=wrapper.in; \ 70 $(edit) wrapper.in >$@.tmp 71 chmod +x $@.tmp 72 chmod a-w $@.tmp 73 mv -f $@.tmp $@ 74 75 76 77## ------------ ## 78## Test suite. ## 79## ------------ ## 80 81TESTSUITE_GENERATED_AT = \ 82 $(srcdir)/aclang.at \ 83 $(srcdir)/acc.at \ 84 $(srcdir)/acfortran.at \ 85 $(srcdir)/acgeneral.at \ 86 $(srcdir)/acstatus.at \ 87 $(srcdir)/acautoheader.at \ 88 $(srcdir)/acautoupdate.at \ 89 $(srcdir)/acspecific.at \ 90 $(srcdir)/acfunctions.at \ 91 $(srcdir)/acheaders.at \ 92 $(srcdir)/actypes.at \ 93 $(srcdir)/aclibs.at \ 94 $(srcdir)/acprograms.at 95 96TESTSUITE_HAND_AT = \ 97 suite.at \ 98 m4sugar.at m4sh.at autotest.at \ 99 base.at tools.at torture.at \ 100 compile.at c.at fortran.at \ 101 semantics.at \ 102 autoscan.at \ 103 foreign.at 104 105TESTSUITE_AT = $(TESTSUITE_GENERATED_AT) $(TESTSUITE_HAND_AT) 106TESTSUITE = ./testsuite 107 108# Run the non installed autom4te. 109# Don't use AUTOM4TE since `make alpha' makes it unavailable although 110# we are allowed to use it (since we ship it). 111AUTOTEST = $(MY_AUTOM4TE) --language=autotest 112$(TESTSUITE): $(srcdir)/package.m4 \ 113 local.at \ 114 $(TESTSUITE_AT) \ 115 $(autotest_m4f_dependencies) 116 cd $(top_builddir)/lib/autotest && $(MAKE) $(AM_MAKEFLAGS) autotest.m4f 117 $(AUTOTEST) -I $(srcdir) suite.at -o $@.tmp 118 mv $@.tmp $@ 119 120atconfig: $(top_builddir)/config.status 121 cd $(top_builddir) && ./config.status tests/$@ 122 123clean-local: 124 test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean 125 rm -f *.tmp 126 rm -f -r autom4te.cache 127 128check-local: atconfig atlocal $(TESTSUITE) 129 $(SHELL) $(TESTSUITE) $(TESTSUITEFLAGS) 130 131# Run the test suite on the *installed* tree. 132installcheck-local: atconfig atlocal $(TESTSUITE) 133 $(SHELL) $(TESTSUITE) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS) 134 135 136 137## ------------------ ## 138## Maintainer rules. ## 139## ------------------ ## 140 141MAINTAINERCLEANFILES += $(TESTSUITE_GENERATED_AT) 142 143## Producing the test files. 144 145# The files which contain macros we check for syntax. Use $(top_srcdir) 146# for the benefit of non-GNU make. Fix the names in the rule below 147# where we `cd' to $srcdir. 148autoconfdir = $(top_srcdir)/lib/autoconf 149AUTOCONF_FILES = $(autoconfdir)/general.m4 \ 150 $(autoconfdir)/status.m4 \ 151 $(autoconfdir)/autoheader.m4 \ 152 $(autoconfdir)/autoupdate.m4 \ 153 $(autoconfdir)/specific.m4 \ 154 $(autoconfdir)/functions.m4 \ 155 $(autoconfdir)/lang.m4 \ 156 $(autoconfdir)/c.m4 \ 157 $(autoconfdir)/fortran.m4 \ 158 $(autoconfdir)/headers.m4 \ 159 $(autoconfdir)/libs.m4 \ 160 $(autoconfdir)/types.m4 \ 161 $(autoconfdir)/programs.m4 162 163$(TESTSUITE_GENERATED_AT): mktests.sh $(AUTOCONF_FILES) 164 cd $(srcdir) && ./mktests.sh \ 165 `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, ../lib/autoconf/,g'` 166 167 168## maintainer-check ## 169 170maintainer-check: maintainer-check-posix maintainer-check-c++ 171 172# The hairy heredoc is more robust than using echo. 173CLEANFILES += expr 174expr: 175 echo '#! $(SHELL)' >expr 176 echo 'result=`$(EXPR) "$$@"`'>>expr 177 echo 'estatus=$$?' >>expr 178 echo 'cat <<EOF' >>expr 179 echo '$${result:-0}' >>expr 180 echo 'EOF' >>expr 181 echo 'exit $$estatus' >>expr 182 chmod +x expr 183 184# Try the test suite with more severe environments. 185maintainer-check-posix: expr 186 POSIXLY_CORRECT=yes make check 187 rm expr 188 189# Try using G++ as a C compiler. 190maintainer-check-c++: 191 CC=g++ make check 192