[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] aclocal: remove @automake_includes
From: |
Paolo Bonzini |
Subject: |
[PATCH 2/3] aclocal: remove @automake_includes |
Date: |
Tue, 9 Nov 2010 20:14:39 +0100 |
This patch simplifies the overly complicated rules for ACLOCAL_PATH
vs. @automake_includes and @system_includes, by stating that
ACLOCAL_PATH will override even @automake_includes. The simplest
way to achieve this is to remove @automake_includes altogether.
There are two small visible differences here with respect to 1.11:
- "--acdir ${datadir}/prefix/aclocal-VERSION" will treat files
in acdir as FT_AUTOMAKE, and special case them with respect to the
serial number. This option makes no sense, but I like the new
semantics better.
- if "${datadir}/prefix/aclocal-VERSION" does not exist, aclocal
will not warn about it. This shouldn't happen anyway, so I think we
can live with this.
The third difference is of course in the semantics of ACLOCAL_PATH.
* NEWS: Adapt to change in ACLOCAL_PATH semantics.
* aclocal.in (default_automake_dir): New.
(scan_file): Use it to distinguish FT_AUTOMAKE from FT_SYSTEM.
(automake_includes): Remove.
(scan_m4_files): Do not scan it.
(have_ac_dir): New.
(parse_arguments): Set it for --acdir instead of automake_includes, use it
to determine whether to filter absent directories out of @system_includes.
Allow >1 directory in @system_includes for --print-ac-dir.
* doc/automake.texi: Adapt to changes in ACLOCAL_PATH semantics.
* tests/acloca25.test: Likewise.
---
ChangeLog | 15 +++++++++++++++
NEWS | 4 ++--
aclocal.in | 36 +++++++++++++++++++++---------------
doc/automake.texi | 6 ++----
tests/acloca25.test | 7 +------
5 files changed, 41 insertions(+), 27 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fa43c14..ede73dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2010-11-09 Paolo Bonzini <address@hidden>
+ aclocal: remove @automake_includes.
+ * NEWS: Adapt to changes in ACLOCAL_PATH semantics.
+ * aclocal.in (default_automake_dir): New.
+ (scan_file): Use it to distinguish FT_AUTOMAKE from FT_SYSTEM.
+ (automake_includes): Remove.
+ (scan_m4_files): Do not scan it.
+ (have_ac_dir): New.
+ (parse_arguments): Set it for --acdir instead of automake_includes, use
it
+ to determine whether to filter absent directories out of
@system_includes.
+ Allow >1 directory in @system_includes for --print-ac-dir.
+ * doc/automake.texi: Adapt to changes in ACLOCAL_PATH semantics.
+ * tests/acloca25.test: Likewise.
+
+2010-11-09 Paolo Bonzini <address@hidden>
+
aclocal: handle ACLOCAL_PATH environment variable.
* NEWS: Document new behavior.
* aclocal.in (parse_arguments): Parse ACLOCAL_PATH as a colon-separated
diff --git a/NEWS b/NEWS
index 9dd7860..eb732d9 100644
--- a/NEWS
+++ b/NEWS
@@ -3,8 +3,8 @@ New in 1.11a:
* Changes to aclocal:
- aclocal now interprets the `ACLOCAL_PATH' environment variable as a
- colon-separated list of additional directories to search after
- ${prefix}/share/aclocal-VERSION and before ${prefix}/share/aclocal.
+ colon-separated list of additional directories to search before
+ ${prefix}/share/aclocal-VERSION and ${prefix}/share/aclocal.
* Changes to automake:
diff --git a/aclocal.in b/aclocal.in
index 942d8e3..1d73f49 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -50,16 +50,20 @@ use Cwd;
# We do not operate in threaded mode.
$perl_threads = 0;
+# This directory is treated specially with respect to serial numbers.
+my $default_automake_dir = "@datadir@/aclocal-$APIVERSION";
+
# 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 macros. @user_includes can be augmented with -I.
# @system_includes can be augmented with the `dirlist' file or
-# ACLOCAL_PATH. Also --acdir will reset both @automake_includes
-# and @system_includes.
+# ACLOCAL_PATH.
my @user_includes = ();
-my @automake_includes = ("@datadir@/aclocal-$APIVERSION");
-my @system_includes = ('@datadir@/aclocal');
+my @system_includes = ($default_automake_dir, '@datadir@/aclocal');
+
+# Whether --acdir was passed.
+my $have_acdir = 0;
# Whether we should copy M4 file in $user_includes[0].
my $install = 0;
@@ -346,7 +350,6 @@ sub scan_m4_files ()
# Finally, scan all files in our search paths.
scan_m4_dirs (FT_USER, @user_includes);
- scan_m4_dirs (FT_AUTOMAKE, @automake_includes);
scan_m4_dirs (FT_SYSTEM, @system_includes);
# Construct a new function that does the searching. We use a
@@ -464,8 +467,8 @@ my $underquoted_manual_once = 0;
# --------------------------------
# Scan a single M4 file ($FILE), and all files it includes.
# Return the list of included files.
-# $TYPE is one of FT_USER, FT_AUTOMAKE, or FT_SYSTEM, depending
-# on where the file comes from.
+# $TYPE is one of FT_USER or FT_SYSTEM, depending on where
+# the file comes from.
# $WHERE is the location to use in the diagnostic if the file
# does not exist.
sub scan_file ($$$)
@@ -480,6 +483,9 @@ sub scan_file ($$$)
unshift @file_order, $file;
+ $type = FT_AUTOMAKE
+ if $type == FT_SYSTEM && $default_automake_dir eq dirname $file;
+
$file_type{$file} = $type;
fatal "$where: file `$file' does not exist" if ! -e $file;
@@ -932,7 +938,7 @@ sub parse_arguments ()
'acdir=s' => sub # Setting --acdir overrides both the
{ # automake (versioned) directory and the
# public (unversioned) system directory.
- @automake_includes = ();
+ $have_acdir = 1;
@system_includes = ($_[1])
},
'diff:s' => \$diff_command,
@@ -997,7 +1003,8 @@ sub parse_arguments ()
if ($print_and_exit)
{
- print "@system_includes\n";
+ my $acdir = $system_includes[$#system_includes];
+ print "$acdir\n";
exit 0;
}
@@ -1015,16 +1022,15 @@ sub parse_arguments ()
. "\nfirst -I option, but no -I was supplied");
}
- if (! -d $system_includes[0])
+ if (! $have_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. (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 = () if @automake_includes;
+ # directory and it hasn't been created.
+ @system_includes = grep { -d } @system_includes;
}
- else
+
+ if (length @system_includes > 0)
{
# Add any directory listed in the `dirlist' file.
if (open (DIRLIST, "$system_includes[0]/dirlist"))
diff --git a/doc/automake.texi b/doc/automake.texi
index 9c548fd..d128e29 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -3368,10 +3368,8 @@ Macro Search Path
also the simplest. Any directory included in the colon-separated
environment variable @env{ACLOCAL_PATH} is added to the search path
and takes precedence over system directories (including those found
-via @file{dirlist}), with the exception of the versioned directory
address@hidden@var{prefix}/share/address@hidden However, directories
-passed via @option{-I} will take precedence over directories in
-ACLOCAL_PATH.
+via @file{dirlist}). However, directories passed via @option{-I}
+will take precedence over directories in ACLOCAL_PATH.
Conversely to @file{dirlist}, @env{ACLOCAL_PATH} is useful if you are
using a global copy of Automake and want @command{aclocal} to look for
diff --git a/tests/acloca25.test b/tests/acloca25.test
index 14c8892..5cdd1b8 100755
--- a/tests/acloca25.test
+++ b/tests/acloca25.test
@@ -60,12 +60,7 @@ $FGREP '!!FAIL-FOO!!' configure && Exit 1
$FGREP '~~PASS-BAR~~' configure
$FGREP '//FAIL-BAR//' configure && Exit 1
# Directories in ACLOCAL_PATH should take precedence over system
-# directories, typically ${prefix}/share/aclocal. Note that directories
-# in ACLOCAL_PATH do _not_ take precedence over the internal automake
-# directory ${prefix}/share/aclocal-VERSION, and AM_INIT_AUTOMAKE would
-# normally be found there; however, the testsuite is run with --acdir,
-# so the place of ${srcdir}/m4 in the search path is exactly what
-# ACLOCAL_PATH overrides.
+# directories, i.e. ${prefix}/share/aclocal and /share/aclocal-VERSION.
$FGREP '%%blablabla%%' configure
:
--
1.7.3.2