Hello,
  in project, I don't set ACLOCAL_AMFLAGS in Makefile.am literally,
I define it via AC_SUBST.  The following patch does two things

1) autoreconf doesn't call
        aclocal '$(xyz)'
nor
        aclocal '@xyz@

2) autoreconf searches Makefile instead of Makefile.am, if it is
available, so if can find the AC_SUBSTed value.

Paul, can I commit this patch?

Stepan
2005-03-10  Stepan Kasal  <[EMAIL PROTECTED]>

        * bin/autoreconf.in (autoreconf_current_directory): When searching
          for ACLOCAL_AMFLAGS, try Makefile before Makefile.am, if it
          exists, because ACLOCAL_AMFLAGS can be AC_SUBSTed.  And ignore
          the line, if the value starts with @ or $, which means that it's
          not literal.

Index: bin/autoreconf.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/bin/autoreconf.in,v
retrieving revision 1.126
diff -u -p -r1.126 autoreconf.in
--- bin/autoreconf.in   3 Jan 2005 07:38:01 -0000       1.126
+++ bin/autoreconf.in   10 Mar 2005 14:06:46 -0000
@@ -370,6 +370,7 @@ sub autoreconf_current_directory ()
   # complex and too error prone.  The best we can do is avoiding
   # nuking the time stamp.
   my $uses_aclocal = 1;
+  my $aclocal_flags = '';
 
   # Nevertheless, if aclocal.m4 exists and is not made by aclocal,
   # don't run aclocal.
@@ -382,27 +383,32 @@ sub autoreconf_current_directory ()
        unless defined ($_) && /generated.*by aclocal/;
     }
 
-  # If there are flags for aclocal in Makefile.am, use them.
-  my $aclocal_flags = '';
-  if ($uses_aclocal && -f 'Makefile.am')
-    {
-      my $makefile = new Autom4te::XFile 'Makefile.am';
-      while ($_ = $makefile->getline)
-       {
-         if (/^ACLOCAL_[A-Z_]*FLAGS\s*=\s*(.*)/)
-           {
-             $aclocal_flags = $1;
-             last;
-           }
-       }
-    }
-
   if (!$uses_aclocal)
     {
       verb "$configure_ac: not using aclocal";
     }
   else
     {
+      # If there are flags for aclocal in Makefile.am, use them.
+      my $makefile;
+      for my $fname ('Makefile', 'Makefile.am')
+       {
+         next unless (-f $fname);
+         $makefile = new Autom4te::XFile $fname;
+         last;
+       }
+      if (defined ($makefile))
+       {
+         while ($_ = $makefile->getline)
+           {
+             if (/^ACLOCAL_[A-Z_]*FLAGS\s*=\s*([EMAIL PROTECTED])/)
+               {
+                 $aclocal_flags = $1;
+                 last;
+               }
+           }
+       }
+
       # Some filesystems have sub-second time stamps, and if so we may
       # run into trouble later, after we rerun autoconf and set the
       # time stamps of input files to be no greater than aclocal.m4,

Reply via email to