summaryrefslogtreecommitdiff
path: root/t/subpkg.sh
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2010-10-05 17:14:00 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-07-03 21:12:23 +0200
commitcd1a9ccc1bd0248d2c504f367089f2481d364324 (patch)
tree954a0221cf20db06a9a7f7c4990fd6f3eadba05a /t/subpkg.sh
parente2f007f0c78e011c5fab60bfad332f6aad0989f1 (diff)
downloadautomake-cd1a9ccc1bd0248d2c504f367089f2481d364324.tar.gz
aclocal: deprecate ACLOCAL_AMFLAGS, trace AC_CONFIG_MACRO_DIR instead
Maintaining ACLOCAL_AMFLAGS in the Makefile.am to pass extra flags to aclocal is (and have always been) quite of an hack. For example, autoreconf is forced to grep Makefile.am to honour those flags. But this is a bad obsolescent behaviour; in fact, the autotools have moved consistently in the past years from custom grepping of Makefile.am and configure.ac to tracing of m4 macro calls, which is more consistent, more reliable and more flexible. And when autoreconf is not used, the developer is forced to add *by hand* the flags specified by ACLOCAL_AMFLAGS to the aclocal calls not triggered by make rebuild rules; here lie again more duplication and more chances for errors. Moreover, ACLOCAL_AMFLAGS has only two typical use cases: - to instruct aclocal to look for extra macro definition in a local directory (as with "ACLOCAL_AMFLAGS = -I m4"); and - to further instruct aclocal to copy in that local directory the required third-party .m4 files found in the system-wide directory (as with "ACLOCAL_AMFLAGS = -I m4 --install"). The first use case can be better covered if aclocal can instead trace and honours call to the AC_CONFIG_MACRO_DIR autoconf macro; and the second use case shouldn't be considered really legitimate, as it is quite (and subtly) brittle (see automake bug#9037). Thus we now make aclocal trace AC_CONFIG_MACRO_DIR macro, and act accordingly. For backward compatibility, we continue to support the ACLOCAL_AMFLAGS special variable (although removing any mention of it from the documentation). Future Automake releases will likely start to warn about the use of that variable, and eventually remove support for it altogether. From a suggestion by Eric Blake. This is a much simplified (and IMHO saner) version of the patch series discussed in the threads: <http://lists.gnu.org/archive/html/automake-patches/2010-10/msg00045.html> <http://lists.gnu.org/archive/html/automake-patches/2010-12/msg00156.html> * aclocal.in ($ac_config_macro_dir): New global variable. (trace_used_macros): Also trace the macro 'AC_CONFIG_MACRO_DIR', and set the '$ac_config_macro_dir' variable accordingly. (parse_arguments): Code for diagnosis of '--install' used without any user-specified include directory moved ... (while (1)): .. into the main loop. Which now also updates the list of user-specified include directories to include the directory given as argument to the call (if any) of 'AC_CONFIG_MACRO_DIR'. * lib/am/configure.am: Update comments. * NEWS: Updated. * doc/automake.texi: Likewise. Also, stop advising the use of the '--install' in ACLOCAL_AMFLAGS (see automake bug#9037 for a rationale), and remove any reference to ACLOCAL_AMFLAGS (which is now considered obsolescent). * t/aclocal-path-install.sh: Adjust grepping check in the aclocal error messages. * t/subpkg.sh: Updated: add 'AC_CONFIG_MACRO_DIR' call to configure.ac, remove setting of 'ACLOCAL_AMFLAGS' in Makefile.am and use of aclocal command line arguments. * t/subpkg2.sh: Likewise. * t/subdir8.sh: Likewise. * t/remake10c.sh: Likewise. * t/remake8a.sh: Likewise. * t/remake8b.sh: Likewise. * t/aclocal4.sh: Likewise. * t/aclocal6.sh: Likewise. * t/acloca14.sh: Likewise. * t/acloca22.sh: Likewise. * t/aclocal5.sh: Likewise, and do not not invade the Automake namespace (this avoids spurious failures). * t/acloca14b.sh: New test, identical to the previous version of 'acloca14.test'; it is kept to verify backwards compatibility with the use of ACLOCAL_AMFLAGS. * t/acloca22b.sh: Likewise (but for 'acloca22.test'). * t/aclocal-amflags.sh: New test, check for backwards compatibility that ACLOCAL_AMFLAGS still works. * t/remake-macrodir.sh: New test, checking that aclocal's honoring of AC_CONFIG_MACRO_DIR interacts nicely with automatic rebuild rules. * t/list-of-tests.mk: Add the new tests. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 't/subpkg.sh')
-rwxr-xr-xt/subpkg.sh10
1 files changed, 4 insertions, 6 deletions
diff --git a/t/subpkg.sh b/t/subpkg.sh
index c8ce125b6..d1c5ed3b6 100755
--- a/t/subpkg.sh
+++ b/t/subpkg.sh
@@ -29,6 +29,7 @@ AC_DEFUN([FOO],[
EOF
cat >>configure.ac <<'END'
+AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SUBDIRS([lib])
FOO
END
@@ -46,8 +47,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'
@@ -64,6 +63,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])
@@ -80,8 +80,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'
@@ -92,12 +90,12 @@ int lib (void)
}
EOF
-$ACLOCAL -I m4
+$ACLOCAL
$AUTOCONF
$AUTOMAKE -Wno-override
cd lib
-$ACLOCAL -I ../m4
+$ACLOCAL
$FGREP 'm4_include([../m4/foo.m4])' aclocal.m4
$AUTOCONF
$AUTOHEADER