[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 01-as-require-shell-fn.patch
From: |
Akim Demaille |
Subject: |
Re: 01-as-require-shell-fn.patch |
Date: |
Wed, 26 Nov 2003 14:57:55 +0100 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
| Ok, this is clearer now. I hope this can be the last iteration.
| Paolo
It looks good, indeed.
| 2003-11-26 Paolo Bonzini <address@hidden>
|
| * lib/m4sugar/m4sh.m4 (_AS_BOURNE_COMPATIBLE):
| Extracted from AS_SHELL_SANITIZE.
| (_AS_SHELL_FUNCTIONS_WORK, AS_INIT_WITH_SHFN): New
| macros.
| (AS_SHELL_SANITIZE): Move reinvocation code from
| _AS_LINENO_WORKS, use it to find out if shell
| functions work.
| (_AS_LINENO_WORKS): Use manual solution if $LINENO
| does not work.
| (AS_INIT): Pass parameter down to AS_SHELL_SANITIZE.
| (AS_REQUIRE_SHELL_FN): Test that AS_INIT_WITH_SHFN
| was called.
| * lib/autotest/general.m4: Use AS_INIT_WITH_SHFN.
| * bin/autoconf.in: Regenerate.
| * tests/wrapper.in: Regenerate.
| * tests/tools.at: Test the syntax of tests/autoconf
| and tests/testsuite.
You can use wider space. And also, the last time your ChangeLog has
leading spaces, instead of tabs.
| Index: lib/autotest/general.m4
| ===================================================================
| RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
| retrieving revision 1.153
| diff -u -r1.153 general.m4
| --- lib/autotest/general.m4 26 Sep 2003 08:12:39 -0000 1.153
| +++ lib/autotest/general.m4 26 Nov 2003 10:29:33 -0000
| @@ -142,7 +142,7 @@
| m4_defn([AT_PACKAGE_STRING])[ test suite]m4_ifval([$1], [: $1]))
| m4_define([AT_ordinal], 0)
| m4_define([AT_banner_ordinal], 0)
| -AS_INIT
| +AS_INIT_WITH_SHFN
| AS_PREPARE
| m4_divert_push([DEFAULTS])dnl
|
| Index: lib/m4sugar/m4sh.m4
| ===================================================================
| RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
| retrieving revision 1.107
| diff -u -r1.107 m4sh.m4
| --- lib/m4sugar/m4sh.m4 24 Nov 2003 10:44:52 -0000 1.107
| +++ lib/m4sugar/m4sh.m4 26 Nov 2003 10:29:33 -0000
| @@ -141,20 +141,18 @@
| # xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.
| #
| m4_define([AS_REQUIRE_SHELL_FN],
| -[m4_provide_if([AS_SHELL_FN_$1], [],
| +[m4_provide_if([AS_INIT_WITH_SHFN],
| + [m4_warn([syntax], [AS_INIT_WITH_SHFN not called.])])dnl
| +m4_provide_if([AS_SHELL_FN_$1], [],
| [m4_provide([AS_SHELL_FN_$1])m4_divert_text([M4SH-INIT],
[$1() {
| $2
| }])])])
We should stick to a single name, be it SHELL_FUNCTION, or SHELL_FN,
or SHFN, but no mixture. AS_INIT_WITH_SHELL_FN seems fine.
| -# AS_SHELL_SANITIZE
| -# -----------------
| +# _AS_BOURNE_COMPATIBLE
| +# ---------------------
| # Try to be as Bourne and/or POSIX as possible.
| -m4_defun([AS_SHELL_SANITIZE],
| -[## --------------------- ##
| -## M4sh Initialization. ##
| -## --------------------- ##
| -
| +m4_define([_AS_BOURNE_COMPATIBLE], [
Please, keep the current style, which has [ and ] at the first column.
| # Be Bourne compatible
| if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
| emulate sh
| @@ -166,9 +164,112 @@
| set -o posix
| fi
| DUALCASE=1; export DUALCASE # for MKS sh
| +])
| +
| +
| +# _AS_SHELL_FUNCTIONS_WORK(TESTED-SHELL)
| +# --------------------------------------------------
| +# This is a spy to detect "in the wild" shells that do not support shell
| +# functions correctly. It is based on the m4sh.at Autotest testcases.
| +m4_define([_AS_SHELL_FUNCTIONS_WORK],
| +[{ $1 <<\EOF
| +_AS_BOURNE_COMPATIBLE
| +func_return () {
| + (exit [$]1)
| +}
| +
| +func_success () {
| + func_return 0
| +}
| +
| +func_failure () {
| + func_return 1
| +}
| +
| +func_ret_success () {
| + return 0
| +}
| +
| +func_ret_failure () {
| + return 1
| +}
| +
| +exitcode=0
| +AS_IF([func_success], [], [
| + exitcode=1
| + echo func_failure succeeded.
| +])
| +AS_IF([func_failure], [
| + exitcode=1
| + echo func_success failed.
| +])
| +AS_IF([func_ret_success], [], [
| + exitcode=1
| + echo func_ret_success failed.
| +])
| +AS_IF([func_ret_failure], [
| + exitcode=1
| + echo func_ret_failure succeeded.
| +])
| +AS_EXIT($exitcode)
| +EOF
| +}])
EOF is not allowed to maintainers. Use _?ASEOF. I would suggest
having a file conftest.sh that contains this, to factor the two calls
below. But it is a detail.
| +# AS_SHELL_SANITIZE(WHAT-IF-SHELL-FUNCTIONS-DO-NOT-WORK)
| +# ------------------------------------------------------
| +# The parameter is temporary; it will go away and you
| +# should not rely on it.
| +m4_defun([AS_SHELL_SANITIZE],
| +[## --------------------- ##
| +## M4sh Initialization. ##
| +## --------------------- ##
| +
| +_AS_BOURNE_COMPATIBLE
| +
| +# PATH needs CR
| +_AS_CR_PREPARE
| +_AS_PATH_SEPARATOR_PREPARE
| _AS_UNSET_PREPARE
|
| +# Find who we are. Look in the path if we contain no path at all
| +# relative or not.
| +case $[0] in
| + *[[\\/]]* ) as_myself=$[0] ;;
| + *) _AS_PATH_WALK([],
| + [test -r "$as_dir/$[0]" && as_myself=$as_dir/$[0] && break])
| + ;;
| +esac
| +# We did not find ourselves, most probably we were run as `sh COMMAND'
| +# in which case we are not to be found in the path.
| +if test "x$as_myself" = x; then
| + as_myself=$[0]
| +fi
| +if test ! -f "$as_myself"; then
| + AS_ERROR([cannot find myself; rerun with an absolute path])
| +fi
| +
| +dnl In the future, the `else' branch will be that in AS_INIT_WITH_SHFN.
| +AS_IF([_AS_SHELL_FUNCTIONS_WORK([$SHELL])], [], [
| + case $CONFIG_SHELL in
| + '')
| + _AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
| + [for as_base in sh bash ksh sh5; do
| + case $as_dir in
| + /*)
| + AS_IF([_AS_SHELL_FUNCTIONS_WORK([$as_dir/$as_base])], [
| + AS_UNSET(BASH_ENV)
| + AS_UNSET(ENV)
| + CONFIG_SHELL=$as_dir/$as_base
| + export CONFIG_SHELL
| + exec "$CONFIG_SHELL" "$as_myself" ${1+"address@hidden"}
| + ]);;
| + esac
| + done]);;
| + *)
| + $1;;
| + esac
| +])
| +
| # Work around bugs in pre-3.0 UWIN ksh.
| $as_unset ENV MAIL MAILPATH
| PS1='$ '
| @@ -211,10 +312,7 @@
| # there are so many _AS_PREPARE_* below, and that's also why it is
| # important not to forget some: config.status needs them.
| m4_defun([_AS_PREPARE],
| -[# PATH needs CR, and LINENO needs CR and PATH.
| -_AS_CR_PREPARE
| -_AS_PATH_SEPARATOR_PREPARE
| -_AS_LINENO_PREPARE
| +[_AS_LINENO_PREPARE
|
| _AS_ECHO_N_PREPARE
| _AS_EXPR_PREPARE
| @@ -539,8 +637,7 @@
| as_lineno_2=$LINENO
| as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
| test "x$as_lineno_1" != "x$as_lineno_2" &&
| - test "x$as_lineno_3" = "x$as_lineno_2" dnl
| -])
| + test "x$as_lineno_3" = "x$as_lineno_2"])
|
| # _AS_LINENO_PREPARE
| # ------------------
| @@ -553,38 +650,6 @@
| m4_define([_AS_LINENO_PREPARE],
| [AS_REQUIRE([_AS_CR_PREPARE])dnl
| _AS_LINENO_WORKS || {
| - # Find who we are. Look in the path if we contain no path at all
| - # relative or not.
| - case $[0] in
| - *[[\\/]]* ) as_myself=$[0] ;;
| - *) _AS_PATH_WALK([],
| - [test -r "$as_dir/$[0]" && as_myself=$as_dir/$[0] && break])
| - ;;
| - esac
| - # We did not find ourselves, most probably we were run as `sh COMMAND'
| - # in which case we are not to be found in the path.
| - if test "x$as_myself" = x; then
| - as_myself=$[0]
| - fi
| - if test ! -f "$as_myself"; then
| - AS_ERROR([cannot find myself; rerun with an absolute path])
| - fi
| - case $CONFIG_SHELL in
| - '')
| - _AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
| - [for as_base in sh bash ksh sh5; do
| - case $as_dir in
| - /*)
| - if ("$as_dir/$as_base" -c '_AS_LINENO_WORKS') 2>/dev/null; then
| - AS_UNSET(BASH_ENV)
| - AS_UNSET(ENV)
| - CONFIG_SHELL=$as_dir/$as_base
| - export CONFIG_SHELL
| - exec "$CONFIG_SHELL" "$[0]" ${1+"address@hidden"}
| - fi;;
| - esac
| - done]);;
| - esac
I don't understand why you remove all this. Plus, it looks broken.
This is still wanted by AS_INIT which is expected to be asis.
| # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
| # uniformly replaced by the line number. The first 'sed' inserts a
| @@ -1122,8 +1187,10 @@
| ## ----------------- ##
|
|
| -# AS_INIT
| -# -------
| +# AS_INIT(WHAT-IF-SHELL-FUNCTIONS-DO-NOT-WORK)
| +# --------------------------------------------
| +# The parameter is temporary; it will go away and you
| +# should not rely on it.
| m4_define([AS_INIT],
| [m4_init
|
| @@ -1132,9 +1199,26 @@
|
| # Bangshe and minimal initialization.
| m4_divert_text([BINSH], address@hidden:@! /bin/sh])
| -m4_divert_text([M4SH-INIT], [AS_SHELL_SANITIZE])
| +m4_divert_text([M4SH-INIT], [AS_SHELL_SANITIZE([m4_default([$1], [
| +echo Found no shell that has working shell functions.
| +echo
| +echo Please tell address@hidden about your system.
| +])])])
|
| # Let's go!
| m4_wrap([m4_divert_pop([BODY])[]])
| m4_divert_push([BODY])[]dnl
| ])
| +
| +# AS_INIT_WITH_SHFN
| +# -----------------
| +# Same as AS_INIT, but exit if shell functions are
| +# not supported.
| +m4_define([AS_INIT_WITH_SHFN],
| +[AS_INIT([
| +echo Shell functions are not supported on any shell I could find
| +echo on your system. This script requires shell functions: please
| +echo install a modern shell, or manually run the script under such
| +echo a shell if you do have one.
| +AS_EXIT(1)
| +])])
Well this is still not what I said: AS_INIT no longer looks for LINENO
support, any m4sh script has the probe etc. But OK, let's go forward.
- Re: 01-as-require-shell-fn.patch, (continued)
- Re: 01-as-require-shell-fn.patch, Akim Demaille, 2003/11/21
- Re: 01-as-require-shell-fn.patch, Paolo Bonzini, 2003/11/22
- Re: 01-as-require-shell-fn.patch, Paul Eggert, 2003/11/24
- Re: 01-as-require-shell-fn.patch, Akim Demaille, 2003/11/24
- Re: 01-as-require-shell-fn.patch, Paolo Bonzini, 2003/11/24
- Re: 01-as-require-shell-fn.patch, Akim Demaille, 2003/11/24
- Message not available
- Re: 01-as-require-shell-fn.patch, Akim Demaille, 2003/11/24
- Re: 01-as-require-shell-fn.patch, Bonzini, 2003/11/25
- Re: 01-as-require-shell-fn.patch, Akim Demaille, 2003/11/26
- Re: 01-as-require-shell-fn.patch, Paolo Bonzini, 2003/11/26
- Re: 01-as-require-shell-fn.patch,
Akim Demaille <=
- Re: 01-as-require-shell-fn.patch, Paolo Bonzini, 2003/11/27
- Re: 01-as-require-shell-fn.patch, Akim Demaille, 2003/11/27
- Re: 01-as-require-shell-fn.patch, Paul Eggert, 2003/11/24
- Re: 01-as-require-shell-fn.patch, Paolo Bonzini, 2003/11/25
- Re: 01-as-require-shell-fn.patch, Akim Demaille, 2003/11/26
- Re: 01-as-require-shell-fn.patch, Akim Demaille, 2003/11/26
- Re: 01-as-require-shell-fn.patch, Gary V. Vaughan, 2003/11/24
- Re: 01-as-require-shell-fn.patch, Akim Demaille, 2003/11/24
- Re: 01-as-require-shell-fn.patch, Gary V. Vaughan, 2003/11/24
- Re: 01-as-require-shell-fn.patch, Peter Eisentraut, 2003/11/24