autoconf-patches
[Top][All Lists]
Advanced

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

Re: more efficient AS_EXIT


From: Eric Blake
Subject: Re: more efficient AS_EXIT
Date: Tue, 18 Nov 2008 17:03:51 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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

> > 
> > I wouldn't bother much about performance here BTW, it's not like it's
> > common to execute many AS_EXITs during one script run.  
> > (And it's not much of a text reduction either.)
> 
> You're right - on coreutils, I think the size of configure even increased,
> because even though there were fewer bytes in all the AS_EXIT sites, the
> prep in AS_PREPARE and _AS_PREPARE was bigger than the savings.

> > So all in all I'm kind of wondering if this patch is worth the hassles
> > it introduces.
> 
> I'll keep the patch updated, but we'll re-evaluate it after applying the
> non-controversial improvements.

This argument about minimal gain is still true.  However, based on Paolo's 
numbers[1], anything we can do to teach users about the avoidance of forks is a 
good idea, and although autoconf doesn't have a current use for AC_SET_STATUS 
outside of AS_EXIT, other users might.  So I'm going ahead and applying the 
first two patches below (modifications from the original proposal are: 
documentation of Tru64 'set -e' bug, the addition of a test which exposed a 
Solaris /bin/sh 'set -e' bug, and using m4_pushdef([AS_EXIT]) within 
_AS_SHELL_SANITIZE).  Thanks again to Ralf's research[2], for the first patch.

[1] http://lists.gnu.org/archive/html/autoconf/2008-11/msg00015.html
[2] http://lists.gnu.org/archive/html/automake-patches/2008-09/msg00009.html

>  It could
> be more of a reduction, if we were willing to shorten the function names
> to as_exit (I'm okay with exceptions to the rule of thumb about the
> as_func_* namespace, as long as we have a good reason for it and aren't
> worried about inadvertant namespace clashes - for that matter, since we
> own the entire as_* namespace and the user should always be going through
> our macros unless we document a variable name, maybe we can get away with
> shortening all of our macro names).

Autoconf had already been using 'ac_func_list' for AC_CHECK_FUNCS_ONCE, which 
clashes with our current choice of namespace a[cst]_func_.  If no one 
complains, I will commit the second patch below tomorrow; it is a purely 
mechanical replacement to the shorter a[cst]_fn_ for shell functions, leaving 
ac_func_list for the list of C functions being checked (and in general, leaving 
the term "func" to refer to language functions linked by the compiler, and "fn" 
for functions in the shell script).  It shaves nearly 2k off of coreutils' 
configure, and more than 27k off of autoconf's testsuite (almost 1%!).

>From fed7af3616b516067643c4a4abbb203ea5622841 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 18 Nov 2008 08:45:04 -0700
Subject: [PATCH] Document Tru64 bug with 'set -e'.

* doc/autoconf.texi (Limitations of Builtins) <trap>: Mention a
bug in mixing 'set -e' with 'trap .. 0'.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog         |    5 +++++
 doc/autoconf.texi |   16 ++++++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 93c085c..543ce5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-11-18  Eric Blake  <address@hidden>
 
+       Document Tru64 bug with 'set -e'.
+       * doc/autoconf.texi (Limitations of Builtins) <trap>: Mention a
+       bug in mixing 'set -e' with 'trap .. 0'.
+       Reported by Ralf Wildenhues.
+
        Document a Solaris /bin/sh bug with 'set -e'.
        * doc/autoconf.texi (Shell Functions): Mention the bug.
 
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 90e6cee..37becc5 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -15425,6 +15425,22 @@ Limitations of Builtins
 "$foo"; then exit 1; fi} rather than @samp{test -n "$foo" && exit 1}.
 Another possibility is to warn @acronym{BSD} users not to use @samp{sh -e}.
 
+Portable scripts should not use @samp{set -e} if @command{trap} is used
+to install an exit handler.  This is because Tru64/OSF 5.1 @command{sh}
+enters the trap handler with the exit status of the command prior to the
+one that triggered the errexit handler:
+
address@hidden
+$ @kbd{bash -c 'trap '\''echo $?'\'' 0; set -e; false'}
+1
+$ @kbd{sh -c 'trap '\''echo $?'\'' 0; set -e; false'}
+0
address@hidden example
+
address@hidden
+Thus, when writing a script in M4sh, rather than trying to rely on
address@hidden -e}, it is better to append @samp{|| AS_EXIT([$?])} to any
+statement where it is desirable to abort on failure.
 
 @item @command{shift}
 @c ------------------
-- 
1.6.0.4


>From 740062eb427759b1c8203004dedeab07a60cab52 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 17 Nov 2008 15:49:30 -0700
Subject: [PATCH] Add AS_SET_STATUS, make AS_EXIT more efficient.

* lib/m4sugar/m4sh.m4 (_AS_EXIT_PREPARE, AS_SET_STATUS): New
macros.
(AS_EXIT): Rewrite to avoid forks.
(_AS_SHELL_SANITIZE): Avoid AS_EXIT prior to shell functions.
(AS_PREPARE, _AS_PREPARE): Add new preparation.
* doc/autoconf.texi (Common Shell Constructs) <AS_SET_STATUS>:
Document.
* NEWS: Mention new macro.
* tests/m4sh.at (AS@&address@hidden): New test.
(BASENAME_TEST): Sort.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog           |   12 +++++
 NEWS                |    4 +-
 doc/autoconf.texi   |    8 +++
 lib/m4sugar/m4sh.m4 |   48 +++++++++++++++----
 tests/m4sh.at       |  133 +++++++++++++++++++++++++++++++++------------------
 5 files changed, 147 insertions(+), 58 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 543ce5d..1e56b6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2008-11-18  Eric Blake  <address@hidden>
 
+       Add AS_SET_STATUS, make AS_EXIT more efficient.
+       * lib/m4sugar/m4sh.m4 (_AS_EXIT_PREPARE, AS_SET_STATUS): New
+       macros.
+       (AS_EXIT): Rewrite to avoid forks.
+       (_AS_SHELL_SANITIZE): Avoid AS_EXIT prior to shell functions.
+       (AS_PREPARE, _AS_PREPARE): Add new preparation.
+       * doc/autoconf.texi (Common Shell Constructs) <AS_SET_STATUS>:
+       Document.
+       * NEWS: Mention new macro.
+       * tests/m4sh.at (AS@&address@hidden): New test.
+       (BASENAME_TEST): Sort.
+
        Document Tru64 bug with 'set -e'.
        * doc/autoconf.texi (Limitations of Builtins) <trap>: Mention a
        bug in mixing 'set -e' with 'trap .. 0'.
diff --git a/NEWS b/NEWS
index f5f3d6e..b67d82c 100644
--- a/NEWS
+++ b/NEWS
@@ -30,8 +30,8 @@ GNU Autoconf NEWS - User visible changes.
    m4_copy  m4_dumpdefs  m4_rename
 
 ** The following documented m4sh macros are new:
-   AS_LINENO_PREPARE  AS_ME_PREPARE  AS_VAR_APPEND  AS_VAR_ARITH
-   AS_VAR_COPY
+   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:
    AS_ECHO  AS_ECHO_N  AS_EXIT  AS_LITERAL_IF  AS_UNSET  AS_VAR_IF
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 37becc5..71d72f4 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -12052,6 +12052,14 @@ Common Shell Constructs
 Also see the @code{AC_PROG_MKDIR_P} macro (@pxref{Particular Programs}).
 @end defmac
 
address@hidden AS_SET_STATUS (@var{status})
address@hidden
+Emit shell code to set the value of @samp{$?} to @var{status} without
+forking.  However, this is not guaranteed to abort a shell running with
address@hidden -e} (@pxref{Limitations of Builtins, , Limitations of Shell
+Builtins}).
address@hidden defmac
+
 @defmac AS_TR_CPP (@var{expression})
 @asindex{TR_CPP}
 Transform @var{expression} into a valid right-hand side for a C @code{#define}.
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 4da8f37..f056ee3 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -299,7 +299,8 @@ m4_defun([_AS_PREPARE],
 [m4_pushdef([AS_REQUIRE])]dnl
 [m4_pushdef([AS_REQUIRE_SHELL_FN], _m4_defn([_AS_REQUIRE_SHELL_FN])
 )]dnl
-[_AS_UNSET_PREPARE
+[_AS_EXIT_PREPARE
+_AS_UNSET_PREPARE
 _AS_VAR_APPEND_PREPARE
 _AS_VAR_ARITH_PREPARE
 
@@ -331,6 +332,7 @@ AS_REQUIRE([_AS_ME_PREPARE])
 AS_REQUIRE([_AS_CR_PREPARE])
 AS_REQUIRE([_AS_LINENO_PREPARE])
 AS_REQUIRE([_AS_ECHO_N_PREPARE])
+AS_REQUIRE([_AS_EXIT_PREPARE])
 AS_REQUIRE([_AS_LN_S_PREPARE])
 AS_REQUIRE([_AS_MKDIR_P_PREPARE])
 AS_REQUIRE([_AS_TEST_PREPARE])
@@ -418,8 +420,11 @@ test x$exitcode = x0[]])# _AS_SHELL_FN_WORK
 
 # _AS_SHELL_SANITIZE
 # ------------------
-# This is the prolog that is emitted by AS_INIT and AS_INIT_GENERATED.
+# This is the prolog that is emitted by AS_INIT and AS_INIT_GENERATED;
+# it is executed prior to shell function definitions, hence the
+# temporary redefinition of AS_EXIT.
 m4_defun([_AS_SHELL_SANITIZE],
+[m4_pushdef([AS_EXIT], [exit m4_default([$1], 1)])]dnl
 [m4_text_box([M4sh Initialization.])
 
 AS_BOURNE_COMPATIBLE
@@ -470,7 +475,7 @@ export LANGUAGE
 
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-])# _AS_SHELL_SANITIZE
+_m4_popdef([AS_EXIT])])# _AS_SHELL_SANITIZE
 
 
 # AS_SHELL_SANITIZE
@@ -519,18 +524,34 @@ m4_defun([AS_CASE],
 esac])# AS_CASE
 
 
-# AS_EXIT([EXIT-CODE = 1])
-# ------------------------
-# Exit and set exit code to EXIT-CODE in the way that it's seen
-# within "trap 0".
+# _AS_EXIT_PREPARE
+# ----------------
+# Ensure AS_EXIT and AS_SET_STATUS will work.
 #
 # We cannot simply use "exit N" because some shells (zsh and Solaris sh)
 # will not set $? to N while running the code set by "trap 0"
-# So we set $? by executing "exit N" in the subshell and then exit.
+# Some shells fork even for (exit N), so we use a helper function
+# to set $? prior to the exit.
 # Other shells don't use `$?' as default for `exit', hence just repeating
 # the exit value can only help improving portability.
-m4_define([AS_EXIT],
-[{ (exit m4_default([$1], 1)); exit m4_default([$1], 1); }])
+m4_defun([_AS_EXIT_PREPARE],
+[AS_REQUIRE_SHELL_FN([as_func_set_status],
+  [AS_FUNCTION_DESCRIBE([as_func_set_status], [STATUS],
+    [Set $? to STATUS, without forking.])], [  return $[]1])]dnl
+[AS_REQUIRE_SHELL_FN([as_func_exit],
+  [AS_FUNCTION_DESCRIBE([as_func_exit], [STATUS],
+    [Exit the shell with STATUS, even in a "trap 0" or "set -e" context.])],
+[  set +e
+  as_func_set_status $[]1
+  exit $[]1])])#_AS_EXIT_PREPARE
+
+
+# AS_EXIT([EXIT-CODE = 1])
+# ------------------------
+# Exit, with status set to EXIT-CODE in the way that it's seen
+# within "trap 0", and without interference from "set -e".
+m4_defun([AS_EXIT],
+[AS_REQUIRE([_AS_EXIT_PREPARE])[]as_func_exit m4_default([$1], 1)])
 
 
 # AS_FOR(MACRO, SHELL-VAR, [LIST = "$@"], [BODY = :])
@@ -589,6 +610,13 @@ m4_map_args_pair([_$0], [_$0_ELSE], m4_shift2($@))]dnl
 [fi[]])# AS_IF
 
 
+# AS_SET_STATUS(STATUS)
+# ---------------------
+# Set the shell status ($?) to STATUS, without forking.
+m4_defun([AS_SET_STATUS],
+[AS_REQUIRE([_AS_EXIT_PREPARE])[]as_func_set_status $1])
+
+
 # _AS_UNSET_PREPARE
 # -----------------
 # Define $as_unset to execute AS_UNSET, for backwards compatibility
diff --git a/tests/m4sh.at b/tests/m4sh.at
index 96e0452..85ad5d8 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -126,6 +126,63 @@ AT_CHECK([./script])
 AT_CLEANUP
 
 
+## ------------- ##
+## AS_BASENAME.  ##
+## ------------- ##
+
+# Strip path from file.
+AT_SETUP([AS@&address@hidden)
+AT_KEYWORDS([m4sh])
+
+AT_DATA_M4SH([script.as],
+[[AS_INIT
+
+m4_define([BASENAME_TEST],
+[base=`AS_BASENAME([$1])`
+test "$base" = "$2" ||
+  echo "basename($1) = $base instead of $2" >&2
+
+base=`_AS_BASENAME_SED([$1])`
+test "$base" = "$2" ||
+  echo "basename_sed($1) = $base instead of $2" >&2])
+
+BASENAME_TEST([//1],             [1])
+BASENAME_TEST([/1],              [1])
+BASENAME_TEST([./1],             [1])
+BASENAME_TEST([../../2],         [2])
+BASENAME_TEST([//1/],            [1])
+BASENAME_TEST([/1/],             [1])
+BASENAME_TEST([./1/],            [1])
+BASENAME_TEST([../../2],         [2])
+BASENAME_TEST([//1/3],           [3])
+BASENAME_TEST([/1/3],            [3])
+BASENAME_TEST([./1/3],           [3])
+BASENAME_TEST([../../2/3],       [3])
+BASENAME_TEST([//1/3///],        [3])
+BASENAME_TEST([/1/3///],         [3])
+BASENAME_TEST([./1/3///],        [3])
+BASENAME_TEST([../../2/3///],    [3])
+BASENAME_TEST([//1//3/],         [3])
+BASENAME_TEST([/1//3/],          [3])
+BASENAME_TEST([./1//3/],         [3])
+BASENAME_TEST([a.c],             [a.c])
+BASENAME_TEST([a.c/],            [a.c])
+BASENAME_TEST([/a.c/],           [a.c])
+BASENAME_TEST([/1/a.c],          [a.c])
+BASENAME_TEST([/1/a.c/],         [a.c])
+BASENAME_TEST([/1/../a.c],       [a.c])
+BASENAME_TEST([/1/../a.c/],      [a.c])
+BASENAME_TEST([./1/a.c],         [a.c])
+BASENAME_TEST([./1/a.c/],        [a.c])
+AS_EXIT(0)
+]])
+
+AT_CHECK_M4SH
+AT_CHECK([./script])
+
+AT_CLEANUP
+
+
 ## ------------ ##
 ## AS_DIRNAME.  ##
 ## ------------ ##
@@ -236,59 +293,43 @@ AT_CLEANUP
 
 
 
-## ------------- ##
-## AS_BASENAME.  ##
-## ------------- ##
+## --------- ##
+## AS_EXIT.  ##
+## --------- ##
 
-# Strip path from file.
-AT_SETUP([AS@&address@hidden)
-AT_KEYWORDS([m4sh])
+# Exit scripts with given status.
+AT_SETUP([AS@&address@hidden)
+AT_KEYWORDS([m4sh AS@&address@hidden)
 
 AT_DATA_M4SH([script.as],
 [[AS_INIT
-
-m4_define([BASENAME_TEST],
-[base=`AS_BASENAME([$1])`
-test "$base" = "$2" ||
-  echo "basename($1) = $base instead of $2" >&2
-
-base=`_AS_BASENAME_SED([$1])`
-test "$base" = "$2" ||
-  echo "basename_sed($1) = $base instead of $2" >&2])
-
-BASENAME_TEST([//1],             [1])
-BASENAME_TEST([/1],              [1])
-BASENAME_TEST([./1],             [1])
-BASENAME_TEST([../../2],         [2])
-BASENAME_TEST([//1/],            [1])
-BASENAME_TEST([/1/],             [1])
-BASENAME_TEST([./1/],            [1])
-BASENAME_TEST([../../2],         [2])
-BASENAME_TEST([//1/3],           [3])
-BASENAME_TEST([/1/3],            [3])
-BASENAME_TEST([./1/3],           [3])
-BASENAME_TEST([../../2/3],       [3])
-BASENAME_TEST([//1/3///],        [3])
-BASENAME_TEST([/1/3///],         [3])
-BASENAME_TEST([./1/3///],        [3])
-BASENAME_TEST([../../2/3///],    [3])
-BASENAME_TEST([//1//3/],         [3])
-BASENAME_TEST([/1//3/],          [3])
-BASENAME_TEST([./1//3/],         [3])
-BASENAME_TEST([a.c],             [a.c])
-BASENAME_TEST([a.c/],            [a.c])
-BASENAME_TEST([/a.c/],           [a.c])
-BASENAME_TEST([/1/a.c],          [a.c])
-BASENAME_TEST([/1/a.c/],         [a.c])
-BASENAME_TEST([/1/../a.c],       [a.c])
-BASENAME_TEST([/1/../a.c/],      [a.c])
-BASENAME_TEST([./1/a.c],         [a.c])
-BASENAME_TEST([./1/a.c/],        [a.c])
-AS_EXIT(0)
+test x${1} = xa && AS_EXIT
+test x${1} = xb && AS_EXIT([${2}])
+test x${1} = xc && trap 's=$?; echo $s; AS_EXIT([$s])' 0
+test x${2} = xd && set -e
+AS_SET_STATUS([3])
+dnl Solaris /bin/sh 'set -e' doesn't react to failed function calls
+test x${2} = xd \
+  && { echo 'skipping rest of test: set -e support is lousy'; exit 77; }
+AS_SET_STATUS([4])
 ]])
 
 AT_CHECK_M4SH
-AT_CHECK([./script])
+AT_CHECK([./script], [4])
+AT_CHECK([./script a], [1])
+AT_CHECK([./script b], [0])
+AT_CHECK([./script b 2], [2])
+AT_CHECK([./script c], [4], [[4
+]])
+dnl If we got to this point without a FAIL, then AS_EXIT at least works.
+dnl The rest of this test relies on semi-decent 'set -e' support, even
+dnl though m4sh in general should not try to rely on it because of
+dnl portability nightmares on what constructs are considered errors across
+dnl various shells; therefore, an overall SKIP result is desirable on
+dnl broken shells like Solaris /bin/sh.
+AT_CHECK([./script '' d], [3])
+AT_CHECK([./script c d], [3], [[3
+]])
 
 AT_CLEANUP
 
-- 
1.6.0.4


>From 127c899836e26e4c83c6221a8094e629e8f4fc5e Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 18 Nov 2008 09:40:03 -0700
Subject: [PATCH] Use fn for shell functions, func for autoconf CHECK_FUNCS.

* lib/autoconf/functions.m4 (AC_CHECK_FUNC): Abbreviate shell
function names.
* lib/autoconf/general.m4 (_AC_PREPROC_IFELSE)
(_AC_COMPILE_IFELSE, _AC_LINK_IFELSE, _AC_RUN_IFELSE)
(AC_CHECK_DECL, AC_COMPUTE_INT): Likewise.
* lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL)
(_AC_CHECK_HEADER_COMPILE, _AC_CHECK_HEADER_PREPROC): Likewise.
* lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW, _AC_TYPE_INT)
(_AC_TYPE_UNSIGNED_INT, AC_CHECK_MEMBER): Likewise.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* lib/m4sugar/m4sh.m4 (_AS_SHELL_FN_WORK, _AS_EXIT_PREPARE)
(AS_EXIT, AS_SET_STATUS, _AS_UNSET_PREPARE, _AS_MKDIR_P)
(_AS_MKDIR_P_PREPARE, _AS_VAR_APPEND_PREPARE, AS_VAR_APPEND)
(_AS_VAR_ARITH_PREPARE, AS_VAR_ARITH): Likewise.
* doc/autoconf.texi (Shell Functions): Likewise.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog                 |   19 +++++++++
 doc/autoconf.texi         |    2 +-
 lib/autoconf/functions.m4 |    6 +-
 lib/autoconf/general.m4   |   36 +++++++++---------
 lib/autoconf/headers.m4   |   18 ++++----
 lib/autoconf/types.m4     |   24 ++++++------
 lib/autotest/general.m4   |   90 ++++++++++++++++++++++----------------------
 lib/m4sugar/m4sh.m4       |   70 +++++++++++++++++-----------------
 8 files changed, 142 insertions(+), 123 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1e56b6e..9a1da80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 2008-11-18  Eric Blake  <address@hidden>
 
+       Use fn for shell functions, func for autoconf CHECK_FUNCS.
+       * lib/autoconf/functions.m4 (AC_CHECK_FUNC): Abbreviate shell
+       function names.
+       * lib/autoconf/general.m4 (_AC_PREPROC_IFELSE)
+       (_AC_COMPILE_IFELSE, _AC_LINK_IFELSE, _AC_RUN_IFELSE)
+       (AC_CHECK_DECL, AC_COMPUTE_INT): Likewise.
+       * lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL)
+       (_AC_CHECK_HEADER_COMPILE, _AC_CHECK_HEADER_PREPROC): Likewise.
+       * lib/autoconf/types.m4 (_AC_CHECK_TYPE_NEW, _AC_TYPE_INT)
+       (_AC_TYPE_UNSIGNED_INT, AC_CHECK_MEMBER): Likewise.
+       * lib/autotest/general.m4 (AT_INIT): Likewise.
+       * lib/m4sugar/m4sh.m4 (_AS_SHELL_FN_WORK, _AS_EXIT_PREPARE)
+       (AS_EXIT, AS_SET_STATUS, _AS_UNSET_PREPARE, _AS_MKDIR_P)
+       (_AS_MKDIR_P_PREPARE, _AS_VAR_APPEND_PREPARE, AS_VAR_APPEND)
+       (_AS_VAR_ARITH_PREPARE, AS_VAR_ARITH): Likewise.
+       * doc/autoconf.texi (Shell Functions): Likewise.
+
+2008-11-18  Eric Blake  <address@hidden>
+
        Add AS_SET_STATUS, make AS_EXIT more efficient.
        * lib/m4sugar/m4sh.m4 (_AS_EXIT_PREPARE, AS_SET_STATUS): New
        macros.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 71d72f4..a54cfa4 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -14687,7 +14687,7 @@ Shell Functions
 
 @noindent
 For this reason, Autoconf (actually M4sh, @pxref{Programming in M4sh})
-uses the prefix @samp{as_func_} for its functions.
+uses the prefix @samp{as_fn_} for its functions.
 
 Handling of positional parameters and shell options varies among shells.
 For example, Korn shells reset and restore trace output (@samp{set -x})
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 0e22efc..aaf961b 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -80,13 +80,13 @@ m4_define([_AC_CHECK_FUNC_BODY],
 # variable ac_cv_func_FUNCTION accordingly, then execute
 # ACTION-IF-FOUND or ACTION-IF-NOT-FOUND.
 AC_DEFUN([AC_CHECK_FUNC],
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_check_func],
-  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_check_func],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_func],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_func],
     [LINENO FUNC VAR],
     [Tests whether FUNC exists, setting the cache variable VAR accordingly])],
   [_$0_BODY])]dnl
 [AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])]dnl
-[ac_func_[]_AC_LANG_ABBREV[]_check_func "$LINENO" "$1" "ac_var"
+[ac_fn_[]_AC_LANG_ABBREV[]_check_func "$LINENO" "$1" "ac_var"
 AS_VAR_IF([ac_var], [yes], [$2], [$3])
 AS_VAR_POPDEF([ac_var])])# AC_CHECK_FUNC
 
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 4afa794..2f40f82 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2413,12 +2413,12 @@ m4_define([_AC_PREPROC_IFELSE_BODY],
 # This macro can be used during the selection of a preprocessor.
 # eval is necessary to expand ac_cpp.
 AC_DEFUN([_AC_PREPROC_IFELSE],
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_try_cpp],
-  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_try_cpp], [LINENO],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_try_cpp],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_try_cpp], [LINENO],
     [Try to preprocess conftest.$ac_ext, and return whether this succeeded.])],
   [$0_BODY])]dnl
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
-[AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_cpp "$LINENO"], [$2], [$3])
+[AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_try_cpp "$LINENO"], [$2], [$3])
 rm -f conftest.err[]m4_ifval([$1], [ conftest.$ac_ext])[]dnl
 ])# _AC_PREPROC_IFELSE
 
@@ -2500,12 +2500,12 @@ m4_define([_AC_COMPILE_IFELSE_BODY],
 # Try to compile PROGRAM.
 # This macro can be used during the selection of a compiler.
 AC_DEFUN([_AC_COMPILE_IFELSE],
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_try_compile],
-  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_try_compile], [LINENO],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_try_compile],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_try_compile], [LINENO],
     [Try to compile conftest.$ac_ext, and return whether this succeeded.])],
   [$0_BODY])]dnl
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
-[AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_compile "$LINENO"], [$2], [$3])
+[AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_try_compile "$LINENO"], [$2], [$3])
 rm -f core conftest.err conftest.$ac_objext[]m4_ifval([$1], [ 
conftest.$ac_ext])[]dnl
 ])# _AC_COMPILE_IFELSE
 
@@ -2571,12 +2571,12 @@ m4_define([_AC_LINK_IFELSE_BODY],
 # <http://lists.gnu.org/archive/html/autoconf/2007-03/msg00085.html>.
 #
 AC_DEFUN([_AC_LINK_IFELSE],
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_try_link],
-  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_try_link], [LINENO],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_try_link],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_try_link], [LINENO],
     [Try to link conftest.$ac_ext, and return whether this succeeded.])],
   [$0_BODY])]dnl
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
-[AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_link "$LINENO"], [$2], [$3])
+[AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_try_link "$LINENO"], [$2], [$3])
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext[]m4_ifval([$1], [ conftest.$ac_ext])[]dnl
 ])# _AC_LINK_IFELSE
@@ -2639,13 +2639,13 @@ m4_define([_AC_RUN_IFELSE_BODY],
 # don't remove it.  We remove gmon.out and bb.out, which may be
 # created during the run if the program is built with profiling support.
 AC_DEFUN([_AC_RUN_IFELSE],
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_try_run],
-  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_try_run], [LINENO],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_try_run],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_try_run], [LINENO],
     [Try to link conftest.$ac_ext, and return whether this succeeded.
      Assumes that executables *can* be run.])],
   [$0_BODY])]dnl
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
-[AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_run "$LINENO"], [$2], [$3])
+[AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_try_run "$LINENO"], [$2], [$3])
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest$ac_exeext[]m4_ifval([$1], [ conftest.$ac_ext])[]
dnl
 ])# _AC_RUN_IFELSE
@@ -2748,13 +2748,13 @@ m4_define([_AC_CHECK_DECL_BODY],
 # -------------------------------------------------------
 # Check whether SYMBOL (a function, variable, or constant) is declared.
 AC_DEFUN([AC_CHECK_DECL],
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_check_decl],
-  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_check_decl],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_decl],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_decl],
     [LINENO SYMBOL VAR],
     [Tests whether SYMBOL is declared, setting cache variable VAR 
accordingly.])],
   [_$0_BODY])]dnl
 [AS_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])]dnl
-[ac_func_[]_AC_LANG_ABBREV[]_check_decl ]dnl
+[ac_fn_[]_AC_LANG_ABBREV[]_check_decl ]dnl
 ["$LINENO" "$1" "ac_Symbol" "AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
 AS_VAR_IF([ac_Symbol], [yes], [$2], [$3])
 AS_VAR_POPDEF([ac_Symbol])dnl
@@ -2961,14 +2961,14 @@ m4_define([_AC_COMPUTE_INT_BODY],
 # case of cross-compilation, if EXPRESSION is not computable at compile-time.
 AC_DEFUN([AC_COMPUTE_INT],
 [AC_LANG_COMPILER_REQUIRE()]dnl
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_compute_int],
-  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_compute_int],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_compute_int],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_compute_int],
     [LINENO EXPR VAR INCLUDES],
     [Tries to find the compile-time value of EXPR in a program that includes
      INCLUDES, setting VAR accordingly.  Returns whether the value could
      be computed])],
     [_$0_BODY])]dnl
-[AS_IF([ac_func_[]_AC_LANG_ABBREV[]_compute_int "$LINENO" "$2" "$1" ]dnl
+[AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_compute_int "$LINENO" "$2" "$1" ]dnl
        ["AS_ESCAPE([$3], [""])"],
        [], [$4])
 ])# AC_COMPUTE_INT
diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index 56bbb39..f4a4528 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -149,15 +149,15 @@ esac
 # because it obfuscate the code to try to factor everything, in particular
 # because of the cache variables, and the `checking...' messages.
 AC_DEFUN([_AC_CHECK_HEADER_MONGREL],
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_check_header_mongrel],
-  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_check_header_mongrel],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_header_mongrel],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_header_mongrel],
     [LINENO HEADER VAR INCLUDES],
     [Tests whether HEADER exists, giving a warning if it cannot be compiled
      using the include files in INCLUDES and setting the cache variable VAR
      accordingly.])],
   [$0_BODY])]dnl
 [AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])]dnl
-[ac_func_[]_AC_LANG_ABBREV[]_check_header_mongrel ]dnl
+[ac_fn_[]_AC_LANG_ABBREV[]_check_header_mongrel ]dnl
 ["$LINENO" "$1" "ac_Header" "AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
 AS_VAR_IF([ac_Header], [yes], [$2], [$3])
 AS_VAR_POPDEF([ac_Header])])# _AC_CHECK_HEADER_MONGREL
@@ -182,14 +182,14 @@ m4_define([_AC_CHECK_HEADER_COMPILE_BODY],
 # --------------------------------------------------------------
 # Check the compiler accepts HEADER-FILE.  The INCLUDES are defaulted.
 AC_DEFUN([_AC_CHECK_HEADER_COMPILE],
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_check_header_compile],
-  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_check_header_compile],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_header_compile],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_header_compile],
     [LINENO HEADER VAR INCLUDES],
     [Tests whether HEADER exists and can be compiled using the include files
      in INCLUDES, setting the cache variable VAR accordingly.])],
   [$0_BODY])]dnl
 [AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])]dnl
-[ac_func_[]_AC_LANG_ABBREV[]_check_header_compile ]dnl
+[ac_fn_[]_AC_LANG_ABBREV[]_check_header_compile ]dnl
 ["$LINENO" "$1" "ac_Header" "AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
 AS_VAR_IF([ac_Header], [yes], [$2], [$3])
 AS_VAR_POPDEF([ac_Header])])# _AC_CHECK_HEADER_COMPILE
@@ -214,13 +214,13 @@ m4_define([_AC_CHECK_HEADER_PREPROC_BODY],
 # --------------------------------------------------------------
 # Check the preprocessor accepts HEADER-FILE.
 AC_DEFUN([_AC_CHECK_HEADER_PREPROC],
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_check_header_preproc],
-  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_check_header_preproc],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_header_preproc],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_header_preproc],
     [LINENO HEADER VAR],
     [Tests whether HEADER is present, setting the cache variable VAR 
accordingly.])],
   [$0_BODY])]dnl
 [AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])]dnl
-[ac_func_[]_AC_LANG_ABBREV[]_check_header_preproc "$LINENO" "$1" "ac_Header"
+[ac_fn_[]_AC_LANG_ABBREV[]_check_header_preproc "$LINENO" "$1" "ac_Header"
 AS_VAR_IF([ac_Header], [yes], [$2], [$3])
 AS_VAR_POPDEF([ac_Header])dnl
 ])# _AC_CHECK_HEADER_PREPROC
diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4
index b233591..2d055de 100644
--- a/lib/autoconf/types.m4
+++ b/lib/autoconf/types.m4
@@ -167,14 +167,14 @@ m4_define([_AC_CHECK_TYPE_NEW_BODY],
 # Check whether the type TYPE is supported by the system, maybe via the
 # the provided includes.
 AC_DEFUN([_AC_CHECK_TYPE_NEW],
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_check_type],
-  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_check_type],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_type],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_type],
     [LINENO TYPE VAR INCLUDES],
     [Tests whether TYPE exists after having included INCLUDES, setting
      cache variable VAR accordingly.])],
     [$0_BODY])]dnl
 [AS_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])]dnl
-[ac_func_[]_AC_LANG_ABBREV[]_check_type "$LINENO" "$1" "ac_Type" ]dnl
+[ac_fn_[]_AC_LANG_ABBREV[]_check_type "$LINENO" "$1" "ac_Type" ]dnl
 ["AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
 AS_VAR_IF([ac_Type], [yes], [$2], [$3])
 AS_VAR_POPDEF([ac_Type])dnl
@@ -679,12 +679,12 @@ m4_define([_AC_TYPE_INT_BODY],
 # exactly NBITS bits was found.  In the third case, intNBITS_t is AC_DEFINEd
 # to type, as well.
 AC_DEFUN([_AC_TYPE_INT],
-[AC_REQUIRE_SHELL_FN([ac_func_c_find_intX_t],
-  [AS_FUNCTION_DESCRIBE([ac_func_c_find_intX_t], [LINENO BITS VAR],
+[AC_REQUIRE_SHELL_FN([ac_fn_c_find_intX_t],
+  [AS_FUNCTION_DESCRIBE([ac_fn_c_find_intX_t], [LINENO BITS VAR],
     [Finds a signed integer type with width BITS, setting cache variable VAR
      accordingly.])],
     [$0_BODY])]dnl
-[ac_func_c_find_intX_t "$LINENO" "$1" "ac_cv_c_int$1_t"
+[ac_fn_c_find_intX_t "$LINENO" "$1" "ac_cv_c_int$1_t"
 case $ac_cv_c_int$1_t in #(
   no|yes) ;; #(
   *)
@@ -724,12 +724,12 @@ m4_define([_AC_TYPE_UNSIGNED_INT_BODY],
 # exactly NBITS bits was found.  In the third case, uintNBITS_t is AC_DEFINEd
 # to type, as well.
 AC_DEFUN([_AC_TYPE_UNSIGNED_INT],
-[AC_REQUIRE_SHELL_FN([ac_func_c_find_uintX_t],
-  [AS_FUNCTION_DESCRIBE([ac_func_c_find_uintX_t], [LINENO BITS VAR],
+[AC_REQUIRE_SHELL_FN([ac_fn_c_find_uintX_t],
+  [AS_FUNCTION_DESCRIBE([ac_fn_c_find_uintX_t], [LINENO BITS VAR],
     [Finds an unsigned integer type with width BITS, setting cache variable VAR
      accordingly.])],
   [$0_BODY])]dnl
-[ac_func_c_find_uintX_t "$LINENO" "$1" "ac_cv_c_uint$1_t"
+[ac_fn_c_find_uintX_t "$LINENO" "$1" "ac_cv_c_uint$1_t"
 case $ac_cv_c_uint$1_t in #(
   no|yes) ;; #(
   *)
@@ -887,8 +887,8 @@ return 0;])],
 # AGGREGATE.MEMBER is for instance `struct passwd.pw_gecos', shell
 # variables are not a valid argument.
 AC_DEFUN([AC_CHECK_MEMBER],
-[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_check_member],
-  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_check_member],
+[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_member],
+  [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_member],
     [LINENO AGGR MEMBER VAR INCLUDES],
     [Tries to find if the field MEMBER exists in type AGGR, after including
      INCLUDES, setting cache variable VAR accordingly.])],
@@ -896,7 +896,7 @@ AC_DEFUN([AC_CHECK_MEMBER],
 [AS_LITERAL_IF([$1], [], [m4_fatal([$0: requires literal arguments])])]dnl
 [m4_if(m4_index([$1], [.]), -1, [m4_fatal([$0: Did not see any dot in `$1'])])]
dnl
 [AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])]dnl
-[ac_func_[]_AC_LANG_ABBREV[]_check_member "$LINENO" ]dnl
+[ac_fn_[]_AC_LANG_ABBREV[]_check_member "$LINENO" ]dnl
 [m4_bpatsubst([$1], [^\([^.]*\)\.\(.*\)], ["\1" "\2"]) "ac_Member" ]dnl
 ["AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
 AS_VAR_IF([ac_Member], [yes], [$2], [$3])
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index e497c02..704dbbf 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -249,22 +249,22 @@ m4_divert_push([PREPARE_TESTS])dnl
 
 m4_text_box([Autotest shell functions.])
 
-AS_FUNCTION_DESCRIBE([at_func_banner], [NUMBER],
+AS_FUNCTION_DESCRIBE([at_fn_banner], [NUMBER],
 [Output banner NUMBER, provided the testsuite is running multiple groups
 and this particular banner has not yet been printed.])
-at_func_banner ()
+at_fn_banner ()
 {
   $at_print_banners || return 0
   eval at_banner_text=\$at_banner_text_$[1]
   test "x$at_banner_text" = x && return 0
   eval at_banner_text_$[1]=
   AS_ECHO(["$as_nl$at_banner_text$as_nl"])
-} # at_func_banner
+} # at_fn_banner
 
-AS_FUNCTION_DESCRIBE([at_func_check_newline], [COMMAND],
+AS_FUNCTION_DESCRIBE([at_fn_check_newline], [COMMAND],
 [Test if COMMAND includes a newline and, if so, print a message and return
 exit code 1.])
-at_func_check_newline ()
+at_fn_check_newline ()
 {
   case "$[1]" in
  *'
@@ -274,21 +274,21 @@ at_func_check_newline ()
   esac
 }
 
-AS_FUNCTION_DESCRIBE([at_func_filter_trace], [EXIT-CODE],
+AS_FUNCTION_DESCRIBE([at_fn_filter_trace], [EXIT-CODE],
 [Split the contents of file "$at_stder1" into the "set -x" trace (on
 stderr) and the other lines (on file "$at_stderr").  Return the exit
 code EXIT-CODE.])
-at_func_filter_trace ()
+at_fn_filter_trace ()
 {
   grep '^ *+' "$at_stder1" >&2
   grep -v '^ *+' "$at_stder1" >"$at_stderr"
   return $[1]
 }
 
-AS_FUNCTION_DESCRIBE([at_func_log_failure], [FILE-LIST],
+AS_FUNCTION_DESCRIBE([at_fn_log_failure], [FILE-LIST],
 [Copy the files in the list on stdout with a "> " prefix, and exit the shell
 with a failure exit code.])
-at_func_log_failure ()
+at_fn_log_failure ()
 {
   for file
     do AS_ECHO(["$file:"]); sed 's/^/> /' "$file"; done
@@ -296,21 +296,21 @@ at_func_log_failure ()
   exit 1
 }
 
-AS_FUNCTION_DESCRIBE([at_func_check_skip], [EXIT-CODE],
+AS_FUNCTION_DESCRIBE([at_fn_check_skip], [EXIT-CODE],
 [Check whether EXIT-CODE is the special exit code 77, and if so exit the shell
 with that same exit code.])
-at_func_check_skip ()
+at_fn_check_skip ()
 {
   case $[1] in
     77) echo 77 > "$at_status_file"; exit 77;;
   esac
 }
 
-AS_FUNCTION_DESCRIBE([at_func_check_status], [EXPECTED EXIT-CODE LINE],
+AS_FUNCTION_DESCRIBE([at_fn_check_status], [EXPECTED EXIT-CODE LINE],
 [Check whether EXIT-CODE is the expected exit code, and if so do nothing.
 Otherwise, if it is 77 exit the shell with that same exit code; if it is
 anything else print an error message and fail the test.])
-at_func_check_status ()
+at_fn_check_status ()
 {
 dnl This order ensures that we don't `skip' if we are precisely checking
 dnl $? = 77.
@@ -322,27 +322,27 @@ dnl $? = 77.
   esac
 }
 
-AS_FUNCTION_DESCRIBE([at_func_diff_devnull], [FILE],
+AS_FUNCTION_DESCRIBE([at_fn_diff_devnull], [FILE],
 [Emit a diff between /dev/null and FILE.  Uses "test -s" to avoid useless
 diff invocations.])
-at_func_diff_devnull ()
+at_fn_diff_devnull ()
 {
   test -s "$[1]" || return 0
   $at_diff "$at_devnull" "$[1]"
 }
 
-AS_FUNCTION_DESCRIBE([at_func_test], [NUMBER],
+AS_FUNCTION_DESCRIBE([at_fn_test], [NUMBER],
 [Parse out test NUMBER from the tail of this file.])
-at_func_test ()
+at_fn_test ()
 {
   eval at_sed=\$at_sed$[1]
   sed "$at_sed" "$at_myself" > "$at_test_source"
 }
 
-AS_FUNCTION_DESCRIBE([at_func_create_debugging_script], [],
+AS_FUNCTION_DESCRIBE([at_fn_create_debugging_script], [],
 [Create the debugging script $at_group_dir/run which will reproduce the
 current test group.])
-at_func_create_debugging_script ()
+at_fn_create_debugging_script ()
 {
   {
     echo "#! /bin/sh" &&
@@ -417,10 +417,10 @@ 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])))"
 
-AS_FUNCTION_DESCRIBE([at_func_validate_ranges], [NAME...],
+AS_FUNCTION_DESCRIBE([at_fn_validate_ranges], [NAME...],
 [Validate and normalize the test group number contained in each
 variable NAME.  Leading zeroes are treated as decimal.])
-at_func_validate_ranges ()
+at_fn_validate_ranges ()
 {
   for at_grp
   do
@@ -492,14 +492,14 @@ do
        ;;
 
     [[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]])
-       at_func_validate_ranges at_option
+       at_fn_validate_ranges at_option
        AS_VAR_APPEND([at_groups], ["$at_option "])
        ;;
 
     # Ranges
     [[0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-])
        at_range_start=`echo $at_option |tr -d X-`
-       at_func_validate_ranges at_range_start
+       at_fn_validate_ranges at_range_start
        at_range=`AS_ECHO([" $at_groups_all "]) | \
          sed -e 's/^.* \('$at_range_start' \)/\1/'`
        AS_VAR_APPEND([at_groups], ["$at_range "])
@@ -507,7 +507,7 @@ do
 
     [-[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]])
        at_range_end=`echo $at_option |tr -d X-`
-       at_func_validate_ranges at_range_end
+       at_fn_validate_ranges at_range_end
        at_range=`AS_ECHO([" $at_groups_all "]) | \
          sed -e 's/\( '$at_range_end'\) .*$/\1/'`
        AS_VAR_APPEND([at_groups], ["$at_range "])
@@ -526,7 +526,7 @@ do
          at_range_end=$at_range_start
          at_range_start=$at_tmp
        fi
-       at_func_validate_ranges at_range_start at_range_end
+       at_fn_validate_ranges at_range_start at_range_end
        at_range=`AS_ECHO([" $at_groups_all "]) | \
          sed -e 's/^.*\( '$at_range_start' \)/\1/' \
              -e 's/\( '$at_range_end'\) .*$/\1/'`
@@ -1032,9 +1032,9 @@ AS_ERROR([testsuite directory setup failed])
 # test group execution outside of a shell function in order
 # to avoid hitting zsh 4.x exit status bugs.
 
-AS_FUNCTION_DESCRIBE([at_func_group_prepare], [],
+AS_FUNCTION_DESCRIBE([at_fn_group_prepare], [],
 [Prepare running a test group.])
-at_func_group_prepare ()
+at_fn_group_prepare ()
 {
   # The directory for additional per-group helper files.
   at_job_dir=$at_helper_dir/$at_group
@@ -1082,9 +1082,9 @@ at_func_group_prepare ()
   fi
 }
 
-AS_FUNCTION_DESCRIBE([at_func_group_postprocess], [],
+AS_FUNCTION_DESCRIBE([at_fn_group_postprocess], [],
 [Perform cleanup after running a test group.])
-at_func_group_postprocess ()
+at_fn_group_postprocess ()
 {
   # Be sure to come back to the suite directory, in particular
   # since below we might `rm' the group directory we are in currently.
@@ -1151,7 +1151,7 @@ _ATEOF
 
       # Cleanup the group directory, unless the user wants the files.
       if $at_debug_p; then
-       at_func_create_debugging_script
+       at_fn_create_debugging_script
       else
        if test -d "$at_group_dir"; then
          find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
@@ -1168,7 +1168,7 @@ _ATEOF
 
       # Upon failure, keep the group directory for autopsy, and create
       # the debugging script.  With -e, do not start any further tests.
-      at_func_create_debugging_script
+      at_fn_create_debugging_script
       if $at_errexit; then
        echo stop > "$at_stop_file"
       fi
@@ -1202,15 +1202,15 @@ then
   for at_group in $at_groups; do
     (
       # Start one test group.
-      at_func_group_prepare
+      at_fn_group_prepare
       if cd "$at_group_dir" &&
-        at_func_test $at_group &&
+        at_fn_test $at_group &&
         . "$at_test_source" # AT_JOB_FIFO_FD<&-
       then :; else
        AS_WARN([unable to parse test group: $at_group])
        at_failed=:
       fi
-      at_func_group_postprocess
+      at_fn_group_postprocess
       echo token >&AT_JOB_FIFO_FD
     ) &
     shift # Consume one token.
@@ -1236,14 +1236,14 @@ then
 else
   # Run serially, avoid forks and other potential surprises.
   for at_group in $at_groups; do
-    at_func_group_prepare
+    at_fn_group_prepare
     if cd "$at_group_dir" &&
-       at_func_test $at_group &&
+       at_fn_test $at_group &&
        . "$at_test_source"; then :; else
       AS_WARN([unable to parse test group: $at_group])
       at_failed=:
     fi
-    at_func_group_postprocess
+    at_fn_group_postprocess
     test -f "$at_stop_file" && break
     at_first=false
   done
@@ -1604,7 +1604,7 @@ m4_divert_push([TEST_GROUPS])dnl
 [#AT_START_]AT_ordinal
 @%:@ AT_ordinal. m4_defn([AT_line]): m4_defn([AT_description])
 at_setup_line='m4_defn([AT_line])'
-m4_if(AT_banner_ordinal, [0], [], [at_func_banner AT_banner_ordinal
+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_line=m4_format(["%3d: $at_desc%*s"], AT_ordinal,
@@ -1854,7 +1854,7 @@ dnl We know at build time that tracing COMMANDS is always 
safe.
 [test -n "$at_traceon"],
 dnl COMMANDS may contain parameter expansions; expand them at runtime.
 [test -n "$at_traceon" \
-  && at_func_check_newline "AS_ESCAPE([$1], [`\"])"])])[]dnl
+  && at_fn_check_newline "AS_ESCAPE([$1], [`\"])"])])[]dnl
 m4_popdef([at_reason])])
 
 
@@ -1869,7 +1869,7 @@ m4_define([AT_DIFF_STDERR(ignore)],
 m4_define([AT_DIFF_STDERR(experr)],
          [$at_diff experr "$at_stderr" || at_failed=:])
 m4_define([AT_DIFF_STDERR()],
-         [at_func_diff_devnull "$at_stderr" || at_failed=:])
+         [at_fn_diff_devnull "$at_stderr" || at_failed=:])
 
 m4_define([AT_DIFF_STDOUT(stdout)],
          [echo stdout:; tee stdout <"$at_stdout"])
@@ -1878,7 +1878,7 @@ m4_define([AT_DIFF_STDOUT(ignore)],
 m4_define([AT_DIFF_STDOUT(expout)],
          [$at_diff expout "$at_stdout" || at_failed=:])
 m4_define([AT_DIFF_STDOUT()],
-         [at_func_diff_devnull "$at_stdout" || at_failed=:])
+         [at_fn_diff_devnull "$at_stdout" || at_failed=:])
 
 # _AT_CHECK(COMMANDS, [STATUS = 0], STDOUT, STDERR,
 #           [RUN-IF-FAIL], [RUN-IF-PASS], SHELL_ESCAPE_IO)
@@ -1925,7 +1925,7 @@ echo AT_LINE >"$at_check_line_file"
 if _AT_DECIDE_TRACEABLE([$1]); then
   : >"$at_stder1"
   ( $at_traceon; $1 ) >>"$at_stdout" 2>>"$at_stder1"
-  at_func_filter_trace $?
+  at_fn_filter_trace $?
 else
   : >"$at_stderr"
   ( :; $1 ) >>"$at_stdout" 2>>"$at_stderr"
@@ -1938,9 +1938,9 @@ m4_ifdef([AT_DIFF_STDERR($4)], [m4_indir([AT_DIFF_STDERR
($4)])],
 m4_ifdef([AT_DIFF_STDOUT($3)], [m4_indir([AT_DIFF_STDOUT($3)])],
   [echo >>"$at_stdout"; AS_ECHO(["m4_ifval([$7],[AS_ESCAPE([$3])],[$3])"]) | \
   $at_diff - "$at_stdout" || at_failed=:])
-m4_if([$2], [ignore], [at_func_check_skip],
-  [at_func_check_status m4_default([$2], [0])]) $at_status "$at_srcdir/AT_LINE"
+m4_if([$2], [ignore], [at_fn_check_skip],
+  [at_fn_check_status m4_default([$2], [0])]) $at_status "$at_srcdir/AT_LINE"
 AS_IF($at_failed, [$5], [$6])
-$at_failed && at_func_log_failure AT_capture_files
+$at_failed && at_fn_log_failure AT_capture_files
 $at_traceon; }
 ])# _AT_CHECK
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index f056ee3..bcd4edb 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -402,18 +402,18 @@ m4_define([_AS_RUN],
 # This is a spy to detect "in the wild" shells that do not support shell
 # functions correctly.  It is based on the m4sh.at Autotest testcases.
 m4_define([_AS_SHELL_FN_WORK],
-[as_func_return () { (exit [$]1); }
-as_func_success () { as_func_return 0; }
-as_func_failure () { as_func_return 1; }
-as_func_ret_success () { return 0; }
-as_func_ret_failure () { return 1; }
+[as_fn_return () { (exit [$]1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
 
 exitcode=0
-as_func_success || { exitcode=1; echo as_func_success failed.; }
-as_func_failure && { exitcode=1; echo as_func_failure succeeded.; }
-as_func_ret_success || { exitcode=1; echo as_func_ret_success failed.; }
-as_func_ret_failure && { exitcode=1; echo as_func_ret_failure succeeded.; }
-AS_IF([( set x; as_func_ret_success y && test x = "[$]1" )], [],
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+AS_IF([( set x; as_fn_ret_success y && test x = "[$]1" )], [],
       [exitcode=1; echo positional parameters were not saved.])
 test x$exitcode = x0[]])# _AS_SHELL_FN_WORK
 
@@ -535,14 +535,14 @@ esac])# AS_CASE
 # Other shells don't use `$?' as default for `exit', hence just repeating
 # the exit value can only help improving portability.
 m4_defun([_AS_EXIT_PREPARE],
-[AS_REQUIRE_SHELL_FN([as_func_set_status],
-  [AS_FUNCTION_DESCRIBE([as_func_set_status], [STATUS],
+[AS_REQUIRE_SHELL_FN([as_fn_set_status],
+  [AS_FUNCTION_DESCRIBE([as_fn_set_status], [STATUS],
     [Set $? to STATUS, without forking.])], [  return $[]1])]dnl
-[AS_REQUIRE_SHELL_FN([as_func_exit],
-  [AS_FUNCTION_DESCRIBE([as_func_exit], [STATUS],
+[AS_REQUIRE_SHELL_FN([as_fn_exit],
+  [AS_FUNCTION_DESCRIBE([as_fn_exit], [STATUS],
     [Exit the shell with STATUS, even in a "trap 0" or "set -e" context.])],
 [  set +e
-  as_func_set_status $[]1
+  as_fn_set_status $[]1
   exit $[]1])])#_AS_EXIT_PREPARE
 
 
@@ -551,7 +551,7 @@ m4_defun([_AS_EXIT_PREPARE],
 # Exit, with status set to EXIT-CODE in the way that it's seen
 # within "trap 0", and without interference from "set -e".
 m4_defun([AS_EXIT],
-[AS_REQUIRE([_AS_EXIT_PREPARE])[]as_func_exit m4_default([$1], 1)])
+[AS_REQUIRE([_AS_EXIT_PREPARE])[]as_fn_exit m4_default([$1], 1)])
 
 
 # AS_FOR(MACRO, SHELL-VAR, [LIST = "$@"], [BODY = :])
@@ -614,7 +614,7 @@ m4_map_args_pair([_$0], [_$0_ELSE], m4_shift2($@))]dnl
 # ---------------------
 # Set the shell status ($?) to STATUS, without forking.
 m4_defun([AS_SET_STATUS],
-[AS_REQUIRE([_AS_EXIT_PREPARE])[]as_func_set_status $1])
+[AS_REQUIRE([_AS_EXIT_PREPARE])[]as_fn_set_status $1])
 
 
 # _AS_UNSET_PREPARE
@@ -622,12 +622,12 @@ m4_defun([AS_SET_STATUS],
 # Define $as_unset to execute AS_UNSET, for backwards compatibility
 # with older versions of M4sh.
 m4_defun([_AS_UNSET_PREPARE],
-[AS_FUNCTION_DESCRIBE([as_func_unset], [VAR], [Portably unset VAR.])
-as_func_unset ()
+[AS_FUNCTION_DESCRIBE([as_fn_unset], [VAR], [Portably unset VAR.])
+as_fn_unset ()
 {
   AS_UNSET([$[1]])
 }
-as_unset=as_func_unset])
+as_unset=as_fn_unset])
 
 
 # AS_UNSET(VAR)
@@ -1167,14 +1167,14 @@ m4_define([_AS_MKDIR_P],
 # Emulate `mkdir -p' with plain `mkdir' if needed.
 m4_defun_init([AS_MKDIR_P],
 [AS_REQUIRE([_$0_PREPARE])],
-[as_dir=$1; as_func_mkdir_p])# AS_MKDIR_P
+[as_dir=$1; as_fn_mkdir_p])# AS_MKDIR_P
 
 
 # _AS_MKDIR_P_PREPARE
 # -------------------
 m4_defun([_AS_MKDIR_P_PREPARE],
-[AS_REQUIRE_SHELL_FN([as_func_mkdir_p],
-  [AS_FUNCTION_DESCRIBE([as_func_mkdir_p], [],
+[AS_REQUIRE_SHELL_FN([as_fn_mkdir_p],
+  [AS_FUNCTION_DESCRIBE([as_fn_mkdir_p], [],
     [Create "$as_dir" as a directory, including parents if necessary.])],
 [
   _AS_MKDIR_P
@@ -1713,24 +1713,24 @@ m4_defun([_AS_TR_PREPARE],
 
 # _AS_VAR_APPEND_PREPARE
 # ----------------------
-# Define as_func_append to the optimum definition for the current
+# Define as_fn_append to the optimum definition for the current
 # shell (bash and zsh provide the += assignment operator to avoid
 # quadratic append growth over repeated appends).
 m4_defun([_AS_VAR_APPEND_PREPARE],
-[AS_FUNCTION_DESCRIBE([as_func_append], [VAR VALUE],
+[AS_FUNCTION_DESCRIBE([as_fn_append], [VAR VALUE],
 [Append the text in VALUE to the end of the definition contained in
 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))"])],
-[eval 'as_func_append ()
+[eval 'as_fn_append ()
   {
     eval $[]1+=\$[]2
   }'],
-[as_func_append ()
+[as_fn_append ()
   {
     eval $[]1=\$$[]1\$[]2
-  }]) # as_func_append
+  }]) # as_fn_append
 ])
 
 # _AS_VAR_APPEND_WORKS
@@ -1751,27 +1751,27 @@ m4_define([_AS_VAR_APPEND_WORKS],
 # field splitting and file name expansion.
 m4_defun_init([AS_VAR_APPEND],
 [AS_REQUIRE([_AS_VAR_APPEND_PREPARE], [], [M4SH-INIT-FN])],
-[as_func_append $1 $2])
+[as_fn_append $1 $2])
 
 
 # _AS_VAR_ARITH_PREPARE
 # ---------------------
-# Define as_func_arith to the optimum definition for the current
+# Define as_fn_arith to the optimum definition for the current
 # shell (using POSIX $(()) where supported).
 m4_defun([_AS_VAR_ARITH_PREPARE],
-[AS_FUNCTION_DESCRIBE([as_func_arith], [ARG...],
+[AS_FUNCTION_DESCRIBE([as_fn_arith], [ARG...],
 [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))"])],
-[eval 'as_func_arith ()
+[eval 'as_fn_arith ()
   {
     as_val=$(( $[]* ))
   }'],
-[as_func_arith ()
+[as_fn_arith ()
   {
     as_val=`expr "$[]@" || test $? -eq 1`
-  }]) # as_func_arith
+  }]) # as_fn_arith
 ])
 
 # _AS_VAR_ARITH_WORKS
@@ -1794,7 +1794,7 @@ m4_define([_AS_VAR_ARITH_WORKS],
 m4_defun_init([AS_VAR_ARITH],
 [_AS_DETECT_SUGGESTED([_AS_VAR_ARITH_WORKS])]dnl
 [AS_REQUIRE([_AS_VAR_ARITH_PREPARE], [], [M4SH-INIT-FN])],
-[as_func_arith $2 && AS_VAR_SET([$1], [$as_val])])
+[as_fn_arith $2 && AS_VAR_SET([$1], [$as_val])])
 
 
 # AS_VAR_COPY(DEST, SOURCE)
-- 
1.6.0.4








reply via email to

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