2006-04-23 Paul Eggert <eggert@cs.ucla.edu>
- * NEWS: Update wording to say merely "should" for AS_DIRNAME
- and AS_BASENAME.
- * lib/m4sugar/m4sh.m4 (AS_BASENAME, AS_DIRNAME): Bring these
- back, albeit undocumented. Programs now have a grace period
- to switch to AS_VAR_SET_DIRNAME and AS_VAR_SET_BASENAME.
+ * NEWS: Remove mention of AS_VAR_SET_BASENAME and AS_VAR_SET_DIRNAME.
+ * doc/autoconf.texi (Programming in M4sh): Remove mention of
+ AS_VAR_SET_BASENAME, AS_VAR_SET_DIRNAME, and AS_BASENAME.
+ We have to keep AS_DIRNAME since it was part of a stable Autoconf,
+ but AS_BASENAME doesn't have to be supported.
+ * lib/m4sugar/m4sh.m4 (AS_BASENAME, AS_DIRNAME): Bring these back.
2006-04-23 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
M4sh provides portable alternatives for some common shell constructs
that unfortunately are not portable in practice.
-@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{AS_VAR_SET_BASENAME([base], ["$file"])`} sets @code{base} to @samp{three}.
-@end defmac
-
@defmac AS_BOURNE_COMPATIBLE
@asindex{BOURNE_COMPATIBLE}
Set up the shell to be more compatible with the Bourne shell as
corresponding pattern matched @var{word}, else @var{default} is run.
@end defmac
-@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,
+@defmac AS_DIRNAME (@var{file-name})
+@asindex{DIRNAME}
+Output the directory portion of @var{file-name}. For example,
if @code{$file} is @samp{/one/two/three}, the command
-@code{AS_VAR_SET_DIRNAME([var], ["$file"])} sets @code{dir} to @samp{/one/two}.
+@code{dir=`AS_DIRNAME(["$file"])`} sets @code{dir} to @samp{/one/two}.
@end defmac
@defmac AS_IF (@var{test1}, @ovar{run-if-true1}, @dots{}, @ovar{run-if-false})
@item @command{basename}
@c ---------------------
@prindex @command{basename}
-Not all hosts have a working @command{basename}, and you should instead
-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.
-AS_VAR_SET_BASENAME([a], ["$aname"]) # This is more portable.
-
-# This is not portable.
-c=`basename "$cname" .c`
-
-# This is more portable.
-AS_VAR_SET_BASENAME([c], ["$cname"])
-case $c in
-?*.c) c=`expr "X$c" : 'X\(.*\)\.c'`;;
-esac
-@end example
+Not all hosts have a working @command{basename}.
+You can use @command{expr} instead.
@item @command{cat}
@c --------------------
@prindex @command{dirname}
Not all hosts have a working @command{dirname}, and you should instead
-use @code{AS_VAR_SET_DIRNAME} (@pxref{Programming in M4sh}). For example:
+use @code{AS_DIRNAME} (@pxref{Programming in M4sh}). For example:
@example
-dir=`dirname "$file"` # This is not portable.
-AS_VAR_SET_DIRNAME([dir], ["$file"]) # This is more portable.
+dir=`dirname "$file"` # This is not portable.
+dir=`AS_DIRNAME(["$file"])` # This is more portable.
@end example