Hello,
On Fri, Oct 06, 2006 at 05:49:04PM +0200, Stepan Kasal wrote:
> I will break the patch into the ``individual parts'' and add my
> comments tomorrow.
I apologize I'm late. Paul's patch contained 4 changes:
1) Do not play with /usr/bin/posix nor BIN_SH.
This was the main part of the patch; I slightly modified the comment
above _AS_DETECT_BETTER_SHELL, see autoconf-20061009-bin-sh-1.patch,
attached.
Ralf has approved the idea, so I guess I can commit this, unless a
mistake is found.
2) Set DUALCASE in AS_SHELL_SANITIZE instead of AS_BOURNE_COMPATIBLE.
This was discussed in
http://lists.gnu.org/archive/html/autoconf-patches/2006-04/msg00128.html
Updated version of the proposal is attached here as
autoconf-20061009-bin-sh-2.patch , to be applied after patch 1).
OK to commit?
3) AS_EXECUTABLE_P is reduced to `test -x' (on modern hosts).
(See the attached autoconf-20061009-bin-sh-3.patch.)
IIRC, the current implementation of AS_EXECUTABLE_P is a result of a
long discussion. In particular, mere `test -x' was refused because
it is true for a directory, and one might encounter a directory named
`perl' somewhere in PATH.
I think it is best to keep the current implementation.
4) Use AS_EXECUTABLE_P in _AS_DETECT_BETTER_SHELL.
(See autoconf-20061009-bin-sh-4.patch, also attached.)
This depends on 3) and introduces problems reported by Ralf.
To sum up: I suggest to accept 1), 2) and reject 3), 4).
Comments welcome.
Stepan kasal
2006-10-04 Paul Eggert <[EMAIL PROTECTED]>
Stepan Kasal <[EMAIL PROTECTED]>
* doc/autoconf.texi (Special Shell Variables): Autoconf-generated
shell scripts no longer export BIN_SH, due to configuration
hassles with this. See, for example, Tonya Underwood's report
<http://lists.gnu.org/archive/html/bug-autoconf/2006-10/msg00003.html>.
* lib/m4sugar/m4sh.m4 (AS_BOURNE_COMPATIBLE): Don't set BIN_SH.
(_AS_DETECT_BETTER_SHELL): Don't look in /usr/bin/posix.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1090
diff -u -r1.1090 autoconf.texi
--- doc/autoconf.texi 6 Oct 2006 15:31:26 -0000 1.1090
+++ doc/autoconf.texi 9 Oct 2006 14:04:18 -0000
@@ -11891,7 +11891,6 @@
@evindex BIN_SH
In Tru64, if @env{BIN_SH} is set to @code{xpg4}, subsidiary invocations of
the standard shell conform to Posix.
-Autoconf-generated scripts export this variable when they start up.
@item CDPATH
@evindex CDPATH
Index: lib/m4sugar/m4sh.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
retrieving revision 1.196
diff -u -r1.196 m4sh.m4
--- lib/m4sugar/m4sh.m4 6 Oct 2006 15:31:26 -0000 1.196
+++ lib/m4sugar/m4sh.m4 9 Oct 2006 14:04:19 -0000
@@ -161,9 +161,10 @@
# --------------------
# Try to be as Bourne and/or POSIX as possible.
#
-# FIXME: The assignment to BIN_SH is dubious; see
+# This does not set BIN_SH, due to the problems described in
# <http://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
-# It might be better to remove it, but first please see
+# People who need BIN_SH should set it in their environment before invoking
+# configure; apparently this would include UnixWare, as described in
# <http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00025.html>.
m4_define([AS_BOURNE_COMPATIBLE],
[# Be Bourne compatible
@@ -177,7 +178,6 @@
else
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
])
@@ -223,16 +223,14 @@
# The real workhorse for detecting a shell with the correct
# features.
#
-# FIXME: The '/usr/bin/posix' below works around a shell bug in OSF
-# <http://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>
-# but this causes a regression on OpenServer 6.0.0
+# In previous versions, we prepended /usr/posix/bin to the path, but that
+# caused a regression on OpenServer 6.0.0
# <http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00017.html>
-# The code should test for the OSF bug directly rather than look at
-# /usr/bin/posix here.
+# and on HP-UX 11.11, see the failure of test 120 in
+# <http://lists.gnu.org/archive/html/bug-autoconf/2006-10/msg00003.html>
#
-# FIXME: The 'test -f "$as_shell.exe"' works around a problem in OS/2
-# <http://lists.gnu.org/archive/html/autoconf/2006-06/msg00038.html>
-# but we should replace the two test -f calls with a single AS_EXECUTABLE_P.
+# FIXME: The code should test for the OSF bug described in
+# <http://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
#
m4_defun_once([_AS_DETECT_BETTER_SHELL],
[m4_wrap([m4_divert_text([M4SH-SANITIZE], [
@@ -245,7 +243,7 @@
_AS_RUN([_AS_DETECT_SUGGESTED_BODY]) 2> /dev/null],
[],
[as_candidate_shells=
-
_AS_PATH_WALK([/usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
+ _AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
[case $as_dir in
/*)
for as_base in sh bash ksh sh5; do
2006-10-09 Stepan Kasal <[EMAIL PROTECTED]>
* lib/m4sugar/m4sh.m4 (AS_BOURNE_COMPATIBLE): Move the
initialization which is not inherited through the environment
(_AS_BOURNE_COMPATIBLE): ... to this new macro.
(_AS_RUN): Call _AS_BOURNE_COMPATIBLE, not AS_BOURNE_COMPATIBLE.
--- lib/m4sugar/m4sh.m4 2006-10-09 16:13:03.000000000 +0200
+++ lib/m4sugar/m4sh.m4 2006-10-09 16:07:03.000000000 +0200
@@ -167,18 +167,24 @@
# configure; apparently this would include UnixWare, as described in
# <http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00025.html>.
m4_define([AS_BOURNE_COMPATIBLE],
-[# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
+[# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+_$0
+])
+
+# _AS_BOURNE_COMPATIBLE
+# ---------------------
+# This is the part of AS_BOURNE_COMPATIBLE which has to be repeated inside
+# each instance.
+m4_define([_AS_BOURNE_COMPATIBLE],
+[AS_IF([test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1],
+ [emulate sh
NULLCMD=:
[#] Zsh 3.x and 4.x performs word splitting on ${1+"[EMAIL PROTECTED]"},
which
# is contrary to our usage. Disable this feature.
alias -g '${1+"[EMAIL PROTECTED]"}'='"[EMAIL PROTECTED]"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
+ setopt NO_GLOB_SUBST],
+ [AS_CASE([`(set -o) 2>/dev/null`], [*posix*], [set -o posix])])
])
@@ -189,7 +195,7 @@
m4_define([_AS_RUN],
[m4_ifval([$2],
[{ $2 <<\_ASEOF
-AS_BOURNE_COMPATIBLE
+_AS_BOURNE_COMPATIBLE
$1
_ASEOF
}],
2006-10-04 Paul Eggert <[EMAIL PROTECTED]>
* lib/m4sugar/m4sh.m4 (AS_EXECUTABLE_P): Just invoke as_executable_p.
(_AS_TEST_PREPARE): Default to test -f, rather than to nothing.
Index: lib/m4sugar/m4sh.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -r1.194 -r1.195
--- lib/m4sugar/m4sh.m4 4 Oct 2006 18:53:19 -0000 1.194
+++ lib/m4sugar/m4sh.m4 4 Oct 2006 21:16:06 -0000 1.195
@@ -785,7 +785,7 @@
# Check whether a file is executable.
m4_defun([AS_EXECUTABLE_P],
[AS_REQUIRE([_AS_TEST_PREPARE])dnl
-{ test -f $1 && $as_executable_p $1; }dnl
+$as_executable_p $1[]dnl
])# AS_EXECUTABLE_P
@@ -1021,7 +1021,7 @@
[if test -x / >/dev/null 2>&1; then
as_executable_p='test -x'
else
- as_executable_p=:
+ as_executable_p='test -f'
fi
])# _AS_TEST_PREPARE
2006-10-04 Paul Eggert <[EMAIL PROTECTED]>
* lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): Use AS_EXECUTABLE_P
rather than test -f.
Index: lib/m4sugar/m4sh.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -r1.194 -r1.195
--- lib/m4sugar/m4sh.m4 4 Oct 2006 18:53:19 -0000 1.194
+++ lib/m4sugar/m4sh.m4 4 Oct 2006 21:16:06 -0000 1.195
@@ -255,7 +255,7 @@
for as_shell in $as_candidate_shells $SHELL; do
# Try only shells that exist, to save several forks.
- AS_IF([{ test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ AS_IF([AS_EXECUTABLE_P(["$as_shell"]) &&
_AS_RUN([_AS_DETECT_REQUIRED_BODY],
[("$as_shell") 2> /dev/null])],
[CONFIG_SHELL=$as_shell