From: Eric Blake Date: Sat, 25 Feb 2012 04:54:39 +0000 (-0700) Subject: m4sh: make AS_EXECUTABLE_P public X-Git-Tag: v2.68b~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e4e0a37d7b7200f671c2eadb3478a77d2dd7c9c;p=thirdparty%2Fautoconf.git 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 --- 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