Hi,
I recently tried to define autoconf macros for a new language `Lang' using
[AC_DEFUN([AC_LANG_COMPILER(Lang)], [AC_REQUIRE([AC_PROG_CLANG])])
but as a consequence aclocal failed:
autom4te ... --trace='AC_LANG_COMPILER(Lang)' ...
=> /bin/sh /usr/bin/m4 ... --trace=AC_LANG_COMPILER(Lang) ...
=> /bin/sh failed with: syntax error at `(' or so.
The reason is, that the macro names passed from autom4te to M4 lack proper
shell quoting.
Attached is a small patch (against git as of today) fixing this problem,
together with a test case.
Regards
Peter Breitenlohner <[email protected]>
From 678465f12f961a6c06f99158fc712d688c1e50cf Mon Sep 17 00:00:00 2001
From: Peter Breitenlohner <[email protected]>
Date: Tue, 27 Jan 2009 14:48:04 +0100
Subject: [PATCH] Quote traced macros passed from autom4te to M4
* bin/autom4te (handle_m4): Apply shell_quote to macro names.
* test/tools.at: Add a test case.
---
bin/autom4te.in | 2 +-
tests/tools.at | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/bin/autom4te.in b/bin/autom4te.in
index 50c410c..38d6a58 100644
--- a/bin/autom4te.in
+++ b/bin/autom4te.in
@@ -466,7 +466,7 @@ sub handle_m4 ($@)
. ' --debug=aflq'
. (!exists $ENV{'AUTOM4TE_NO_FATAL'} ? ' --fatal-warning' : '')
. " @m4_debugf...@=" . shell_quote ("$tcache" . $req->id . "t")
- . join (' --trace=', '', sort @macro)
+ . join (' --trace=', '', map { shell_quote ($_) } sort @macro)
. " " . files_to_options (@ARGV)
. " > " . shell_quote ("$ocache" . $req->id . "t"));
diff --git a/tests/tools.at b/tests/tools.at
index 3fa0fdb..ec55557 100644
--- a/tests/tools.at
+++ b/tests/tools.at
@@ -213,6 +213,19 @@ done
AT_CLEANUP
+# autom4te --trace and unusual macro names
+# ------------------------------------------------------
+
+AT_SETUP([autom4te --trace and unusual macro names])
+
+AT_DATA([file.m4],
+[[
+]])
+AT_CHECK_AUTOM4TE([-t 'TR A CE' -t 'TR(A)CE' file.m4])
+
+AT_CLEANUP
+
+
## ------------------ ##
## autoconf --trace. ##
## ------------------ ##
--
1.6.0.3