[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] m4sh: make AS_EXECUTABLE_P public
From: |
Eric Blake |
Subject: |
[PATCH] m4sh: make AS_EXECUTABLE_P public |
Date: |
Fri, 24 Feb 2012 22:11:58 -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 <address@hidden>
---
Any thoughts about this as a followup? I will probably apply
it prior to cutting the pre-2.69 beta later this weekend.
NEWS | 2 ++
doc/autoconf.texi | 7 +++++++
lib/m4sugar/m4sh.m4 | 10 +++++++---
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index decad47..1a5f775 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 9c75ab0..83f24ba 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -13658,6 +13658,13 @@ Common Shell Constructs
@end example
@end defmac
address@hidden AS_EXECUTABLE_P (@var{file})
address@hidden
+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}.
address@hidden 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 9cf1d07..fbb258e 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
--
1.7.7.6
- [PATCH] m4sh: make AS_EXECUTABLE_P public,
Eric Blake <=