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 <ebb9@byu.net>
This commit is contained in:
Eric Blake 2008-11-18 09:40:03 -07:00
parent e84b404ff0
commit 667dcc0c30
8 changed files with 142 additions and 123 deletions

View File

@ -1,3 +1,22 @@
2008-11-18 Eric Blake <ebb9@byu.net>
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 <ebb9@byu.net>
Alter default value of AS_EXIT.

View File

@ -14690,7 +14690,7 @@ f: not found
@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})

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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])

View File

@ -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

View File

@ -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,17 +535,17 @@ 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.
If STATUS is omitted, use the maximum of $? and 1.])],
[ as_status=$?
set +e
test $as_status = 0 && as_status=1
as_func_set_status ${1-$as_status}
as_fn_set_status ${1-$as_status}
exit ${1-$as_status}])])#_AS_EXIT_PREPARE
@ -555,7 +555,7 @@ m4_defun([_AS_EXIT_PREPARE],
# within "trap 0", and without interference from "set -e". If
# EXIT-CODE is omitted, then use $?, except use 1 if $? is 0.
m4_defun([AS_EXIT],
[AS_REQUIRE([_AS_EXIT_PREPARE])[]as_func_exit[]m4_ifval([$1], [ $1])])
[AS_REQUIRE([_AS_EXIT_PREPARE])[]as_fn_exit[]m4_ifval([$1], [ $1])])
# AS_FOR(MACRO, SHELL-VAR, [LIST = "$@"], [BODY = :])
@ -618,7 +618,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
@ -626,12 +626,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)
@ -1171,14 +1171,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
@ -1717,24 +1717,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
@ -1755,27 +1755,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
@ -1798,7 +1798,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)