[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Rejecting dash because it lacks +=?
From: |
Eric Blake |
Subject: |
Re: Rejecting dash because it lacks +=? |
Date: |
Thu, 30 Oct 2008 15:48:07 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Paolo Bonzini <bonzini <at> gnu.org> writes:
> 2) The AS_VAR_APPEND technique, right now, does not give any speedup in
> Autoconf-generated scripts, as far as I could read.
It depends on how many appends are taking place. It matters more for coreutils
than m4, for example, because coreutils generates a longer as_func_list based
on its use of AC_CHECK_FUNCS_ONCE.
> Nevertheless, we
> are rejecting all shells that do not support +=. This, unlike LINENO,
> is a pity, because it means that for everybody who's not using bash or
> zsh, but has it installed, the scripts will rerun in bash or zsh. This
> means in turn that we get much less coverage of shells in the wild.
POSIX requires $LINENO (dash is buggy for not providing it). It does not
require +=. So, I can agree with your reluctance on rejecting shells that do
not provide POSIX extensions. How about a patch to AS_VAR_APPEND that removes
the _AS_DETECT_SUGGESTED line, along with a policy that M4sh will never
_AS_DETECT a non-POSIX feature? (M4sh clients could still suggest non-POSIX
extensions, if we were to ever export and document a public version of
_AS_DETECT_*, but that would be their choice to omit dash support, and not
forced on them by M4sh.)
I'm committing this:
>From 5184bb08838be30118ac26710a1f31bb673c062f Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 30 Oct 2008 09:39:57 -0600
Subject: [PATCH] Don't check for non-POSIX extensions in suggested tests.
* lib/m4sugar/m4sh.m4 (_AS_VAR_APPEND_WORKS): Remove suggestion;
we still use += if available, but should not reject shells that
don't provide it.
(_AS_DETECT_SUGGESTED): Document a policy for m4sh.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 8 ++++++++
lib/m4sugar/m4sh.m4 | 7 ++++++-
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e19a3f6..914f83b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2008-10-30 Eric Blake <address@hidden>
+ Don't check for non-POSIX extensions in suggested tests.
+ * lib/m4sugar/m4sh.m4 (_AS_VAR_APPEND_WORKS): Remove suggestion;
+ we still use += if available, but should not reject shells that
+ don't provide it.
+ (_AS_DETECT_SUGGESTED): Document a policy for m4sh.
+
+2008-10-30 Eric Blake <address@hidden>
+
Work around Solaris /bin/sh case bug.
* lib/m4sugar/m4sh.m4 (_AS_CASE, _AS_CASE_DEFAULT): Always provide
a non-empty command list.
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 1f1f599..bf18235 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -173,6 +173,9 @@ m4_define([_AS_DETECT_EXPAND],
# -------------------------
# Refuse to execute under a shell that does not pass the given TEST.
# Does not do AS_REQUIRE for the better-shell detection code.
+#
+# M4sh should never require something not required by POSIX, although
+# other clients are free to do so.
m4_defun([_AS_DETECT_REQUIRED],
[m4_set_add([_AS_DETECT_REQUIRED_BODY], [$1 || AS_EXIT])])
@@ -181,6 +184,9 @@ m4_defun([_AS_DETECT_REQUIRED],
# --------------------------
# Prefer to execute under a shell that passes the given TEST.
# Does not do AS_REQUIRE for the better-shell detection code.
+#
+# M4sh should never suggest something not required by POSIX, although
+# other clients are free to do so.
m4_defun([_AS_DETECT_SUGGESTED],
[m4_set_add([_AS_DETECT_SUGGESTED_BODY], [$1 || AS_EXIT])])
@@ -1679,7 +1685,6 @@ m4_define([_AS_VAR_APPEND_WORKS],
# Note that unlike AS_VAR_SET, VALUE must be properly quoted to avoid
# field splitting and file name expansion.
m4_defun_init([AS_VAR_APPEND],
-[_AS_DETECT_SUGGESTED([_AS_VAR_APPEND_WORKS])]dnl
[AS_REQUIRE([_AS_VAR_APPEND_PREPARE], [], [M4SH-INIT-FN])],
[as_func_append $1 $2])
--
1.6.0.2