automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, ng/master, updated. v1.12.1


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, ng/master, updated. v1.12.1-575-gdb4d85a
Date: Tue, 03 Jul 2012 22:12:22 +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=db4d85abb25a3c9df95cdff367eb0d0e26be4e6d

The branch, ng/master has been updated
       via  db4d85abb25a3c9df95cdff367eb0d0e26be4e6d (commit)
       via  b3a5c6b4973209af0aa125f8916fff4070080ee9 (commit)
       via  bbd192421043a482f00e9532de2a127c708323cf (commit)
       via  51ea4f3ffc52524f88e01fd9e583e90fd2a537b7 (commit)
       via  5e0539a3cc36e426e315ebf55df95b78f4822235 (commit)
       via  cd1a9ccc1bd0248d2c504f367089f2481d364324 (commit)
      from  5fdd743164e2b15a385b19a14108bdacb6c76218 (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 db4d85abb25a3c9df95cdff367eb0d0e26be4e6d
Merge: 5fdd743 b3a5c6b
Author: Stefano Lattarini <address@hidden>
Date:   Tue Jul 3 23:56:54 2012 +0200

    Merge branch 'master' into ng/master
    
    * master:
      tests: make 't/aclocal-macrodir.tap' executable
      maintcheck: fix spurious failure in 'maintainer-check-list-of-tests'
      build: fix cleaning of test directories in contrib (and in t/perf)
      aclocal: deprecate ACLOCAL_AMFLAGS, trace AC_CONFIG_MACRO_DIR instead
    
    Signed-off-by: Stefano Lattarini <address@hidden>

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

Summary of changes:
 Makefile.am                     |   17 +++--
 NEWS                            |   11 +++
 aclocal.in                      |   63 +++++++++++----
 doc/automake-ng.texi            |   93 +++++++---------------
 lib/am/configure.am             |    6 +-
 t/acloca14.sh                   |    2 +-
 t/{acloca14.sh => acloca14b.sh} |    0
 t/acloca22.sh                   |   12 ++-
 t/{acloca22.sh => acloca22b.sh} |   12 ++-
 t/aclocal-amflags.sh            |   69 +++++++++++++++++
 t/aclocal-macrodir.tap          |  161 +++++++++++++++++++++++++++++++++++++++
 t/aclocal-path-install.sh       |    2 +-
 t/aclocal4.sh                   |    4 +-
 t/aclocal5.sh                   |   16 ++--
 t/aclocal6.sh                   |    4 +-
 t/remake-macrodir.sh            |   83 ++++++++++++++++++++
 t/remake10c.sh                  |    4 +-
 t/remake8a.sh                   |   12 ++--
 t/remake8b.sh                   |   12 ++--
 t/subdir-add2-pr46.sh           |    4 +-
 t/subpkg.sh                     |   10 +--
 t/subpkg2.sh                    |   10 ++-
 22 files changed, 470 insertions(+), 137 deletions(-)
 copy t/{acloca14.sh => acloca14b.sh} (100%)
 copy t/{acloca22.sh => acloca22b.sh} (83%)
 create mode 100755 t/aclocal-amflags.sh
 create mode 100755 t/aclocal-macrodir.tap
 create mode 100755 t/remake-macrodir.sh

diff --git a/Makefile.am b/Makefile.am
index 6b8cde9..ada1fac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -438,13 +438,16 @@ installcheck-testsuite:
 clean-local: clean-local-check
 .PHONY: clean-local-check
 clean-local-check:
-       -set x t/*.dir; shift; \
-        if test "$$#,$$1" = "1,*.dir"; then \
-          : there is no test directory to clean; \
-        else \
-          find "$$@" -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
-          rm -rf "$$@"; \
-        fi;
+## Directries candidate to be test directories match this wildcard.
+       @globs='t/*.dir t/*/*.dir */t/*.dir */t/*/*.dir'; \
+## The 'nullglob' bash option is not portable, so use perl.
+       dirs=`$(PERL) -e "print join(' ', glob('$$globs'));"` || exit 1; \
+       if test -n "$$dirs"; then \
+## Errors in find are acceptable, errors in rm are not.
+           find $$dirs -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
+           echo " rm -rf $$dirs"; \
+           rm -rf $$dirs || exit 1; \
+       fi
 
 
 ## ---------------- ##
diff --git a/NEWS b/NEWS
index 292f628..dc2fdb3 100644
--- a/NEWS
+++ b/NEWS
@@ -88,6 +88,17 @@ New in 1.13:
   specifying the name of such targets in invocations of the new
   'AM_EXTRA_RECURSIVE_TARGETS' m4 macro.
 
+* 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.
+
+  - The special make variable ACLOCAL_AMFLAGS is deprecated; future
+    Automake versions will warn about its use, and later version will
+    remove support for it altogether.
+
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 New in 1.12.2:
diff --git a/aclocal.in b/aclocal.in
index cc7343d..6e43097 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -51,7 +51,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.
+# @user_includes can be augmented with -I or AC_CONFIG_MACRO_DIR.
 # @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'
@@ -143,10 +143,14 @@ my $m4_include_rx = 
"(m4_|m4_s|s)include\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
 my $serial_line_rx = '^#\s*serial\s+(\S*)';
 my $serial_number_rx = '^\d+(?:\.\d+)*$';
 
-# Autoconf version
-# Set by trace_used_macros.
+# 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;
+
 # If set, names a temporary file that must be erased on abnormal exit.
 my $erase_me;
 
@@ -719,13 +723,15 @@ sub trace_used_macros ()
   $traces .= join (' ',
                   (map { "'$_'" }
                    (grep { exists $files{$_} } @file_order))) . " ";
+
   # All candidate macros.
   $traces .= join (' ',
                   (map { "--trace='$_:\$f::\$n::\$1'" }
                    ('AC_DEFUN',
                     'AC_DEFUN_ONCE',
                     'AU_DEFUN',
-                    '_AM_AUTOCONF_VERSION')),
+                    '_AM_AUTOCONF_VERSION',
+                    'AC_CONFIG_MACRO_DIR')),
                   # Do not trace $1 for all other macros as we do
                   # not need it and it might contains harmful
                   # characters (like newlines).
@@ -735,6 +741,8 @@ sub trace_used_macros ()
 
   my $tracefh = new Automake::XFile ("$traces $configure_ac |");
 
+  $ac_config_macro_dir = undef;
+
   my %traced = ();
 
   while ($_ = $tracefh->getline)
@@ -744,12 +752,19 @@ sub trace_used_macros ()
 
       $traced{$macro} = 1 if exists $macro_seen{$macro};
 
-      $map_traced_defs{$arg1} = $file
-       if ($macro eq 'AC_DEFUN'
-           || $macro eq 'AC_DEFUN_ONCE'
-           || $macro eq 'AU_DEFUN');
-
-      $ac_version = $arg1 if $macro eq '_AM_AUTOCONF_VERSION';
+      if ($macro eq 'AC_DEFUN' || $macro eq 'AC_DEFUN_ONCE'
+            || $macro eq 'AU_DEFUN')
+        {
+          $map_traced_defs{$arg1} = $file;
+        }
+      elsif ($macro eq '_AM_AUTOCONF_VERSION')
+        {
+          $ac_version = $arg1;
+        }
+      elsif ($macro eq 'AC_CONFIG_MACRO_DIR')
+        {
+          $ac_config_macro_dir = $arg1;
+        }
     }
 
   $tracefh->close;
@@ -1018,12 +1033,6 @@ sub parse_arguments ()
       $dry_run = 1;
     }
 
-  if ($install && address@hidden)
-    {
-      fatal ("--install should copy macros in the directory indicated by the"
-            . "\nfirst -I option, but no -I was supplied");
-    }
-
   # Finally, adds any directory listed in the 'dirlist' file.
   if (open (DIRLIST, "$system_includes[0]/dirlist"))
     {
@@ -1074,16 +1083,36 @@ fatal "$configure_ac is required" unless -f 
$configure_ac;
 # we did not rerun aclocal, the next run of aclocal would produce a
 # different aclocal.m4.
 my $loop = 0;
+my $rerun_due_to_macrodir = 0;
 while (1)
   {
     ++$loop;
-    prog_error "too many loops" if $loop > 2;
+    prog_error "too many loops" if $loop > 2 + $rerun_due_to_macrodir;
 
     reset_maps;
     scan_m4_files;
     scan_configure;
     last if $exit_code;
     my %macro_traced = trace_used_macros;
+
+    if (!$rerun_due_to_macrodir && defined $ac_config_macro_dir)
+      {
+         # 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;
+        # We might have to scan some new directory of .m4 files.
+        $rerun_due_to_macrodir++;
+        next;
+      }
+
+    if ($install && address@hidden)
+      {
+        fatal "installation of third-party macros impossible without " .
+              "-I options nor AC_CONFIG_MACRO_DIR m4 macro";
+      }
+
     last if write_aclocal ($output_file, keys %macro_traced);
     last if $dry_run;
   }
diff --git a/doc/automake-ng.texi b/doc/automake-ng.texi
index 03cca92..1acb622 100644
--- a/doc/automake-ng.texi
+++ b/doc/automake-ng.texi
@@ -3608,32 +3608,19 @@ henceforth be visible to @command{autoconf}.  However 
if it contains
 numerous macros, it will rapidly become difficult to maintain, and it
 will be almost impossible to share macros between packages.
 
address@hidden ACLOCAL_AMFLAGS
 The second possibility, which we do recommend, is to write each macro
-in its own file and gather all of these files in a directory.  This
-directory is usually called @file{m4/}.  To build @file{aclocal.m4},
-one should therefore instruct @command{aclocal} to scan @file{m4/}.
-From the command line, this is done with @samp{aclocal -I m4}.  The
-top-level @file{Makefile.am} should also be updated to define
-
address@hidden
-ACLOCAL_AMFLAGS = -I m4
address@hidden example
-
address@hidden contains options to pass to @command{aclocal}
-when @file{aclocal.m4} is to be rebuilt by @command{make}.  This line is
-also used by @command{autoreconf} (@pxref{autoreconf Invocation, ,
-Using @command{autoreconf} to Update @file{configure} Scripts,
-autoconf, The Autoconf Manual}) to run @command{aclocal} with suitable
-options, or by @command{autopoint} (@pxref{autopoint Invocation, ,
-Invoking the @command{autopoint} Program, gettext, GNU gettext tools})
-and @command{gettextize} (@pxref{gettextize Invocation, , Invoking the
address@hidden Program, gettext, GNU gettext tools}) to locate
-the place where Gettext's macros should be installed.  So even if you
-do not really care about the rebuild rules, you should define
address@hidden
-
-When @samp{aclocal -I m4} is run, it will build an @file{aclocal.m4}
+in its own file and gather all these files in a directory.  This
+directory is usually called @file{m4/}.  Then it's enough to update
address@hidden by adding a proper call to @code{AC_CONFIG_MACRO_DIR}:
+
address@hidden
+AC_CONFIG_MACRO_DIR([m4])
address@hidden example
+
address@hidden will then take care of automatically adding @file{m4/}
+to its search path for m4 files.
+
+When @samp{aclocal} is run, it will build an @file{aclocal.m4}
 that @code{m4_include}s any file from @file{m4/} that defines a
 required macro.  Macros not found locally will still be searched in
 system-wide directories, as explained in @ref{Macro Search Path}.
@@ -3662,19 +3649,14 @@ this requirement will hinder development.  An easy 
solution is to copy
 such third-party macros in your local @file{m4/} directory so they get
 distributed.
 
-Since Automake 1.10, @command{aclocal} offers an option to copy these
-system-wide third-party macros in your local macro directory, solving
-the above problem.  Simply use:
-
address@hidden
-ACLOCAL_AMFLAGS = -I m4 --install
address@hidden example
+Since Automake 1.10, @command{aclocal} offers the option @code{--install}
+to copy these system-wide third-party macros in your local macro directory,
+helping to solve the above problem.
 
address@hidden
 With this setup, system-wide macros will be copied to @file{m4/}
-the first time you run @command{autoreconf}.  Then the locally
-installed macros will have precedence over the system-wide installed
-macros each time @command{aclocal} is run again.
+the first time you run @command{aclocal}.  Then the locally installed
+macros will have precedence over the system-wide installed macros
+each time @command{aclocal} is run again.
 
 One reason why you should keep @option{--install} in the flags even
 after the first run is that when you later edit @file{configure.ac}
@@ -3755,16 +3737,14 @@ MyPackage uses an @file{m4/} directory to store local 
macros as
 explained in @ref{Local Macros}, and has
 
 @example
-ACLOCAL_AMFLAGS = -I m4 --install
+AC_CONFIG_MACRO_DIR([m4])
 @end example
 
 @noindent
-in its top-level @file{Makefile.am}.
+in its @file{configure.ac}.
 
 Initially the @file{m4/} directory is empty.  The first time we run
address@hidden, it will fetch the options to pass to
address@hidden in @file{Makefile.am}, and run @samp{aclocal -I m4
---install}.  @command{aclocal} will notice that
address@hidden --install}, it will notice that
 
 @itemize @bullet
 @item
@@ -3782,9 +3762,8 @@ and @command{aclocal} was given the @option{--install} 
option, it will
 copy this file in @file{m4/thirdparty.m4}, and output an
 @file{aclocal.m4} that contains @samp{m4_include([m4/thirdparty.m4])}.
 
-The next time @samp{aclocal -I m4 --install} is run (either via
address@hidden, by hand, or from the @file{Makefile} rebuild
-rules) something different happens.  @command{aclocal} notices that
+The next time @samp{aclocal --install} is run, something different
+happens.  @command{aclocal} notices that
 
 @itemize @bullet
 @item
@@ -3810,8 +3789,8 @@ the system-wide file in case of equal serial numbers.
 
 Now suppose the system-wide third-party macro is changed.  This can
 happen if the package installing this macro is updated.  Let's suppose
-the new macro has serial number 2.  The next time @samp{aclocal -I m4
---install} is run the situation is the following:
+the new macro has serial number 2.  The next time @samp{aclocal --install}
+is run the situation is the following:
 
 @itemize @bullet
 @item
@@ -3837,16 +3816,16 @@ macro in @file{m4/thirdparty.m4}, in this case 
overriding the old
 version.  MyPackage just had its macro updated as a side effect of
 running @command{aclocal}.
 
-If you are leery of letting @command{aclocal} update your local macro,
-you can run @samp{aclocal -I m4 --diff} to review the changes
address@hidden -I m4 --install} would perform on these macros.
+If you are leery of letting @command{aclocal} update your local
+macro, you can run @samp{aclocal --diff} to review the changes
address@hidden --install} would perform on these macros.
 
 Finally, note that the @option{--force} option of @command{aclocal} has
 absolutely no effect on the files installed by @option{--install}.  For
 instance, if you have modified your local macros, do not expect
 @option{--install --force} to replace the local macros by their
 system-wide versions.  If you want to do so, simply erase the local
-macros you want to revert, and run @samp{aclocal -I m4 --install}.
+macros you want to revert, and run @samp{aclocal --install}.
 
 
 @node Future of aclocal
@@ -9819,15 +9798,6 @@ Automake generates rules to automatically rebuild 
@file{Makefile}s,
 If you are using @code{AM_MAINTAINER_MODE} in @file{configure.ac}, then
 these automatic rebuilding rules are only enabled in maintainer mode.
 
address@hidden ACLOCAL_AMFLAGS
-Sometimes you need to run @command{aclocal} with an argument like
address@hidden to tell it where to find @file{.m4} files.  Since
-sometimes @command{make} will automatically run @command{aclocal}, you
-need a way to specify these arguments.  You can do this by defining
address@hidden; this holds arguments that are passed verbatim
-to @command{aclocal}.  This variable is only useful in the top-level
address@hidden
-
 @vindex CONFIG_STATUS_DEPENDENCIES
 @vindex CONFIGURE_DEPENDENCIES
 @cindex @file{version.sh}, example
@@ -12208,11 +12178,6 @@ DejaGnu tests (@pxref{DejaGnu Tests}) use 
@code{RUNTESTDEFAULTFLAGS} and
 (@pxref{Java}) use @code{JAVACFLAGS} and @code{AM_JAVACFLAGS}.  None
 of these rules support per-target flags (yet).
 
-However you should not think that all variables ending with @code{FLAGS}
-follow this convention.  For instance, @code{ACLOCAL_AMFLAGS} (see
address@hidden and @ref{Local Macros}) is a variable that is only
-useful to the maintainer and has no user counterpart.
-
 @code{ARFLAGS} (@pxref{A Library}) is usually defined by Automake and
 has neither @code{AM_} nor per-target cousin.
 
diff --git a/lib/am/configure.am b/lib/am/configure.am
index ec276b9..9c55e6e 100644
--- a/lib/am/configure.am
+++ b/lib/am/configure.am
@@ -99,13 +99,13 @@ $(top_srcdir)/configure: %MAINTAINER-MODE% 
$(am__configure_deps)
 ## aclocal.m4.  ##
 ## ------------ ##
 
-## aclocal.m4 must be built by the top-level Makefile, because this is
-## where the user is expected to define $(ACLOCAL_AMFLAGS).
-##
 ## Whenever a configure dependency changes we need to rebuild
 ## aclocal.m4 too.  Changing configure.ac, or any file included by
 ## aclocal.m4 might require adding more files to aclocal.m4.  Hence
 ## the $(am__configure_deps) dependency.
+## We still need $(ACLOCAL_AMFLAGS) for sake of backward-compatibility;
+## we should hopefully be able to get rid of it in a not-so-distant
+## future.
 if %?REGEN-ACLOCAL-M4%
 $(ACLOCAL_M4): %MAINTAINER-MODE% $(am__aclocal_m4_deps)
 ?TOPDIR_P?     cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
diff --git a/t/acloca14.sh b/t/acloca14.sh
index eb9105d..cc65214 100755
--- a/t/acloca14.sh
+++ b/t/acloca14.sh
@@ -20,6 +20,7 @@
 . ./defs || exit 1
 
 cat >> configure.ac << 'END'
+AC_CONFIG_MACRO_DIR([defs])
 AM_PROG_LIBTOOL
 AC_OUTPUT
 END
@@ -45,7 +46,6 @@ echo 'AC_DEFUN([SOMETHING_ELSE])' >defs/e.m4
 echo 'AC_DEFUN([ANOTHER_MACRO])' >defs/f.m4
 
 cat >>Makefile.am<<\EOF
-ACLOCAL_AMFLAGS = -I defs
 testdist1: distdir
        test -f $(distdir)/acinclude.m4
        test -f $(distdir)/a.m4
diff --git a/t/acloca14.sh b/t/acloca14b.sh
similarity index 100%
copy from t/acloca14.sh
copy to t/acloca14b.sh
diff --git a/t/acloca22.sh b/t/acloca22.sh
index c8f8307..c23a7cb 100755
--- a/t/acloca22.sh
+++ b/t/acloca22.sh
@@ -21,24 +21,27 @@
 . ./defs || exit 1
 
 cat >>configure.ac <<EOF
+AC_CONFIG_MACRO_DIR([.])
 FOO
 AC_OUTPUT
 EOF
+
 cat >foo.m4 <<EOF
 AC_DEFUN([FOO], [AC_SUBST([GREPFOO])])
 EOF
+
 cat >bar.m4 <<EOF
 AC_DEFUN([BAR], [AC_SUBST([GREPBAR])])
 EOF
-cat >Makefile.am <<EOF
-ACLOCAL_AMFLAGS = -I .
-EOF
 
-$ACLOCAL -I .
+: >Makefile.am
+
+$ACLOCAL
 $AUTOMAKE
 $AUTOCONF
 
 ./configure
+
 $MAKE
 grep GREPFOO Makefile
 grep GREPBAR Makefile && exit 1
@@ -46,6 +49,7 @@ grep GREPBAR Makefile && exit 1
 sed 's/FOO/BAR/' < configure.ac > t
 mv -f t configure.ac
 rm -f foo.m4
+
 $MAKE
 grep GREPFOO Makefile && exit 1
 grep GREPBAR Makefile
diff --git a/t/acloca22.sh b/t/acloca22b.sh
similarity index 83%
copy from t/acloca22.sh
copy to t/acloca22b.sh
index c8f8307..0317b12 100755
--- a/t/acloca22.sh
+++ b/t/acloca22b.sh
@@ -14,9 +14,10 @@
 # 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 the "deleted header file" issue is fixed w.r.t. aclocal.m4
-# dependencies.  See also related the tests 'remake-deleted-m4-file.test'
-# and 'remake-renamed-m4-macro-and-file.test'.
+# Make sure the "deleted header file" issue is fixed wrt. aclocal.m4
+# dependencies.
+# NOTE: this test works by using the obsolete 'ACLOCAL_AMFLAGS' make
+# variable; see sister test 'acloca22.test' for a modern equivalent.
 
 . ./defs || exit 1
 
@@ -24,12 +25,15 @@ cat >>configure.ac <<EOF
 FOO
 AC_OUTPUT
 EOF
+
 cat >foo.m4 <<EOF
 AC_DEFUN([FOO], [AC_SUBST([GREPFOO])])
 EOF
+
 cat >bar.m4 <<EOF
 AC_DEFUN([BAR], [AC_SUBST([GREPBAR])])
 EOF
+
 cat >Makefile.am <<EOF
 ACLOCAL_AMFLAGS = -I .
 EOF
@@ -39,6 +43,7 @@ $AUTOMAKE
 $AUTOCONF
 
 ./configure
+
 $MAKE
 grep GREPFOO Makefile
 grep GREPBAR Makefile && exit 1
@@ -46,6 +51,7 @@ grep GREPBAR Makefile && exit 1
 sed 's/FOO/BAR/' < configure.ac > t
 mv -f t configure.ac
 rm -f foo.m4
+
 $MAKE
 grep GREPFOO Makefile && exit 1
 grep GREPBAR Makefile
diff --git a/t/aclocal-amflags.sh b/t/aclocal-amflags.sh
new file mode 100755
index 0000000..47bf135
--- /dev/null
+++ b/t/aclocal-amflags.sh
@@ -0,0 +1,69 @@
+#! /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/>.
+
+# Check that the obsolescent idiom of setting $(ACLOCAL_AMFLAGS) in
+# Makefile.am still works.  Remove this test once support for this
+# obsolescent idiom is removed.
+
+. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+MACRO_FOO || AS_EXIT([1])
+AC_OUTPUT
+END
+
+mkdir m4_1 m4_2
+cat > m4_1/foo.m4 <<'END'
+AC_DEFUN([MACRO_FOO], [: > foo])
+END
+cat > m4_2/bar.m4 <<'END'
+AC_DEFUN([MACRO_BAR], [: > bar])
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4_2 --verbose
+check-local:
+       test ! -r foo
+       test -f bar
+DISTCLEANFILES = bar
+END
+
+$ACLOCAL -I m4_1 >output 2>&1 || { cat output; exit 1; }
+cat output
+grep 'found macro' output && exit 1 # Sanity check.
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+test -f foo
+rm -f foo
+
+# ACLOCAL_AMFLAGS is used in rebuild rules, so trigger them.
+$sleep
+
+sed 's/MACRO_FOO/MACRO_BAR/' configure.ac > t
+mv -f t configure.ac
+
+$MAKE Makefile >output 2>&1 || { cat output; exit 1; }
+cat output
+grep "^aclocal.*:.*found macro.*MACRO_BAR.*m4_2/bar\.m4" output
+grep "macro.*MACRO_FOO" output && exit 1
+test ! -r foo
+test -f bar
+
+$MAKE distcheck
+
+:
diff --git a/t/aclocal-macrodir.tap b/t/aclocal-macrodir.tap
new file mode 100755
index 0000000..c35d9e0
--- /dev/null
+++ b/t/aclocal-macrodir.tap
@@ -0,0 +1,161 @@
+#! /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_DIR with
+# aclocal.
+
+am_create_testdir=empty
+. ./defs || exit 1
+
+plan_ later
+
+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
+    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_todo () { directive=TODO; }
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIR is honored"
+
+cat > configure.ac <<'END'
+AC_INIT([md], [10.0])
+AC_CONFIG_MACRO_DIR([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
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIR([foo]) interaction with --install"
+
+cat > configure.ac << 'END'
+AC_INIT([inst], [1.0])
+AC_CONFIG_MACRO_DIR([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
+
+#---------------------------------------------------------------------------
+
+test_begin "'-I' option wins over AC_CONFIG_MACRO_DIR"
+
+cat > configure.ac <<'END'
+AC_INIT([md], [4.6])
+AC_CONFIG_MACRO_DIR([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_DIR([foo]) can create directory 'foo'"
+
+cat > configure.ac << 'END'
+AC_INIT([x], [1.0])
+AC_CONFIG_MACRO_DIR([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
+
+#---------------------------------------------------------------------------
+
+:
diff --git a/t/aclocal-path-install.sh b/t/aclocal-path-install.sh
index 4ed1a2c..ccad30b 100755
--- a/t/aclocal-path-install.sh
+++ b/t/aclocal-path-install.sh
@@ -41,7 +41,7 @@ END
 # in a directory specified in ACLOCAL_PATH.
 $ACLOCAL --install 2>stderr && { cat stderr >&2; exit 1; }
 cat stderr >&2
-grep ' no -I was supplied' stderr
+grep 'impossible without -I .* nor AC_CONFIG_MACRO_DIR' stderr
 test ! -e pdir/foo.m4
 
 # The '--install' option should cause a required macro found in a
diff --git a/t/aclocal4.sh b/t/aclocal4.sh
index 0086303..9bed718 100755
--- a/t/aclocal4.sh
+++ b/t/aclocal4.sh
@@ -21,6 +21,7 @@ required=cc
 . ./defs || exit 1
 
 cat >>configure.ac <<EOF
+AC_CONFIG_MACRO_DIR([m4])
 AC_PROG_RANLIB
 AM_PROG_AR
 AC_PROG_CC
@@ -46,7 +47,6 @@ EOF
 cat >Makefile.am <<'EOF'
 SUBDIRS = lib
 EXTRA_DIST = m4/mymacro.m4
-ACLOCAL_AMFLAGS = -I m4
 check-foo: distdir
        test -f $(distdir)/lib/foo.c
        test -f $(distdir)/lib/bar.c
@@ -56,7 +56,7 @@ check-not-foo: distdir
        test -f $(distdir)/lib/bar.c
 EOF
 
-$ACLOCAL -I m4
+$ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 ./configure
diff --git a/t/aclocal5.sh b/t/aclocal5.sh
index 4d3730a..cf0006d 100755
--- a/t/aclocal5.sh
+++ b/t/aclocal5.sh
@@ -20,23 +20,23 @@
 . ./defs || exit 1
 
 cat >> configure.ac << 'END'
-AM_TEST([GREPME])
+AC_CONFIG_MACRO_DIR([m4])
+FOO_TEST([GREPME])
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 SUBDIRS = sub
-ACLOCAL_AMFLAGS = -I m4
 END
 
 mkdir sub
 : > sub/Makefile.am
 
 mkdir m4
-echo 'AC_DEFUN([AM_TEST], [echo address@hidden)' > m4/moredefs.m4
+echo 'AC_DEFUN([FOO_TEST], [echo address@hidden)' > m4/moredefs.m4
 
-$ACLOCAL -I m4
+$ACLOCAL
 $AUTOCONF
 $AUTOMAKE --copy --add-missing
 ./configure
@@ -44,10 +44,10 @@ $MAKE
 
 # Update an aclocal.m4 dependency, then make sure all Makefiles are
 # updated, even from a sub-directory.  Check that AU_ALIAS is
-# recognized. Change the definition of AM_TEST to check that its new
+# recognized. Change the definition of FOO_TEST to check that its new
 # definition is used.
 $sleep # Modified configure dependencies must be newer than config.status.
-echo 'AU_ALIAS([AM_TEST], [AC_SUBST])' > m4/moredefs.m4
+echo 'AU_ALIAS([FOO_TEST], [AC_SUBST])' > m4/moredefs.m4
 cd sub
 $MAKE
 cd ..
@@ -58,10 +58,10 @@ grep GREPME sub/Makefile
 $MAKE distdir
 test -f $me-1.0/m4/moredefs.m4
 
-# Change the definition of AM_TEST to check that its new definition is
+# Change the definition of FOO_TEST to check that its new definition is
 # used.  Check that AC_DEFUN_ONCE is caught.
 $sleep # Modified configure dependencies must be newer than config.status.
-echo 'AC_DEFUN_ONCE([AM_TEST], [AC_SUBST(__$1__)])' > m4/moredefs.m4
+echo 'AC_DEFUN_ONCE([FOO_TEST], [AC_SUBST(__$1__)])' > m4/moredefs.m4
 $MAKE
 grep 'm4/moredefs\.m4' aclocal.m4
 grep '__GREPME__' configure
diff --git a/t/aclocal6.sh b/t/aclocal6.sh
index dc6b38d..80c918a 100755
--- a/t/aclocal6.sh
+++ b/t/aclocal6.sh
@@ -22,12 +22,12 @@
 cat >> configure.ac << 'END'
 SOME_DEFS
 AC_CONFIG_FILES([sub/Makefile])
+AC_CONFIG_MACRO_DIR([m4])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 SUBDIRS = sub
-ACLOCAL_AMFLAGS = -I m4
 END
 
 mkdir sub
@@ -37,7 +37,7 @@ mkdir m4
 echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
 echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4
 
-$ACLOCAL -I m4
+$ACLOCAL
 $AUTOCONF
 $AUTOMAKE --copy --add-missing
 
diff --git a/t/remake-macrodir.sh b/t/remake-macrodir.sh
new file mode 100755
index 0000000..61ac197
--- /dev/null
+++ b/t/remake-macrodir.sh
@@ -0,0 +1,83 @@
+#! /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/>.
+
+# Check that the aclocal honouring of AC_CONFIG_MACRO_DIR interacts
+# nicely with automatic rebuild rules.
+
+. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AC_CONFIG_MACRO_DIR([macro-dir])
+my__FOO || AS_EXIT([1])
+AC_OUTPUT
+END
+
+: > Makefile.am
+
+mkdir macro-dir
+cat > macro-dir/foo.m4 <<'END'
+AC_DEFUN([my__FOO], [: > bar])
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+$FGREP my__FOO configure && exit 1
+
+./configure
+test -f bar
+rm -f bar
+
+$sleep
+
+cat > macro-dir/foo.m4 <<'END'
+AC_DEFUN([my__FOO], [: > baz])
+END
+
+$MAKE Makefile
+test -f baz
+test ! -r bar
+rm -f baz
+
+$sleep
+
+rm -f macro-dir/foo.m4
+cat > macro-dir/quux.m4 <<'END'
+AC_DEFUN([my__FOO], [: > quux])
+END
+
+$MAKE Makefile
+test -f quux
+test ! -r baz
+rm -f quux
+
+$sleep
+
+sed 's/^AC_CONFIG_MACRO_DIR/&([newdir])/' configure.ac > t
+mv -f t configure.ac
+
+mkdir newdir
+cat > newdir/mu.m4 <<'END'
+AC_DEFUN([my__FOO], [[: my__FOO do nothing]])
+END
+
+$MAKE Makefile
+$FGREP ': my__FOO do nothing' configure
+
+$MAKE distcheck
+
+:
diff --git a/t/remake10c.sh b/t/remake10c.sh
index 739d7a7..5c22177 100755
--- a/t/remake10c.sh
+++ b/t/remake10c.sh
@@ -27,13 +27,13 @@ magic3=%%MagicStringThree%%
 remake="$MAKE nil"
 
 cat >> configure.ac <<END
+AC_CONFIG_MACRO_DIR([m4])
 FINGERPRINT='my_fingerprint'
 AC_SUBST([FINGERPRINT])
 AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
-ACLOCAL_AMFLAGS = -I m4
 .PHONY: nil
 nil:
 ## Used by "make distcheck" later.
@@ -46,7 +46,7 @@ END
 mkdir m4
 echo 'AC_DEFUN([my_fingerprint], [BadBadBad])' > m4/foo.m4
 
-$ACLOCAL -I m4
+$ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
diff --git a/t/remake8a.sh b/t/remake8a.sh
index 30c25f4..315bc25 100755
--- a/t/remake8a.sh
+++ b/t/remake8a.sh
@@ -108,29 +108,29 @@ $MAKE distcheck
 
 rm -f quux
 
-# Modify Makefile.am to add a directory of extra m4 files
-# considered by aclocal.
+# Modify configure.ac and aclocal.m4 to add a directory of extra m4
+# files considered by aclocal.  Also update checks in Makefile.am.
+# Note that we won't use this new directory of extra m4 files in the
+# first rebuild below (but we will in the second).
 
 $sleep
 
 mkdir $srcdir/m4
 
 cat > $srcdir/Makefile.am <<'END'
-ACLOCAL_AMFLAGS = -I m4
+all-local: quux
 check-local:
        cat quux
        grep '%Foo%' quux
        test x'$(QUUX)' = x'%Foo%'
 END
 
-$MAKE # This should place aclocal flags in Makefile.
-grep '.*-I m4' Makefile # Sanity check.
-
 # Modify configure.ac and aclocal.m4.
 
 $sleep
 
 cat $srcdir/configure.stub - > $srcdir/configure.ac <<'END'
+AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_FILES([quux])
 MY_CUSTOM_MACRO
 AC_OUTPUT
diff --git a/t/remake8b.sh b/t/remake8b.sh
index a0adf07..e1d2097 100755
--- a/t/remake8b.sh
+++ b/t/remake8b.sh
@@ -110,29 +110,29 @@ $MAKE distcheck
 
 rm -f quux
 
-# Modify Makefile.am to add a directory of extra m4 files
-# considered by aclocal.
+# Modify configure.ac and aclocal.m4 to add a directory of extra m4
+# files considered by aclocal.  Also update checks in Makefile.am.
+# Note that we won't use this new directory of extra m4 files in the
+# first rebuild below (but we will in the second).
 
 $sleep
 
 mkdir $srcdir/m4
 
 cat > $srcdir/Makefile.am <<'END'
-ACLOCAL_AMFLAGS = -I m4
+all-local: quux
 check-local:
        cat quux
        grep '%Foo%' quux
        test x'$(QUUX)' = x'%Foo%'
 END
 
-$MAKE # This should place aclocal flags in Makefile.
-grep '.*-I m4' Makefile # Sanity check.
-
 # Modify configure.ac and aclocal.m4.
 
 $sleep
 
 cat $srcdir/configure.stub - > $srcdir/configure.ac <<'END'
+AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_FILES([quux])
 MY_CUSTOM_MACRO
 AC_OUTPUT
diff --git a/t/subdir-add2-pr46.sh b/t/subdir-add2-pr46.sh
index a4dca90..b226a09 100755
--- a/t/subdir-add2-pr46.sh
+++ b/t/subdir-add2-pr46.sh
@@ -22,6 +22,7 @@
 . ./defs || exit 1
 
 cat >> configure.ac << 'END'
+AC_CONFIG_MACRO_DIR([m4])
 m4_include([confiles.m4])
 MORE_DEFS
 AC_OUTPUT
@@ -31,7 +32,6 @@ echo 'AC_CONFIG_FILES([sub/Makefile])' > confiles.m4
 
 cat > Makefile.am << 'END'
 SUBDIRS = sub
-ACLOCAL_AMFLAGS = -I m4
 END
 
 mkdir sub
@@ -41,7 +41,7 @@ mkdir sub
 mkdir m4
 echo 'AC_DEFUN([MORE_DEFS], [])' > m4/moredefs.m4
 
-$ACLOCAL -I m4
+$ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 ./configure
diff --git a/t/subpkg.sh b/t/subpkg.sh
index 79c51da..0548f98 100755
--- a/t/subpkg.sh
+++ b/t/subpkg.sh
@@ -30,6 +30,7 @@ AC_DEFUN([FOO],[
 EOF
 
 cat >>configure.ac <<'END'
+AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SUBDIRS([lib])
 FOO
 END
@@ -47,8 +48,6 @@ distdir = subpack-1
 dist-hook:
        test -f $(distdir)/LDADD.c
        test -f $(top_distdir)/LDADD.c
-
-ACLOCAL_AMFLAGS = -I m4
 EOF
 
 cat >LDADD.c <<'EOF'
@@ -65,6 +64,7 @@ mkdir lib/src
 cat >lib/configure.ac <<'EOF'
 AC_INIT([lib], [2.3])
 AM_INIT_AUTOMAKE
+AC_CONFIG_MACRO_DIR([../m4])
 AM_PROG_AR
 AC_PROG_RANLIB
 AC_CONFIG_HEADERS([config.h:config.hin])
@@ -81,8 +81,6 @@ dist-hook:
        test -f $(top_distdir)/LDADD.c
        test -f $(distdir)/src/x.c
        test ! -f $(top_distdir)/src/x.c
-
-ACLOCAL_AMFLAGS = -I ../m4
 EOF
 
 cat >lib/src/x.c <<'EOF'
@@ -95,12 +93,12 @@ EOF
 
 cp "$am_scriptdir"/compile .
 
-$ACLOCAL -I m4
+$ACLOCAL
 $AUTOCONF
 $AUTOMAKE -Wno-override
 
 cd lib
-$ACLOCAL -I ../m4
+$ACLOCAL
 $FGREP 'm4_include([../m4/foo.m4])' aclocal.m4
 $AUTOCONF
 $AUTOHEADER
diff --git a/t/subpkg2.sh b/t/subpkg2.sh
index 8afcc5a..ea95d5f 100755
--- a/t/subpkg2.sh
+++ b/t/subpkg2.sh
@@ -28,6 +28,7 @@ AC_DEFUN([FOO],[
 EOF
 
 cat >>configure.ac <<'END'
+AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SUBDIRS([sub])
 AC_OUTPUT
 END
@@ -43,20 +44,21 @@ mkdir sub
 cat >sub/configure.ac <<'EOF'
 AC_INIT([sub], [2.3])
 AM_INIT_AUTOMAKE
+AC_CONFIG_MACRO_DIR([../m4])
 AC_CONFIG_FILES([Makefile])
 AC_CONFIG_FILES([script])
 FOO
 EOF
 
 : >sub/script.in
-echo ACLOCAL_AMFLAGS = -I ../m4 > sub/Makefile.am
+: >sub/Makefile.am
 
-$ACLOCAL -I m4
+$ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
 cd sub
-$ACLOCAL -I ../m4
+$ACLOCAL
 $FGREP 'm4_include([../m4/foo.m4])' aclocal.m4
 $AUTOCONF
 $AUTOMAKE -Wno-override
@@ -64,3 +66,5 @@ cd ..
 
 ./configure
 $MAKE distcheck
+
+:


hooks/post-receive
-- 
GNU Automake



reply via email to

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