summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2012-02-24 21:54:39 -0700
committerEric Blake <eblake@redhat.com>2012-02-24 22:12:07 -0700
commit9e4e0a37d7b7200f671c2eadb3478a77d2dd7c9c (patch)
tree5f55e14c9955633b4c98848a99db6612bb6a0a18
parent8798792f568d7cdfb0815d249fe6a718d6877708 (diff)
downloadautoconf-9e4e0a37d7b7200f671c2eadb3478a77d2dd7c9c.tar.gz
m4sh: make AS_EXECUTABLE_P public
In the process of making it public, factor it into a reusable function. This makes constructs like AC_CHECK_PROGRAM smaller, as well as making libtool's naughty use of $as_executable_p safer. * lib/m4sugar/m4sh.m4 (_AS_TEST_PREPARE): Add a shell function. (AS_EXECUTABLE_P): Forward to shell function. * doc/autoconf.texi (Common Shell Constructs): Document it. * NEWS: Mention this. Signed-off-by: Eric Blake <eblake@redhat.com>
-rw-r--r--NEWS2
-rw-r--r--doc/autoconf.texi7
-rw-r--r--lib/m4sugar/m4sh.m48
3 files changed, 15 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index decad47b..1a5f775e 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,8 @@ GNU Autoconf NEWS - User visible changes.
** AS_LITERAL_IF again treats '=' as a literal. Regression introduced in
2.66.
+** The macro AS_EXECUTABLE_P, present since 2.50, is now documented.
+
** Macros
- AC_PROG_LN_S and AS_LN_S now fall back on 'cp -pR' (not 'cp -p') if 'ln -s'
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 9c75ab08..83f24ba0 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -13658,6 +13658,13 @@ m4_bpatsubst([[@var{string}]], ['], ['\\''])
@end example
@end defmac
+@defmac AS_EXECUTABLE_P (@var{file})
+@asindex{EXECUTABLE_P}
+Emit code to probe whether @var{file} is a regular file with executable
+permissions (and not a directory with search permissions). The caller
+is responsible for quoting @var{file}.
+@end defmac
+
@defmac AS_EXIT (@dvar{status, $?})
@asindex{EXIT}
Emit code to exit the shell with @var{status}, defaulting to @samp{$?}.
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 9cf1d071..91fc0fb2 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -1097,7 +1097,7 @@ m4_defun_init([AS_TEST_X],
# Check whether a file is a regular file that has executable permissions.
m4_defun_init([AS_EXECUTABLE_P],
[AS_REQUIRE([_AS_TEST_PREPARE])],
-[{ test -f $1 && test -x $1; }])# AS_EXECUTABLE_P
+[as_fn_executable_p $1])# AS_EXECUTABLE_P
# _AS_EXPR_PREPARE
@@ -1378,8 +1378,12 @@ m4_define([_AS_TEST_X_WORKS], [test -x /])
# Provide back-compat to people that hooked into our undocumented
# internals (here's looking at you, libtool).
m4_defun([_AS_TEST_PREPARE],
+[AS_REQUIRE_SHELL_FN([as_fn_executable_p],
+ [AS_FUNCTION_DESCRIBE([as_fn_executable_p], [FILE],
+ [Test if FILE is an executable regular file.])],
+ [ test -f "$[]1" && test -x "$[]1"])]dnl
[as_test_x='test -x'
-as_executable_p=$as_test_x
+as_executable_p=as_fn_executable_p
])# _AS_TEST_PREPARE