Hello,
  sorry for the delay, I was offline until today.

We are discussing the problems caused by my patch:
http://lists.gnu.org/archive/html/autoconf-patches/2005-06/msg00014.html

On Sat, Jun 11, 2005 at 01:12:36PM +0200, Ralf Wildenhues wrote:
> FYI: I have applied this patch to HEAD and branch-2-0 after some
> reformatting.

Let me comment on the changes:

1)
m4/ltsugar.m4:
>  m4_define([lt_combine],
> -[m4_if([$2], [[]], [],
> +[m4_if([$2], [], [],
>         [lt_join(m4_quote(m4_default([$1], [, ])),

This is the type of problem I mentioned in the comment to the patch.
(But I said I don't expect to see it in real life--I was wrong.)
Your code specified the empty list as [[]] instead of [], which matched
the incorrect implementation of m4_cdr.

If you want to be compatible with both old and new m4_cdr, you have to
use:
  m4_if([$2], [[]], [],
        [$2], [], [],
        [lt_join(...

I apologize for the inconvinience, but I believe this was a good step
in the long time perspective.

2)
In the code of lt_combine cited above, I noticed that you use
        m4_quote(m4_default([$1], [, ])

Do you know that this removes all spaces after commas and is effectively
the same as
        m4_quote(m4_default([$1], [,])
?

I suggest that you use the following instead:

        m4_ifval([$1], [[$1]], [[, ]])

This way the first argument to lt_join will be $1, defaulting to ", ".

3)
m4/ltoptions.m4
>  m4_define([_LT_SET_OPTIONS],
> -[AC_FOREACH([_LT_Option], [$1], [...]
> +[m4_if([$1], [], [],
> +       [AC_FOREACH([_LT_Option], [$1], [...]

This change is a workaround for a bug I introduced.
Please remove the workaround, as the bug is now fixed in the Autoconf CVS.

Let me explain:
If the second argument of AC_FOREACH is empty, the expansion should be empty,
too.
Previously, m4_split([]) expanded to [[]] instead of [] (empty string).
This was the same mistake as in previous versions of m4_cdr and m4_foreach.

m4_split is now fixed; I committed the patch as attached to this mail.

AC_FOREACH now works again and your workaround id no longer needed.

Have a nice day,
        Stepan Kasal
2005-06-21  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/m4sugar/m4sugar.m4 (m4_split): If the parameter is empty,
        expand to the empty list.  Don't use two pairs of m4_changequote,
        it's not necessary.

Index: lib/m4sugar/m4sugar.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sugar.m4,v
retrieving revision 2.91
diff -u -r2.91 m4sugar.m4
--- lib/m4sugar/m4sugar.m4      8 Jun 2005 18:54:24 -0000       2.91
+++ lib/m4sugar/m4sugar.m4      21 Jun 2005 15:34:12 -0000
@@ -1364,11 +1364,11 @@
 #
 # REGEXP specifies where to split.  Default is [\t ]+.
 #
-# Pay attention to the m4_changequotes.  Inner m4_changequotes exist for
-# obvious reasons (we want to insert square brackets).  Outer
-# m4_changequotes are needed because otherwise the m4 parser, when it
-# sees the closing bracket we add to the result, believes it is the
-# end of the body of the macro we define.
+# If STRING is empty, the result is an empty list.
+#
+# Pay attention to the m4_changequotes.  When m4 reads the definition of
+# m4_split, it still has quotes set to [ and ].  Luckily, these are matched
+# in the macro body, so the definition is stored correctly.
 #
 # Also, notice that $1 is quoted twice, since we want the result to
 # be quoted.  Then you should understand that the argument of
@@ -1379,16 +1379,17 @@
 #   m4_split([active active ])end
 #   => [active], [active], []end
 
-m4_changequote(<<, >>)
-m4_define(<<m4_split>>,
-<<m4_changequote(``, '')dnl
+m4_define([m4_split],
+[m4_ifval([$1], [_m4_split($@)])])
+
+m4_define([_m4_split],
+[m4_changequote(``, '')dnl
 [dnl Can't use m4_default here instead of m4_if, because m4_default uses
 dnl [ and ] as quotes.
 m4_bpatsubst(````$1'''',
             m4_if(``$2'',, ``[  ]+'', ``$2''),
             ``], ['')]dnl
-m4_changequote([, ])>>)
-m4_changequote([, ])
+m4_changequote([, ])])
 
 
 

Reply via email to