automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, master, updated. v1.12.4-22


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, master, updated. v1.12.4-221-gb7c507e
Date: Wed, 14 Nov 2012 14:53:56 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=b7c507eadfa7b9ef40ba433dee0d231432ab7c39

The branch, master has been updated
       via  b7c507eadfa7b9ef40ba433dee0d231432ab7c39 (commit)
       via  834e16016b07aab9e3613a0b08a86dbadeff88c0 (commit)
       via  d114599bd66589794c6b78130bbc0db4ac91c334 (commit)
       via  838238295952cc86e5ccfe59113e6c315cf640ec (commit)
       via  256659b06280ab4be5103c760b777e26980863c3 (commit)
       via  bd337b9b203aa92fc524d24d325329b099d8cbc2 (commit)
       via  4a5955172d2d39ef03191d2ca69edc585a12910d (commit)
       via  9018a126345d53a83b0666e7e44e8b1d0d1bb8ee (commit)
       via  fd60ad28737e90d8732f28ce85d6cdaa781bdeed (commit)
       via  d2155d50e6ef6d11845583af0113a717642f53df (commit)
      from  2296a5e1fbe39415111ad5fdce475fe49897233d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b7c507eadfa7b9ef40ba433dee0d231432ab7c39
Merge: d114599 834e160
Author: Stefano Lattarini <address@hidden>
Date:   Wed Nov 14 11:48:53 2012 +0100

    Merge branch 'ac-config-macro-dirs'
    
    * ac-config-macro-dirs:
      news: we trace AC_CONFIG_MACRO_DIRS
      aclocal: trace AC_CONFIG_MACRO_DIR_TRACE
      aclocal: avoid spurious warnings from autom4te with AC_CONFIG_MACRO_DIRS
      coverage: expose a bug in aclocal (spurious warnings)
      aclocal: smash newlines in arguments of traced macros
      tests: better coverage for AC_CONFIG_MACRO_DIRS
      aclocal: diagnose non-existing directories in AC_CONFIG_MACRO_DIRS better
      aclocal: multiple local m4 macro dirs with AC_CONFIG_MACRO_DIRS

commit 834e16016b07aab9e3613a0b08a86dbadeff88c0
Author: Stefano Lattarini <address@hidden>
Date:   Sat Nov 10 14:39:55 2012 +0100

    news: we trace AC_CONFIG_MACRO_DIRS
    
    * NEWS (New in 1.13): Update accordingly.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit d114599bd66589794c6b78130bbc0db4ac91c334
Author: Stefano Lattarini <address@hidden>
Date:   Sat Nov 10 14:31:43 2012 +0100

    news: improve wording
    
    * NEWS (New in 1.13): Prefer "no longer" over "not anymore",
    wherever possible.  Related re-wrapping of text.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 838238295952cc86e5ccfe59113e6c315cf640ec
Author: Stefano Lattarini <address@hidden>
Date:   Sat Nov 10 10:54:44 2012 +0100

    aclocal: trace AC_CONFIG_MACRO_DIR_TRACE
    
    This is now the documented way, and indeed the only correct way, to
    support AC_CONFIG_MACRO_DIR and AC_CONFIG_MACRO_DIRS in third-party
    tools.  See autoconf commit v2.69-45-g5269030 of 2012-11-09,
    "AC_CONFIG_MACRO_DIRS: improve tracing and add sanity checks".
    
    * aclocal.in (trace_used_macros): Trace 'AC_CONFIG_MACRO_DIR_TRACE'
    rather than 'AC_CONFIG_MACRO_DIRS'.  We still have to trace
    'AC_CONFIG_MACRO_DIR' explicitly though, for compatibility with
    Autoconf versions before 2.70.
    * t/aclocal-macrodirs.tap: Enhance w.r.t. precedence of arguments
    in one and several AC_CONFIG_MACRO_DIRS calls.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 256659b06280ab4be5103c760b777e26980863c3
Author: Stefano Lattarini <address@hidden>
Date:   Sat Nov 3 11:30:04 2012 +0100

    aclocal: avoid spurious warnings from autom4te with AC_CONFIG_MACRO_DIRS
    
    When some macro expanded in configure.ac calls AC_REQUIRE on another
    macro that is defined in one of the local m4 macro dirs specified
    with AC_CONFIG_MACRO_DIRS, aclocal prints spurious warnings like:
    
        configure.ac:4: warning: MY_BAR is m4_require'd but not m4_defun'd
        configure.ac:3: MY_FOO is expanded from...
    
    Such warnings come from autom4te, and are due to the fact that the
    *first* autom4te invocation issued by aclocal is not yet able to
    "see" the m4 macro definitions in the local m4 dirs (because they
    can be looked for only after the AC_CONFIG_MACRO_DIRS call has been
    traced, and tracing it requires running autom4te).
    
    To allow us to work around this issue, autom4te has introduced a new
    "witness" macro 'm4_require_silent_probe', that, when defined, allows
    us to silence that particular kind of warnings (and only it).
    
    Reported by Nick Bowler; see point (4) of:
    <http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00000.html>
    
    * aclocal.in (trace_used_macros): Pre-define the special macro
    'm4_require_silent_probe' when invoking autom4te.
    * t/aclocal-macrodirs.tap ("AC_CONFIG_MACRO_DIR interaction with
    AC_REQUIRE"): This test passes now: remove the "TODO" directive.
    * t/aclocal-macrodir.tap ("AC_CONFIG_MACRO_DIRS interaction with
    AC_REQUIRE"): Likewise.
    * t/acloca17.sh: Remove.
    * t/list-of-tests.mk: Adjust.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit bd337b9b203aa92fc524d24d325329b099d8cbc2
Author: Stefano Lattarini <address@hidden>
Date:   Fri Nov 2 18:12:40 2012 +0100

    coverage: expose a bug in aclocal (spurious warnings)
    
    When some macro expanded in configure.ac calls AC_REQUIRE on another
    macro that is defined in one of the local m4 macro dirs specified
    with one of the macros AC_CONFIG_MACRO_DIRS or AC_CONFIG_MACRO_DIR,
    aclocal prints spurious warnings like:
    
        configure.ac:4: warning: MY_BAR is m4_require'd but not m4_defun'd
        configure.ac:3: MY_FOO is expanded from...
    
    Expose this weakness in our testsuite.
    
    Reported by Nick Bowler; see point (4) of:
    <http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00000.html>
    
    * t/aclocal-macrodir.tap ("AC_CONFIG_MACRO_DIR interaction with
    AC_REQUIRE"): New test, still xfailing.
    * t/aclocal-macrodirs.tap ("AC_CONFIG_MACRO_DIRS interaction with
    AC_REQUIRE"): Likewise.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 4a5955172d2d39ef03191d2ca69edc585a12910d
Author: Stefano Lattarini <address@hidden>
Date:   Fri Nov 2 11:49:46 2012 +0100

    aclocal: smash newlines in arguments of traced macros
    
    This change fixes the existing issues with AC_CONFIG_MACRO_DIRS
    containing newlines:
    <http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00000.html>
    
    Likely, it will also allow a less involved implementation of the
    AM_EXTRA_RECURSIVE_TARGETS macro (but that is left for potential
    follow-up patches).
    
    * aclocal.in (trace_used_macros): When calling autom4te, pass its
    '--trace' option an argument containing '${::}%' rather than '$1'.
    According to the autoconf manual (as of version 2.69), that will expand
    to the concatenation, with the '::' string, of all the arguments passed
    to a macro, with all newline characters in such arguments smashed.
    Related adjustments when handling the macro AC_CONFIG_MACRO_DIRS, to
    ensure leading whitespace in its argument are handled correctly.
    * t/aclocal-macrodirs.tap ("AC_CONFIG_MACRO_DIRS: extra whitespace"):
    No longer declare it as an xfailing test.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 9018a126345d53a83b0666e7e44e8b1d0d1bb8ee
Author: Stefano Lattarini <address@hidden>
Date:   Fri Nov 2 10:09:36 2012 +0100

    tests: better coverage for AC_CONFIG_MACRO_DIRS
    
    Suggested by a report from Nick Bowler:
    <http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00000.html>
    
    * t/aclocal-macrodirs.tap: Enhance to check use of extra whitespaces
    and newline characters in the arguments to AC_CONFIG_MACRO_DIRS.  This
    test currently fails, so mark it as "TODO".  While at it, throw in other
    minor edits and enhancements.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit fd60ad28737e90d8732f28ce85d6cdaa781bdeed
Author: Stefano Lattarini <address@hidden>
Date:   Wed Jul 4 15:37:46 2012 +0200

    aclocal: diagnose non-existing directories in AC_CONFIG_MACRO_DIRS better
    
    This new implementation ensures that any directory (possibly excluding
    the first one, if the '--install' option is used) that is declared with
    AC_CONFIG_MACRO_DIRS and that is non-existent will cause an error from
    aclocal.
    
    * aclocal.in (scan_m4_dirs): Add a new argument, telling whether it's OK
    for the scanned directory to be non-existing.  Adjust the implementation
    accordingly.
    ($first_user_m4dir): Remove, no more needed.
    (scan_m4_files): Update 'scan_m4_dirs' invocations so that aclocal will
    not complain if the first user macro directory is non-existing and the
    '--install' option is given: such directory will be created later by
    aclocal itself.
    * t/aclocal-macrodir.tap: Do not mark the last test as TODO anymore;
    it now passes.  Make stricter by ensuring a non-existing directory in
    AC_CONFIG_MACRO_DIRS causes an hard error, not a warning.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit d2155d50e6ef6d11845583af0113a717642f53df
Author: Stefano Lattarini <address@hidden>
Date:   Wed Jul 4 15:23:50 2012 +0200

    aclocal: multiple local m4 macro dirs with AC_CONFIG_MACRO_DIRS
    
    A new macro 'AC_CONFIG_MACRO_DIRS' has been recently introduced in
    autoconf (and is expected to appear in the autoconf 2.70 release),
    allowing us to declare several local m4 macro directories for a
    package.
    
    It can be done either passing several arguments to a single invocation:
    
        AC_CONFIG_MACRO_DIRS([dir1 dir2])
    
    or issuing more invocations:
    
        AC_CONFIG_MACRO_DIRS([dir1])
        AC_CONFIG_MACRO_DIRS([dir2])
    
    or a combination of the two:
    
        AC_CONFIG_MACRO_DIRS([dir1 dir2])
        AC_CONFIG_MACRO_DIRS([dir3])
    
    This will allow projects to use several m4 macro local dirs, without the
    need to use ACLOCAL_AMFLAGS (which we want to make obsolete and finally
    remove).  This is especially important for projects that are used as
    nested subpackages of larger projects.
    
    For more information and rationales, refer to these past discussions:
    
    <http://lists.gnu.org/archive/html/autoconf/2011-12/msg00037.html>
    <http://lists.gnu.org/archive/html/automake-patches/2012-07/msg00010.html>
    <http://lists.gnu.org/archive/html/autoconf-patches/2012-07/msg00000.html>
    <http://lists.gnu.org/archive/html/autoconf-patches/2012-07/msg00012.html>
    <http://thread.gmane.org/gmane.comp.sysutils.autoconf.patches/8037/>
    <http://thread.gmane.org/gmane.comp.sysutils.autoconf.patches/8087>
    <http://thread.gmane.org/gmane.comp.sysutils.automake.patches/8956>
    
    as well as to Automake commit v1.12.1-165-gcd1a9cc of 2012-07-03,
    "aclocal: deprecate ACLOCAL_AMFLAGS, trace AC_CONFIG_MACRO_DIR instead",
    autoconf commit v2.69-42-gd73770f of 2012-10-17, "AC_CONFIG_MACRO_DIRS:
    new macro, mostly for aclocal".
    
    * aclocal.in ($ac_config_macro_dir): Turn this global scalar it into ...
    (@ac_config_macro_dirs): ... this global array.
    (trace_used_macros): Update '@ac_config_macro_dirs' instead of
    re-defining '$ac_config_macro_dir'.  Cater to calls the now-preferred
    macro 'AC_CONFIG_MACRO_DIRS' in addition to the "obsolescent" one
    AC_CONFIG_MACRO_DIR.
    (main loop): Append '@ac_config_macro_dirs', not '$ac_config_macro_dir',
    to '@user_includes'.
    * t/subpkg-macrodir.sh: New test.
    * t/aclocal-macrodirs.tap: Likewise.
    * t/list-of-tests.mk: Add them.
    * t/aclocal-macrodir.tap: Adjust and extend a little to keep it more in
    sync with 'aclocal-macrodirs.tap'.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 NEWS                    |   29 ++--
 aclocal.in              |   92 +++++++----
 t/acloca17.sh           |   41 -----
 t/aclocal-macrodir.tap  |   48 +++++-
 t/aclocal-macrodirs.tap |  412 +++++++++++++++++++++++++++++++++++++++++++++++
 t/list-of-tests.mk      |    3 +-
 t/subpkg-macrodir.sh    |   93 +++++++++++
 7 files changed, 623 insertions(+), 95 deletions(-)
 delete mode 100755 t/acloca17.sh
 create mode 100755 t/aclocal-macrodirs.tap
 create mode 100755 t/subpkg-macrodir.sh

diff --git a/NEWS b/NEWS
index 4425a89..7fa94d0 100644
--- a/NEWS
+++ b/NEWS
@@ -42,12 +42,12 @@ New in 1.13:
 * Obsolescent features:
 
   - Use of the long-deprecated two- and three-arguments invocation forms
-    of the AM_INIT_AUTOMAKE is not documented anymore.  It's still
-    supported though (albeit with a warning in the 'obsolete' category),
-    to cater for people who want to define the version number for their
-    package dynamically (e.g., from the current VCS revision).  We'll
-    have to continue this support until Autoconf itself is fixed to allow
-    better support for such dynamic version numbers.
+    of the AM_INIT_AUTOMAKE is no longer documented.  It's still supported
+    though (albeit with a warning in the 'obsolete' category), to cater
+    for people who want to define the version number for their package
+    dynamically (e.g., from the current VCS revision).  We'll have to
+    continue this support until Autoconf itself is fixed to allow better
+    support for such dynamic version numbers.
 
 * Elisp byte-compilation:
 
@@ -95,8 +95,8 @@ New in 1.13:
     "make V=0" to enable quieter output in the package he's building.
 
   - The 'silent-rules' option has now become a no-op, preserved for
-    backward-compatibility only.  In particular, its use does not disable
-    the warnings in the 'portability-recursive' category anymore.
+    backward-compatibility only.  In particular, its use no longer
+    disables the warnings in the 'portability-recursive' category.
 
 * Texinfo Support:
 
@@ -107,8 +107,8 @@ New in 1.13:
 
 * Automatic remake rules and 'missing' script:
 
-  - The 'missing' script does not try anymore to update the timestamp
-    of out-of-date files that require a maintainer-specific tool to be
+  - The 'missing' script no longer tries to update the timestamp of
+    out-of-date files that require a maintainer-specific tool to be
     remade, in case the user lacks such a tool (or has a too-old version
     of it).  It just give a useful warning, and in some cases also a tip
     about how to obtain such a tool.
@@ -138,10 +138,11 @@ New in 1.13:
 
 * Improvements to aclocal and related rebuilds rules:
 
-  - The Autoconf-provided macro AC_CONFIG_MACRO_DIR is now traced by
-    aclocal, and can be used to declare the local m4 include directory.
-    Formerly, one had to specify it with an explicit '-I' option to the
-    'aclocal' invocation.
+  - Autoconf-provided macros AC_CONFIG_MACRO_DIR and AC_CONFIG_MACRO_DIRS
+    (the latter of which will only be present since Autoconf 2.70) are
+    now traced by aclocal, and can be used to declare the local m4 include
+    directories.  Formerly, one had to specify it with an explicit '-I'
+    option to the 'aclocal' invocation.
 
   - The special make variable ACLOCAL_AMFLAGS is deprecated; future
     Automake versions will warn about its use, and later version will
diff --git a/aclocal.in b/aclocal.in
index e2e9536..d4e7000 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -52,7 +52,7 @@ $perl_threads = 0;
 # 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 or AC_CONFIG_MACRO_DIR.
+# @user_includes can be augmented with -I or AC_CONFIG_MACRO_DIRS.
 # @automake_includes can be reset with the '--automake-acdir' option.
 # @system_includes can be augmented with the 'dirlist' file or the
 # ACLOCAL_PATH environment variable, and reset with the '--system-acdir'
@@ -146,10 +146,10 @@ my $serial_number_rx = '^\d+(?:\.\d+)*$';
 # Autoconf version.  This variable is set by 'trace_used_macros'.
 my $ac_version;
 
-# Primary user directory containing extra m4 files for macros
-# definition, as extracted from call to macro AC_CONFIG_MACRO_DIR.
-# This variable is set by 'trace_used_macros'.
-my $ac_config_macro_dir;
+# User directory containing extra m4 files for macros definition,
+# as extracted from calls to the macro AC_CONFIG_MACRO_DIRS.
+# This variable is updated by 'trace_used_macros'.
+my @ac_config_macro_dirs;
 
 # If set, names a temporary file that must be erased on abnormal exit.
 my $erase_me;
@@ -164,7 +164,7 @@ sub check_acinclude ();
 sub reset_maps ();
 sub install_file ($$);
 sub list_compare (address@hidden@);
-sub scan_m4_dirs ($@);
+sub scan_m4_dirs ($$@);
 sub scan_m4_files ();
 sub add_macro ($);
 sub scan_configure_dep ($);
@@ -344,28 +344,20 @@ sub list_compare (address@hidden@)
 
 ################################################################
 
-# scan_m4_dirs($TYPE, @DIRS)
-# --------------------------
+# scan_m4_dirs($TYPE, $ERR_ON_NONEXISTING, @DIRS)
+# -----------------------------------------------
 # Scan all M4 files installed in @DIRS for new macro definitions.
 # Register each file as of type $TYPE (one of the FT_* constants).
-my $first_user_m4dir = 1;
-sub scan_m4_dirs ($@)
+sub scan_m4_dirs ($$@)
 {
-  my ($type, @dirlist) = @_;
+  my ($type, $err_on_nonexisting, @dirlist) = @_;
 
   foreach my $m4dir (@dirlist)
     {
       if (! opendir (DIR, $m4dir))
        {
-         if ($install && $type == FT_USER && $first_user_m4dir)
-            {
-              # We will try to create this directory later, so don't
-              # complain if it doesn't exist.
-              # TODO: maybe we should avoid complaining only if errno
-              # is ENONENT?
-              $first_user_m4dir = 0;
-              next;
-            }
+         # TODO: maybe avoid complaining only if errno == ENONENT?
+         next unless $err_on_nonexisting;
          fatal "couldn't open directory '$m4dir': $!";
        }
 
@@ -400,9 +392,16 @@ 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);
+
+  if (@user_includes)
+    {
+      # Don't complain if the first user directory doesn't exist, in case
+      # we need to create it later (can happen if '--install' was given).
+      scan_m4_dirs (FT_USER, !$install, $user_includes[0]);
+      scan_m4_dirs (FT_USER, 1, @user_includes[1..$#user_includes]);
+    }
+  scan_m4_dirs (FT_AUTOMAKE, 1, @automake_includes);
+  scan_m4_dirs (FT_SYSTEM,   1, @system_includes);
 
   # Construct a new function that does the searching.  We use a
   # function (instead of just evaluating $search in the loop) so that
@@ -719,6 +718,14 @@ sub trace_used_macros ()
 
   my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@');
   $traces .= " --language Autoconf-without-aclocal-m4 ";
+  # When AC_CONFIG_MACRO_DIRS is used, avoid possible spurious warnings
+  # from autom4te about macros being "m4_require'd but not m4_defun'd";
+  # for more background, see:
+  # http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00004.html
+  # as well as autoconf commit 'v2.69-44-g1ed0548', "warn: allow aclocal
+  # to silence m4_require warnings".
+  $traces = "echo 'm4_define([m4_require_silent_probe], [-])' | " .
+            "$traces - ";
   # All candidate files.
   $traces .= join (' ',
                   (map { "'$_'" }
@@ -726,12 +733,16 @@ sub trace_used_macros ()
 
   # All candidate macros.
   $traces .= join (' ',
-                  (map { "--trace='$_:\$f::\$n::\$1'" }
+                  (map { "--trace='$_:\$f::\$n::\${::}%'" }
                    ('AC_DEFUN',
                     'AC_DEFUN_ONCE',
                     'AU_DEFUN',
                     '_AM_AUTOCONF_VERSION',
-                    'AC_CONFIG_MACRO_DIR')),
+                    # FIXME: We still need to trace AC_CONFIG_MACRO_DIR
+                     # for compatibility with older autoconf.  Remove this
+                     # when we can assume Autoconf 2.70 or later.
+                    'AC_CONFIG_MACRO_DIR',
+                    'AC_CONFIG_MACRO_DIR_TRACE')),
                   # Do not trace $1 for all other macros as we do
                   # not need it and it might contains harmful
                   # characters (like newlines).
@@ -741,7 +752,7 @@ sub trace_used_macros ()
 
   my $tracefh = new Automake::XFile ("$traces $configure_ac |");
 
-  $ac_config_macro_dir = undef;
+  @ac_config_macro_dirs = ();
 
   my %traced = ();
 
@@ -761,12 +772,24 @@ sub trace_used_macros ()
         {
           $ac_version = $arg1;
         }
-      elsif ($macro eq 'AC_CONFIG_MACRO_DIR')
+      elsif ($macro eq 'AC_CONFIG_MACRO_DIR_TRACE')
+        {
+          push @ac_config_macro_dirs, $arg1;
+        }
+    # FIXME: We still need to trace AC_CONFIG_MACRO_DIR
+    # for compatibility with older autoconf.  Remove this
+    # when we can assume Autoconf 2.70 or later.
+    elsif ($macro eq 'AC_CONFIG_MACRO_DIR')
         {
-          $ac_config_macro_dir = $arg1;
+          @ac_config_macro_dirs = ($arg1);
         }
     }
 
+  # FIXME: in Autoconf >= 2.70, AC_CONFIG_MACRO_DIR calls
+  # AC_CONFIG_MACRO_DIR_TRACE behind the scenes, which could
+  # leave unwanted duplicates in @ac_config_macro_dirs.
+  @ac_config_macro_dirs = uniq @ac_config_macro_dirs;
+
   $tracefh->close;
 
   return %traced;
@@ -1094,13 +1117,12 @@ while (1)
     last if $exit_code;
     my %macro_traced = trace_used_macros;
 
-    if (!$rerun_due_to_macrodir && defined $ac_config_macro_dir)
+    if (!$rerun_due_to_macrodir && @ac_config_macro_dirs)
       {
-         # The directory specified by the AC_CONFIG_MACRO_DIR m4 macro
-         # (if any) must after the user includes specified explicitly
-         # with the '-I' option.
-         push @user_includes, $ac_config_macro_dir
-           if defined $ac_config_macro_dir;
+        # The directory specified in calls to the AC_CONFIG_MACRO_DIRS
+        # m4 macro (if any) must go after the user includes specified
+        # explicitly with the '-I' option.
+        push @user_includes, @ac_config_macro_dirs;
         # We might have to scan some new directory of .m4 files.
         $rerun_due_to_macrodir++;
         next;
@@ -1109,7 +1131,7 @@ while (1)
     if ($install && address@hidden)
       {
         fatal "installation of third-party macros impossible without " .
-              "-I options nor AC_CONFIG_MACRO_DIR m4 macro";
+              "-I options nor AC_CONFIG_MACRO_DIR{,S} m4 macro(s)";
       }
 
     last if write_aclocal ($output_file, keys %macro_traced);
diff --git a/t/acloca17.sh b/t/acloca17.sh
deleted file mode 100755
index ed8fc32..0000000
--- a/t/acloca17.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2004-2012 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Make sure aclocal report unused required macros.
-
-am_create_testdir=empty
-. test-init.sh
-
-cat > configure.ac << 'END'
-AC_INIT
-SOME_DEFS
-END
-
-mkdir m4
-cat >m4/somedefs.m4 <<EOF
-AC_DEFUN([SOME_DEFS], [
-  AC_REQUIRE([UNDEFINED_MACRO])
-])
-EOF
-
-# FIXME: We want autom4te's 'undefined required macro' warning to be fatal,
-# but have no means to say so to aclocal.  We use WARNINGS=error instead.
-
-WARNINGS=error $ACLOCAL -I m4 2>stderr && { cat stderr >&2; exit 1; }
-cat stderr >&2
-grep '^configure\.ac:2:.*UNDEFINED_MACRO' stderr
-
-:
diff --git a/t/aclocal-macrodir.tap b/t/aclocal-macrodir.tap
index 3daedad..63ede71 100755
--- a/t/aclocal-macrodir.tap
+++ b/t/aclocal-macrodir.tap
@@ -15,12 +15,12 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Several tests on the use of the m4 macro AC_CONFIG_MACRO_DIR with
-# aclocal.
+# aclocal.  See also related test 'aclocal-macrodir.tap'.
 
 am_create_testdir=empty
 . test-init.sh
 
-plan_ later
+plan_ 6
 
 ocwd=$(pwd) || fatal_ "getting current working directory"
 ACLOCAL_PATH=; unset ACLOCAL_PATH
@@ -44,6 +44,7 @@ test_begin ()
   else
     r=ok
     description=$1
+    directive=${2-}
     echo "$description" > README.txt
     shift
   fi
@@ -68,8 +69,6 @@ test_end ()
   fi
 }
 
-test_todo () { directive=TODO; }
-
 #---------------------------------------------------------------------------
 
 test_begin "AC_CONFIG_MACRO_DIR is honored"
@@ -158,4 +157,45 @@ test_end
 
 #---------------------------------------------------------------------------
 
+test_begin "AC_CONFIG_MACRO_DIR([non-existent]) errors out (1)"
+
+cat > configure.ac << 'END'
+AC_INIT([oops], [1.0])
+AC_CONFIG_MACRO_DIR([non-existent])
+END
+
+not $ACLOCAL -Wnone 2>stderr \
+  && cat stderr >&2 \
+  && grep "couldn't open directory 'non-existent'" stderr \
+  || r='not ok'
+
+test_end
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIR interaction with AC_REQUIRE"
+
+cat > configure.ac <<'END'
+AC_INIT([req], [1.0])
+AC_CONFIG_MACRO_DIR([macro-dir])
+AC_DEFUN([MY_FOO], [AC_REQUIRE([MY_BAR])])
+MY_FOO
+END
+
+mkdir macro-dir
+echo 'AC_DEFUN([MY_BAR], [//my//bar//])' > macro-dir/x.m4
+
+st=0; $ACLOCAL 2>stderr || st=$?
+cat stderr >&2
+
+test $st -eq 0 \
+  && test ! -s stderr \
+  && $FGREP 'm4_include([macro-dir/x.m4])' aclocal.m4 \
+  && $AUTOCONF \
+  && not $EGREP 'MY_(FOO|BAR)' configure \
+  && $FGREP '//my//bar//' configure \
+  || r='not ok'
+
+test_end
+
 :
diff --git a/t/aclocal-macrodirs.tap b/t/aclocal-macrodirs.tap
new file mode 100755
index 0000000..28abb7c
--- /dev/null
+++ b/t/aclocal-macrodirs.tap
@@ -0,0 +1,412 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Several tests on the use of the m4 macro AC_CONFIG_MACRO_DIRS with
+# aclocal.  See also related test 'aclocal-macrodir.tap'.
+
+am_create_testdir=empty
+. test-init.sh
+
+{ $AUTOCONF -o /dev/null - <<END
+    AC_INIT([x], [0])
+    AC_CONFIG_MACRO_DIRS([.])
+END
+} || skip_all_ "autoconf doesn't define the AC_CONFIG_MACRO_DIRS macro"
+
+plan_ 14
+
+ocwd=$(pwd) || fatal_ "getting current working directory"
+ACLOCAL_PATH=; unset ACLOCAL_PATH
+
+#
+# General utility functions and variables.
+#
+# TODO: These should maybe be refactored, generalized and
+#       moved into 't/ax/tap-functions.sh' ...
+#
+
+tcount=0
+r=invalid
+description=''
+directive=''
+
+test_begin ()
+{
+  if test -n "$description"; then
+    fatal_ "'test_begin' called, but another test seems active already"
+  else
+    r=ok
+    description=$1
+    directive=${2-}
+    echo "$description" > README.txt
+    shift
+  fi
+  tcount=$(($tcount + 1)) && test $tcount -gt 0 \
+    || fatal_ "failed to bump the test count"
+  mkdir $tcount.d
+  cd $tcount.d
+}
+
+test_end ()
+{
+  if test -z "$description"; then
+    fatal_ "'test_end' called, but no test seems active"
+  else
+    cd "$ocwd" || fatal_ "cannot chdir back to top-level directory"
+    result_ "$r" -D "$directive" -- "$description"
+    # Don't leave directories for successful subtests hanging around.
+    if test -z "$directive" && test "$r" = ok; then
+      rm -rf "$tcount.d" || fatal_ "removing subdir $tcount.d"
+    fi
+    r=invalid directive= description=
+  fi
+}
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIRS is honored"
+
+cat > configure.ac <<'END'
+AC_INIT([md], [10.0])
+AC_CONFIG_MACRO_DIRS([macro-dir])
+MY_FOO
+END
+
+mkdir macro-dir
+echo 'AC_DEFUN([MY_FOO], [::my::foo::])' > macro-dir/foo.m4
+
+$ACLOCAL \
+  && $FGREP 'm4_include([macro-dir/foo.m4])' aclocal.m4 \
+  && $AUTOCONF \
+  && not $FGREP 'MY_FOO' configure \
+  && $FGREP '::my::foo::' configure \
+  || r='not ok'
+
+test_end
+
+#---------------------------------------------------------------------------
+
+three_dirs_check ()
+{
+  mkdir dir1 dir2 dir3
+  echo 'AC_DEFUN([MY_FOO], [::my::foo::])' > dir1/foo.m4
+  echo 'AC_DEFUN([MY_BAR], [!!my!!bar!!])' > dir2/zap.m4
+  echo 'AC_DEFUN([MY_BAZ], [==my==baz==])' > dir3/0.m4
+  $ACLOCAL \
+    && $FGREP 'm4_include([dir1/foo.m4])' aclocal.m4 \
+    && $FGREP 'm4_include([dir2/zap.m4])' aclocal.m4 \
+    && $FGREP 'm4_include([dir3/0.m4])'   aclocal.m4 \
+    && $AUTOCONF \
+    && not $EGREP 'MY_(FOO|BAR|BAZ)' configure \
+    && $FGREP '::my::foo::' configure \
+    && $FGREP '!!my!!bar!!' configure \
+    && $FGREP '==my==baz==' configure \
+    || r='not ok'
+}
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIRS several arguments"
+
+cat > configure.ac <<'END'
+AC_INIT([more-args], [0.2])
+AC_CONFIG_MACRO_DIRS([dir1 dir2 dir3])
+MY_FOO
+MY_BAR
+MY_BAZ
+END
+
+three_dirs_check
+
+test_end
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIRS several calls"
+
+cat > configure.ac <<'END'
+AC_INIT([more-calls], [2.0])
+AC_CONFIG_MACRO_DIRS([dir1])
+AC_CONFIG_MACRO_DIRS([dir2 dir3])
+MY_FOO
+MY_BAR
+MY_BAZ
+END
+
+three_dirs_check
+
+test_end
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIRS extra whitespace"
+
+bslash=\\
+
+cat > configure.ac <<END
+AC_INIT([more-args], [0.2])
+AC_CONFIG_MACRO_DIRS([   dir1${bslash}
+${tab} dir2   ${tab}${tab}dir3
+${bslash}
+
+])
+MY_FOO
+MY_BAR
+MY_BAZ
+END
+
+three_dirs_check
+
+test_end
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIRS precedence"
+
+cat > configure.ac <<'END'
+AC_INIT([more-calls], [2.0])
+AC_CONFIG_MACRO_DIRS([dir1])
+AC_CONFIG_MACRO_DIRS([dir2 dir3])
+MY_FOO
+MY_BAR
+MY_BAZ
+END
+
+mkdir dir1 dir2 dir3
+echo 'AC_DEFUN([MY_FOO], [OK-Foo])' > dir1/b.m4
+echo 'AC_DEFUN([MY_FOO], [KO-Foo])' > dir2/a.m4
+echo 'AC_DEFUN([MY_BAR], [OK-Bar])' > dir2/1.m4
+echo 'AC_DEFUN([MY_BAR], [KO-Bar])' > dir3/0.m4
+echo 'AC_DEFUN([MY_BAZ], [OK-Baz])' > dir3/x.m4
+
+$ACLOCAL \
+  && $FGREP 'm4_include([dir1/b.m4])' aclocal.m4 \
+  && $FGREP 'm4_include([dir2/1.m4])' aclocal.m4 \
+  && $FGREP 'm4_include([dir3/x.m4])' aclocal.m4 \
+  && test $($FGREP -c 'm4_include([dir1' aclocal.m4) -eq 1 \
+  && test $($FGREP -c 'm4_include([dir2' aclocal.m4) -eq 1 \
+  && test $($FGREP -c 'm4_include([dir3' aclocal.m4) -eq 1 \
+  && $AUTOCONF \
+  && not $EGREP 'MY_(FOO|BAR|BAZ)' configure \
+  && $FGREP 'OK-Foo' configure \
+  && $FGREP 'OK-Bar' configure \
+  && $FGREP 'OK-Baz' configure \
+  && not $FGREP 'KO-' configure \
+  || r='not ok'
+
+test_end
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIRS interaction with --install"
+
+cat > configure.ac << 'END'
+AC_INIT([inst], [1.0])
+AC_CONFIG_MACRO_DIRS([the-dir])
+THE_MACRO
+END
+
+mkdir sys-dir the-dir
+echo 'AC_DEFUN([THE_MACRO], [:])' > sys-dir/my.m4
+
+test ! -r the-dir/my.m4 \
+  && $ACLOCAL --install --system-acdir ./sys-dir \
+  && diff sys-dir/my.m4 the-dir/my.m4 \
+  || r='not ok'
+
+test_end
+
+#---------------------------------------------------------------------------
+
+two_dirs_install_check ()
+{
+  mkdir sys-dir dir1 dir2
+  echo 'AC_DEFUN([THE_MACRO], [:])' > sys-dir/my.m4
+  echo 'AC_DEFUN([AX_FOO], [:])' > dir2/zap.m4
+  test ! -r dir1/my.m4 \
+    && $ACLOCAL --install --system-acdir ./sys-dir \
+    && diff sys-dir/my.m4 dir1/my.m4 \
+    && test ! -e dir2/my.m4 \
+    && $FGREP 'm4_include([dir1/my.m4])' aclocal.m4 \
+    && $FGREP 'm4_include([dir2/zap.m4])' aclocal.m4 \
+    || r='not ok'
+}
+
+#---------------------------------------------------------------------------
+
+test_begin "several AC_CONFIG_MACRO_DIRS arguments and --install"
+
+cat > configure.ac << 'END'
+AC_INIT([inst2a], [1.0])
+AC_CONFIG_MACRO_DIRS([dir1 dir2])
+THE_MACRO
+AX_FOO
+END
+
+two_dirs_install_check
+
+test_end
+
+#---------------------------------------------------------------------------
+
+
+test_begin "several AC_CONFIG_MACRO_DIRS calls and --install"
+
+cat > configure.ac << 'END'
+AC_INIT([inst2b], [1.0])
+AC_CONFIG_MACRO_DIRS([dir1])
+AC_CONFIG_MACRO_DIRS([dir2])
+THE_MACRO
+AX_FOO
+END
+
+two_dirs_install_check
+
+test_end
+
+#---------------------------------------------------------------------------
+
+test_begin "'-I' option wins over AC_CONFIG_MACRO_DIRS"
+
+cat > configure.ac <<'END'
+AC_INIT([md], [4.6])
+AC_CONFIG_MACRO_DIRS([dir1])
+MY_FOO
+END
+
+mkdir dir1 dir2
+echo 'AC_DEFUN([MY_FOO], [::ko::ko::])' > dir1/1.m4
+echo 'AC_DEFUN([MY_FOO], [::ok::ok::])' > dir2/2.m4
+
+$ACLOCAL -I dir2 \
+  && $FGREP 'm4_include([dir2/2.m4])' aclocal.m4 \
+  && not $FGREP 'm4_include([dir1/1.m4])' aclocal.m4 \
+  && $AUTOCONF \
+  && not $FGREP '::ko::ko::' configure \
+  && $FGREP '::ok::ok::' configure \
+  || r='not ok'
+
+test_end
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIRS([foo]) can create directory 'foo'"
+
+cat > configure.ac << 'END'
+AC_INIT([x], [1.0])
+AC_CONFIG_MACRO_DIRS([foo])
+MY_MACRO
+END
+
+mkdir acdir
+echo 'AC_DEFUN([MY_MACRO], [:])' > acdir/bar.m4
+
+test ! -d foo \
+  && $ACLOCAL --install --system-acdir ./acdir \
+  && diff acdir/bar.m4 foo/bar.m4 \
+  || r='not ok'
+
+test_end
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) errors out (1)"
+
+cat > configure.ac << 'END'
+AC_INIT([oops], [1.0])
+AC_CONFIG_MACRO_DIRS([non-existent])
+END
+
+not $ACLOCAL 2>stderr \
+  && cat stderr >&2 \
+  && grep "couldn't open directory 'non-existent'" stderr \
+  || r='not ok'
+
+test_end
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) errors out (2)"
+
+cat > configure.ac << 'END'
+AC_INIT([oops], [1.0])
+AC_CONFIG_MACRO_DIRS([dir-ok])
+AC_CONFIG_MACRO_DIRS([dir-ko])
+END
+
+mkdir dir-ok
+not $ACLOCAL 2>stderr \
+  && cat stderr >&2 \
+  && grep "couldn't open directory 'dir-ko'" stderr \
+  && not grep "dir-ok" stderr \
+  || r='not ok'
+
+test_end
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) errors out (tricky setup)"
+
+cat > configure.ac << 'END'
+AC_INIT([oops], [1.0])
+AC_CONFIG_MACRO_DIRS([dir-ok])
+AC_CONFIG_MACRO_DIRS([dir-ko])
+END
+
+mkdir dir-ok
+
+not $ACLOCAL -Wnone --install 2>stderr \
+  && cat stderr >&2 \
+  && grep "couldn't open directory 'dir-ko'" stderr \
+  && test ! -e dir-ko \
+  || r='not ok'
+
+test_end
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIRS interaction with AC_REQUIRE"
+
+cat > configure.ac <<'END'
+AC_INIT([req], [1.0])
+AC_CONFIG_MACRO_DIRS([m1 m2])
+AC_DEFUN([MY_FOO], [
+  AC_REQUIRE([MY_BAR])
+  AC_REQUIRE([MY_BAZ])
+])
+MY_FOO
+END
+
+mkdir m1 m2
+echo 'AC_DEFUN([MY_BAR], [^^my^^bar^^])' > m1/x.m4
+echo 'AC_DEFUN([MY_BAZ], [~~my~~baz~~])' > m2/x.m4
+
+st=0; $ACLOCAL 2>stderr || st=$?
+cat stderr >&2
+
+test $st -eq 0 \
+  && test ! -s stderr \
+  && $FGREP 'm4_include([m1/x.m4])' aclocal.m4 \
+  && $FGREP 'm4_include([m2/x.m4])' aclocal.m4 \
+  && $AUTOCONF \
+  && not $EGREP 'MY_(FOO|BAR|BAZ)' configure \
+  && $FGREP '^^my^^bar^^' configure \
+  && $FGREP '~~my~~baz~~' configure \
+  || r='not ok'
+
+test_end
+
+:
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 89ec37d..2b19150 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -87,7 +87,6 @@ t/acloca14.sh \
 t/acloca14b.sh \
 t/acloca15.sh \
 t/acloca16.sh \
-t/acloca17.sh \
 t/acloca18.sh \
 t/acloca19.sh \
 t/acloca20.sh \
@@ -98,6 +97,7 @@ t/acloca23.sh \
 t/aclocal-acdir.sh \
 t/aclocal-install-absdir.sh \
 t/aclocal-macrodir.tap \
+t/aclocal-macrodirs.tap \
 t/aclocal-amflags.sh \
 t/aclocal-print-acdir.sh \
 t/aclocal-path.sh \
@@ -1035,6 +1035,7 @@ t/subpkg2.sh \
 t/subpkg3.sh \
 t/subpkg4.sh \
 t/subpkg-yacc.sh \
+t/subpkg-macrodir.sh \
 t/subst.sh \
 t/subst3.sh \
 t/subst4.sh \
diff --git a/t/subpkg-macrodir.sh b/t/subpkg-macrodir.sh
new file mode 100755
index 0000000..275af0d
--- /dev/null
+++ b/t/subpkg-macrodir.sh
@@ -0,0 +1,93 @@
+#! /bin/sh
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Subpackages that want to use m4 macros from their superpackages,
+# with AC_CONFIG_MACRO_DIRS.
+
+. test-init.sh
+
+{ $AUTOCONF -o /dev/null - <<END
+    AC_INIT([x], [0])
+    AC_CONFIG_MACRO_DIRS([.])
+END
+} || skip_ "autoconf doesn't define the AC_CONFIG_MACRO_DIRS macro"
+
+cat > configure.ac <<'END'
+AC_INIT([super], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_SUBDIRS([pkg])
+AX_BAR
+AX_FOO
+END
+
+mkdir m4
+
+cat > m4/foo.m4 <<'EOF'
+AC_DEFUN([AX_FOO], [
+  AC_CONFIG_FILES([Makefile])
+  AC_OUTPUT
+])
+EOF
+
+cat > m4/bar.m4 <<'EOF'
+AC_DEFUN([AX_BAR], [AC_SUBST([WHOMAI], [SuperPkg])])
+EOF
+
+cat > Makefile.am << 'END'
+test-whomai:
+       test '$(WHOAMI)' = SuperPkg
+check-local: test
+.PHONY: test
+END
+
+mkdir pkg
+
+cat > pkg/configure.ac <<'END'
+AC_INIT([super], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_MACRO_DIRS([macros ../m4])
+AX_BAR
+AX_FOO
+END
+
+mkdir pkg/macros
+cat > pkg/macros/zardoz.m4 << 'END'
+AC_DEFUN([AX_BAR], [AC_SUBST([WHOMAI], [sub-pkg])])
+END
+
+cat > pkg/Makefile.am << 'END'
+test-whomai:
+       test '$(WHOAMI)' = sub-pkg
+check-local: test
+.PHONY: test
+END
+
+AUTOMAKE=$AUTOMAKE ACLOCAL=$ACLOCAL AUTOCONF=$AUTOCONF $AUTORECONF -vi
+
+$FGREP 'm4_include([m4/foo.m4])' aclocal.m4
+$FGREP 'm4_include([m4/bar.m4])' aclocal.m4
+$FGREP 'm4_include([../m4/foo.m4])' pkg/aclocal.m4
+$FGREP 'm4_include([macros/zardoz.m4])' pkg/aclocal.m4
+
+./configure
+
+$MAKE test
+(cd pkg && $MAKE test) || exit 1
+
+$MAKE distcheck
+
+:


hooks/post-receive
-- 
GNU Automake



reply via email to

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