]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* acgeneral.m4 (_AC_SHELL_DIRNAME): Behave properly when the
authorAkim Demaille <akim@epita.fr>
Thu, 6 Jul 2000 11:25:26 +0000 (11:25 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 6 Jul 2000 11:25:26 +0000 (11:25 +0000)
argument is a dir with trailing slashes, and when its depth is
just one (`/tmp').

ChangeLog
acgeneral.m4
lib/autoconf/general.m4

index 2d8a86aec9af566802df3c995c75bec634c3198a..1f4c028e433261acf9c4faaa8ae5ef98f1964a15 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-07-06  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
+
+       * acgeneral.m4 (_AC_SHELL_DIRNAME): Behave properly when the
+       argument is a dir with trailing slashes, and when its depth is
+       just one (`/tmp').
+
 2000-07-06  Lars J. Aas  <larsa@sim.no>
 
        * acgeneral.m4 (_AC_SHELL_DIRNAME): New macro.
index b79e353215f469b1bed21ab84cbdd5eb805a424a..c790ff1fe877dc64022d5084baf739fac32d567a 100644 (file)
@@ -774,11 +774,10 @@ done; }
 
 # _AC_SHELL_DIRNAME(PATHNAME)
 # ---------------------------
-# Remove last slash and trailing text.
-# Not all systems have dirname, so we emulate it with sed.
+# Simulate running `dirname(1)' on PATHNAME, not all systems have it.
 # This macro must be usable from inside ` `.
 define([_AC_SHELL_DIRNAME],
-[echo $1 | sed 's%/[[^/][^/]]*$%%'])
+[echo $1 | sed '/^\/*$/!s,//*$,,;s,[^/]*$,,;s,//*$,/,;/^\/$/!s,/$,,'])
 
 
 
index b79e353215f469b1bed21ab84cbdd5eb805a424a..c790ff1fe877dc64022d5084baf739fac32d567a 100644 (file)
@@ -774,11 +774,10 @@ done; }
 
 # _AC_SHELL_DIRNAME(PATHNAME)
 # ---------------------------
-# Remove last slash and trailing text.
-# Not all systems have dirname, so we emulate it with sed.
+# Simulate running `dirname(1)' on PATHNAME, not all systems have it.
 # This macro must be usable from inside ` `.
 define([_AC_SHELL_DIRNAME],
-[echo $1 | sed 's%/[[^/][^/]]*$%%'])
+[echo $1 | sed '/^\/*$/!s,//*$,,;s,[^/]*$,,;s,//*$,/,;/^\/$/!s,/$,,'])