autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH 2/3] Add and document AS_ME_PREPARE and AS_LINENO_PREPARE


From: Paolo Bonzini
Subject: [PATCH 2/3] Add and document AS_ME_PREPARE and AS_LINENO_PREPARE
Date: Fri, 10 Oct 2008 08:40:52 +0200

This patch documents $as_me and $LINENO, which are the sole constructs
(for now) that explicitly require a *_PREPARE macro because they are
variables.  So those are defined without the hyphen and documented.

(I started using --thread to keep outgoing mail more organized).

2008-10-10  Paolo Bonzini  <address@hidden>

        * bin/autoconf.as: Invoke AS_ME_PREPARE.
        * lib/m4sugar/m4sh.m4 (AS_ME_PREPARE, AS_LINENO_PREPARE): New.
        * doc/autoconf.texi (Initialization macros): Document them.
        (Portable Shell): Refer to AS_LINENO_PREPARE.
---
 ChangeLog           |    7 +++++++
 bin/autoconf.as     |    1 +
 doc/autoconf.texi   |   25 +++++++++++++++++++------
 lib/m4sugar/m4sh.m4 |    5 ++---
 4 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index db82caa..3efc2f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-10-10  Paolo Bonzini  <address@hidden>
 
+       * bin/autoconf.as: Invoke AS_ME_PREPARE.
+       * lib/m4sugar/m4sh.m4 (AS_ME_PREPARE, AS_LINENO_PREPARE): New.
+       * doc/autoconf.texi (Initialization macros): Document them.
+       (Portable Shell): Refer to AS_LINENO_PREPARE.
+
+2008-10-10  Paolo Bonzini  <address@hidden>
+
        * doc/autoconf.texi (Programming in M4sh): Make its own chapter.
 
 2008-10-09  Paolo Bonzini  <address@hidden>
diff --git a/bin/autoconf.as b/bin/autoconf.as
index 3a25322..6eab32a 100644
--- a/bin/autoconf.as
+++ b/bin/autoconf.as
@@ -22,6 +22,7 @@ m4_divert_push([HEADER-COPYRIGHT])dnl
 # 02110-1301, USA.
 
 m4_divert_pop([HEADER-COPYRIGHT])dnl back to BODY
+AS_ME_PREPARE[]dnl
 
 usage=["\
 Usage: $0 [OPTION]... [TEMPLATE-FILE]
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index cae6bd5..1256f97 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -11943,6 +11943,18 @@ generated from, and code to sanitize the environment 
for the rest of the
 script.  Finally, it changes the current diversion to @code{BODY}.
 @end defmac
 
address@hidden AS_LINENO_PREPARE
address@hidden
+Find a shell that supports the special variable @code{$LINENO}, which
+contains the number of the currently executing line.
address@hidden defmac
+
address@hidden AS_ME_PREPARE
address@hidden
+Set up variable @code{$as_me} to be the name of the currently executing
+script.
address@hidden defmac
+
 @defmac AS_SHELL_SANITIZE
 @asindex{SHELL_SANITIZE}
 Initialize the shell suitably for @command{configure} scripts.  This has
@@ -14002,12 +14014,13 @@ etc.)@: as described above.
 @item LINENO
 Most modern shells provide the current line number in @code{LINENO}.
 Its value is the line number of the beginning of the current command.
-Autoconf attempts to execute @command{configure} with a shell that
-supports @code{LINENO}.
-If no such shell is available, it attempts to implement @code{LINENO}
-with a Sed prepass that replaces each instance of the string
address@hidden (not followed by an alphanumeric character) with the
-line's number.
+M4sh, and hence Autoconf, attempts to execute @command{configure} with
+a shell that supports @code{LINENO}.  If no such shell is available, it
+attempts to implement @code{LINENO} with a Sed prepass that replaces each
+instance of the string @code{$LINENO} (not followed by an alphanumeric
+character) with the line's number.  In M4sh scripts you should execute
address@hidden so that these workarounds are included in
+your script.
 
 You should not rely on @code{LINENO} within @command{eval}, as the
 behavior differs in practice.  Also, the possibility of the Sed
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index b64a6cf..b9db92d 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -457,9 +457,6 @@ export LC_ALL
 LANGUAGE=C
 export LANGUAGE
 
-dnl Delay this until after shell functions are defined.
-AS_REQUIRE([_AS_ME_PREPARE])
-
 # CDPATH.
 $as_unset CDPATH
 ])# AS_SHELL_SANITIZE
@@ -911,6 +908,7 @@ fi
 # _AS_ME_PREPARE
 # --------------
 # Define $as_me to the basename of the executable file's name.
+m4_defun([AS_ME_PREPARE], [AS_REQUIRE([_$0])])
 m4_defun([_AS_ME_PREPARE],
 [AS_REQUIRE([_AS_BASENAME_PREPARE])dnl
 as_me=`AS_BASENAME("$[0]")`
@@ -939,6 +937,7 @@ m4_define([_AS_LINENO_WORKS],
 # the case of embedded executables (such as config.status within
 # configure) you'd compare LINENO wrt config.status vs. _oline_ wrt
 # configure.
+m4_defun([AS_LINENO_PREPARE], [AS_REQUIRE([_$0])])
 m4_defun([_AS_LINENO_PREPARE],
 [AS_REQUIRE([_AS_CR_PREPARE])dnl
 AS_REQUIRE([_AS_ME_PREPARE])dnl
-- 
1.5.5





reply via email to

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