]> git.draconx.ca Git - dxcommon.git/blob - tests/macros.at
9986d75ffd0274b3ffc73d03d59b380d1c575599
[dxcommon.git] / tests / macros.at
1 dnl Copyright © 2015 Nick Bowler
2 dnl
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
6
7 AT_BANNER([Autoconf macros])
8
9 m4_define([TEST_CONFIGURE_AC], [AT_DATA([configure.ac],
10 [[AC_INIT([test], [0])
11 ]$1[
12 AC_OUTPUT
13 ]])
14 cp "$srcdir/install-sh" \
15    "$srcdir/config.guess" \
16    "$srcdir/config.sub" \
17    .
18 ])
19
20 m4_define([TEST_AUTORECONF],
21   [AT_CHECK([autoreconf -I "$srcdir/m4"], [0], [], [stderr])])
22
23 m4_define([TEST_CONFIGURE], [AT_CHECK([./configure $1], [0], [ignore])])
24
25 dnl Verify that the DX_BASEDIR macro expands correctly during argument
26 dnl collection.  Crucially, the output must not contain any other text.
27 AT_SETUP([DX_BASEDIR during argument collection])
28
29 AT_XFAIL_IF([:])
30
31 AT_DATA([test.in],
32 [[@TEST@
33 ]])
34
35 TEST_CONFIGURE_AC(
36 [[AC@&t@_SUBST([TEST], 'm4@&t@_dquote(DX_BASEDIR)')
37 AC_CONFIG_FILES([test])
38 ]])
39 TEST_AUTORECONF
40 TEST_CONFIGURE
41
42 printf '%s\n' "$srcdir" | sed -e 's:/\./:/:g' -e 's:/\.$::g' \
43                               -e 's:\(.\)//*:\1/:g' >expout
44 AT_CHECK([cat test], [0], [expout])
45
46 AT_CLEANUP