[adding autoconf] On 11/11/2011 01:38 PM, Bruno Haible wrote:
> The syntax "export VAR=VALUE" is not guaranteed by this shell. > Either write "env VAR=VALUE ...", or "VAR=VALUE; export VAR; ..." > > Strangely enough, this portability problem of the 'export' built-in > is well-known, but not mentioned in the Autoconf manual > <http://www.gnu.org/software/autoconf/manual/html_node/Limitations-of-Builtins.html>. Hmm, I could have sworn it was in there, but you appear to be right. I'll be committing this soon. diff --git i/ChangeLog w/ChangeLog index e51f7d7..72b1dbc 100644 --- i/ChangeLog +++ w/ChangeLog @@ -1,3 +1,10 @@ +2011-11-11 Eric Blake <ebl...@redhat.com> + + doc: mention export portability hint + * doc/autoconf.texi (Limitations of Builtins) <export>: Document + export limitation. + Suggested by Bruno Haible. + 2011-10-21 Stefano Lattarini <stefano.lattar...@gmail.com> fortran: define $GFC to "yes" if $FC is a GNU compiler diff --git i/doc/autoconf.texi w/doc/autoconf.texi index b6dc67b..417c432 100644 --- i/doc/autoconf.texi +++ w/doc/autoconf.texi @@ -17642,6 +17642,20 @@ Limitations of Builtins foo= @end example +Posix requires @command{export} to honor assignments made as arguments, +but older shells did not support this. Portable scripts should separate +assignments and exports into different statements (it does not matter if +the export comes before or after the assignment). + +@example +$ @kbd{bash -c 'export foo=bar; echo $foo'} +bar +$ @kbd{/bin/sh -c 'export foo=bar; echo $foo'} +/bin/sh: foo=bar: is not an identifier +$ @kbd{/bin/sh -c 'export foo; foo=bar; echo $foo'} +bar +@end example + @item @command{false} @c ------------------ @prindex @command{false} -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature