1 dnl Copyright © 2015 Nick Bowler
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.
7 AT_BANNER([Autoconf macros])
9 m4_define([TEST_CONFIGURE_AC], [AT_DATA([configure.ac],
10 [[AC_INIT([test], [0])
14 cp "$srcdir/install-sh" \
15 "$srcdir/config.guess" \
16 "$srcdir/config.sub" \
20 m4_define([TEST_AUTORECONF],
21 [AT_CHECK([autoreconf -I "$srcdir/m4"], [0], [], [stderr])])
23 m4_define([TEST_CONFIGURE], [AT_CHECK([./configure $1], [0], [ignore])])
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])
34 [[AC_SUBST([TEST], 'm4@&t@_dquote(DX_BASEDIR)')
35 AC_CONFIG_FILES([test])
40 printf '%s\n' "$srcdir" | sed -e 's:/\./:/:g' -e 's:/\.$::g' \
41 -e 's:\(.\)//*:\1/:g' >expout
42 AT_CHECK([cat test], [0], [expout])
46 dnl Verify that DX_BASEDIR is correctly AC_SUBSTed
47 AT_SETUP([DX_BASEDIR output substitution])
55 AC_CONFIG_FILES([test])
60 printf '%s\n' "$srcdir" | sed -e 's:/\./:/:g' -e 's:/\.$::g' \
61 -e 's:\(.\)//*:\1/:g' >expout
62 AT_CHECK([cat test], [0], [expout])
66 dnl Verify that DX_BASEDIR is set correctly implicitly
67 AT_SETUP([DX_BASEDIR implicit definition])
75 AC_CONFIG_FILES([test])
82 AT_SETUP([DX_COMMAND_OUTPUT])
86 trailing whitespace @&t@
94 [[DX_COMMAND_OUTPUT([var], [cat expout])
95 AS@&t@_ECHO(["$var"]) >test.out
100 AT_CHECK([cat test.out], [0], [expout])