automake-patches
[Top][All Lists]
Advanced

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

FYI: distinguish user/automake/system aclocal include patch more clearly


From: Alexandre Duret-Lutz
Subject: FYI: distinguish user/automake/system aclocal include patch more clearly
Date: Mon, 08 Nov 2004 00:25:23 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

I'm checking this in.

This is some distant preparation for the --copy (or --update, or
--install, or whatever name we find) feature [*], in which
aclocal will have to distinguish whether an m4 file is local to
a package (subject to update), or is a third-party macro
(subject to copy), or is an automake macro (subject to nothing).

Note that the user/automake/system distinction below is not the
same as the local/third-party/automake distinction above, but it
will help it.


[*] http://lists.gnu.org/archive/html/bug-libtool/2004-04/msg00082.html

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

        * aclocal.in ($acdir): Rename as ...
        (@system_includes): ... this.
        (@user_includes, @automake_includes): New variables.
        ($default_acdir, $default_dirlist): Remove.
        (parse_arguments): Populate @user_includes, @automake_includes, and
        @system_includes instead of filling a unique @dirlist array.
        ("MAIN"): Adjust to scan m4 files in @user_includes,
        @automake_includes, and @system_includes.

Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.112
diff -u -r1.112 aclocal.in
--- aclocal.in  6 Nov 2004 21:10:38 -0000       1.112
+++ aclocal.in  7 Nov 2004 22:37:06 -0000
@@ -47,18 +47,18 @@
 use File::stat;
 use Cwd;
 
-# Note that this isn't pkgdatadir, but a separate directory.
-# Note also that the versioned directory is handled later.
-my $acdir = '@datadir@/aclocal';
-my $default_acdir = $acdir;
-# contains a list of directories, one per line, to be added
-# to the dirlist in addition to $acdir, as if -I had been
-# added to the command line.  If acdir has been redirected,
-# we will also check the specified acdir (this is done later).
-my $default_dirlist = "$default_acdir/dirlist";
-
 # Some globals.
 
+# Include paths for searching macros.  We search macros in this order:
+# user-supplied directories first, then the directory containing the
+# automake macros, and finally the system-wide directories for
+# third-party macro.  @user_includes can be augmented with -I.
+# @system_includes can be augmented with the `dirlist' file.  Also
+# --acdir will reset both @automake_includes and @system_includes.
+my @user_includes = ();
+my @automake_includes = ("@datadir@/aclocal-$APIVERSION");
+my @system_includes = ('@datadir@/aclocal');
+
 # configure.ac or configure.in.
 my $configure_ac;
 
@@ -593,14 +593,18 @@
 # Parse command line.
 sub parse_arguments ()
 {
-  my @dirlist;
   my $print_and_exit = 0;
 
   my %cli_options =
     (
-     'acdir=s'         => \$acdir,
+     'acdir=s'         => sub # Setting --acdir overrides both the
+                             { # automake (versioned) directory and the
+                              # public (unversioned) system directory.
+                              @automake_includes = ();
+                              @system_includes = ($_[1])
+                            },
      'force'           => \$force_output,
-     'I=s'             => address@hidden,
+     'I=s'             => address@hidden,
      'output=s'                => \$output_file,
      'print_ac_dir'     => \$print_and_exit,
      'verbose'         => sub { setup_channel 'verb', silent => 0; },
@@ -640,49 +644,44 @@
 
   if ($print_and_exit)
     {
-      print $acdir, "\n";
+      print "@system_includes\n";
       exit 0;
     }
 
-  $default_dirlist="$acdir/dirlist"
-    if $acdir ne $default_acdir;
-
-  # Search the versioned directory near the end, and then the
-  # unversioned directory last.  Only do this if the user didn't
-  # override acdir.
-  push (@dirlist, "$acdir-$APIVERSION")
-    if $acdir eq $default_acdir;
-
-  # By default $(datadir)/aclocal doesn't exist.  We don't want to
-  # get an error in the case where we are searching the default
-  # directory and it hasn't been created.
-  push (@dirlist, $acdir)
-    unless $acdir eq $default_acdir && ! -d $acdir;
-
-  # Finally, adds any directory listed in the `dirlist' file.
-  if (open (DEFAULT_DIRLIST, $default_dirlist))
+  if (! -d $system_includes[0])
     {
-      while (<DEFAULT_DIRLIST>)
+      # By default $(datadir)/aclocal doesn't exist.  We don't want to
+      # get an error in the case where we are searching the default
+      # directory and it hasn't been created.  (We know
+      # @system_includes has its default value if @automake_includes
+      # is not empty, because --acdir is the only way to change this.)
+      @system_includes = () unless @automake_includes;
+    }
+  else
+    {
+      # Finally, adds any directory listed in the `dirlist' file.
+      if (open (DIRLIST, "$system_includes[0]/dirlist"))
        {
-         # Ignore '#' lines.
-         next if /^#/;
-         # strip off newlines and end-of-line comments
-         s/\s*\#.*$//;
-         chomp;
-         push (@dirlist, $_) if -d $_;
+         while (<DIRLIST>)
+           {
+             # Ignore '#' lines.
+             next if /^#/;
+             # strip off newlines and end-of-line comments
+             s/\s*\#.*$//;
+             chomp;
+             push (@system_includes, $_) if -d $_;
+           }
+         close (DIRLIST);
        }
-      close (DEFAULT_DIRLIST);
     }
-
-  return @dirlist;
 }
 
 ################################################################
 
 parse_WARNINGS;                    # Parse the WARNINGS environment variable.
-my @dirlist = parse_arguments;
+parse_arguments;
 $configure_ac = require_configure_ac;
-scan_m4_files (@dirlist);
+scan_m4_files (@user_includes, @automake_includes, @system_includes);
 scan_configure;
 if (! $exit_code)
   {
-- 
Alexandre Duret-Lutz





reply via email to

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