autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] AC_SUBST: document and test previous patch


From: Eric Blake
Subject: [PATCH] AC_SUBST: document and test previous patch
Date: Wed, 15 Aug 2012 22:21:08 -0600

* doc/autoconf.texi (Setting Output Variables) <AC_SUBST>: Mention
that variable does not overlap with macros.
* tests/base.at (AC_SUBST): New test.

Signed-off-by: Eric Blake <address@hidden>
---

I went ahead and whipped something up.

 doc/autoconf.texi |  3 ++-
 tests/base.at     | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index c4ebe11..b3f7a23 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -9876,7 +9876,8 @@ Setting Output Variables
 If @var{value} is given, in addition assign it to @var{variable}.

 The string @var{variable} is passed to @code{m4_pattern_allow}
-(@pxref{Forbidden Patterns}).
+(@pxref{Forbidden Patterns}).  @var{variable} is not further expanded,
+even if there is another macro by the same name.
 @end defmac

 @defmac AC_SUBST_FILE (@var{variable})
diff --git a/tests/base.at b/tests/base.at
index 7979413..7530c21 100644
--- a/tests/base.at
+++ b/tests/base.at
@@ -708,3 +708,57 @@ libdir=${exec_prefix}/lib
 ]])

 AT_CLEANUP
+
+## ---------- ##
+## AC_SUBST.  ##
+## ---------- ##
+
+AT_SETUP([AC_SUBST])
+AT_KEYWORDS([AS@&address@hidden)
+
+# Check that a valid variable name is used.
+AT_DATA([configure.ac],
+[[AC_INIT([test], [1])
+AC_SUBST([1], [bar])
+AC_OUTPUT
+]])
+AT_CHECK_AUTOCONF([], [1], [], [stderr])
+AT_CHECK([grep 'not a valid shell variable' stderr], [], [ignore])
+
+AT_DATA([configure.ac],
+[[AC_INIT([test], [1])
+AC_SUBST([], [bar])
+AC_OUTPUT
+]])
+AT_CHECK_AUTOCONF([], [1], [], [stderr])
+AT_CHECK([grep 'not a valid shell variable' stderr], [], [ignore])
+
+AT_DATA([configure.ac],
+[[AC_INIT([test], [1])
+AC_SUBST([*], [bar])
+AC_OUTPUT
+]])
+AT_CHECK_AUTOCONF([], [1], [], [stderr])
+AT_CHECK([grep 'not a valid shell variable' stderr], [], [ignore])
+
+# Make sure AC_SUBST handles variables as expected.
+AT_DATA([file.in],
address@hidden@
+FOO
+]])
+AT_DATA([configure.ac],
+[[AC_INIT([test], [0])
+m4_define([FOO], [baz])
+AC_SUBST([FOO], [bar])
+AC_CONFIG_FILES([file])
+AC_OUTPUT
+]])
+
+AT_CHECK_AUTOCONF([], [], [], [stderr])
+AT_CHECK_CONFIGURE
+AT_CHECK([cat file], [],
+[[bar
+FOO
+]])
+
+AT_CLEANUP
-- 
1.7.11.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]