autoconf-patches
[Top][All Lists]
Advanced

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

33-autore-aclocal.patch


From: Akim Demaille
Subject: 33-autore-aclocal.patch
Date: Mon, 15 Oct 2001 10:02:29 +0200

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        
        * lib/Autom4te/General.pm (&update_file): If destination is
        unchanged, remove the source.
        (&up_to_date_p): Don't be verbose, be debug.
        * bin/autoreconf.in: No longer support --m4dir.
        (&autoreconf): Display the full path of the configure.ac we are
        studying.
        Trace it only once.
        Be sure to honor --force with gettextize.
        Always run aclocal.
        * doc/autoconf.texi: Adjust.
        
Index: NEWS
--- NEWS Tue, 09 Oct 2001 21:25:03 +0200 akim
+++ NEWS Sun, 14 Oct 2001 15:24:10 +0200 akim
@@ -1,7 +1,9 @@
 * Major changes in Autoconf 2.52e                       -*- outline -*-
 
 ** Requirements
-  Perl 5.005 is required.
+  Perl 5.005 is required: autom4te is written in Perl and is needed by
+  autoconf.  autoheader, autoreconf, ifnames, and autoscan are
+  rewritten in Perl.
 
 ** Documentation
 - AC_INIT
@@ -32,13 +34,15 @@
 - --force, -f
   Supported by autom4te, autoconf and autoheader.
 - --include, -I
-  Replaces --autoconf-dir and --localdir in autoconf, autoheader and
-  autoupdate.
+  Replaces --autoconf-dir and --localdir in autoconf, autoheader,
+  autoupdate, and autoreconf.
 - autoreconf
   No longer passes --cygnus, --foreign, --gnits, --gnu, --include-deps:
   automake options are to be given via AUTOMAKE_OPTIONS.
 - autoreconf
   Runs gettextize and libtoolize when appropriate.
+- autoreconf
+  --m4dir is no longer supported.
 
 ** Bug fixes
 - The top level $prefix is propagated to the AC_CONFIG_SUBDIRS configures.
Index: bin/autoreconf.in
--- bin/autoreconf.in Thu, 11 Oct 2001 19:45:09 +0200 akim
+++ bin/autoreconf.in Sat, 13 Oct 2001 21:12:28 +0200 akim
@@ -67,10 +67,6 @@
 
 Library directories:
   -I, --include=DIR  look for FILES in DIR (cumulative)
-  -M, --m4dir=M4DIR  this package's Autoconf extensions
-
-Unless specified, heuristics try to compute `M4DIR' from the `Makefile.am',
-or defaults to `m4' if it exists.
 
 The environment variables AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL,
 GETTEXTIZE, LIBTOOLIZE are honored.
@@ -100,8 +96,6 @@
 # --install -- as --add-missing in other tools.
 my $install = 0;
 my @include;
-# m4dir -- local Autoconf extensions.  Typically `m4'.
-my $m4dir;
 my $status = 0;
 # symlink -- when --install, use symlinks instead.
 my $symlink = 0;
@@ -120,7 +114,6 @@ sub parse_args ()
   my $srcdir;
 
   getopt ('I|include|A|autoconf-dir|m|macrodir|l|localdir=s' => address@hidden,
-         'M|m4dir=s'                                        => \$m4dir,
          'i|install'                                        => \$install,
          's|symlink'                                        => \$symlink);
 
@@ -145,8 +138,8 @@ sub parse_args ()
 
   # Dispatch autoreconf's option to the tools.
   # --include;
-  $autoconf   .= join (' ', map { "--include=$_" } @include);
-  $autoheader .= join (' ', map { "--include=$_" } @include);
+  $autoconf   .= join (' --include=', '', @include);
+  $autoheader .= join (' --include=', '', @include);
 
   # --install and --symlink;
   if ($install)
@@ -205,40 +198,59 @@ sub maybe_autoreconf ()
 sub autoreconf ($)
 {
   my ($configure_ac) = @_;
-  verbose "working on $configure_ac";
+  verbose "working on $File::Find::name";
 
-  # If there is no AC_INIT, then we are not interested: it looks like
-  # a Cygnus thingy.
+  # ------------------------------- #
+  # See what tools will be needed.  #
+  # ------------------------------- #
+
+  # Perform a single trace reading to avoid --force forcing a rerun
+  # between two --trace, that's useless.  If there is no AC_INIT, then
+  # we are not interested: it looks like a Cygnus thingy.
   my $configure_ac_file = new Autom4te::XFile $configure_ac;
   my $uses_autoconf;
+  my $uses_gettext;
+  my $uses_libtool;
+  my $uses_autoheader;
   while ($_ = $configure_ac_file->getline)
      {
        $uses_autoconf = 1
         if /AC_INIT/;
      }
+
+  my $traces = new Autom4te::XFile
+    ("$autoconf"
+     . join (' --trace=', '',
+            'AC_INIT', 'AM_GNU_GETTEXT', 'AM_PROG_LIBTOOL',
+            'AC_CONFIG_HEADERS')
+     . " |");
+  while ($_ = $traces->getline)
+    {
+      $uses_autoconf = 1   if /AC_INIT/;
+      $uses_gettext = 1    if /AM_GNU_GETTEXT/;
+      $uses_libtool = 1    if /AM_PROG_LIBTOOL/;
+      $uses_autoheader = 1 if /AC_CONFIG_HEADERS/;
+    }
+
+  # ------------------ #
+  # Running autoconf.  #
+  # ------------------ #
+
   if (!$uses_autoconf)
     {
       verbose "$configure_ac: not using Autoconf";
       return;
     }
 
-
   # -------------------- #
   # Running gettexitze.  #
   # -------------------- #
 
-  my $uses_gettext = 0;
-  my $traces = new Autom4te::XFile "$autoconf --trace=AM_GNU_GETTEXT |";
-  while ($_ = $traces->getline)
-    {
-      $uses_gettext = 1
-       if /AM_GNU_GETTEXT/;
-    }
   if (!$uses_gettext)
     {
       verbose "$configure_ac: not using Gettext";
     }
-  elsif (-d 'intl')
+  elsif (-d 'intl' && !$force)
     {
       verbose "$configure_ac: not running gettextize: `intl' is already 
present";
     }
@@ -252,13 +264,6 @@ sub autoreconf ($)
   # Running libtoolize.  #
   # -------------------- #
 
-  my $uses_libtool = 0;
-  $traces = new Autom4te::XFile "$autoconf --trace=AM_PROG_LIBTOOL |";
-  while ($_ = $traces->getline)
-    {
-      $uses_libtool = 1
-       if /AM_PROG_LIBTOOL/;
-    }
   if (!$uses_libtool)
     {
       verbose "$configure_ac: not using Libtool";
@@ -273,34 +278,27 @@ sub autoreconf ($)
   # Running aclocal.  #
   # ----------------- #
 
-  if (-f 'aclocal.m4' &&
-      !up_to_date_p ('aclocal.m4', 'acinclude.m4'))
+  # Always run aclocal.  Tracking its sources for up-to-dateness
+  # is too complex and too error prone.  The best we can do is
+  # avoiding nuking the time stamp.
+
+  # If there are flags for aclocal in Makefile.am, use them.
+  my $aclocal_flags;
+  if (-f 'Makefile.am')
     {
-      # If there are flags for aclocal in Makefile.am, use them.
-      my $aclocal_flags;
-      if (-f 'Makefile.am')
+      my $aclocal_m4 = new Autom4te::XFile 'Makefile.am';
+      while ($_ = $aclocal_m4->getline)
        {
-         my $aclocal_m4 = new Autom4te::XFile 'Makefile.am';
-         while ($_ = $aclocal_m4->getline)
+         if (/^ACLOCAL_[A-Z_]*FLAGS\s*=\s*(.*)/)
            {
-             if (/^ACLOCAL_[A-Z_]*FLAGS\s*=\s*(.*)/)
-               {
-                 $aclocal_flags = $1;
-                 last;
-               }
+             $aclocal_flags = $1;
+             last;
            }
        }
-
-      # If m4dir is not specified and these flags do not specify the
-      # location of the local Autoconf extensions, default to `m4'.
-      if (!$aclocal_flags)
-       {
-         $aclocal_flags = '-I ' . ($m4dir || 'm4');
-       }
-      xsystem ("$aclocal $aclocal_flags")
     }
 
-
+  xsystem ("$aclocal $aclocal_flags --output=aclocal.m4t");
+  update_file ('aclocal.m4t', 'aclocal.m4');
 
   # ------------------ #
   # Running automake.  #
@@ -336,13 +334,6 @@ sub autoreconf ($)
   # We now consider that if AC_CONFIG_HEADERS is used, then autoheader
   # is used too.
   # Just as for autoconf, up to date ness is performed by the tool itself.
-  my $uses_autoheader = 0;
-  $traces = new Autom4te::XFile "$autoconf --trace=AC_CONFIG_HEADERS |";
-  while ($_ = $traces->getline)
-    {
-      $uses_autoheader = 1
-       if /AC_CONFIG_HEADERS/;
-    }
   if (!$uses_autoheader)
     {
       verbose "$configure_ac: not using Autoheader";
Index: doc/autoconf.texi
--- doc/autoconf.texi Tue, 09 Oct 2001 21:39:06 +0200 akim
+++ doc/autoconf.texi Sun, 14 Oct 2001 15:18:19 +0200 akim
@@ -1077,7 +1077,7 @@ @node autoscan Invocation
 @item address@hidden
 @itemx -I @var{dir}
 Also look for input files in @var{dir}.  Multiple invocations
-accumulate.  Latest directories are looking in first.
+accumulate.  Directories are browsed from last to first.
 @end table
 
 @node ifnames Invocation
@@ -1162,7 +1162,7 @@ @node autoconf Invocation
 @item address@hidden
 @itemx -I @var{dir}
 Also look for input files in @var{dir}.  Multiple invocations
-accumulate.  Latest directories are looking in first.
+accumulate.  Directories are browsed from last to first.
 
 @item address@hidden
 @itemx -o @var{file}
@@ -1443,26 +1443,10 @@ @node autoreconf Invocation
 @itemx -s
 Instead of copying missing auxiliary files, install symbolic links.
 
address@hidden address@hidden
address@hidden -l @var{dir}
-Have @code{autoconf} and @code{autoheader} look for the package files
address@hidden and (@code{autoheader} only) @file{acconfig.h} (but
-not @address@hidden and @address@hidden) in directory
address@hidden instead of in the directory containing each @file{configure.ac}.
-
address@hidden address@hidden
address@hidden -A @var{dir}
address@hidden AC_MACRODIR
-Override the location where the installed Autoconf data files are looked
-for.  You can also set the @code{AC_MACRODIR} environment variable to a
-directory; this option overrides the environment variable.
-
-This option is rarely needed and dangerous; it is only used when one
-plays with different versions of Autoconf simultaneously.
-
address@hidden address@hidden
address@hidden -M @var{dir}
-Specify location of additional macro files (@file{m4} by default).
address@hidden address@hidden
address@hidden -I @var{dir}
+Also look for input files in @var{dir}.  Multiple invocations
+accumulate.  Directories are browsed from last to first.
 @end table
 
 
@@ -2533,7 +2517,7 @@ @node autoheader Invocation
 @item address@hidden
 @itemx -I @var{dir}
 Also look for input files in @var{dir}.  Multiple invocations accumulate.
-Latest directories are looking in first.
+Directories are browsed from last to first.
 
 @item address@hidden
 @itemx -W @var{category}
@@ -10258,7 +10242,7 @@ @node autoupdate Invocation
 @item address@hidden
 @itemx -I @var{dir}
 Also look for input files in @var{dir}.  Multiple invocations accumulate.
-Latest directories are looking in first.
+Directories are browsed from last to first.
 @end table
 
 @node Obsolete Macros
Index: lib/Autom4te/General.pm
--- lib/Autom4te/General.pm Mon, 08 Oct 2001 01:38:43 +0200 akim
+++ lib/Autom4te/General.pm Sat, 13 Oct 2001 21:02:13 +0200 akim
@@ -280,12 +280,12 @@ sub up_to_date_p ($@)
     {
       if ($mtime < mtime ($dep))
        {
-         verbose "up_to_date ($file): outdated: $dep";
+         debug "up_to_date ($file): outdated: $dep";
          return 0;
        }
     }
 
-  verbose "up_to_date ($file): up to date";
+  debug "up_to_date ($file): up to date";
   return 1;
 }
 
@@ -293,7 +293,7 @@ sub up_to_date_p ($@)
 # &update_file ($FROM, $TO)
 # -------------------------
 # Rename $FROM as $TO, preserving $TO timestamp if it has not changed.
-# Recognize `$TO = -' standing for stdin.
+# Recognize `$TO = -' standing for stdin.  $FROM is always removed/renamed.
 sub update_file ($$)
 {
   my ($from, $to) = @_;
@@ -319,6 +319,8 @@ sub update_file ($$)
     {
       # File didn't change, so don't update its mod time.
       print STDERR "$me: `$to' is unchanged\n";
+      unlink ($from)
+       or die "$me: cannot not remove $from: $!\n";
       return
     }
 
Index: lib/Autom4te/XFile.pm
--- lib/Autom4te/XFile.pm Sun, 23 Sep 2001 08:45:24 +0200 akim
+++ lib/Autom4te/XFile.pm Sat, 13 Oct 2001 20:02:39 +0200 akim
@@ -135,6 +135,11 @@ sub open
       my $me = basename ($0);
       croak "$me: cannot open $file: $!\n";
     }
+
+  # In case we're running under MSWindows, don't write with CRLF.
+  # (This circumvents a bug in at least Cygwin bash where the shell
+  # parsing fails on lines ending with the continuation character '\'
+  # and CRLF).
   binmode $fh if $file =~ /^\s*>/;
 }
 



reply via email to

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