[PATCH] don't advertise shell function adversely

View: New views
3 Messages — Rating Filter:   Alert me  

[PATCH] don't advertise shell function adversely

by Paolo Bonzini-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

And here is some documentation, finally.

2008-10-08  Paolo Bonzini  <bonzini@...>

        * doc/autoconf.texi: Be less wary of shell functions.
---
 ChangeLog         |    4 ++++
 doc/autoconf.texi |   23 +++++++++++------------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 56bb40d..5aaaad0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2008-10-09  Paolo Bonzini  <bonzini@...>
 
+ * doc/autoconf.texi: Be less wary of shell functions.
+
+2008-10-09  Paolo Bonzini  <bonzini@...>
+
  * m4sugar/m4sh.m4 (AS_BASENAME): Just dispatch to $as_basename.
  (_AS_BASENAME_PREPARE): Test availability of basename and expr.
  Define shell functions.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 5753d37..2ea542c 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -1059,11 +1059,10 @@ to their lowest common denominator of features.
 Naturally, you might then think of shell scripts; who needs
 @command{autoconf}?  A set of properly written shell functions is enough to
 make it easy to write @command{configure} scripts by hand.  Sigh!
-Unfortunately, shell functions do not belong to the least common
-denominator; therefore, where you would like to define a function and
-use it ten times, you would instead need to copy its body ten times.
-Even in 2007, where shells without any function support are far and
-few between, there are pitfalls to avoid when making use of them.
+Unfortunately, even in 2008, where shells without any function support are
+far and few between, there are pitfalls to avoid when making use of them.
+Also, finding a Bourne shell that accepts shell functions is not trivial,
+even though there is almost always one on interesting porting targets.
 
 So, what is really needed is some kind of compiler, @command{autoconf},
 that takes an Autoconf program, @file{configure.ac}, and transforms it
@@ -12673,9 +12672,9 @@ that are not found in all Bourne-compatible shells; restrict yourself
 to the lowest common denominator.  Even @code{unset} is not supported
 by all shells!
 
-Shell functions are considered portable nowadays, though Autoconf still
-does not use them (Autotest does).  However, some pitfalls have to be
-avoided for portable use of shell functions (@pxref{Shell Functions}).
+Shell functions are considered portable nowadays.  However, some pitfalls
+have to be avoided for portable use of shell functions (@pxref{Shell
+Functions}).
 
 Some ancient systems have quite
 small limits on the length of the @samp{#!} line; for instance, 32
@@ -13645,8 +13644,8 @@ $ @kbd{pdksh -c 'echo $(( 010 ))'}
 
 When it is available, using arithmetic expansion provides a noticeable
 speedup in script execution; but testing for support requires
-@command{eval} to avoid syntax errors.  If shell function support has
-also been detected, then this construct can be used to assign @samp{foo}
+@command{eval} to avoid syntax errors.  If shell function support can
+be assumed, then this construct can be used to assign @samp{foo}
 to an arithmetic result, provided all numeric arguments are provided in
 decimal and without a leading zero:
 
@@ -14149,8 +14148,8 @@ f: not found
 @end example
 
 @noindent
-For this reason, Autotest uses the prefix @samp{at_func_} for its
-functions.
+For this reason, Autoconf (actually M4sh, @pxref{Programming in M4sh})
+uses the prefix @samp{as_func_} for its functions.
 
 Handling of positional parameters and shell options varies among shells.
 For example, Korn shells reset and restore trace output (@samp{set -x})
--
1.5.5




Re: [PATCH] don't advertise shell function adversely

by Eric Blake :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Paolo Bonzini on 10/9/2008 8:04 AM:
> And here is some documentation, finally.
>
> 2008-10-08  Paolo Bonzini  <bonzini@...>
>
> * doc/autoconf.texi: Be less wary of shell functions.

Looks okay to apply.  Can you also add a NEWS entry, mentioning that
configure scripts now use shell functions?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjvVx8ACgkQ84KuGfSFAYC9rwCeJak5QGvTY7ZzgMGfah4KwtOn
pSYAniiaUaK5EH7tuQ0Sf5ZTQpLu3NIK
=pXhC
-----END PGP SIGNATURE-----



Re: [PATCH] don't advertise shell function adversely

by Paolo Bonzini-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>> 2008-10-08  Paolo Bonzini  <bonzini@...>
>
>> * doc/autoconf.texi: Be less wary of shell functions.
>
> Looks okay to apply.  Can you also add a NEWS entry, mentioning that
> configure scripts now use shell functions?

Yes, thanks.

Paolo


LightInTheBox - Buy quality products at wholesale price!