A very small refactoring that removes a tiny bit of gratuitous usage of global status in the automake script. After this change, no regression showed up in the testsuite. I will push in 72 hours if there is no objection or review by then.
Regards, Stefano -*-*-*- refactor: improve signature of 'check_directory' sub in automake * automake.in (check_directory): Take the relative directory the directory to be checked is expected to be found into as an optional parameter, rather than reading it from the global variable `$relative_dir'. (scan_autoconf_traces, check_directories_in_var): Adjust. --- ChangeLog | 9 +++++++++ automake.in | 21 ++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4a470bd..bb0a521 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-10-17 Stefano Lattarini <stefano.lattar...@gmail.com> + + refactor: improve signature of 'check_directory' sub in automake + * automake.in (check_directory): Take the relative directory + the directory to be checked is expected to be found into as + an optional parameter, rather than reading it from the global + variable `$relative_dir'. + (scan_autoconf_traces, check_directories_in_var): Adjust. + 2011-10-07 Stefano Lattarini <stefano.lattar...@gmail.com> parallel-tests: warn on conditional TEST_EXTENSIONS definition diff --git a/automake.in b/automake.in index 00fcbf1..c218f83 100644 --- a/automake.in +++ b/automake.in @@ -3880,16 +3880,17 @@ sub handle_dist () } -# check_directory ($NAME, $WHERE) -# ------------------------------- -# Ensure $NAME is a directory, and that it uses a sane name. -# Use $WHERE as a location in the diagnostic, if any. -sub check_directory ($$) +# check_directory ($NAME, $WHERE [, $RELATIVE_DIR = "."]) +# ------------------------------------------------------- +# Ensure $NAME is a directory (in $RELATIVE_DIR), and that it uses a sane +# name. Use $WHERE as a location in the diagnostic, if any. +sub check_directory ($$;$) { - my ($dir, $where) = @_; + my ($dir, $where, $reldir) = @_; + $reldir = '.' unless defined $reldir; - error $where, "required directory $relative_dir/$dir does not exist" - unless -d "$relative_dir/$dir"; + error $where, "required directory $reldir/$dir does not exist" + unless -d "$reldir/$dir"; # If an `obj/' directory exists, BSD make will enter it before # reading `Makefile'. Hence the `Makefile' in the current directory @@ -3928,7 +3929,7 @@ sub check_directories_in_var ($) (sub { my ($var, $val, $cond, $full_cond) = @_; - check_directory ($val, $var->rdef ($cond)->location); + check_directory ($val, $var->rdef ($cond)->location, $relative_dir); return (); }, undef, @@ -5252,7 +5253,6 @@ sub scan_autoconf_traces ($) } $config_aux_dir = $args[1]; $config_aux_dir_set_in_configure_ac = 1; - $relative_dir = '.'; check_directory ($config_aux_dir, $where); } elsif ($macro eq 'AC_CONFIG_FILES') @@ -5272,7 +5272,6 @@ sub scan_autoconf_traces ($) elsif ($macro eq 'AC_CONFIG_LIBOBJ_DIR') { $config_libobj_dir = $args[1]; - $relative_dir = '.'; check_directory ($config_libobj_dir, $where); } elsif ($macro eq 'AC_CONFIG_LINKS') -- 1.7.2.3