On Wed, Jul 05, 2000 at 04:10:54PM +0200, Akim Demaille wrote:
: Lars> There's obviously one set of ""s too much here.  Should the
: Lars> redundant pair be removed in the macro definition or the macro
: Lars> invocations?
: 
: I'd say from the macro.
: 
: BTW, you should state in the comment of AC_SHELL_DIRNAME that this
: macro must be usable in ` `.

Updated:

ChangeLog entry:

2000-07-05  Lars J. Aas  <[EMAIL PROTECTED]>

        * acgeneral.m4 (AC_SHELL_DIRNAME): New macro.
        (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS, _AC_OUTPUT_LINKS):
        Use AC_SHELL_DIRNAME.

Index: acgeneral.m4
===================================================================
RCS file: /cvs/autoconf/acgeneral.m4,v
retrieving revision 1.502
diff -u -r1.502 acgeneral.m4
--- acgeneral.m4        2000/07/04 18:20:05     1.502
+++ acgeneral.m4        2000/07/05 14:35:09
@@ -771,6 +771,13 @@
 done; }
 ])# AC_SHELL_MKDIR_P
 
+# AC_SHELL_DIRNAME(PATHNAME)
+# --------------------------
+# Remove last slash and trailing text.
+# Not all systems have dirname, so we emulate it with sed.
+# This macro must be usable from inside ` `.
+define([AC_SHELL_DIRNAME],
+[echo $1 | sed 's%/[[^/][^/]]*$%%'])
 
 ## --------------------------------------------------- ##
 ## Common m4/sh handling of variables (indirections).  ##
@@ -4514,9 +4521,7 @@
   esac
 
   # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
-  # Remove last slash and all that follows it.  Not all systems have dirname.
-  ac_dir=`echo "$ac_file" | sed 's%/[[^/][^/]]*$%%'`
+  ac_dir=`AC_SHELL_DIRNAME("$ac_file")`
   if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
     AC_SHELL_MKDIR_P("$ac_dir")
     ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
@@ -4782,8 +4787,7 @@
   if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
     echo "$ac_file is unchanged"
   else
-    # Remove last slash and all that follows it.  Not all systems have dirname.
-    ac_dir=`echo "$ac_file" | sed 's%/[[^/][^/]]*$%%'`
+    ac_dir=`AC_SHELL_DIRNAME("$ac_file")`
     if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
       AC_SHELL_MKDIR_P("$ac_dir")
     fi
@@ -4830,8 +4834,7 @@
   rm -f $ac_dest
 
   # Make relative symlinks.
-  # Remove last slash and all that follows it.  Not all systems have dirname.
-  ac_dest_dir=`echo $ac_dest | sed 's%/[[^/][^/]]*$%%'`
+  ac_dest_dir=`AC_SHELL_DIRNAME("$ac_dest")`
   if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
     AC_SHELL_MKDIR_P("$ac_dest_dir")
     ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"

Reply via email to