diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-07-04 15:23:50 +0200 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-11-10 10:04:17 +0100 |
commit | d2155d50e6ef6d11845583af0113a717642f53df (patch) | |
tree | b1237ba2408665404ef3c439a9c30e95daa9796f /aclocal.in | |
parent | 2296a5e1fbe39415111ad5fdce475fe49897233d (diff) | |
download | automake-d2155d50e6ef6d11845583af0113a717642f53df.tar.gz |
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 <stefano.lattarini@gmail.com>
Diffstat (limited to 'aclocal.in')
-rw-r--r-- | aclocal.in | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/aclocal.in b/aclocal.in index e2e953626..ea9602538 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; @@ -731,7 +731,8 @@ sub trace_used_macros () 'AC_DEFUN_ONCE', 'AU_DEFUN', '_AM_AUTOCONF_VERSION', - 'AC_CONFIG_MACRO_DIR')), + 'AC_CONFIG_MACRO_DIR', + 'AC_CONFIG_MACRO_DIRS')), # Do not trace $1 for all other macros as we do # not need it and it might contains harmful # characters (like newlines). @@ -741,7 +742,7 @@ sub trace_used_macros () my $tracefh = new Automake::XFile ("$traces $configure_ac |"); - $ac_config_macro_dir = undef; + @ac_config_macro_dirs = (); my %traced = (); @@ -763,7 +764,11 @@ sub trace_used_macros () } elsif ($macro eq 'AC_CONFIG_MACRO_DIR') { - $ac_config_macro_dir = $arg1; + @ac_config_macro_dirs = ($arg1); + } + elsif ($macro eq 'AC_CONFIG_MACRO_DIRS') + { + push @ac_config_macro_dirs, split (/\s+/, $arg1); } } @@ -1094,13 +1099,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 +1113,7 @@ while (1) if ($install && !@user_includes) { 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); |