autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AS_EXECUTABLE_P, rev 2


From: Tim Van Holder
Subject: AS_EXECUTABLE_P, rev 2
Date: Tue, 23 Jan 2001 22:02:33 +0100

OK - now revised to use _ASEOF as here-document separator.
Also tested using Cygwin's bash - like the DJGPP version,
test -x returns true when run against a simple shell
script (as well as when run against 'foo' if only foo.exe
exists).

2001-01-23      Tim Van Holder <address@hidden>

        * m4sh.m4 (AS_EXECUTABLE_P, _AS_TEST_PREPARE):
        New macros.
        (AS_SANITIZE_SHELL): Call _AS_TEST_PREPARE.
        * acgeneral.m4 (AC_CHECK_PROG, AC_PATH_PROG): Use
        AS_EXECUTABLE_P instead of test -f.

Index: m4sh.m4
===================================================================
RCS file: /cvs/autoconf/m4sh.m4,v
retrieving revision 1.27
diff -u -r1.27 m4sh.m4
--- m4sh.m4     2001/01/22 08:59:02     1.27
+++ m4sh.m4     2001/01/23 20:54:58
@@ -67,6 +67,7 @@
 fi
 
 _AS_EXPR_PREPARE
+_AS_TEST_PREPARE
 _AS_UNSET_PREPARE
 
 # NLS nuisances.
@@ -288,6 +289,15 @@
 AS_DIRNAME_SED([$1])])
 
 
+# AS_EXECUTABLE_P
+# ---------------
+# Check whether a file is executable.
+m4_defun([AS_EXECUTABLE_P],
+[m4_require([_AS_TEST_PREPARE])dnl
+$as_executable_p [$1]dnl
+])# AS_EXECUTABLE_P
+
+
 # _AS_EXPR_PREPARE
 # ----------------
 # Some expr work properly (i.e. compute and issue the right result),
@@ -298,7 +308,7 @@
   as_expr=expr
 else
   as_expr=false
-fi[]dnl
+fi
 ])# _AS_EXPR_PREPARE
 
 
@@ -322,6 +332,28 @@
   esac
 done; }
 ])# AS_MKDIR_P
+
+# _AS_TEST_PREPARE
+# ----------------
+# Find out ahead of time whether we want test -x (preferred) or test -f
+# to check whether a file is executable.
+m4_defun([_AS_TEST_PREPARE],
+[# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conftest.file <<_ASEOF
address@hidden:@! /bin/sh
+exit 0
+_ASEOF
+chmod 100 conftest.file
+if test -x conftest.file; then
+  as_executable_p="test -x"
+elif test -f conftest.file; then
+  as_executable_p="test -f"
+else
+  AS_ERROR([Can't check whether a file is executable on this system])
+fi
+rm -f conftest.file
+])# _AS_TEST_PREPARE
 
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]