bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_CANONICAL_SYSTEM overwrites $@


From: Paul Eggert
Subject: Re: AC_CANONICAL_SYSTEM overwrites $@
Date: Wed, 14 Jun 2006 12:20:40 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Ben Pfaff <address@hidden> writes:

> In the long term, I suspect that the Autoconf macros in the
> apr-util package should be fixed, and that autoconf-doc should
> document that $@ may be changed by some macros.

I've done the latter by installing the patch at the end of this
message into Autoconf CVS.

> In the short term, I'm willing to help out, if necessary, by putting
> some kind of Debian-specific patch that saves and restores the
> positional parameters (if indeed there's a way to do that) around
> AC_CANONICAL_SYSTEM.

I don't know of any portable, reliable way to do it in general,
but you can approximate it by doing something like this:

   # Save "$@".
   args=
   for arg
   do
     case $arg in
     *\'*) arg=`echo "$arg" | sed "s/'/'\\\\\\\\''/g"`;;
     esac
     args="$args '$arg'"
   done

   # Restore "$@".
   eval set x $args
   shift

But even this isn't correct in general, e.g., it mishandles args
containing backslashes, or equal to '-n', or with trailing newlines.

Here's the patch I installed.

2006-06-14  Paul Eggert  <address@hidden>

        * doc/autoconf.texi (Initializing configure, Shell Substitutions):
        Warn about $@ not persisting.  Problem reported by Julien Danjou in
        <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=372179>.

--- doc/autoconf.texi   14 Jun 2006 05:14:09 -0000      1.1044
+++ doc/autoconf.texi   14 Jun 2006 19:11:21 -0000
@@ -1747,6 +1747,14 @@ Exactly @var{bug-report}.
 @end table
 @end defmac
 
+If your @command{configure} script does its own option processing, it
+should inspect @samp{$@@} or @samp{$*} immediately after calling
address@hidden, because other Autoconf macros liberally use the
address@hidden command to process strings, and this has the side effect
+of updating @samp{$@@} and @samp{$*}.  However, we suggest that you use
+standard macros like @code{AC_ARG_ENABLE} instead of attempting to
+implement your own option processing.  @xref{Site Configuration}.
+
 
 @node Notices
 @section Notices in @command{configure}
@@ -11297,6 +11305,11 @@ case $# in
 esac
 @end example
 
+Autocoonf macros often use the @command{set} command to update
address@hidden@@}, so if you are writing shell code intended for
address@hidden you should not assume that the value of @samp{$@@}
+persists for any length of time.
+
 
 @item address@hidden@}
 @cindex positional parameters




reply via email to

[Prev in Thread] Current Thread [Next in Thread]