Just a small patch to make code more self-explanatory, reducing the need
for comments, compacting the code...


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 12:28:51
@@ -771,6 +771,12 @@
 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.
+define([AC_SHELL_DIRNAME],
+[echo "$1" | sed 's%/[[^/][^/]]*$%%'])
 
 ## --------------------------------------------------- ##
 ## Common m4/sh handling of variables (indirections).  ##
@@ -4514,9 +4520,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 +4786,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 +4833,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