]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
m4sh: make AS_EXECUTABLE_P public
authorEric Blake <eblake@redhat.com>
Sat, 25 Feb 2012 04:54:39 +0000 (21:54 -0700)
committerEric Blake <eblake@redhat.com>
Sat, 25 Feb 2012 05:12:07 +0000 (22:12 -0700)
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>
NEWS
doc/autoconf.texi
lib/m4sugar/m4sh.m4

diff --git a/NEWS b/NEWS
index decad47bac998b33a2b0a7c97937033e9a73797b..1a5f775e9e1f1b9ef3ba73ac5393c317db14cf7b 100644 (file)
--- 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'
index 9c75ab0898e67bacecb8e198000394ae230f8a8a..83f24ba0b8d02837b8abe37bf3a8cab3aa1350cf 100644 (file)
@@ -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{$?}.
index 9cf1d071d45fb351f8a67098736bc58a0951d1ab..91fc0fb203461e56f698d82f2c18c0513fc19330 100644 (file)
@@ -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