autoconf-patches
[Top][All Lists]
Advanced

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

Autoscan: prefer Makefile.am over Makefile.in


From: Alexandre Duret-Lutz
Subject: Autoscan: prefer Makefile.am over Makefile.in
Date: Thu, 07 Nov 2002 14:04:51 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-debian-linux-gnu)

This teaches autoscan to prefer Makefile.am over Makefile.in,
and also makes sure it doesn't output an empty
AC_CONFIG_FILES([]) when no makefiles were found.

2002-11-07  Alexandre Duret-Lutz  <address@hidden>

        * bin/autoscan.in (scan_file): Scan Makefile.am too. Ignore
        Makefile.in if Makefile.am exists.
        (output): Strip `.am' from Makefiles.  Don't
        output AC_CONFIG_FILES if no Makefiles were found.

Index: bin/autoscan.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/bin/autoscan.in,v
retrieving revision 1.88
diff -u -r1.88 autoscan.in
--- bin/autoscan.in     25 Oct 2002 08:22:52 -0000      1.88
+++ bin/autoscan.in     7 Nov 2002 13:00:12 -0000
@@ -368,7 +368,7 @@
     if -f "$_.in";
 
   # Save $_ as Find::File requires it to be preserved.
-  my $underscore = $_;
+  local $_ = $_;
 
   # Strip a useless leading `./'.
   $File::Find::name =~ s,^\./,,;
@@ -383,7 +383,8 @@
       used 'program', 'c++', $File::Find::name;
       scan_c_file ($_);
     }
-  elsif (/^[Mm]akefile(\.in)?$/ || /^GNUmakefile(\.in)?$/)
+  elsif ((/^((?:GNUm|M|m)akefile)(\.in)?$/ && ! -f "$1.am")
+        || /^(?:GNUm|M|m)akefile(\.am)?$/)
     {
       scan_makefile ($_);
     }
@@ -391,8 +392,6 @@
     {
       scan_sh_file ($_);
     }
-
-  $_ = $underscore;
 }
 
 
@@ -519,14 +518,18 @@
   output_kind ($file, 'identifier');
   output_kind ($file, 'function');
 
-  # Change DIR/Makefile.in to DIR/Makefile.
-  foreach my $m (@makefiles)
+  if (@makefiles)
     {
-      $m =~ s/\.in$//;
-      $unique_makefiles{$m}++;
+      # Change DIR/Makefile.in to DIR/Makefile.
+      foreach my $m (@makefiles)
+       {
+         $m =~ s/\.(?:in|am)$//;
+         $unique_makefiles{$m}++;
+       }
+      print $file ("\nAC_CONFIG_FILES([",
+                  join ("\n                 ",
+                        sort keys %unique_makefiles), "])\n");
     }
-  print $file "\nAC_CONFIG_FILES([",
-       join ("\n                 ", sort keys %unique_makefiles), "])\n";
   print $file "AC_OUTPUT\n";
 
   $file->close;
-- 
Alexandre Duret-Lutz





reply via email to

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