From: Paolo Bonzini Date: Fri, 10 Oct 2008 06:40:52 +0000 (+0200) Subject: Add and document AS_ME_PREPARE and AS_LINENO_PREPARE X-Git-Tag: v2.63b~265 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06bceefef2590d66bc316e9b02dcbfe325a41600;p=thirdparty%2Fautoconf.git Add and document AS_ME_PREPARE and AS_LINENO_PREPARE 2008-10-10 Paolo Bonzini * 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. * bin/autoconf.as: Invoke AS_ME_PREPARE. * lib/autotest/general.m4: Likewise. --- diff --git a/ChangeLog b/ChangeLog index ea444600..76dc4f58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-10-10 Paolo Bonzini + + * 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. + * NEWS: Mention them. + + * bin/autoconf.as: Invoke AS_ME_PREPARE. + * lib/autotest/general.m4: Likewise. + 2008-10-10 Paolo Bonzini * doc/autoconf.texi (Programming in M4sh): Make its own chapter. diff --git a/NEWS b/NEWS index 97bcb6ac..31e58c63 100644 --- a/NEWS +++ b/NEWS @@ -15,8 +15,12 @@ GNU Autoconf NEWS - User visible changes. ** The following m4sugar macros are new: m4_default_quoted +** The following documented m4sh macros are new: + AS_LINENO_PREPARE + AS_ME_PREPARE + ** The following m4sh macros are documented now: - AS_VERSION_COMPARE. + AS_VERSION_COMPARE * Major changes in Autoconf 2.63 (2008-09-09) [stable] diff --git a/bin/autoconf.as b/bin/autoconf.as index 3a253224..6eab32a9 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 96fdc5b9..d9d82aa7 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -11943,6 +11943,21 @@ 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 +@defmac AS_LINENO_PREPARE +@asindex{LINENO_PREPARE} +@evindex LINENO +Find a shell that supports the special variable @env{LINENO}, which +contains the number of the currently executing line. This macro is +automatically invoked by @code{AC_INIT} in configure scripts. +@end defmac + +@defmac AS_ME_PREPARE +@asindex{ME_PREPARE} +Set up variable @env{as_me} to be the basename of the currently executing +script. This macro is automatically invoked by @code{AC_INIT} in +configure scripts. +@end defmac + @defmac AS_SHELL_SANITIZE @asindex{SHELL_SANITIZE} Initialize the shell suitably for @command{configure} scripts. This has @@ -14002,12 +14017,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 -@code{$LINENO} (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 +@code{AS_LINENO_PREPARE} so that these workarounds are included in +your script; configure scripts do this automatically in @code{AC_INIT}. 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/autotest/general.m4 b/lib/autotest/general.m4 index d19f9d9c..e39aee1c 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -216,6 +216,7 @@ m4_define([AT_help_all], []) m4_foreach([AT_name], [_AT_DEFINE_INIT_LIST], [m4_popdef(m4_defn([AT_name]))]) m4_wrap([_AT_FINISH]) AS_INIT[]dnl +AS_ME_PREPARE[]dnl m4_divert_push([DEFAULTS])dnl AT_COPYRIGHT( [Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 369d27a4..ef3d93b5 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -914,6 +914,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]")` @@ -942,6 +943,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