autoconf-patches
[Top][All Lists]
Advanced

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

Patch: Too many files in AC_OUTPUT cause M4 error


From: Martin Frydl
Subject: Patch: Too many files in AC_OUTPUT cause M4 error
Date: Fri, 22 Nov 2002 19:03:52 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827

Hello,

I'm using Autoconf 2.56, Automake 1.7.1 and M4 1.4.1. When I add too many files (or too long paths) to AC_OUTPUT, running automake ends with

    M4: Error matching regular expression `^ *\(.*\) *$'

Automake runs autoconf with several --trace options to get output it can simply parse. This runs several M4 macros which lead to at_flatten and at_patsubst macros. Here, M4 does not like the at_patsubst(...,[^ *\(.*\) *$],[[\1]]) expression (the one stripping spaces from the begining and end of files list). I've found the error occurs when the total length of pathnames is about 3000 characters (after any previous space squeezing). When the regexp is shortened to [^ *\(.*\)] only, everything works. It probably has something to do with regexp evaluation in M4 since this expression in fact means "remove leading spaces and copy rest to \1". Moreover, stripping from the end of string seems to be not working since * inside parentheses is "greedy" and consumes also ending space. There are two solutions here. First, just remove " *$" from regexp. It won't strip terminating space but it does not anyway. Second, I've created a patch which is aware of M4 problem and separates the task into two expressions - first removes the terminating space, then strips the leading one and puts brackets around. The same problem exists with Autoconf 2.52, but former automake has not used the --trace feature so it was hidden.
  Can someone look at this and let me know?

  Thanks
    Martin

    * bin/autom4te.in (at_flatten): rewritten to avoid M4 problem when
    \(.*\) match is too long and there is something more to be checked.
Index: autom4te.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/bin/autom4te.in,v
retrieving revision 1.77
diff -u -r1.77 autom4te.in
--- autom4te.in 31 Oct 2002 08:37:20 -0000      1.77
+++ autom4te.in 22 Nov 2002 16:34:37 -0000
@@ -941,9 +941,10 @@
   # Note that the second pattern is `newline, tab or space'.  Don't lose
   # the tab!
   define([at_flatten],
-  [at_patsubst(at_patsubst(at_patsubst([[[$1]]], [\\\n]),
-                           [[\n\t ]+], [ ]),
-               [^ *\(.*\) *$], [[\1]])])
+  [at_patsubst(at_patsubst(at_patsubst(at_patsubst([[[[$1]]]], [\\\n]),
+                                       [[\n\t ]+], [ ]),
+                           [ *\(.\)$],[\1]),
+               [^ *\(.*\)], [[\1]])])
 
   define([at_args],    [at_shift(at_shift(at_shift(at_shift(at_shift($@)))))])
   define([at_at],      [_$0([$1], at_args($@))])

reply via email to

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