Hello,

On Thu, Apr 06, 2006 at 02:08:27PM +0200, Ralf Wildenhues wrote:
> I also think BIN_SH should be set in AS_BOURNE_COMPATIBLE, not in
> AS_SHELL_SANITIZE, but am less certain about that.

yes, you are probably right.  But it's even more clear that the
DUALCASE really belongs there: the documentation says that
AS_BOURNE_COMPATIBLE makes the shell more compatible with Bourne
shell, and DUALCASE immediately affects the running shell.

But these two settings are not needed inside _AS_RUN, which is why
I moved them out of AS_BOURNE_COMPATIBLE previously.

Would the following patch be OK?

Stepan
2006-04-06  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Do not set DUALCASE.
        (AS_BOURNE_COMPATIBLE): Set it here, and set BIN_SH=xpg4, factor out
          the rest...
        (_AS_BOURNE_COMPATIBLE): ... to this new macro.
        (_AS_RUN): Call _AS_BOURNE_COMPATIBLE instead of AS_BOURNE_COMPATIBLE.
        * doc/autoconf.texi (Special Shell Variables) <BIN_SH>: Document that
          we set it again.

Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.985
diff -u -r1.985 autoconf.texi
--- doc/autoconf.texi   6 Apr 2006 07:58:20 -0000       1.985
+++ doc/autoconf.texi   6 Apr 2006 13:02:49 -0000
@@ -11197,6 +11197,7 @@
 @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.175
diff -u -r1.175 m4sh.m4
--- lib/m4sugar/m4sh.m4 5 Apr 2006 08:01:05 -0000       1.175
+++ lib/m4sugar/m4sh.m4 6 Apr 2006 13:02:50 -0000
@@ -161,17 +161,26 @@
 # --------------------
 # Try to be as Bourne and/or POSIX as possible.
 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
+# BIN_SH doesn't affect this shell, but the user may call `/bin/sh'.
+BIN_SH=xpg4; export BIN_SH # for Tru64
+_$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
+  setopt NO_GLOB_SUBST],
+ [AS_CASE([`(set -o) 2>/dev/null`], [*posix*], [set -o posix])])
 ])
 
 
@@ -182,7 +191,7 @@
 m4_define([_AS_RUN],
 [m4_ifval([$2],
 [{ $2 <<\_ASEOF
-AS_BOURNE_COMPATIBLE
+_AS_BOURNE_COMPATIBLE
 $1
 _ASEOF
 }],
@@ -322,7 +331,6 @@
 ## --------------------- ##
 
 AS_BOURNE_COMPATIBLE
-DUALCASE=1; export DUALCASE # for MKS sh
 
 # PATH needs CR
 _AS_CR_PREPARE

Reply via email to