1 # Copyright © 2021-2024 Nick Bowler
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 AT_BANNER([Automake snippet tests])
18 m4_define([TEST_DEPFILES_INIT],
19 [TEST_DEPFILES_INIT_CONFIGURE
20 TEST_DEPFILES_INIT_MAKEFILE
23 m4_define([TEST_DEPFILES_INIT_CONFIGURE], [TEST_CONFIGURE_AC(
24 [[AM_INIT_AUTOMAKE([foreign])
29 AM_OUTPUT_DEPENDENCY_COMMANDS
33 AC_CONFIG_FILES([Makefile])
36 m4_define([TEST_DEPFILES_INIT_MAKEFILE],
37 [cp "$srcdir/snippet/autotest.mk" .
38 AT_DATA([Makefile.am],
41 include $(top_srcdir)/autotest.mk
44 AT_SETUP([autotest.mk depfiles (MAKE=gmake)])
49 AT_CHECK([{ echo 'rule:; @: $(info works)' |
50 gmake --no-print-directory -f - >out 2>/dev/null &&
51 read s <out && test x"$s" = x"works"; } || exit 77])
54 AT_CHECK([cd build && ../configure MAKE=gmake && test -f .deps/testsuite.P],
56 AT_CHECK([gmake --no-print-directory -sC build distclean &&
61 AT_SETUP([autotest.mk depfiles (MAKE=dmake)])
66 AT_CHECK([{ echo 'rule:; @echo works' | dmake -f - >out 2>/dev/null &&
67 read s <out && test x"$s" = x"works"; } || exit 77])
69 AT_CHECK([./configure MAKE=dmake && test -f .deps/testsuite.P], [0], [ignore])
73 AT_SETUP([autotest.mk no depfiles])
76 [[AM_INIT_AUTOMAKE([foreign])
79 AM_OUTPUT_DEPENDENCY_COMMANDS
84 AM_CONDITIONAL([HAVE_AUTOTEST], [:])
86 AC_CONFIG_FILES([Makefile])
89 cp "$srcdir/snippet/autotest.mk" .
90 AT_DATA([Makefile.am],
93 include $(top_srcdir)/autotest.mk
97 TEST_CONFIGURE([--disable-dependency-tracking])
99 AT_DATA([testsuite.at])
100 AT_CHECK([make -s AUTOTEST="$srcdir/t/autotest.sh" testsuite])
104 # Check that the distribution does not fail if the generated testsuite
105 # dependencies include a file which is already in the distribution.
106 AT_SETUP([autotest.mk distribution])
113 eval ': >package.m4 >testsuite.at'
115 TEST_DEPFILES_INIT_CONFIGURE
116 TEST_DEPFILES_INIT_MAKEFILE([EXTRA_DIST += ro/ro])
120 { echo ro/ro; echo ro/rw; } >testsuite.deps
121 TEST_CONFIGURE([--disable-dependency-tracking])
122 AT_CHECK([make -s distdir && cat test-0/ro/ro test-0/ro/rw], [0],
129 AT_SETUP([glconfig.mk no depfiles])
132 [[AM_INIT_AUTOMAKE([foreign])
135 AM_OUTPUT_DEPENDENCY_COMMANDS
140 AC_SUBST([GLSRC], [lib])
142 AC_CONFIG_FILES([Makefile])
145 cp "$srcdir/snippet/glconfig.mk" .
146 AT_DATA([Makefile.am],
150 include $(top_srcdir)/glconfig.mk
154 TEST_CONFIGURE([--disable-dependency-tracking])
155 AT_CHECK([make -s lib/glconfig.h])
156 AT_CHECK([test ! -d lib/.deps && test ! -d lib/_deps && cat lib/glconfig.h])
160 AT_SETUP([gettext.mk .mo installation])
162 cp "$srcdir/snippet/gettext.mk" "$srcdir/t/msgfmt.sh" .
165 [[AM_INIT_AUTOMAKE([foreign])
166 AC_CONFIG_FILES([Makefile])
169 AT_DATA([Makefile.am],
170 [[MSGFMT = $(SHELL) $(top_srcdir)/msgfmt.sh
172 MAINTAINERCLEANFILES =
175 include $(top_srcdir)/gettext.mk
180 (cd build && TEST_CONFIGURE([--prefix="$at_group_dir/inst"], [../configure]))
182 AT_CHECK([cd build &&
183 make DESTDIR="$at_group_dir" localedir=/l0 install],
184 [0], [ignore], [ignore])
185 AT_CHECK([test -d inst || { find l0 | LC_ALL=C sort; }], [0],
189 l0/a/LC_MESSAGES/test.mo
192 l0/b/LC_MESSAGES/test.mo
195 AT_CHECK([cd build &&
196 make DESTDIR="$at_group_dir" localedir=/l1 installdirs],
197 [0], [ignore], [ignore])
198 AT_CHECK([test -d inst || { find l1 | LC_ALL=C sort; }], [0],
206 AT_CHECK([cd build &&
207 make DESTDIR="$at_group_dir" localedir=/l2 MOFILES= install installdirs],
208 [0], [ignore], [ignore])
209 AT_CHECK([test ! -d inst && test ! -d l2])
211 AT_CHECK([cd build &&
212 make DESTDIR="$at_group_dir" localedir=/l0 MOFILES= uninstall],
213 [0], [ignore], [ignore])
214 AT_CHECK([test -d inst || { find l0 | LC_ALL=C sort; }], [0],
224 TEST_TAP_SIMPLE([test-tap.at sanity], [tapcheck.sh 4 : : : :], [], [autotest])