Re: [PATCH 2/3] aclocal: remove @automake_includes

2010-11-14 Thread Ralf Wildenhues
Hi Paolo,

* Paolo Bonzini wrote on Tue, Nov 09, 2010 at 08:14:39PM CET:
 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.

I've read the previous discussion about this now, but I'm still not sure
I understand the rationale for this change.  Is it because you want to
actually be able to override the $(datadir)/aclocal-$VERSION files with
this variable?  If so, why?

I guess in that case it would be good to have another test to ensure
that this happens, and is intentional.

If the only reason is that --acdir doesn't accurately reflect what would
happen after 'make install', maybe we can instead fix --acdir?

The other changes in this patch seem fairly benign to me.

I'm not sure if you stated whether the testsuite passes for you with
this patch series.

Thanks,
Ralf

 * 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.





Re: [PATCH 2/3] aclocal: remove @automake_includes

2010-11-14 Thread Paolo Bonzini

On 11/14/2010 05:46 PM, Ralf Wildenhues wrote:

Hi Paolo,

* Paolo Bonzini wrote on Tue, Nov 09, 2010 at 08:14:39PM CET:

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.


I've read the previous discussion about this now, but I'm still not sure
I understand the rationale for this change.  Is it because you want to
actually be able to override the $(datadir)/aclocal-$VERSION files with
this variable?  If so, why?


I don't really need to override the files, it's just to simplify the 
semantics and make ACLOCAL_PATH between -I and the system variables.



If the only reason is that --acdir doesn't accurately reflect what would
happen after 'make install', maybe we can instead fix --acdir?


That's not a problem, during the testsuite it is safer to operate as if 
$(datadir)/aclocal is empty, and --acdir achieves that.  So I think 
--acdir is fine.


If you would prefer to fix --acdir, it would be in theory possible to 
make --acdir change @automake_includes and empty @system_includes instead.


However, before going on, I might be missing something.  Google code 
search shows a relatively large amount of strange uses of --acdir, even 
in projects using relatively recent Autoconf (like 1.9.x).  I'm not sure 
how they work; for example:


acdir = m4
@ma...@aclocal-files: configure.in
@MAINT@ echo 'acfiles = \'  $...@-tmp
@MAINT@ find $(acdir) -type f -name '*.m4' -print   \
@MAINT@   | sed 's!^!$(top_srcdir)/!'   \
@MAINT@   | tr '\012' ' '   \
@MAINT@$...@-tmp
@MAINT@ echo  $...@-tmp
@MAINT@ mv $...@-tmp $@

@ma...@include aclocal-files

@ma...@# Override default rule to use --acdir option
@ma...@$(srcdir)/aclocal.m4: configure.in $(acfiles)
@MAINT@ cd $(srcdir)  aclocal --acdir=$(acdir)

How can this work, wouldn't it miss all the internal Automake macros?


I'm not sure if you stated whether the testsuite passes for you with
this patch series.


Yes, it works.

Paolo



[PATCH 2/3] aclocal: remove @automake_includes

2010-11-09 Thread Paolo Bonzini
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  bonz...@gnu.org
 
+   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  bonz...@gnu.org
+
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.