]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Allow comments before functions emitted by m4sh.
authorEric Blake <ebb9@byu.net>
Fri, 17 Oct 2008 02:08:06 +0000 (20:08 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 17 Oct 2008 02:25:28 +0000 (20:25 -0600)
* lib/m4sugar/m4sh.m4 (AS_REQUIRE_SHELL_FN): Add comment
argument.  Supply closing comment, to ease readability.
(_AS_MKDIR_P_PREPARE): Adjust caller.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/m4sugar/m4sh.m4

index b36b295495f969cf0396a42f25eaf36c94b66358..1ba968661872a6eae0156b0175230d1c31d788fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-10-16  Eric Blake  <ebb9@byu.net>
 
+       Allow comments before functions emitted by m4sh.
+       * lib/m4sugar/m4sh.m4 (AS_REQUIRE_SHELL_FN): Add comment
+       argument.  Supply closing comment, to ease readability.
+       (_AS_MKDIR_P_PREPARE): Adjust caller.
+       (_AS_UNSET_PREPARE): Add comment.
+
        Add AS_FUNCTION_DESCRIBE.
        * lib/m4sugar/m4sh.m4 (AS_FUNCTION_DESCRIBE): New macro.
        * lib/autotest/general.m4 (AT_INIT): Use it.
index 566d27c7dd7c3c802d6e595368ea2f2b0ff3264d..c38786422b40dcd387fbf04aee44d4a533d1be90 100644 (file)
@@ -258,6 +258,8 @@ fi
 # important not to forget some: config.status needs them.
 m4_defun([_AS_PREPARE],
 [m4_pushdef([AS_REQUIRE], [])dnl
+AS_FUNCTION_DESCRIBE([as_func_mkdir_p], [],
+[Create "$as_dir" as a directory, including parents if necessary.])
 as_func_mkdir_p ()
 {
   _AS_MKDIR_P
@@ -314,18 +316,21 @@ m4_if(m4_eval(_m4_divert(_m4_divert_dump) <= _m4_divert(_m4_divert_desired)), 1,
       [m4_divert_require([_m4_divert_desired], [$1], [$2])])])
 
 
-# AS_REQUIRE_SHELL_FN(NAME-TO-CHECK, BODY-TO-EXPAND,
+# AS_REQUIRE_SHELL_FN(NAME-TO-CHECK, COMMENT, BODY-TO-EXPAND,
 #                     [DIVERSION = M4SH-INIT-FN])
-# --------------------------------------------------
+# -----------------------------------------------------------
 # BODY-TO-EXPAND is the body of a shell function to be emitted in the
 # given diversion when expanded (required or not).  Unlike other
-# xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.
-#
+# xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.  If COMMENT is
+# provided (often via AS_FUNCTION_DESCRIBE), it is listed with a
+# newline before the function name.
 m4_define([AS_REQUIRE_SHELL_FN],
-[AS_REQUIRE([AS_SHELL_FN_$1], [m4_provide([AS_SHELL_FN_$1])$1 ()
+[AS_REQUIRE([AS_SHELL_FN_$1],
+[m4_provide([AS_SHELL_FN_$1])m4_n([$2])$1 ()
 {
-$2
-}], m4_default_quoted([$3], [M4SH-INIT-FN]))])
+$3
+} [#] $1
+], m4_default_quoted([$4], [M4SH-INIT-FN]))])
 
 
 # _AS_RUN(TEST, [SHELL])
@@ -539,7 +544,8 @@ fi
 # Define $as_unset to execute AS_UNSET, for backwards compatibility
 # with older versions of M4sh.
 m4_defun([_AS_UNSET_PREPARE],
-[as_func_unset ()
+[AS_FUNCTION_DESCRIBE([as_func_unset], [VAR], [Portably unset VAR.])
+as_func_unset ()
 {
   AS_UNSET([$[1]])
 }
@@ -1080,7 +1086,10 @@ as_dir=$1; as_func_mkdir_p])# AS_MKDIR_P
 # _AS_MKDIR_P_PREPARE
 # -------------------
 m4_defun([_AS_MKDIR_P_PREPARE],
-[AS_REQUIRE_SHELL_FN([as_func_mkdir_p], [
+[AS_REQUIRE_SHELL_FN([as_func_mkdir_p],
+  [AS_FUNCTION_DESCRIBE([as_func_mkdir_p], [],
+    [Create "$as_dir" as a directory, including parents if necessary.])],
+[
   _AS_MKDIR_P
 ])
 if mkdir -p . 2>/dev/null; then