Hi,

I'm afraid this

  AM_CONFIG_HEADER([config.h])

leads to

  configure.in: 3: required file `./[config.h].in' not found

May I suggest the change below?  (I browsed the source and
didn't find something similar to unquote_m4_arg, that's quite
surprising; did I missed something?)

2001-01-17  Alexandre Duret-Lutz  <[EMAIL PROTECTED]>

        * automake.in (unquote_m4_arg): New function.
        (scan_one_configure_file): Call unquote_m4_arg on
        AM_CONFIG_HEADER argument, so that AM_CONFIG_HEADER([foobar.h])
        works.

--- automake.in.old     Wed Jan 17 20:13:19 2001
+++ automake.in Wed Jan 17 22:31:03 2001
@@ -4558,7 +4558,7 @@
 
            $config_header_line = $.;
            local ($one_hdr);
-           foreach $one_hdr (split (' ', $2))
+           foreach $one_hdr (split (' ', &unquote_m4_arg ($2)))
            {
                push (@config_fullnames, $one_hdr);
                if ($one_hdr =~ /^([^:]+):(.+)$/)
@@ -7759,6 +7759,36 @@
 {
     local ($pat) = @_;
     return <${pat}>;
+}
+
+# Remove one level of brackets and strip leading spaces,
+# as does m4 to function arguments.
+sub unquote_m4_arg
+{
+    $_ = shift;
+    s/^\s*//;
+
+    my @letters = split //;
+    my @result = ();
+    my $depth = 0;
+
+    foreach (@letters)
+    {
+       if ($_ eq '[')
+       {
+           ++$depth;
+           next if $depth == 1;
+       }
+       elsif ($_ eq ']')
+       {
+           --$depth;
+           next if $depth == 0;
+           # don't count orphan right brackets
+           $depth = 0 if $depth < 0;
+       }
+       push @result, $_;
+    }
+    return join '', @result;
 }
 
 ################################################################

-- 
Alexandre Duret-Lutz

Reply via email to