]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
(_AS_BASENAME_PREPARE): New macro.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 27 Mar 2002 20:33:03 +0000 (20:33 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 27 Mar 2002 20:33:03 +0000 (20:33 +0000)
(AS_SHELL_SANITIZE): Invoke it.
(AS_BASENAME): AS_REQUIRE it, and use $as_basename.

lib/m4sugar/m4sh.m4

index 5bcefe4c26246aa6326d114d8c7e69d54a0d8465..d7a86a8f51ca84b9d97f4f64f9a2778470a0a68f 100644 (file)
@@ -162,6 +162,7 @@ m4_foreach([_AS_var],
 ])
 
 # Name of the executable.
+_AS_BASENAME_PREPARE
 as_me=`AS_BASENAME("$[0]")`
 
 # PATH needs CR, and LINENO needs CR and PATH.
@@ -431,7 +432,8 @@ m4_defun([AS_BASENAME_SED],
          s/.*/./; q']])
 
 m4_defun([AS_BASENAME],
-[(basename $1) 2>/dev/null ||
+[AS_REQUIRE([_$0_PREPARE])dnl
+$as_basename $1 ||
 AS_BASENAME_EXPR([$1]) 2>/dev/null ||
 AS_BASENAME_SED([$1])])
 
@@ -445,6 +447,17 @@ $as_executable_p $1[]dnl
 ])# AS_EXECUTABLE_P
 
 
+# _AS_BASENAME_PREPARE
+# --------------------
+# Avoid Solaris 9 /usr/ucb/basename, as `basename /' outputs an empty line.
+m4_defun([_AS_BASENAME_PREPARE],
+[if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+])# _AS_BASENAME_PREPARE
+
 # _AS_EXPR_PREPARE
 # ----------------
 # Some expr work properly (i.e. compute and issue the right result),