Merge branch 'fix-pr13514' into branch-1.13.2
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 21 Feb 2013 14:35:04 +0000 (15:35 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 21 Feb 2013 14:35:04 +0000 (15:35 +0100)
* fix-pr13514:
  aclocal: fix for more-than-once specified directories
  aclocal: just warn if the primary local m4 dir doesn't exist (don't error)

1  2 
NEWS
THANKS
aclocal.in
t/aclocal-macrodir.tap
t/aclocal-macrodirs.tap

diff --combined NEWS
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -1,59 -1,22 +1,59 @@@
 -New in 1.13.2:
 +* WARNING: New versioning scheme for Automake.
 +
 +  - Starting with this version onward, Automake will use an update and
 +    more rational versioning scheme, one that will allow users to know
 +    which kind of changes can be expected from a new version, based on
 +    its version number.
 +
 +    + Micro versions (e.g., 1.13.3, 2.0.1, 3.2.8) will introduce only
 +      documentation updates and bug and regression fixes; they will
 +      not introduce new features, nor any backward-incompatibility (any
 +      such incompatibility would be considered a bug, to be fixed with
 +      a further  micro release).
 +
 +    + Minor versions (e.g., 1.14, 2.1) can introduce new backward
 +      compatible features; the only backward-incompatibilities allowed
 +      in such a release are new *non-fatal* deprecations and warnings,
 +      and possibly fixes for old or non-trivial bugs (or even inefficient
 +      behaviours) that could unfortunately have been seen, and used, by
 +      some developers as "corner case features".  This kind of fixes
 +      should hopefully be quite rare.
 +
 +    + Major versions (now expected to be released every 18 or 24 months,
 +      and not more often) can introduce new big features (possibly with
 +      rough edges and not-fully-stabilized APIs), removal of deprecated
 +      features, backward-incompatible changes of behaviour, and possibly
 +      major refactorings (that, while ideally transparent to the user,
 +      could introduce new bugs).  Incompatibilities should however not
 +      be introduced gratuitously and abruptly; a proper deprecation path
 +      should be duly implemented in the preceding minor releases.
 +
 +  - According to this new scheme, the next major version of Automake
 +    (the one that has until now been labelled as '1.14') will actually
 +    become "Automake 2.0".  Automake 1.14 will be the next minor version,
 +    which will introduce new features and deprecation, but no backward
 +    incompatibility.
 +
 +  - See discussion about automake bug#13578 for more details and
 +    background: <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13578>
  
  * WARNING: Future backward-incompatibilities!
  
 -  - Automake 1.14 will require Autoconf 2.70 or later (which is still
 +  - Automake 2.0 will require Autoconf 2.70 or later (which is still
      unreleased at the moment of writing, but is planned to be released
 -    before Automake 1.14 is).
 +    before Automake 2.0 is).
  
 -  - Automake 1.14 will drop support for the long-deprecated 'configure.in'
 +  - Automake 2.0 will drop support for the long-deprecated 'configure.in'
      name for the Autoconf input file.  You are advised to start using the
      recommended name 'configure.ac' instead, ASAP.
  
    - The ACLOCAL_AMFLAGS special make variable will be fully deprecated
 -    in Automake 1.14 (where it will raise warnings in the "obsolete"
 +    in Automake 2.0 (where it will raise warnings in the "obsolete"
      category).  You are advised to start relying on the new Automake
      support for AC_CONFIG_MACRO_DIRS instead (which was introduced in
      Automake 1.13).
  
 -  - Automake 1.14 will remove support for automatic dependency tracking
 +  - Automake 2.0 will remove support for automatic dependency tracking
      with the SGI C/C++ compilers on IRIX.  The SGI depmode has been
      reported broken "in the wild" already, and we don't think investing
      time in debugging and fixing is worthwhile, especially considering
      DJGPP project).  Note however that both Cygwin and MSYS/MinGW on
      modern Windows versions will continue to be fully supported.
  
 -  - Support for the long-deprecated INCLUDES variable will be removed
 -    altogether in Automake 1.14.  The AM_CPPFLAGS variable should be
 -    used instead.
 -
    - Automake-provided scripts and makefile recipes might (finally!)
 -    start assuming a POSIX shell in Automake 1.14.
 +    start assuming a POSIX shell in Automake 2.0.
  
 -  - Starting from Automake 1.14, third-party m4 files located in the
 +  - Starting from Automake 2.0, third-party m4 files located in the
      system-wide aclocal directory, as well as in any directory listed
      in the ACLOCAL_PATH environment variable, will take precedence
      over "built-in" Automake macros.  For example (assuming Automake
      is installed in the /usr/local hierarchy), a definition of the
      AM_PROG_VALAC macro found in '/usr/local/share/aclocal/my-vala.m4'
      should take precedence over the same-named automake-provided macro
 -    (defined in '/usr/local/share/aclocal-1.14/vala.m4').
 +    (defined in '/usr/local/share/aclocal-2.0/vala.m4').
 +
 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 +
 +New in 1.13.2:
  
  * Obsolescent features:
  
      Automake 1.13, has turned out to be a similarly very bad idea,
      for exactly the same reason.
  
+   - Aclocal no longer error out if the first local m4 directory (as
+     specified by the '-I' option or the 'AC_CONFIG_MACRO_DIRS' or
+     'AC_CONFIG_MACRO_DIR' macros) doesn't exist; it merely report a
+     warning in the 'unsupported' category.  This is done to support
+     some pre-existing real-world usages; refer to automake bug#13514
+     for more details.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  New in 1.13.1:
diff --combined THANKS
--- 1/THANKS
--- 2/THANKS
+++ b/THANKS
@@@ -48,7 -48,6 +48,7 @@@ Bob Friesenhahn                 bfriese
  Bob Proulx                      rwp@hprwp.fc.hp.com
  Bob Rossi                       bob@brasko.net
  Bobby Jack                      bobbykjack@yahoo.co.uk
 +Boris Kolpackov                 boris@codesynthesis.com
  Braden N. McDaniel              braden@endoframe.com
  Brandon Black                   blblack@gmail.com
  Brendan O'Dea                   bod@debian.org
@@@ -298,6 -297,7 +298,7 @@@ Paul Jarc                       prj@po.
  Paul Lunau                      temp@lunau.me.uk
  Paul Martinolich                martinol@datasync.com
  Paul Thomas                     PTHOMAS@novell.com
+ Pavel Raiskup                   praiskup@redhat.com
  Pavel Roskin                    pavel_roskin@geocities.com
  Pavel Sanda                     ps@twin.jikos.cz
  Per Bothner                     bothner@cygnus.com
diff --combined aclocal.in
@@@ -47,7 -47,7 +47,7 @@@ use File::Path ()
  # Some globals.
  
  # Support AC_CONFIG_MACRO_DIRS also with older autoconf.
 -# FIXME: To be removed in Automake 1.14, once we can assume autoconf
 +# FIXME: To be removed in Automake 2.0, once we can assume autoconf
  #        2.70 or later.
  # FIXME: keep in sync with 'internal/ac-config-macro-dirs.m4'.
  my $ac_config_macro_dirs_fallback =
@@@ -165,6 -165,11 +165,11 @@@ my @ac_config_macro_dirs
  # If set, names a temporary file that must be erased on abnormal exit.
  my $erase_me;
  
+ # Constants for the $ERR_LEVEL parameter of the 'scan_m4_dirs' function.
+ use constant SCAN_M4_DIRS_SILENT => 0;
+ use constant SCAN_M4_DIRS_WARN => 1;
+ use constant SCAN_M4_DIRS_ERROR => 2;
  ################################################################
  
  # Prototypes for all subroutines.
@@@ -355,21 -360,42 +360,42 @@@ sub list_compare (\@\@
  
  ################################################################
  
- # scan_m4_dirs($TYPE, $ERR_ON_NONEXISTING, @DIRS)
+ # scan_m4_dirs($TYPE, $ERR_LEVEL, @DIRS)
  # -----------------------------------------------
  # Scan all M4 files installed in @DIRS for new macro definitions.
  # Register each file as of type $TYPE (one of the FT_* constants).
+ # If a directory in @DIRS cannot be read:
+ #  - fail hard                if $ERR_LEVEL == SCAN_M4_DIRS_ERROR
+ #  - just print a warning     if $ERR_LEVEL == SCAN_M4_DIRS_WA
+ #  - continue silently        if $ERR_LEVEL == SCAN_M4_DIRS_SILENT
  sub scan_m4_dirs ($$@)
  {
-   my ($type, $err_on_nonexisting, @dirlist) = @_;
+   my ($type, $err_level, @dirlist) = @_;
  
    foreach my $m4dir (@dirlist)
      {
        if (! opendir (DIR, $m4dir))
        {
          # TODO: maybe avoid complaining only if errno == ENONENT?
-         next unless $err_on_nonexisting;
-         fatal "couldn't open directory '$m4dir': $!";
+           my $message = "couldn't open directory '$m4dir': $!";
+           if ($err_level == SCAN_M4_DIRS_ERROR)
+             {
+               fatal $message;
+             }
+           elsif ($err_level == SCAN_M4_DIRS_WARN)
+             {
+               msg ('unsupported', $message);
+               next;
+             }
+           elsif ($err_level == SCAN_M4_DIRS_SILENT)
+             {
+               next; # Silently ignore.
+             }
+           else
+             {
+                prog_error "invalid \$err_level value '$err_level'";
+             }
        }
  
        # We reverse the directory contents so that foo2.m4 gets
@@@ -406,13 -432,27 +432,27 @@@ sub scan_m4_files (
  
    if (@user_includes)
      {
+       # Don't explore the same directory multiple times.  This is here not
+       # only for speedup purposes.  We need this when the user has e.g.
+       # specified 'ACLOCAL_AMFLAGS = -I m4' and has also set
+       # AC_CONFIG_MACRO_DIR[S]([m4]) in configure.ac.  This makes the 'm4'
+       # directory to occur twice here and fail on the second call to
+       # scan_m4_dirs([m4]) when the 'm4' directory doesn't exist.
+       # TODO: Shouldn't there be rather a check in scan_m4_dirs for
+       #       @user_includes[0]?
+       @user_includes = uniq @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_USER,
+                     $install ? SCAN_M4_DIRS_SILENT : SCAN_M4_DIRS_WARN,
+                     $user_includes[0]);
+       scan_m4_dirs (FT_USER,
+                     SCAN_M4_DIRS_ERROR,
+                   @user_includes[1..$#user_includes]);
      }
-   scan_m4_dirs (FT_AUTOMAKE, 1, @automake_includes);
-   scan_m4_dirs (FT_SYSTEM,   1, @system_includes);
+   scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes);
+   scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes);
  
    # Construct a new function that does the searching.  We use a
    # function (instead of just evaluating $search in the loop) so that
@@@ -744,7 -784,7 +784,7 @@@ sub trace_used_macros (
    # a bug in option parsing code of autom4te 2.68 and earlier will cause
    # it to read standard input last, even if the "-" argument is specified
    # early.
 -  # FIXME: To be removed in Automake 1.14, once we can assume autoconf
 +  # FIXME: To be removed in Automake 2.0, once we can assume autoconf
    #        2.70 or later.
    $traces .= "$automake_includes[0]/internal/ac-config-macro-dirs.m4 ";
  
                     'AC_CONFIG_MACRO_DIR_TRACE',
                       # FIXME: Tracing the next two macros is a hack for
                       # compatibility with older autoconf.  Remove this in
 -                     # Automake 1.14, when we can assume Autoconf 2.70 or
 +                     # Automake 2.0, when we can assume Autoconf 2.70 or
                       # later.
                     'AC_CONFIG_MACRO_DIR',
                     '_AM_CONFIG_MACRO_DIRS')),
    # 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.
 -  # Remove this in Automake 1.14, when we'll stop tracing
 +  # Remove this in Automake 2.0, when we'll stop tracing
    # AC_CONFIG_MACRO_DIR explicitly.
    @ac_config_macro_dirs = uniq @ac_config_macro_dirs;
  
diff --combined t/aclocal-macrodir.tap
@@@ -20,7 -20,7 +20,7 @@@
  am_create_testdir=empty
  . test-init.sh
  
- plan_ 6
+ plan_ 7
  
  ocwd=$(pwd) || fatal_ "getting current working directory"
  ACLOCAL_PATH=; unset ACLOCAL_PATH
@@@ -157,16 -157,44 +157,44 @@@ test_en
  
  #---------------------------------------------------------------------------
  
- test_begin "AC_CONFIG_MACRO_DIR([non-existent]) errors out (1)"
+ test_begin "AC_CONFIG_MACRO_DIR([non-existent]) warns with -Wunsupported"
  
  cat > configure.ac << 'END'
  AC_INIT([oops], [1.0])
  AC_CONFIG_MACRO_DIR([non-existent])
+ AM_INIT_AUTOMAKE
  END
  
not $ACLOCAL -Wnone 2>stderr \
$ACLOCAL -Wno-error 2>stderr \
    && cat stderr >&2 \
    && grep "couldn't open directory 'non-existent'" stderr \
+   && test -f aclocal.m4 \
+   || r='not ok'
+ rm -rf aclocal.m4 autom4te*.cache
+ $ACLOCAL -Werror -Wno-unsupported \
+   && test -f aclocal.m4 \
+   || r='not ok'
+ test_end
+ #---------------------------------------------------------------------------
+ test_begin "AC_CONFIG_MACRO_DIR([not-exist]) and ACLOCAL_AMFLAGS = -I not-exist"
+ cat > configure.ac << 'END'
+ AC_INIT([oops], [1.0])
+ AC_CONFIG_MACRO_DIR([not-exist])
+ END
+ cat > Makefile.am << 'END'
+ ACLOCAL_AMFLAGS = -I not-exist
+ END
+ $ACLOCAL -Wno-error 2>stderr \
+   && cat stderr >&2 \
+   && test $(grep -c "couldn't open directory 'not-exist'" stderr) -eq 1 \
    || r='not ok'
  
  test_end
  #---------------------------------------------------------------------------
  
  # Avoid spurious failures with pre-2.70 autoconf.
 -# FIXME: remove this in automake 1.14, once we require Autoconf 2.70.
 +# FIXME: remove this in automake 2.0, once we require Autoconf 2.70.
  if echo 'AC_INIT AC_CONFIG_MACRO_DIRS' | $AUTOCONF -o/dev/null -; then
  
    test_begin "AC_CONFIG_MACRO_DIR interaction with AC_REQUIRE"
diff --combined t/aclocal-macrodirs.tap
@@@ -20,7 -20,7 +20,7 @@@
  am_create_testdir=empty
  . test-init.sh
  
- plan_ 14
+ plan_ 15
  
  ocwd=$(pwd) || fatal_ "getting current working directory"
  ACLOCAL_PATH=; unset ACLOCAL_PATH
@@@ -317,23 -317,31 +317,31 @@@ test_en
  
  #---------------------------------------------------------------------------
  
- test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) errors out (1)"
+ test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) warns (1)"
  
  cat > configure.ac << 'END'
  AC_INIT([oops], [1.0])
  AC_CONFIG_MACRO_DIRS([non-existent])
+ AM_INIT_AUTOMAKE
  END
  
not $ACLOCAL 2>stderr \
$ACLOCAL -Wno-error 2>stderr \
    && cat stderr >&2 \
    && grep "couldn't open directory 'non-existent'" stderr \
+   && test -f aclocal.m4 \
+   || r='not ok'
+ rm -rf aclocal.m4 autom4te*.cache
+ $ACLOCAL -Werror -Wno-unsupported \
+   && test -f aclocal.m4 \
    || r='not ok'
  
  test_end
  
  #---------------------------------------------------------------------------
  
- test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) errors out (2)"
+ test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) warns (2)"
  
  cat > configure.ac << 'END'
  AC_INIT([oops], [1.0])
@@@ -346,13 -354,14 +354,14 @@@ not $ACLOCAL 2>stderr 
    && cat stderr >&2 \
    && grep "couldn't open directory 'dir-ko'" stderr \
    && not grep "dir-ok" stderr \
+   && test ! -e aclocal.m4 \
    || r='not ok'
  
  test_end
  
  #---------------------------------------------------------------------------
  
- test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) errors out (tricky setup)"
+ test_begin "AC_CONFIG_MACRO_DIRS([existent non-existent]) errors out"
  
  cat > configure.ac << 'END'
  AC_INIT([oops], [1.0])
@@@ -371,9 -380,29 +380,29 @@@ not $ACLOCAL -Wnone --install 2>stderr 
  test_end
  
  #---------------------------------------------------------------------------
+ test_begin "AC_CONFIG_MACRO_DIRS([not-exist]) and ACLOCAL_AMFLAGS = -I not-exist"
+ cat > configure.ac << 'END'
+ AC_INIT([oops], [1.0])
+ AC_CONFIG_MACRO_DIRS([not-exist])
+ END
+ cat > Makefile.am << 'END'
+ ACLOCAL_AMFLAGS = -I not-exist
+ END
+ $ACLOCAL -Wno-error 2>stderr \
+   && cat stderr >&2 \
+   && test $(grep -c "couldn't open directory 'not-exist'" stderr) -eq 1 \
+   || r='not ok'
+ test_end
+ #---------------------------------------------------------------------------
  
  # Avoid spurious failures with pre-2.70 autoconf.
 -# FIXME: remove this in automake 1.14, once we require Autoconf 2.70.
 +# FIXME: remove this in automake 2.0, once we require Autoconf 2.70.
  if echo 'AC_INIT AC_CONFIG_MACRO_DIRS' | $AUTOCONF -o/dev/null -; then
  
    test_begin "AC_CONFIG_MACRO_DIRS interaction with AC_REQUIRE"