From: Akim Demaille Date: Thu, 6 Jul 2000 11:25:26 +0000 (+0000) Subject: * acgeneral.m4 (_AC_SHELL_DIRNAME): Behave properly when the X-Git-Tag: autoconf-2.50~782 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ba9d8b0b7971b8f51177ba9b8b8779c03644fc2;p=thirdparty%2Fautoconf.git * acgeneral.m4 (_AC_SHELL_DIRNAME): Behave properly when the argument is a dir with trailing slashes, and when its depth is just one (`/tmp'). --- diff --git a/ChangeLog b/ChangeLog index 2d8a86aec..1f4c028e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-07-06 Alexandre Oliva + + * 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 * acgeneral.m4 (_AC_SHELL_DIRNAME): New macro. diff --git a/acgeneral.m4 b/acgeneral.m4 index b79e35321..c790ff1fe 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -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,/$,,']) diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index b79e35321..c790ff1fe 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -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,/$,,'])