[Top][All Lists]

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

AC_CHECK_PROG and 'test -x'

From: Sander Niemeijer
Subject: AC_CHECK_PROG and 'test -x'
Date: Mon, 23 Dec 2002 15:57:35 +0100

Hi all,

I have send the e-mail below more then a month ago to the bug-autoconf list without receiving any reaction. The problem is still there that _AS_TEST_PREPARE as used by AS_EXECUTABLE_P, as used by AC_CHECK_PROG, is only using 'test -f', which only tests whether we have a file at hand. I am still missing the test for executability of the file with a 'test -x' (currently I have a problem on a system of a user that has an 'install' script without execution permission as first entry in the list of possible 'install' executables. Of course the user could circumvent the problem himself by reordering his PATH entries, but I would rather have configure deal with this).

Furthermore, I figured out that the proposal I made in the previous e-mail wouldn't work, since a 'test -x' without a 'test -f' would also allow directories with executable permissions to be used for a AC_CHECK_PROG. So the check that should actually be done by AC_CHECK_PROG is a 'test -f <file> && test -x <file>'

So here are some questions I hope people on this list can give me an answer to:

1) Is AS_EXECUTABLE_P only intended to test for executability in general or for executability of a *file*? (this determines whether AS_EXECUTABLE_P should only perform a 'test -x' or also a 'test -f')

2) Is 'test -x' portable (i.e. is the -x option available on all systems for which autoconf is supported, and does the -x option have the same semantics on all these systems).

3) Is anyone one the list willing to implement any changes to support 'test -x' for AC_CHECK_PROG, or do I have to device a patch myself (since we are now in the holiday season I may have some time to do this myself :-)

Sander Niemeijer

On Tuesday, November 19, 2002, at 05:20 PM, Sander Niemeijer wrote:

It seems that in the _AS_TEST_PREPARE part of the m4sugar/m4sh.m4 file, as_executable_p is not set to 'test -x' if this can be done. An old seemingly 'buggy' version was renamed to _AS_BROKEN_TEST_PREPARE. I was wondering whether the old test can't be rewritten to test executability of '/bin/sh' (which is always available and executable, right?). This would turn it into something like:

[if test -x /bin/sh >/dev/null 2>&1; then
  as_executable_p="test -x"
elif test -f /bin/sh >/dev/null 2>&1; then
  as_executable_p="test -f"
  AS_ERROR([cannot check whether a file is executable on this system])

Anybody got any idea whether this is a portable solution?


reply via email to

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