]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/m4sugar/m4sh.m4 (AS_TEST_X): New macro.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 11 Oct 2006 21:50:57 +0000 (21:50 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 11 Oct 2006 21:50:57 +0000 (21:50 +0000)
(AS_EXECUTABLE_P): Use as_test_x rather than as_executable_p.
(_AS_TEST_PREPARE): Set as_test_x rather than as_executable_p.
Use a better substitute, by inspecting the output of "ls"
rather than just using ":".
* lib/autoconf/general.m4 (_AC_LINK_IFELSE): Use AS_TEST_X
rather than AS_EXECUTABLE_P, since we needn't worry about
non-regular files here.

ChangeLog
lib/autoconf/general.m4
lib/m4sugar/m4sh.m4

index 32815e253b38c532eb46ee1d85248a917f82d571..93b861fe4ae273cc19856a07eb9380687369c492 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2006-10-11  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * lib/m4sugar/m4sh.m4 (AS_TEST_X): New macro.
+       (AS_EXECUTABLE_P): Use as_test_x rather than as_executable_p.
+       (_AS_TEST_PREPARE): Set as_test_x rather than as_executable_p.
+       Use a better substitute, by inspecting the output of "ls"
+       rather than just using ":".
+       * lib/autoconf/general.m4 (_AC_LINK_IFELSE): Use AS_TEST_X
+       rather than AS_EXECUTABLE_P, since we needn't worry about
+       non-regular files here.
+
        * NEWS: Autoconf-generated shell scripts no longer export BIN_SH,
        due to configuration hassles with this.  See Tonya Underwood's report
        <http://lists.gnu.org/archive/html/bug-autoconf/2006-10/msg00003.html>.
index eeb77485df84b9728792d2d80dec70fa5cd7c352..7dd2e1f1124988fed8da855a47b815206dc04ff6 100644 (file)
@@ -2394,7 +2394,7 @@ AS_IF([_AC_DO_STDERR($ac_link) && {
         test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest$ac_exeext &&
-       AS_EXECUTABLE_P([conftest$ac_exeext])],
+       AS_TEST_X([conftest$ac_exeext])],
       [$2],
       [_AC_MSG_LOG_CONFTEST
        $3])
index b74fdcb7ea59d8324bdb4abb70ebdac239b34ffa..e577a88735211566397535c7a27222041ae4ffe7 100644 (file)
@@ -784,12 +784,21 @@ fi
 ])# _AS_DIRNAME_PREPARE
 
 
+# AS_TEST_X
+# ---------
+# Check whether a file has executable or search permissions.
+m4_defun([AS_TEST_X],
+[AS_REQUIRE([_AS_TEST_PREPARE])dnl
+$as_test_x $1[]dnl
+])# AS_EXECUTABLE_P
+
+
 # AS_EXECUTABLE_P
 # ---------------
-# Check whether a file is executable.
+# Check whether a file is a regular file that has executable permissions.
 m4_defun([AS_EXECUTABLE_P],
 [AS_REQUIRE([_AS_TEST_PREPARE])dnl
-{ test -f $1 && $as_executable_p $1; }dnl
+{ test -f $1 && AS_TEST_X([$1]); }dnl
 ])# AS_EXECUTABLE_P
 
 
@@ -1019,13 +1028,37 @@ esac[]dnl
 
 # _AS_TEST_PREPARE
 # ----------------
-# Find out ahead of time whether ``test -x'' can be used to distinguish
-# executables from other regular files.
+# Find out whether `test -x' works.  If not, prepare a substitute
+# that should work well enough for most scripts.
+#
+# Here are some of the problems with the substitute.
+# The 'ls' tests whether the owner, not the current user, can execute/search.
+# The eval means '*', '?', and '[' cause inadvertent file name globbing
+# after the 'eval', so jam together as many tokens as we can to minimize
+# the likelihood that the inadvertent globbing will actually do anything.
+# Luckily, this gorp is needed only on really ancient hosts.
+#
 m4_defun([_AS_TEST_PREPARE],
 [if test -x / >/dev/null 2>&1; then
-  as_executable_p='test -x'
+  as_test_x='test -x'
 else
-  as_executable_p=:
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$[]1"; then
+        test -d "$[]1/.";
+      else
+       case $[]1 in
+        -*)set "./$[]1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$[]1" 2>/dev/null` in
+       ???[[sx]]*):;;*)false;;esac;fi
+    '\'' sh
+  '
 fi
 ])# _AS_TEST_PREPARE