* 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.
This commit is contained in:
Paul Eggert 2006-10-11 21:50:57 +00:00
parent 520f7f02ed
commit 1681d462cb
3 changed files with 49 additions and 7 deletions

View File

@ -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>.

View 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])

View 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