autoconf-patches
[Top][All Lists]
Advanced

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

Re: AS_BASENAME and AS_DIRNAME API change


From: Paul Eggert
Subject: Re: AS_BASENAME and AS_DIRNAME API change
Date: Sun, 23 Apr 2006 01:43:54 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Ralf Wildenhues <address@hidden> writes:

> AS_DIRNAME *is* documented since 2001-09-18

Ah, OK, so we have to keep it.  Sorry about that.  But we don't
have to keep AS_BASENAME.  And for now it's probably better if we
don't mention the new names, since they might change.

> I am pretty wary of optimization work at this point.

I wasn't trying to add optimization, only to avoid being foreclosed
from it in future versions.  Here's what I installed to undo the
effects of the recent changes:

Index: ChangeLog
===================================================================
RCS file: /cvsroot/autoconf/autoconf/ChangeLog,v
retrieving revision 1.2845
diff -p -u -r1.2845 ChangeLog
--- ChangeLog   23 Apr 2006 08:13:43 -0000      1.2845
+++ ChangeLog   23 Apr 2006 08:40:31 -0000
@@ -1,10 +1,11 @@
 2006-04-23  Paul Eggert  <address@hidden>
 
-       * 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  <address@hidden>
 
Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.365
diff -p -u -r1.365 NEWS
--- NEWS        23 Apr 2006 08:13:43 -0000      1.365
+++ NEWS        23 Apr 2006 08:40:31 -0000
@@ -1,9 +1,5 @@
 * Major changes in Autoconf 2.59d
 
-** New macros AS_VAR_SET_BASENAME and AS_VAR_SET_DIRNAME.
-  Programs that use the (never-stable, and now undocumented) AS_BASENAME
-  and AS_DIRNAME macros should use these new macros instead.
-
 * Major changes in Autoconf 2.59c
 
   Released 2006-04-12, by Ralf Wildenhues.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.996
diff -p -u -r1.996 autoconf.texi
--- doc/autoconf.texi   23 Apr 2006 07:13:52 -0000      1.996
+++ doc/autoconf.texi   23 Apr 2006 08:40:32 -0000
@@ -9646,14 +9646,6 @@ For the time being, it is not mature eno
 M4sh provides portable alternatives for some common shell constructs
 that unfortunately are not portable in practice.
 
address@hidden AS_VAR_SET_BASENAME (@var{variable}, @var{file-name})
address@hidden
-Set @var{variable} to the non-directory portion of @var{file-name}.
-For example,
-if @code{$file} is @samp{/one/two/three}, the command
address@hidden([base], ["$file"])`} sets @code{base} to @samp{three}.
address@hidden defmac
-
 @defmac AS_BOURNE_COMPATIBLE
 @asindex{BOURNE_COMPATIBLE}
 Set up the shell to be more compatible with the Bourne shell as
@@ -9669,11 +9661,11 @@ against one or more patterns.  @var{if-m
 corresponding pattern matched @var{word}, else @var{default} is run.
 @end defmac
 
address@hidden AS_VAR_SET_DIRNAME (@var{variable}, @var{file-name})
address@hidden
-Set @var{variable} to the directory portion of @var{file-name}.  For example,
address@hidden AS_DIRNAME (@var{file-name})
address@hidden
+Output the directory portion of @var{file-name}.  For example,
 if @code{$file} is @samp{/one/two/three}, the command
address@hidden([var], ["$file"])} sets @code{dir} to @samp{/one/two}.
address@hidden(["$file"])`} sets @code{dir} to @samp{/one/two}.
 @end defmac
 
 @defmac AS_IF (@var{test1}, @ovar{run-if-true1}, @dots{}, @ovar{run-if-false})
@@ -12468,23 +12460,8 @@ fields in a record.  You may be able to 
 @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
address@hidden if you need to strip a suffix.  For example:
-
address@hidden
-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
address@hidden example
+Not all hosts have a working @command{basename}.
+You can use @command{expr} instead.
 
 
 @item @command{cat}
@@ -12648,11 +12625,11 @@ Some implementations, such as Tru64's, f
 @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
 
 





reply via email to

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