]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* NEWS: Remove AS_DIRNAME and AS_BASENAME, replacing them with
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 23 Apr 2006 06:49:53 +0000 (06:49 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 23 Apr 2006 06:49:53 +0000 (06:49 +0000)
AS_VAR_SET_DIRNAME and AS_VAR_SET_BASENAME.
* doc/autoconf.texi (Programming in M4sh): Document this.  All uses
changed.  The newer interfaces are more reliable, as they allow
implementations that handle trailing newline correctly.  For now,
we're in a freeze, so I did not include the more-reliable
implementations, but I wanted to correct the interface before 2.60
goes out.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_REQUIRED): Renamed from
AS_DETECT_REQUIRED.  All uses changed.
(_AS_DETECT_SUGGESTED): Renamed from AS_DETECT_SUGGESTED.
All uses changed.
(_AS_DETECT_BETTER_SHELL): Put ;; at the end of a case.
(_AS_BASENAME): Renamed from AS_BASENAME.  All uses changed.
Use "basename --" to protect against leading "-".
(_AS_BASENAME_EXPR): Renamed from AS_BASENAME_EXPR.  All uses changed.
(_AS_BASENAME_SED): Renamed from AS_BASENAME_SED.  All uses changed.
(_AS_BASENAME_PREPARE): Reject implementations that cannot handle "--".
(_AS_DIRNAME_PREPARE): Likewise.
(_AS_DIRNAME): Renamed from AS_DIRNAME.  All uses changed.
(_AS_DIRNAME_EXPR): Renamed from AS_DIRNAME_EXPR.  All uses changed.
(_AS_DIRNAME_SED): Renamed from AS_DIRNAME_SED.  All uses changed.
Use "dirname --".
(AS_VAR_SET_BASENAME, AS_VAR_SET_DIRNAME): New macros.
* tests/m4sh.at (AS_VAR_SET_DIRNAME): Renamed from AS_DIRNAME.
Test the new API.  Don't test internals, since they're probably
going to change anyway.
(AS_VAR_SET_BASENAME): Likewise, renamed from AS_BASENAME.

* bin/autoconf.as: Don't use AS_BASENAME or AS_DIRNAME.  This
removes a bootstrapping problem with the changes described above.
The AS_DIRNAME part wasn't used, anyway, and the AS_BASENAME
part can be done portably without all the deep Autoconf magic.

ChangeLog
NEWS
bin/autoconf.as
doc/autoconf.texi
lib/autoconf/general.m4
lib/autoconf/status.m4
lib/m4sugar/m4sh.m4
tests/m4sh.at

index 67db276610b79fe3ac45ff6be7e377269054cf08..c13e0a58fd61233e10cc3055dba3bbb2e3074fec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2006-04-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * NEWS: Remove AS_DIRNAME and AS_BASENAME, replacing them with
+       AS_VAR_SET_DIRNAME and AS_VAR_SET_BASENAME.
+       * doc/autoconf.texi (Programming in M4sh): Document this.  All uses
+       changed.  The newer interfaces are more reliable, as they allow
+       implementations that handle trailing newline correctly.  For now,
+       we're in a freeze, so I did not include the more-reliable
+       implementations, but I wanted to correct the interface before 2.60
+       goes out.
+       * lib/m4sugar/m4sh.m4 (_AS_DETECT_REQUIRED): Renamed from
+       AS_DETECT_REQUIRED.  All uses changed.
+       (_AS_DETECT_SUGGESTED): Renamed from AS_DETECT_SUGGESTED.
+       All uses changed.
+       (_AS_DETECT_BETTER_SHELL): Put ;; at the end of a case.
+       (_AS_BASENAME): Renamed from AS_BASENAME.  All uses changed.
+       Use "basename --" to protect against leading "-".
+       (_AS_BASENAME_EXPR): Renamed from AS_BASENAME_EXPR.  All uses changed.
+       (_AS_BASENAME_SED): Renamed from AS_BASENAME_SED.  All uses changed.
+       (_AS_BASENAME_PREPARE): Reject implementations that cannot handle "--".
+       (_AS_DIRNAME_PREPARE): Likewise.
+       (_AS_DIRNAME): Renamed from AS_DIRNAME.  All uses changed.
+       (_AS_DIRNAME_EXPR): Renamed from AS_DIRNAME_EXPR.  All uses changed.
+       (_AS_DIRNAME_SED): Renamed from AS_DIRNAME_SED.  All uses changed.
+       Use "dirname --".
+       (AS_VAR_SET_BASENAME, AS_VAR_SET_DIRNAME): New macros.
+       * tests/m4sh.at (AS_VAR_SET_DIRNAME): Renamed from AS_DIRNAME.
+       Test the new API.  Don't test internals, since they're probably
+       going to change anyway.
+       (AS_VAR_SET_BASENAME): Likewise, renamed from AS_BASENAME.
+
+       * bin/autoconf.as: Don't use AS_BASENAME or AS_DIRNAME.  This
+       removes a bootstrapping problem with the changes described above.
+       The AS_DIRNAME part wasn't used, anyway, and the AS_BASENAME
+       part can be done portably without all the deep Autoconf magic.
+
 2006-04-19  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * lib/autoconf/general.m4 (_AC_INIT_PREPARE): Remove the leading
diff --git a/NEWS b/NEWS
index 0cbd79429888ac998f7f99fa20c242ad8bb98620..56d8323b611ee307354ca2de3c00c3ef7edc4ddd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,9 @@
 * Major changes in Autoconf 2.59d
 
+** New macros AS_VAR_SET_BASENAME and AS_VAR_SET_DIRNAME, replacing the
+  AS_BASENAME and AS_DIRNAME macros that were introduced in alpha
+  versions but not mentioned in the NEWS file.
+
 * Major changes in Autoconf 2.59c
 
   Released 2006-04-12, by Ralf Wildenhues.
index e84ccbc2740a30bfb10799f19fabe18f5baa7b72..45c9875ab70076f1380665471c9ee1e94aabea1b 100644 (file)
@@ -1,7 +1,8 @@
 AS_INIT[]dnl                                            -*- shell-script -*-
 # autoconf -- create `configure' using m4 macros
-# Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
+
+# Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003,
+# 2004, 2005, 2006 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -66,7 +67,11 @@ Copyright (C) 2006 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."]
 
-me=`AS_BASENAME([$0])`
+me=$0
+case $me in
+*/autoconf) me=autoconf;;
+*/*) me=`expr "X$me" : '.*/\(.*\)'`;;
+esac
 
 help="\
 Try \`$me --help' for more information."
@@ -79,7 +84,6 @@ exit 1"
 # Variables.
 : ${AUTOM4TE='@bindir@/@autom4te-name@'}
 autom4te_options=
-dir=`AS_DIRNAME([$0])`
 outfile=
 verbose=:
 
index 8163b6f0eea04f2a024aa02612dad4b5f2d346e9..507af0914f29f396b85aa2c8e3c3dd62f38e44fd 100644 (file)
@@ -9646,11 +9646,12 @@ For the time being, it is not mature enough to be widely used.
 M4sh provides portable alternatives for some common shell constructs
 that unfortunately are not portable in practice.
 
-@defmac AS_BASENAME (@var{file-name})
-@asindex{BASENAME}
-Output the non-directory portion of @var{file-name}.  For example,
+@defmac AS_VAR_SET_BASENAME (@var{variable}, @var{file-name})
+@asindex{VAR_SET_BASENAME}
+Set @var{variable} to the non-directory portion of @var{file-name}.
+For example,
 if @code{$file} is @samp{/one/two/three}, the command
-@code{base=`AS_BASENAME(["$file"])`} sets @code{base} to @samp{three}.
+@code{AS_VAR_SET_BASENAME([base], ["$file"])`} sets @code{base} to @samp{three}.
 @end defmac
 
 @defmac AS_BOURNE_COMPATIBLE
@@ -9668,11 +9669,11 @@ against one or more patterns.  @var{if-matched} is run if the
 corresponding pattern matched @var{word}, else @var{default} is run.
 @end defmac
 
-@defmac AS_DIRNAME (@var{file-name})
-@asindex{DIRNAME}
-Output the directory portion of @var{file-name}.  For example,
+@defmac AS_VAR_SET_DIRNAME (@var{variable}, @var{file-name})
+@asindex{VAR_SET_DIRNAME}
+Set @var{variable} to the directory portion of @var{file-name}.  For example,
 if @code{$file} is @samp{/one/two/three}, the command
-@code{dir=`AS_DIRNAME(["$file"])`} sets @code{dir} to @samp{/one/two}.
+@code{AS_VAR_SET_DIRNAME([var], ["$file"])} sets @code{dir} to @samp{/one/two}.
 @end defmac
 
 @defmac AS_IF (@var{test1}, @ovar{run-if-true1}, @dots{}, @ovar{run-if-false})
@@ -11197,8 +11198,8 @@ test "$@{var+set@}" = set || var=@var{@{value@}}
 @cindex Command Substitution
 Posix requires shells to trim all trailing newlines from command
 output before substituting it, so assignments like
-@samp{dir=`AS_DIRNAME(["$file"])`} will not work as expected if the
-directory of @samp{$file} ends in a newline.
+@samp{dir=`echo "$file" | tr a A`} will not work as expected if
+@samp{$file} ends in a newline.
 
 While in general it makes no sense, do not substitute a single builtin
 with side effects, because Ash 0.2, trying to optimize, does not fork a
@@ -12468,18 +12469,18 @@ fields in a record.  You may be able to circumvent this problem by using
 @c ---------------------
 @prindex @command{basename}
 Not all hosts have a working @command{basename}, and you should instead
-use @code{AS_BASENAME} (@pxref{Programming in M4sh}), followed by
+use @code{AS_VAR_SET_BASENAME} (@pxref{Programming in M4sh}), followed by
 @command{expr} if you need to strip a suffix.  For example:
 
 @example
-a=`basename "$aname"`       # This is not portable.
-a=`AS_BASENAME(["$aname"])` # This is more portable.
+a=`basename "$aname"`  # This is not portable.
+AS_VAR_SET_BASENAME([a], ["$aname"])  # This is more portable.
 
 # This is not portable.
 c=`basename "$cname" .c`
 
 # This is more portable.
-c=`AS_BASENAME(["$cname"])`
+AS_VAR_SET_BASENAME([c], ["$cname"])
 case $c in
 ?*.c) c=`expr "X$c" : 'X\(.*\)\.c'`;;
 esac
@@ -12647,11 +12648,11 @@ Some implementations, such as Tru64's, fail when comparing to
 @c --------------------
 @prindex @command{dirname}
 Not all hosts have a working @command{dirname}, and you should instead
-use @code{AS_DIRNAME} (@pxref{Programming in M4sh}).  For example:
+use @code{AS_VAR_SET_DIRNAME} (@pxref{Programming in M4sh}).  For example:
 
 @example
-dir=`dirname "$file"`       # This is not portable.
-dir=`AS_DIRNAME(["$file"])` # This is more portable.
+dir=`dirname "$file"`  # This is not portable.
+AS_VAR_SET_DIRNAME([dir], ["$file"])  # This is more portable.
 @end example
 
 
index 5158ab52db75ee33bbf000f85dd36da8e810f09b..ecaeecf5a04e267f3a472afca8759d99fa29c5e8 100644 (file)
@@ -440,8 +440,8 @@ dnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle.
   _AS_ECHO_N([checking for prefix by ])
   AC_PATH_PROG(ac_prefix_program, [$1])
   if test -n "$ac_prefix_program"; then
-    prefix=`AS_DIRNAME(["$ac_prefix_program"])`
-    prefix=`AS_DIRNAME(["$prefix"])`
+    AS_VAR_SET_DIRNAME([prefix], ["$ac_prefix_program"])
+    AS_VAR_SET_DIRNAME([prefix], ["$prefix"])
   fi
 fi
 ])# AC_PREFIX_PROGRAM
@@ -489,7 +489,7 @@ m4_divert_push([PARSE_ARGS])dnl
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
   # Try the directory containing this script, then the parent directory.
-  ac_confdir=`AS_DIRNAME(["$[0]"])`
+  AS_VAR_SET_DIRNAME([ac_confdir], ["$[0]"])
   srcdir=$ac_confdir
   if test ! -r "$srcdir/$ac_unique_file"; then
     srcdir=..
index a0239a518fc70e61562694ff5690f89dfdc753d8..221576672ff6ebe672cf1b3cab78f46692cf5a77 100644 (file)
@@ -1427,7 +1427,7 @@ do
     ;;
   esac
 
-  ac_dir=`AS_DIRNAME(["$ac_file"])`
+  AS_VAR_SET_DIRNAME([ac_dir], ["$ac_file"])
   AS_MKDIR_P(["$ac_dir"])
   _AC_SRCDIRS(["$ac_dir"])
 
index aac29eec6ffbf3030b2b1d6639c00d23aaae1a50..723a6b0718835f34e06e8f03cd3fe9fdb752d46a 100644 (file)
@@ -150,7 +150,7 @@ m4_define([AS_REQUIRE],
 # xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.
 #
 m4_define([AS_REQUIRE_SHELL_FN],
-[AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl
+[_AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl
 m4_provide_if([AS_SHELL_FN_$1], [],
                [m4_provide([AS_SHELL_FN_$1])m4_divert_text([M4SH-INIT], [$1() {
 $2
@@ -191,27 +191,26 @@ _ASEOF
 [(eval "AS_ESCAPE(m4_quote($1))")])])
 
 
-# AS_DETECT_REQUIRED(TEST)
-# ------------------------
-# Refuse to execute under a shell that does not pass
-# the given TEST.
+# _AS_DETECT_REQUIRED(TEST)
+# -------------------------
+# Refuse to execute under a shell that does not pass the given TEST.
 m4_define([_AS_DETECT_REQUIRED_BODY], [:])
-m4_defun([AS_DETECT_REQUIRED],
+m4_defun([_AS_DETECT_REQUIRED],
 [m4_require([_AS_DETECT_BETTER_SHELL])dnl
 m4_expand_once([m4_append([_AS_DETECT_REQUIRED_BODY], [
 ($1) || AS_EXIT(1)
-])], [AS_DETECT_REQUIRED_provide($1)])])
+])], [_AS_DETECT_REQUIRED_provide($1)])])
 
 
-# AS_DETECT_SUGGESTED(TEST)
-# -------------------------
+# _AS_DETECT_SUGGESTED(TEST)
+# --------------------------
 # Prefer to execute under a shell that passes the given TEST.
 m4_define([_AS_DETECT_SUGGESTED_BODY], [:])
-m4_defun([AS_DETECT_SUGGESTED],
+m4_defun([_AS_DETECT_SUGGESTED],
 [m4_require([_AS_DETECT_BETTER_SHELL])dnl
 m4_expand_once([m4_append([_AS_DETECT_SUGGESTED_BODY], [
 ($1) || AS_EXIT(1)
-])], [AS_DETECT_SUGGESTED_provide($1)])])
+])], [_AS_DETECT_SUGGESTED_provide($1)])])
 
 
 # _AS_DETECT_BETTER_SHELL
@@ -234,7 +233,7 @@ if test "x$CONFIG_SHELL" = x; then
         /*)
           for as_base in sh bash ksh sh5; do
             as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
-          done
+          done;;
        esac])
 
       for as_shell in $as_candidate_shells $SHELL; do
@@ -383,7 +382,7 @@ _AS_EXPR_PREPARE
 _AS_BASENAME_PREPARE
 
 # Name of the executable.
-as_me=`AS_BASENAME("$[0]")`
+AS_VAR_SET_BASENAME([as_me], [$[0]])
 
 # CDPATH.
 $as_unset CDPATH
@@ -660,18 +659,18 @@ m4_define([AS_ERROR],
 # This section is lexicographically sorted.
 
 
-# AS_BASENAME(FILE-NAME)
-# ----------------------
+# _AS_BASENAME(FILE-NAME)
+# -----------------------
 # Simulate the command 'basename FILE-NAME'.  Not all systems have basename.
 # Also see the comments for AS_DIRNAME.
 
-m4_defun([AS_BASENAME_EXPR],
+m4_defun([_AS_BASENAME_EXPR],
 [AS_REQUIRE([_AS_EXPR_PREPARE])dnl
 $as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \
         X[]$1 : 'X\(//\)$' \| \
         X[]$1 : 'X\(/\)' \| .])
 
-m4_defun([AS_BASENAME_SED],
+m4_defun([_AS_BASENAME_SED],
 [echo X/[]$1 |
     sed ['/^.*\/\([^/][^/]*\)\/*$/{
            s//\1/
@@ -687,18 +686,19 @@ m4_defun([AS_BASENAME_SED],
          }
          s/.*/./; q']])
 
-m4_defun([AS_BASENAME],
-[AS_REQUIRE([_$0_PREPARE])dnl
-$as_basename $1 ||
-AS_BASENAME_EXPR([$1]) 2>/dev/null ||
-AS_BASENAME_SED([$1])])
+m4_defun([_AS_BASENAME],
+[AS_REQUIRE([$0_PREPARE])dnl
+$as_basename -- $1 ||
+_AS_BASENAME_EXPR([$1]) 2>/dev/null ||
+_AS_BASENAME_SED([$1])])
 
 
 # _AS_BASENAME_PREPARE
 # --------------------
 # Avoid Solaris 9 /usr/ucb/basename, as `basename /' outputs an empty line.
+# Also, traditional basename mishandles --.
 m4_defun([_AS_BASENAME_PREPARE],
-[if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+[if as_basename=`(basename -- /) 2>&1` && test "X$as_basename" = "X/"; then
   as_basename=basename
 else
   as_basename=false
@@ -706,8 +706,8 @@ fi
 ])# _AS_BASENAME_PREPARE
 
 
-# AS_DIRNAME(FILE-NAME)
-# ---------------------
+# _AS_DIRNAME(FILE-NAME)
+# ----------------------
 # Simulate the command 'dirname FILE-NAME'.  Not all systems have dirname.
 # This macro must be usable from inside ` `.
 #
@@ -717,14 +717,14 @@ fi
 # a silly length limit that causes expr to fail if the matched
 # substring is longer than 120 bytes.  So fall back on echo|sed if
 # expr fails.
-m4_defun([AS_DIRNAME_EXPR],
+m4_defun([_AS_DIRNAME_EXPR],
 [AS_REQUIRE([_AS_EXPR_PREPARE])dnl
 $as_expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \
         X[]$1 : 'X\(//\)[[^/]]' \| \
         X[]$1 : 'X\(//\)$' \| \
         X[]$1 : 'X\(/\)' \| .])
 
-m4_defun([AS_DIRNAME_SED],
+m4_defun([_AS_DIRNAME_SED],
 [echo X[]$1 |
     sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
@@ -744,17 +744,17 @@ m4_defun([AS_DIRNAME_SED],
          }
          s/.*/./; q']])
 
-m4_defun([AS_DIRNAME],
-[AS_REQUIRE([_$0_PREPARE])dnl
-$as_dirname $1 ||
-AS_DIRNAME_EXPR([$1]) 2>/dev/null ||
-AS_DIRNAME_SED([$1])])
+m4_defun([_AS_DIRNAME],
+[AS_REQUIRE([$0_PREPARE])dnl
+$as_dirname -- $1 ||
+_AS_DIRNAME_EXPR([$1]) 2>/dev/null ||
+_AS_DIRNAME_SED([$1])])
 
 
 # _AS_DIRNAME_PREPARE
 # --------------------
 m4_defun([_AS_DIRNAME_PREPARE],
-[if (dirname /) >/dev/null 2>&1; then
+[if (dirname -- /) >/dev/null 2>&1; then
   as_dirname=dirname
 else
   as_dirname=false
@@ -811,7 +811,7 @@ m4_define([_AS_LINENO_WORKS],
 # configure.
 m4_define([_AS_LINENO_PREPARE],
 [AS_REQUIRE([_AS_CR_PREPARE])dnl
-AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])
+_AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])
 _AS_LINENO_WORKS || {
 
   # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
@@ -907,7 +907,7 @@ m4_define([AS_MKDIR_P],
     as_dirs=
     while test ! -d "$as_dir"; do
       as_dirs="$as_dir $as_dirs"
-      as_dir=`AS_DIRNAME("$as_dir")`
+      AS_VAR_SET_DIRNAME([as_dir], ["$as_dir"])
     done
     test ! -n "$as_dirs" || mkdir $as_dirs
   fi || AS_ERROR([cannot create directory $1]); }dnl
@@ -1010,6 +1010,22 @@ rm -f conf$$.file
 ])# _AS_TEST_PREPARE
 
 
+# AS_VAR_SET_BASENAME(VARIABLE, FILE-NAME)
+# ----------------------------------------
+# Simulate VARIABLE=`basename FILE-NAME`.
+m4_defun([AS_VAR_SET_BASENAME],
+[$1=$2
+$1=`_AS_BASENAME(["$$1"])`])
+
+
+# AS_VAR_SET_DIRNAME(VARIABLE, FILE-NAME)
+# ---------------------------------------
+# Simulate the command VARIABLE=`dirname FILE-NAME`.
+m4_defun([AS_VAR_SET_DIRNAME],
+[$1=$2
+$1=`_AS_DIRNAME(["$$1"])`])
+
+
 
 
 ## ------------------ ##
@@ -1441,7 +1457,7 @@ m4_define([AS_VAR_POPDEF],
 # This temporary macro checks "in the wild" for shells that do
 # not support shell functions.
 m4_define([_AS_SHELL_FN_SPY],
-[AS_DETECT_SUGGESTED([_AS_SHELL_FN_WORK])
+[_AS_DETECT_SUGGESTED([_AS_SHELL_FN_WORK])
 _AS_RUN([_AS_SHELL_FN_WORK]) || {
   echo No shell found that supports shell functions.
   echo Please tell autoconf@gnu.org about your system,
index 849d9ef930fe672903e57dae80d70781160ba930..2f51e7029f96f17d6ff98cbad1835e648510237f 100644 (file)
@@ -95,33 +95,20 @@ AT_CLEANUP
 
 
 
-## ------------ ##
-## AS_DIRNAME.  ##
-## ------------ ##
+## -------------------- ##
+## AS_VAR_SET_DIRNAME.  ##
+## -------------------- ##
 
 # Build nested dirs.
-AT_SETUP([AS@&t@_DIRNAME])
+AT_SETUP([AS@&t@_VAR_SET_DIRNAME])
 
 AT_DATA_M4SH([script.as],
 [[AS_INIT
 
-# The EXPR variant is allowed to fail if `expr' was considered as too
-# weak for us, in which case `as_expr=false'.
 m4_define([DIRNAME_TEST],
-[dir=`AS_DIRNAME([$1])`
-test "$dir" = "$2" || (test -n "$3" && test "$dir" = "$3") ||
-  echo "dirname($1) = $dir instead of $2" >&2
-
-if test "$as_expr" != false; then
-  dir=`AS_DIRNAME_EXPR([$1])`
-  test "$dir" = "$2" || (test -n "$3" && test "$dir" = "$3") ||
-    echo "dirname_expr($1) = $dir instead of $2" >&2
-fi
-
-dir=`AS_DIRNAME_SED([$1])`
-test "$dir" = "$2" ||
+[AS_VAR_SET_DIRNAME([dir], [$1])
 test "$dir" = "$2" || (test -n "$3" && test "$dir" = "$3") ||
-  echo "dirname_sed($1) = $dir instead of $2" >&2])
+  echo "dirname($1) = $dir instead of $2" >&2])
 
 DIRNAME_TEST([/],              [/])
 DIRNAME_TEST([//],             [//],   [/])
@@ -156,24 +143,20 @@ AT_CLEANUP
 
 
 
-## ------------- ##
-## AS_BASENAME.  ##
-## ------------- ##
+## --------------------- ##
+## AS_VAR_SET_BASENAME.  ##
+## --------------------- ##
 
 # Build nested dirs.
-AT_SETUP([AS@&t@_BASENAME])
+AT_SETUP([AS@&t@_VAR_SET_BASENAME])
 
 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])`
+[AS_VAR_SET_BASENAME([base], [$1])
 test "$base" = "$2" ||
-  echo "basename_sed($1) = $base instead of $2" >&2])
+  echo "basename($1) = $base instead of $2" >&2])
 
 BASENAME_TEST([//1],             [1])
 BASENAME_TEST([/1],              [1])