Eric Blake
Tue, 02 Mar 2010 14:44:05 -0800
According to Ralf Wildenhues on 3/2/2010 2:45 PM:
> Hi Eric,
>
> * Eric Blake wrote on Tue, Mar 02, 2010 at 07:04:52AM CET:
>> Here's an updated version of patch 2/3 of the previous post; I realized
>> that ${a+b} should not be treated as a simple indirection, and added some
>> documentation. Patch 1/3 and 3/3 are unchanged.
>
> This patch causes a number of testsuite regressions. The AS_BOX patch
> has a typo s/@var/@ovar/ in the manual causing a texinfo warning.
Thanks for a review. Certainly still a work in progress, and I won't commit without a complete successful testsuite run. > > While working on AS_LITERAL_IF, you might want to fix the typo near the > beginning of the description: > # If EXPRESSION has shell indirections ($var or `expr`), expand > # IF-LITERAL, else IF-NOT-LITERAL. > > That should be "has no shell indirections". Yep. > > If you're really motivated, then you could also look into this code > snippet taken from the manual: > > header="sys/some file.h" > AS_TR_SH([HAVE_$header])=yes > if test "x$HAVE_sys_some_file_h" = xyes; then echo "Have it!"; fi > > which has been broken presumably by one of the earlier AS_LITERAL_IF > changes already. (This is not a recent regression, so feel free to > ignore right now.) Actually, it's a doc bug. This is not valid shell variable assignment: `echo $foo`=yes So this patch is going in now, while I spend more time fixing the actual code changes. -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net
From d174a5362e1adc52d9ef0e9448b2ad142512e42f Mon Sep 17 00:00:00 2001
From: Eric Blake <ebl...@redhat.com>
Date: Tue, 2 Mar 2010 15:39:58 -0700
Subject: [PATCH] Fix shell code in AS_TR_SH documentation.
* doc/autoconf.texi (Common Shell Constructs) <AS_TR_SH>: Fix
example to expand to valid shell code.
Reported by Ralf Wildenhues.
Signed-off-by: Eric Blake <ebl...@redhat.com>
---
ChangeLog | 5 +++++
doc/autoconf.texi | 7 +++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 747a629..5aae86c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2010-03-02 Eric Blake <ebl...@redhat.com>
+ Fix shell code in AS_TR_SH documentation.
+ * doc/autoconf.texi (Common Shell Constructs) <AS_TR_SH>: Fix
+ example to expand to valid shell code.
+ Reported by Ralf Wildenhues.
+
Improve documentation on AC_{COMPILE,LINK}_IFELSE.
* doc/autoconf.texi (Running the Compiler): Mention that the
object file is available after a successful compile.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 7838f76..8fca9ae 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -13206,12 +13206,15 @@ Common Shell Constructs
@defmac AS_TR_SH (@var{expression})
@asindex{TR_SH}
-Transform @var{expression} into a valid shell variable name. For example:
+Transform @var{expression} into shell code that generates a valid shell
+variable name. The result is literal when possible at m4 time, but must
+be used with @code{eval} if @var{expression} causes shell indirections.
+For example:
@example
# This outputs "Have it!".
header="sys/some file.h"
-AS_TR_SH([HAVE_$header])=yes
+eval AS_TR_SH([HAVE_$header])=yes
if test "x$HAVE_sys_some_file_h" = xyes; then echo "Have it!"; fi
@end example
@end defmac
--
1.6.6.1
signature.asc
Description: OpenPGP digital signature