autoconf-patches
[Top][All Lists]
Advanced

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

Re: AS_ESCAPE cleanups


From: Eric Blake
Subject: Re: AS_ESCAPE cleanups
Date: Tue, 25 Nov 2008 00:24:16 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> I'm still debating about doing more with AS_ESCAPE; I have a pending patch 
that 
> makes AS_ESCAPE noticeably faster if it can m4-quote its output, rather than 
> the current behavior of having to rescan output for macro expansions.  This 
is 
> generally the right thing to do, anyway - macro expansion after escapes have 
> been added are only safe if the macros do not expand to anything that also 
> needed escapes, and if that is the case, the macros could generally be safely 
> expanded in advance.

I still have some pending speedups in the pipe, but first some cleanups.  It 
just makes sense for AS_ESCAPE to pre-expand its argument (you want to escape 
even the bytes that are the result of macro expansions); on the other hand, 
this introduces overhead when you already know there won't be macro 
expansions.  I solved this by introducing AS_ESCAPE_STRING.  This series, on 
top of my improvements to m4_expand, produces identical configure and nearly 
identical testsuite output (the testsuite actually had a bug where it was 
underquoting one AS_ESCAPE use and losing [], which is fixed in this series).

>From 47d83a2df6c037c99de553aaf423636934c6633d Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 24 Nov 2008 16:32:01 -0700
Subject: [PATCH] Add AC_INCLUDES_DEFAULT_QUOTED, undocumented for now.

* lib/autoconf/headers.m4 (AC_INCLUDES_DEFAULT_QUOTED): New
macro.
(_AC_CHECK_HEADER_MONGREL, _AC_CHECK_HEADER_COMPILE): Adjust
clients.
* lib/autoconf/general.m4 (AC_CHECK_DECL): Likewise.
* lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW, AC_CHECK_MEMBER):
Likewise.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog               |    9 +++++++++
 lib/autoconf/general.m4 |    2 +-
 lib/autoconf/headers.m4 |   15 ++++++++++++---
 lib/autoconf/types.m4   |    4 ++--
 4 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 42ea686..8d2a795 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2008-11-24  Eric Blake  <address@hidden>
 
+       Add AC_INCLUDES_DEFAULT_QUOTED, undocumented for now.
+       * lib/autoconf/headers.m4 (AC_INCLUDES_DEFAULT_QUOTED): New
+       macro.
+       (_AC_CHECK_HEADER_MONGREL, _AC_CHECK_HEADER_COMPILE): Adjust
+       clients.
+       * lib/autoconf/general.m4 (AC_CHECK_DECL): Likewise.
+       * lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW, AC_CHECK_MEMBER):
+       Likewise.
+
        Support m4_divert_text inside m4_expand.
        * lib/m4sugar/m4sugar.m4 (_m4_divert_text, _m4_divert_undefer):
        New macros.
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 50b6eae..eebfba6 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2778,7 +2778,7 @@ AC_DEFUN([AC_CHECK_DECL],
   [_$0_BODY])]dnl
 [AS_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])]dnl
 [ac_fn_[]_AC_LANG_ABBREV[]_check_decl ]dnl
-["$LINENO" "$1" "ac_Symbol" "AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
+["$LINENO" "$1" "ac_Symbol" AC_INCLUDES_DEFAULT_QUOTED([$4])
 AS_VAR_IF([ac_Symbol], [yes], [$2], [$3])
 AS_VAR_POPDEF([ac_Symbol])dnl
 ])# AC_CHECK_DECL
diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index f4a4528..2b371f7 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -158,7 +158,7 @@ AC_DEFUN([_AC_CHECK_HEADER_MONGREL],
   [$0_BODY])]dnl
 [AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])]dnl
 [ac_fn_[]_AC_LANG_ABBREV[]_check_header_mongrel ]dnl
-["$LINENO" "$1" "ac_Header" "AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
+["$LINENO" "$1" "ac_Header" AC_INCLUDES_DEFAULT_QUOTED([$4])
 AS_VAR_IF([ac_Header], [yes], [$2], [$3])
 AS_VAR_POPDEF([ac_Header])])# _AC_CHECK_HEADER_MONGREL
 
@@ -190,7 +190,7 @@ AC_DEFUN([_AC_CHECK_HEADER_COMPILE],
   [$0_BODY])]dnl
 [AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])]dnl
 [ac_fn_[]_AC_LANG_ABBREV[]_check_header_compile ]dnl
-["$LINENO" "$1" "ac_Header" "AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
+["$LINENO" "$1" "ac_Header" AC_INCLUDES_DEFAULT_QUOTED([$4])
 AS_VAR_IF([ac_Header], [yes], [$2], [$3])
 AS_VAR_POPDEF([ac_Header])])# _AC_CHECK_HEADER_COMPILE
 
@@ -341,7 +341,7 @@ AC_CHECK_HEADERS([sys/types.h sys/stat.h stdlib.h string.h 
memory.h strings.h \
 # AC_INCLUDES_DEFAULT([INCLUDES])
 # -------------------------------
 # If INCLUDES is empty, expand in default includes, otherwise in
-# INCLUDES.
+# INCLUDES; suitable for use in an unquoted here-doc.
 # In most cases INCLUDES is not double quoted as it should, and if
 # for instance INCLUDES = `#include <stdio.h>' then unless we force
 # a newline, the hash will swallow the closing paren etc. etc.
@@ -354,6 +354,15 @@ AC_DEFUN([AC_INCLUDES_DEFAULT],
 $ac_includes_default])])
 
 
+# AC_INCLUDES_DEFAULT_QUOTED([INCLUDES])
+# --------------------------------------
+# Like AC_INCLUDES_DEFAULT, except output a double-quoted string
+# rather than here-doc text.  Necessary since m4_expand doesn't like
+# AC_INCLUDES_DEFAULT (it tries to change the current diversion,
+# thanks to AC_REQUIRE).
+AC_DEFUN([AC_INCLUDES_DEFAULT_QUOTED],
+[m4_ifval([$1], ["AS_ESCAPE(m4_dquote(m4_expand([$1])), [""])"],
+  [AC_REQUIRE([_AC_INCLUDES_DEFAULT_REQUIREMENTS])"$ac_includes_default"])])
 
 
 
diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4
index 2d055de..1fcba81 100644
--- a/lib/autoconf/types.m4
+++ b/lib/autoconf/types.m4
@@ -175,7 +175,7 @@ AC_DEFUN([_AC_CHECK_TYPE_NEW],
     [$0_BODY])]dnl
 [AS_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])]dnl
 [ac_fn_[]_AC_LANG_ABBREV[]_check_type "$LINENO" "$1" "ac_Type" ]dnl
-["AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
+[AC_INCLUDES_DEFAULT_QUOTED([$4])
 AS_VAR_IF([ac_Type], [yes], [$2], [$3])
 AS_VAR_POPDEF([ac_Type])dnl
 ])# _AC_CHECK_TYPE_NEW
@@ -898,7 +898,7 @@ AC_DEFUN([AC_CHECK_MEMBER],
 [AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])]dnl
 [ac_fn_[]_AC_LANG_ABBREV[]_check_member "$LINENO" ]dnl
 [m4_bpatsubst([$1], [^\([^.]*\)\.\(.*\)], ["\1" "\2"]) "ac_Member" ]dnl
-["AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
+[AC_INCLUDES_DEFAULT_QUOTED([$4])
 AS_VAR_IF([ac_Member], [yes], [$2], [$3])
 AS_VAR_POPDEF([ac_Member])dnl
 ])# AC_CHECK_MEMBER
-- 
1.6.0.4


>From 0acd86352a72f0fd528c3ecd27f3ea8a06b7c31e Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 24 Nov 2008 16:50:48 -0700
Subject: [PATCH] Document AS_ESCAPE, and add AS_ESCAPE_STRING.

* lib/m4sugar/m4sh.m4 (AS_ESCAPE_STRING): New macro.
(AS_ESCAPE): Expand string prior to addition of quotes.
(_AS_ESCAPE): Double-quote output.
(_AS_QUOTE, _AS_QUOTE_OLD, AS_TR_SH, AS_VAR_GET): Adjust
_AS_ESCAPE clients to deal with shift in quoting.
* doc/autoconf.texi (Common Shell Constructs) <AS_ESCAPE>:
Document this interface.
* NEWS: Likewise.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog           |   12 ++++++++++++
 NEWS                |    8 ++++----
 doc/autoconf.texi   |   44 ++++++++++++++++++++++++++++++++++++++++++++
 lib/m4sugar/m4sh.m4 |   37 +++++++++++++++++++++++++------------
 4 files changed, 85 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8d2a795..43992e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2008-11-24  Eric Blake  <address@hidden>
 
+       Document AS_ESCAPE, and add AS_ESCAPE_STRING.
+       * lib/m4sugar/m4sh.m4 (AS_ESCAPE_STRING): New macro.
+       (AS_ESCAPE): Expand string prior to addition of quotes.
+       (_AS_ESCAPE): Double-quote output.
+       (_AS_QUOTE, _AS_QUOTE_OLD, AS_TR_SH, AS_VAR_GET): Adjust
+       _AS_ESCAPE clients to deal with shift in quoting.
+       * doc/autoconf.texi (Common Shell Constructs) <AS_ESCAPE>:
+       Document this interface.
+       * NEWS: Likewise.
+
+2008-11-24  Eric Blake  <address@hidden>
+
        Add AC_INCLUDES_DEFAULT_QUOTED, undocumented for now.
        * lib/autoconf/headers.m4 (AC_INCLUDES_DEFAULT_QUOTED): New
        macro.
diff --git a/NEWS b/NEWS
index f5f1856..b7a57b5 100644
--- a/NEWS
+++ b/NEWS
@@ -37,14 +37,14 @@ GNU Autoconf NEWS - User visible changes.
    around unbalanced `(' where single-quoting used to be sufficient.
 
 ** The following documented m4sh macros are new:
-   AS_LINENO_PREPARE  AS_ME_PREPARE  AS_SET_STATUS  AS_VAR_APPEND
-   AS_VAR_ARITH  AS_VAR_COPY
+   AS_ESCAPE_STRING  AS_LINENO_PREPARE  AS_ME_PREPARE  AS_SET_STATUS
+   AS_VAR_APPEND  AS_VAR_ARITH  AS_VAR_COPY
 
 ** The following m4sh macros are documented now, but in some cases
    with slightly different semantics than what the previous
    undocumented version had:
-   AS_ECHO  AS_ECHO_N  AS_EXIT  AS_LITERAL_IF  AS_UNSET  AS_VAR_IF
-   AS_VAR_POPDEF  AS_VAR_PUSHDEF  AS_VAR_SET  AS_VAR_SET_IF
+   AS_ECHO  AS_ECHO_N  AS_ESCAPE  AS_EXIT  AS_LITERAL_IF  AS_UNSET
+   AS_VAR_IF  AS_VAR_POPDEF  AS_VAR_PUSHDEF  AS_VAR_SET  AS_VAR_SET_IF
    AS_VAR_TEST_SET  AS_VERSION_COMPARE
 
 ** The m4sh macros AS_IF and AS_CASE can now be used in shell lists.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index aab94b3..86c4bb8 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -12195,6 +12195,50 @@ Common Shell Constructs
 Redirections can be placed outside the macro invocation.
 @end defmac
 
address@hidden AS_ESCAPE (@var{string}, @dvar{chars, \"$`})
address@hidden AS_ESCAPE_STRING (@var{string}, @dvar{chars, \"$`})
address@hidden
address@hidden
+Expands to an m4-quoted version of @var{string}, with any characters in
address@hidden escaped with a backslash (@samp{\}).  Characters may be
+safely listed more than once in @var{chars} for the sake of syntax
+highlighting editors.  The current implementation has unspecified
+behavior if @var{chars} contains @samp{[}, @samp{]}, @samp{^}, or
address@hidden  Of the two macros, only @code{AS_ESCAPE} performs M4 macro
+expansion on @var{string}; thus, @code{AS_ESCAPE_STRING(address@hidden)}
+is a faster alternative to @code{AS_ESCAPE(address@hidden)}.
+
+The default for @var{chars} (@samp{\"$`}) is the set of characters
+needing escapes when @var{string} will be used literally within double
+quotes.  One common variant is the set of characters to protect when
address@hidden will be used literally within back-ticks or an unquoted
+here-doc (@samp{\$`}).  Another common variant is @samp{""}, which can
+be used to form a double-quoted string containing the same expansions
+that would have occurred if @var{string} were expanded in an unquoted
+here-doc; however, when using this variant, care must be taken that
address@hidden does not use double quotes within complex variable
+expansions (such as @address@hidden "hi"address@hidden) that would be broken
+with improper escapes.
+
+This macro is often used with @code{AS_ECHO}.  For example, this snippet
+will produce shell code that outputs the three lines @samp{"$foo" =
+bar}, @samp{macro}, and @samp{a, \b}:
+
address@hidden
+foo=bar
+AS_ECHO(["AS_ESCAPE(["$foo" = ])AS_ESCAPE([$foo], [""])"])
+m4_define([macro], [a, [\b]])
+AS_ECHO(["AS_ESCAPE_STRING([macro])"])
+AS_ECHO(["AS_ESCAPE([macro])"])
address@hidden example
+
address@hidden Should we add AS_ESCAPE_SINGLE?
address@hidden If we do, we can optimize in the case of @var{string} that does
address@hidden not contain '.
+To escape a string that will be placed within single quotes, use
address@hidden(address@hidden, ['], ['\\''])}.
address@hidden defmac
+
 @defmac AS_EXIT (@dvar{status, $?})
 @asindex{EXIT}
 Emit code to exit the shell with @var{status}, defaulting to @samp{$?}.
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index be9ff3b..c26c1ba 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -686,16 +686,26 @@ m4_define([AS_ORIGINAL_STDIN_FD], [0])
 
 # AS_ESCAPE(STRING, [CHARS = $"`\])
 # ---------------------------------
-# Escape the CHARS in STRING.
-#
-# Avoid the m4_bpatsubst if there are no interesting characters to escape.
-# _AS_ESCAPE bypasses argument defaulting.
+# Expand STRING, then backslash-escape the CHARS in the result.  Output a
+# quoted string.
 m4_define([AS_ESCAPE],
-[_$0([$1], m4_default([$2], [\"$`]))])
+[$0_STRING(m4_expand([$1]), [$2])])
+
+# AS_ESCAPE_STRING(STRING, [CHARS = $"`\])
+# ----------------------------------------
+# Backslash-escape the CHARS within STRING, and output a quoted
+# string.  AS_ESCAPE_STRING([str]) is faster than AS_ESCAPE([[str]]).
+m4_define([AS_ESCAPE_STRING],
+[_AS_ESCAPE([$1], m4_default([$2], [\"$`]))])
+
+# _AS_ESCAPE(STRING, CHARS)
+# -------------------------
+# Backslash-escape the CHARS within STRING.  Avoid the m4_bpatsubst if
+# there are no interesting characters to escape.
 m4_define([_AS_ESCAPE],
 [m4_if(m4_len([$1]),
        m4_len(m4_translit([[$1]], [$2])),
-       [$1], [m4_bpatsubst([$1], [[$2]], [\\\&])])])
+       [[$1]], [m4_bpatsubst([[$1]], [[$2]], [\\\&])])])
 
 
 # _AS_QUOTE(STRING)
@@ -717,11 +727,13 @@ m4_define([_AS_ESCAPE],
 #          [$2])
 # The current implementation caters to the common case of no backslashes,
 # to minimize m4_index expansions (hence the nested if).
-m4_define([_AS_QUOTE],
+m4_define([_AS_QUOTE], [$0_(m4_expand([$1]))])
+
+m4_define([_AS_QUOTE_],
 [m4_cond([m4_index([$1], [\])], [-1], [_AS_QUOTE_MODERN],
         [m4_eval(m4_index(m4_translit([[$1]], [$], [\]), [\\]) >= 0)],
 [1], [_AS_QUOTE_MODERN],
-        [m4_eval(m4_index(m4_translit([[$1]], ["], [`]), [\`]) >= 0)],dnl"
+        [m4_eval(m4_index(m4_translit([[$1]], [""], [`]), [\`]) >= 0)],
 [1], [_AS_QUOTE_OLD],
         [_AS_QUOTE_MODERN])([$1])])
 
@@ -730,7 +742,7 @@ m4_define([_AS_QUOTE_MODERN],
 
 m4_define([_AS_QUOTE_OLD],
 [m4_warn([obsolete],
-   [back quotes and double quotes must not be escaped in: $1])$1])
+   [back quotes and double quotes must not be escaped in: $1])[$1]])
 
 
 # _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD])
@@ -782,7 +794,8 @@ esac
 # ----------------------------------------
 # Same as _AS_ECHO, but echo doesn't return to a new line.
 m4_define([_AS_ECHO_N],
-[AS_ECHO_N(["_AS_QUOTE([$1])"]) >&m4_default([$2], [AS_MESSAGE_FD])])
+[AS_ECHO_N(["_AS_QUOTE([$1])"]) >&m4_default([$2],
+  [AS_MESSAGE_FD])])
 
 
 # AS_MESSAGE(STRING, [FD = AS_MESSAGE_FD])
@@ -1729,7 +1742,7 @@ m4_defun_init([AS_TR_SH],
 m4_dquote(m4_dquote(m4_defn([m4_cr_not_symbols2])))[[,
                                 [pp[]]]]dnl
 m4_dquote(m4_dquote(m4_for(,1,255,,[[_]])))[[)],
-  [`AS_ECHO(["_AS_ESCAPE(m4_dquote(m4_expand([$1])), [\`])"]) | $as_tr_sh`])])
+  [`AS_ECHO(["_AS_ESCAPE(m4_expand([$1]), [\`])"]) | $as_tr_sh`])])
 
 
 # _AS_TR_CPP_PREPARE
@@ -1887,7 +1900,7 @@ m4_define([AS_VAR_COPY],
 m4_define([AS_VAR_GET],
 [AS_LITERAL_IF([$1],
               [$$1],
-  [`eval 'as_val=${'_AS_ESCAPE([[$1]], [\`])'};AS_ECHO(["$as_val"])'`])])
+  [`eval 'as_val=${'_AS_ESCAPE([$1], [\`])'};AS_ECHO(["$as_val"])'`])])
 
 
 # AS_VAR_IF(VARIABLE, VALUE, IF-TRUE, IF-FALSE)
-- 
1.6.0.4


>From c57fbe2dc4f609314edc55b718f091c2a43035af Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 24 Nov 2008 17:17:58 -0700
Subject: [PATCH] Optimize clients of AS_ESCAPE.

* lib/autoconf/autoheader.m4 (AH_VERBATIM): Use faster
AS_ESCAPE_STRING.
* lib/autoconf/general.m4 (_AC_DEFINE, _AC_DEFINE_UNQUOTED):
Likewise.
* lib/autotest/general.m4 (AT_INIT, AT_SETUP)
(_AT_DECIDE_TRACEABLE, _AT_CHECK): Likewise.
(AT_CHECK): Let AS_ESCAPE do the expansion.
* lib/autoconf/headers.m4 (AC_INCLUDES_DEFAULT_QUOTED): Likewise.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_EXPAND)
(_AS_DETECT_BETTER_SHELL, _AS_VAR_APPEND_PREPARE)
(_AS_VAR_ARITH_PREPARE): Likewise.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog               |   13 +++++++++++++
 lib/autoconf/general.m4 |    4 ++--
 lib/autoconf/headers.m4 |    2 +-
 lib/autotest/general.m4 |   14 +++++++-------
 lib/m4sugar/m4sh.m4     |   10 +++++-----
 5 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 43992e3..86bc395 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2008-11-24  Eric Blake  <address@hidden>
 
+       Optimize clients of AS_ESCAPE.
+       * lib/autoconf/autoheader.m4 (AH_VERBATIM): Use faster
+       AS_ESCAPE_STRING.
+       * lib/autoconf/general.m4 (_AC_DEFINE, _AC_DEFINE_UNQUOTED):
+       Likewise.
+       * lib/autotest/general.m4 (AT_INIT, AT_SETUP)
+       (_AT_DECIDE_TRACEABLE, _AT_CHECK): Likewise.
+       (AT_CHECK): Let AS_ESCAPE do the expansion.
+       * lib/autoconf/headers.m4 (AC_INCLUDES_DEFAULT_QUOTED): Likewise.
+       * lib/m4sugar/m4sh.m4 (_AS_DETECT_EXPAND)
+       (_AS_DETECT_BETTER_SHELL, _AS_VAR_APPEND_PREPARE)
+       (_AS_VAR_ARITH_PREPARE): Likewise.
+
        Document AS_ESCAPE, and add AS_ESCAPE_STRING.
        * lib/m4sugar/m4sh.m4 (AS_ESCAPE_STRING): New macro.
        (AS_ESCAPE): Expand string prior to addition of quotes.
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index eebfba6..1f37e62 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2067,7 +2067,7 @@ m4_define([AC_DEFINE], [_AC_DEFINE_Q([_$0], $@)])
 # Append the pre-expanded STRING and a newline to confdefs.h, as if by
 # a quoted here-doc.
 m4_define([_AC_DEFINE],
-[AS_ECHO(["AS_ESCAPE([[$1]])"]) >>confdefs.h])
+[AS_ECHO(["AS_ESCAPE_STRING([$1])"]) >>confdefs.h])
 
 
 # AC_DEFINE_UNQUOTED(VARIABLE, [VALUE], [DESCRIPTION])
@@ -2084,7 +2084,7 @@ m4_define([AC_DEFINE_UNQUOTED], [_AC_DEFINE_Q([_$0], $@)])
 # substitution, and no quadrigraphs.
 m4_define([_AC_DEFINE_UNQUOTED],
 [m4_if(m4_bregexp([$1], [\\\|`\|\$(\|\${\|@]), [-1],
-       [AS_ECHO(["AS_ESCAPE([$1], [""])"]) >>confdefs.h],
+       [AS_ECHO(["AS_ESCAPE_STRING([$1], [""])"]) >>confdefs.h],
        [cat >>confdefs.h <<_ACEOF
 [$1]
 _ACEOF])])
diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index 2b371f7..7462ac5 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -361,7 +361,7 @@ $ac_includes_default])])
 # AC_INCLUDES_DEFAULT (it tries to change the current diversion,
 # thanks to AC_REQUIRE).
 AC_DEFUN([AC_INCLUDES_DEFAULT_QUOTED],
-[m4_ifval([$1], ["AS_ESCAPE(m4_dquote(m4_expand([$1])), [""])"],
+[m4_ifval([$1], ["AS_ESCAPE([$1], [""])"],
   [AC_REQUIRE([_AC_INCLUDES_DEFAULT_REQUIREMENTS])"$ac_includes_default"])])
 
 
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index f391503..29ef768 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -441,7 +441,7 @@ at_groups_all='AT_groups_all'
 # numerical order.
 at_format='m4_bpatsubst(m4_defn([AT_ordinal]), [.], [?])'
 # Description of all the test groups.
-at_help_all="AS_ESCAPE(m4_dquote(m4_defn([AT_help_all])))"
+at_help_all="AS_ESCAPE_STRING(m4_defn([AT_help_all]))"
 
 AS_FUNCTION_DESCRIBE([at_fn_validate_ranges], [NAME...],
 [Validate and normalize the test group number contained in each
@@ -1743,7 +1743,7 @@ m4_divert_push([TEST_GROUPS])dnl
 at_setup_line='m4_defn([AT_line])'
 m4_if(AT_banner_ordinal, [0], [], [at_fn_banner AT_banner_ordinal
 ])dnl
-at_desc="AS_ESCAPE(m4_dquote(m4_defn([AT_description])))"
+at_desc="AS_ESCAPE_STRING(m4_defn([AT_description]))"
 at_desc_line=m4_format(["%3d: $at_desc%*s"], AT_ordinal,
   m4_max(0, m4_eval(47 - m4_qlen(m4_defn([AT_description])))), [])
 $at_quiet AS_ECHO_N(["$at_desc_line"])
@@ -1880,8 +1880,8 @@ $2[]_ATEOF
 # This may cause spurious failures when the test suite is run with `-x'.
 #
 _AT_DEFINE_SETUP([AT_CHECK],
-[_AT_CHECK(m4_expand([$1]), [$2], m4_expand([AS_ESCAPE([$3])]),
-  m4_expand([AS_ESCAPE([$4])]), [$5], [$6])])
+[_AT_CHECK(m4_expand([$1]), [$2], AS_ESCAPE([$3]),
+  AS_ESCAPE([$4]), [$5], [$6])])
 
 # AT_CHECK_NOESCAPE(COMMANDS, [STATUS = 0], STDOUT, STDERR,
 #                   [RUN-IF-FAIL], [RUN-IF-PASS])
@@ -1988,7 +1988,7 @@ at_fn_check_prepare_notrace],
 dnl We know at build time that tracing COMMANDS is always safe.
 [[at_fn_check_prepare_trace],]dnl
 dnl COMMANDS may contain parameter expansions; expand them at runtime.
-[[at_fn_check_prepare_dynamic "AS_ESCAPE([$1], [`\"])"])])]dnl
+[[at_fn_check_prepare_dynamic "AS_ESCAPE_STRING([$1], [`\"])"])])]dnl
 [_m4_popdef([at_reason])])
 
 
@@ -2050,8 +2050,8 @@ m4_define([AT_DIFF_STDOUT()],
 # with parallel jobs.
 m4_define([_AT_CHECK],
 [{ $at_traceoff
-AS_ECHO(["$at_srcdir/AT_LINE: AS_ESCAPE([[$1]])"])
-_AT_DECIDE_TRACEABLE([$1]) "AS_ESCAPE(m4_dquote(AT_LINE))"
+AS_ECHO(["$at_srcdir/AT_LINE: AS_ESCAPE_STRING([$1])"])
+_AT_DECIDE_TRACEABLE([$1]) "AS_ESCAPE([AT_LINE])"
 ( $at_check_trace; [$1]
 ) >>"$at_stdout" 2>>"$at_stderr"
 at_status=$? at_failed=false
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index c26c1ba..1dad0e6 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -165,8 +165,8 @@ $1], [^], address@hidden:@ ])])])
 # we must piece-meal the assignment of VAR such that $LINENO expansion
 # occurs in a single line.
 m4_define([_AS_DETECT_EXPAND],
-[$1="m4_bpatsubst(m4_dquote(AS_ESCAPE(_m4_expand(m4_set_contents([$2], [
-])))), [\\\$LINENO\(.*\)$], [";$1=$$1$LINENO;$1=$$1"\1])"])
+[$1="m4_bpatsubst(m4_dquote(AS_ESCAPE(m4_set_contents([$2], [
+]))), [\\\$LINENO\(.*\)$], [";$1=$$1$LINENO;$1=$$1"\1])"])
 
 
 # _AS_DETECT_REQUIRED(TEST)
@@ -219,7 +219,7 @@ dnl Remove any tests from suggested that are also required
 [m4_set_map([_AS_DETECT_SUGGESTED_BODY], [_AS_DETECT_SUGGESTED_PRUNE])]dnl
 [m4_pushdef([AS_EXIT], [exit m4_default([$1], 1)])]dnl
 [if test "x$CONFIG_SHELL" = x; then
-  as_bourne_compatible="AS_ESCAPE(_m4_expand([_AS_BOURNE_COMPATIBLE]))"
+  as_bourne_compatible="AS_ESCAPE([_AS_BOURNE_COMPATIBLE])"
   _AS_DETECT_EXPAND([as_required], [_AS_DETECT_REQUIRED_BODY])
   _AS_DETECT_EXPAND([as_suggested], [_AS_DETECT_SUGGESTED_BODY])
   AS_IF([_AS_RUN(["$as_required"])],
@@ -1807,7 +1807,7 @@ m4_defun([_AS_VAR_APPEND_PREPARE],
 VAR.  Take advantage of any shell optimizations that allow amortized
 linear growth over repeated appends, instead of the typical quadratic
 growth present in naive implementations.])
-AS_IF([_AS_RUN(["AS_ESCAPE(m4_quote(_AS_VAR_APPEND_WORKS))"])],
+AS_IF([_AS_RUN(["AS_ESCAPE([_AS_VAR_APPEND_WORKS])"])],
 [eval 'as_fn_append ()
   {
     eval $[]1+=\$[]2
@@ -1848,7 +1848,7 @@ m4_defun([_AS_VAR_ARITH_PREPARE],
 [Perform arithmetic evaluation on the ARGs, and store the result in
 the global $as_val.  Take advantage of shells that can avoid forks.
 The arguments must be portable across $(()) and expr.])
-AS_IF([_AS_RUN(["AS_ESCAPE(m4_quote(_AS_VAR_ARITH_WORKS))"])],
+AS_IF([_AS_RUN(["AS_ESCAPE([_AS_VAR_ARITH_WORKS])"])],
 [eval 'as_fn_arith ()
   {
     as_val=$(( $[]* ))
-- 
1.6.0.4








reply via email to

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