Ben Pfaff <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> * 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 [EMAIL PROTECTED], because other Autoconf macros liberally use the [EMAIL PROTECTED] 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 [EMAIL PROTECTED]@@}, so if you are writing shell code intended for [EMAIL PROTECTED] you should not assume that the value of @samp{$@@} +persists for any length of time. + @item [EMAIL PROTECTED]@} @cindex positional parameters -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]