]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/m4sugar/m4sh.m4 (AS_BASENAME_EXPR): Handle ///, ////, etc.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 31 Mar 2006 18:46:47 +0000 (18:46 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 31 Mar 2006 18:46:47 +0000 (18:46 +0000)
correctly.  Problem reported by Eric Blake.
(_AS_EXPR_PREPARE): Detect Tru64 expr bug.  Problem reported by
Ralf Wildenhues.

ChangeLog
lib/m4sugar/m4sh.m4

index aa3218014ddf8a30e089f44090782a17fe889cf6..2d40cbe19b5c2485da1e5e822ab230dd57fcaf48 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-03-31  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * lib/m4sugar/m4sh.m4 (AS_BASENAME_EXPR): Handle ///, ////, etc.
+       correctly.  Problem reported by Eric Blake.
+       (_AS_EXPR_PREPARE): Detect Tru64 expr bug.  Problem reported by
+       Ralf Wildenhues.
+
 2006-03-30  Paul Eggert  <eggert@cs.ucla.edu>
 
        * doc/autoconf.texi (Programming in M4sh, Limitations of Usual Tools):
index bc3989a6ff5e8d924cff91040bb9ac29492fe230..e022622cca0d55a85ecefed27506ea7a3908848b 100644 (file)
@@ -654,7 +654,7 @@ m4_define([AS_ERROR],
 
 # AS_DIRNAME(FILE-NAME)
 # ---------------------
-# Simulate running `dirname(1)' on FILE-NAME.  Not all systems have it.
+# Simulate the command 'dirname FILE-NAME'.  Not all systems have dirname.
 # This macro must be usable from inside ` `.
 #
 # Prefer expr to echo|sed, since expr is usually faster and it handles
@@ -699,14 +699,14 @@ AS_DIRNAME_SED([$1])])
 
 # AS_BASENAME(FILE-NAME)
 # ----------------------
-# Simulate running `basename(1)' on FILE-NAME.  Not all systems have it.
+# Simulate the command 'basename FILE-NAME'.  Not all systems have basename.
 # Also see the comments for AS_DIRNAME.
 
 m4_defun([AS_BASENAME_EXPR],
 [AS_REQUIRE([_AS_EXPR_PREPARE])dnl
 $as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \
         X[]$1 : 'X\(//\)$' \| \
-        X[]$1 : 'X\(/\)$' \| \
+        X[]$1 : 'X\(/\)' \| \
         .     : '\(.\)'])
 
 m4_defun([AS_BASENAME_SED],
@@ -754,11 +754,12 @@ fi
 
 # _AS_EXPR_PREPARE
 # ----------------
-# Some expr work properly (i.e. compute and issue the right result),
-# but exit with failure.  When a fall back to expr (as in AS_DIRNAME)
-# is provided, you get twice the result.  Prevent this.
+# QNX 4.25 expr computes and issue the right result but exits with failure.
+# Tru64 expr mishandles leading zeros in numeric strings.
+# Detect these flaws.
 m4_defun([_AS_EXPR_PREPARE],
-[if expr a : '\(a\)' >/dev/null 2>&1; then
+[if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
 else
   as_expr=false