autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH] more cleanup before adding shell functions


From: Paolo Bonzini
Subject: [PATCH] more cleanup before adding shell functions
Date: Thu, 9 Oct 2008 15:33:10 +0200

This instroduces _AS_ME_PREPARE, which is needed to properly order
the initialization of as_me after the definition of shell functions.
Otherwise, _AS_BASENAME_PREPARE places shell functions in M4SH-INIT-FN,
and setting as_me in AS_SHELL_SANITIZE fails miserably if basename is
not present in the system.

In addition, _AS_PREPARE macros are sorted correctly, and AS_PREPARE is
modified to use AS_REQUIRE properly.

I'm going to push this shortly as well.

Paolo

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

        * m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Delay setting as_me
        until the M4SH-INIT diversion using _AS_ME_PREPARE.
        (_AS_PREPARE): Invoke _AS_EXPR_PREPARE before _AS_BASENAME_PREPARE
        and _AS_DIRNAME_PREPARE, and _AS_BASENAME_PREPARE and _AS_ME_PREPARE
        before _AS_LINENO_PREPARE.
        (AS_PREPARE): Include all the AS_REQUIREs manually.
        (_AS_ME_PREPARE): New.
        (_AS_LINENO_PREPARE): Use m4_defun.
---
 ChangeLog           |   15 +++++++++++++--
 lib/m4sugar/m4sh.m4 |   45 +++++++++++++++++++++++++++++++--------------
 2 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 25865bd..7bd4745 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2008-10-09  Paolo Bonzini  <address@hidden>
 
+       * m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Delay setting as_me
+       until the M4SH-INIT diversion using _AS_ME_PREPARE.
+       (_AS_PREPARE): Invoke _AS_EXPR_PREPARE
+       before _AS_BASENAME_PREPARE (newly added) and _AS_DIRNAME_PREPARE, and
+       _AS_BASENAME_PREPARE and _AS_ME_PREPARE before _AS_LINENO_PREPARE.
+       (AS_PREPARE): Include all the AS_REQUIREs manually.
+       (_AS_ME_PREPARE): New.
+       (_AS_LINENO_PREPARE): Use m4_defun.
+
+2008-10-09  Paolo Bonzini  <address@hidden>
+
        * m4sugar/m4sh.m4 (_AS_BASENAME_EXPR, _AS_DIRNAME_EXPR): Do not
        require _AS_EXPR_PREPARE.
        (_AS_BASENAME_PREPARE, _AS_DIRNAME_PREPARE): Do it here.
@@ -17,12 +28,12 @@
        * GNUmakefile: Resync from upstream, via new 'make fetch'.
        * build-aux/config.guess: Likewise.
 
-2008-09-18  Paolo Bonzini  <address@hidden>
+2008-10-08  Paolo Bonzini  <address@hidden>
 
        * lib/m4sugar/m4sh.m4 (_AS_SHELL_FN_SPY): Remove.
        (AS_INIT): Do not call it.
 
-2008-09-18  Paolo Bonzini  <address@hidden>
+2008-10-08  Paolo Bonzini  <address@hidden>
 
        * lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): Expand
        _AS_UNSET_PREPARE in M4SH-SANITIZE.
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 2345879..b64a6cf 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -256,12 +256,12 @@ fi
 # there are so many _AS_PREPARE_* below, and that's also why it is
 # important not to forget some: config.status needs them.
 m4_defun([_AS_PREPARE],
-[_AS_LINENO_PREPARE
-
-_AS_DIRNAME_PREPARE
+[_AS_EXPR_PREPARE
 _AS_BASENAME_PREPARE
+_AS_DIRNAME_PREPARE
+_AS_ME_PREPARE
+_AS_LINENO_PREPARE
 _AS_ECHO_N_PREPARE[]dnl We do not need this ourselves but user code might.
-_AS_EXPR_PREPARE
 _AS_LN_S_PREPARE
 _AS_MKDIR_P_PREPARE
 _AS_TEST_PREPARE
@@ -269,13 +269,25 @@ _AS_TR_CPP_PREPARE
 _AS_TR_SH_PREPARE
 ])
 
-
 # AS_PREPARE
 # ----------
 # Output all the M4sh possible initialization into the initialization
-# diversion.
+# diversion.  We do not use _AS_PREPARE so that the m4_provide symbols for
+# AS_REQUIRE and AS_REQUIRE_SHELL_FN are defined properly, and so that
+# shell functions are placed in M4SH-INIT-FN.
 m4_defun([AS_PREPARE],
-[m4_divert_text([M4SH-INIT], [_AS_PREPARE])])
+[AS_REQUIRE([_AS_EXPR_PREPARE])
+AS_REQUIRE([_AS_BASENAME_PREPARE])
+AS_REQUIRE([_AS_DIRNAME_PREPARE])
+AS_REQUIRE([_AS_ME_PREPARE])
+AS_REQUIRE([_AS_LINENO_PREPARE])
+AS_REQUIRE([_AS_ECHO_N_PREPARE])
+AS_REQUIRE([_AS_LN_S_PREPARE])
+AS_REQUIRE([_AS_MKDIR_P_PREPARE])
+AS_REQUIRE([_AS_TEST_PREPARE])
+AS_REQUIRE([_AS_TR_CPP_PREPARE])
+AS_REQUIRE([_AS_TR_SH_PREPARE])
+])
 
 
 # AS_REQUIRE(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK],
@@ -445,12 +457,8 @@ export LC_ALL
 LANGUAGE=C
 export LANGUAGE
 
-# Required to use basename.
-_AS_EXPR_PREPARE
-_AS_BASENAME_PREPARE
-
-# Name of the executable.
-as_me=`AS_BASENAME("$[0]")`
+dnl Delay this until after shell functions are defined.
+AS_REQUIRE([_AS_ME_PREPARE])
 
 # CDPATH.
 $as_unset CDPATH
@@ -900,6 +908,14 @@ fi
 ])# _AS_EXPR_PREPARE
 
 
+# _AS_ME_PREPARE
+# --------------
+# Define $as_me to the basename of the executable file's name.
+m4_defun([_AS_ME_PREPARE],
+[AS_REQUIRE([_AS_BASENAME_PREPARE])dnl
+as_me=`AS_BASENAME("$[0]")`
+])
+
 # _AS_LINENO_WORKS
 # ---------------
 # Succeed if the currently executing shell supports LINENO.
@@ -923,8 +939,9 @@ 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_define([_AS_LINENO_PREPARE],
+m4_defun([_AS_LINENO_PREPARE],
 [AS_REQUIRE([_AS_CR_PREPARE])dnl
+AS_REQUIRE([_AS_ME_PREPARE])dnl
 _AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])
 _AS_LINENO_WORKS || {
 
-- 
1.5.5





reply via email to

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